[fpc-pascal] TParamFlags and fpc 3.2.0.
fredvs
fiens at hotmail.com
Sun Jul 28 03:02:44 CEST 2019
Hello.
Sorry, I am not the skill to find the problem with your code.
I did try but I loose.
So, I still followed your advices to remove all pfHidden stuff.
It is done at end of the procedure, updating the "info" variable.
Here code fully working.
You may take a look at end of code:
-----------------------------------------
procedure getmethodparaminfo(const atype: ptypeinfo;
var info: methodparaminfoty);
function getshortstring(var po: pchar): string;
begin
setlength(result,byte(po^));
inc(po);
move(po^,pointer(result)^,length(result));
inc(po,length(result));
end;
type
pparamflags = ^tparamflags;
paramrecty = record
Flags : TParamFlags;
end;
var
isfunction: boolean;
int1: integer;
po1: pchar;
{$if FPC_FULLVERSION > 030200}
params1: paraminfoarty;
x : integer;
{$endif}
begin
with info do begin
kind:= methodkindty(-1);
params:= nil;
if (atype^.Kind = tkmethod) then begin
with gettypedata(atype)^ do begin
kind:= tmethodkindtomethodkind[methodkind];
int1:= paramcount;
isfunction:= methodkind = mkfunction;
if isfunction then begin
inc(int1);
end;
if isfunction or (methodkind = mkprocedure) then begin
setlength(params,int1);
po1:= @paramlist;
for int1:= 0 to paramcount - 1 do begin
with params[int1] do begin
flags:= tparamflags(
{$if FPC_FULLVERSION >= 030100}
wordset{$else}byteset{$endif}(pbyte(po1)^));
inc(po1,{$if FPC_FULLVERSION >= 030100}2{$else}1{$endif});
name:= getshortstring(po1);
typename:= getshortstring(po1);
if (typename = 'WideString') or (typename = 'UnicodeString') then
begin
typename:= 'msestring';
end
else begin
if typename = 'LongInt' then begin
typename:= 'Integer';
end
else begin
if typename = 'Double' then begin
typename:= 'Real';
end;
end;
end;
end;
end;
if isfunction then begin
params[high(params)].typename:= getshortstring(po1);
end;
end;
end;
end;
end;
// here filter of pfHidden in flags
{$if FPC_FULLVERSION > 030200}
setlength(params1,0);
for x:=0 to length(info.params) -1 do
with info.params[x] do if not (pfHidden in flags) then
begin
setlength(params1,length(params1)+1);
params1[length(params1)-1] := info.params[x];
end;
info.params := params1;
{$endif}
end;
-----------------------------------------
So, many, many thanks for your light and help Sven, without you I could not
do it.
Fre;D
PS: If you know what makes the problems in your code, I am very curious to
know what is the solution.
-----
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/
More information about the fpc-pascal
mailing list