[fpc-pascal] TParamFlags and fpc 3.2.0.

fredvs fiens at hotmail.com
Sat Jul 27 19:02:00 CEST 2019


Re-hello.

Imho, it seems that in your code  "if not (pfHidden in flags) then" was
placed one "end;" too far.

So trying with this code, compilation is ok:

.......

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;
 count: Integer= 0;
 po1: pchar;
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
      
       with params[count] do begin
       flags:= tparamflags(
         {$if FPC_FULLVERSION >= 030100}
wordset{$else}byteset{$endif}(pbyte(po1)^));
       inc(po1,{$if FPC_FULLVERSION >= 030100}2{$else}1{$endif});
       {$if FPC_FULLVERSION > 030200} 
     // skip hidden parameters ($self, $high, etc.)
       if pfHidden in flags then  Continue;
       {$endif}
      
       Inc(count);

       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;

    // ----->  here one "end;" before.

        {$if FPC_FULLVERSION > 030200} 
  // skip hidden parameters ($self, $high, etc.)
  if not (pfHidden in flags) then
  {$endif}
  Inc(count);  

     end;

     end;
     if isfunction then begin
      params[high(params)].typename:= getshortstring(po1);
     end;
    end;
   end;
  end;
 end;
end;

----------------------------------------------

Compliation is ok, but the result gives this:

   procedure onexec(var elfPointer 
   procedure tmainfo.onexec(var elfPointer 

It should be: 

 procedure onexec(const sender: TObject); 
 procedure tmainfo.onex(const sender: TObject); 



Fre;D



-----
Many thanks ;-)
--
Sent from: http://free-pascal-general.1045716.n5.nabble.com/


More information about the fpc-pascal mailing list