[fpc-pascal] TParamFlags and fpc 3.2.0.
Sven Barth
pascaldragon at googlemail.com
Fri Jul 26 10:59:13 CEST 2019
fredvs <fiens at hotmail.com> schrieb am Fr., 26. Juli 2019, 09:06:
> > It would help more if you'd point me exactly at the code in question.
>
> OK, now that you see the problem, here the code in mse-ide project:
>
> In msedesignparser.pas, procedure getmethodparaminfo: (Please take a look
> at
> the // in code that follow --> paramlist has one more entry in fpc 320)
>
I'll do my changes inline:
> --------------------------------------------------------
> 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;
> 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;
>
count := 0;
>
> // there is now one more first parameter that must be ommited
>
> for int1:= 0 to paramcount - 1 do begin
> with params[int1] do begin
>
// replace previous line with:
with params[count] do begin
> flags:= tparamflags(
> {$ifdef mse_fpc_3_2}wordset{$else}byteset{$endif}(pbyte(po1)^));
> inc(po1,{$ifdef mse_fpc_3_2}2{$else}1{$endif});
>
{$ifdef mse_fpc_3_2}
// 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;
> end;
> end;
>
// adjust array now that we know the real count
SetLength(params, count);
> if isfunction then begin
> params[high(params)].typename:= getshortstring(po1);
> end;
> end;
> end;
> end;
> end;
> end;
>
To resume: if somebody knows how to not add by default the first $self
> parameter in paramlist, I vote for that solution.
>
The above changes should help.
Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20190726/e380d5c2/attachment-0001.html>
More information about the fpc-pascal
mailing list