Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program project1;
- {$mode objfpc}{$H+}
- uses
- TypInfo,
- SysUtils;
- type
- {$M+}
- { TMyObject }
- TMyObject = class(TObject)
- published
- procedure Test(AParamInt: Integer; AParamStr: string);
- end;
- {$M-}
- procedure TMyObject.Test(AParamInt: Integer; AParamStr: string);
- begin
- end;
- var
- I: Integer;
- J: Integer;
- PNL: Integer;
- CP: Integer;
- TD: PTypeData;
- Flag: Byte;
- Def: string;
- PN: string;
- TN: string;
- Flags: TParamFlags;
- begin
- TD := GetTypeData(TypeInfo(@TMyObject.Test));
- if TD <> nil then
- begin
- WriteLn('Method kind: ', TD^.MethodKind);
- WriteLn('Param count: ', TD^.ParamCount);
- CP := 0;
- Def := '(';
- for i := 1 to TD^.ParamCount do
- begin
- Flag := Byte(TD^.ParamList[CP]);
- Flags := TParamFlags(Flag);
- WriteLn('Ord(Flags): ', Ord(TD^.ParamList[CP]));
- // for i:= 1 to NumI do
- // begin
- if pfVar in Flags then
- Def += 'var ';
- if pfconst in Flags then
- Def += 'const ';
- if pfArray in Flags then
- Def += 'array of ';
- if pfAddress in Flags then
- Def += 'adresse ?';
- if pfReference in Flags then
- Def += 'reference ?';
- if pfout in Flags then
- Def += 'out ';
- Inc(CP);
- PNL := Ord(TD^.ParamList[CP]);
- PN := '';
- for J := CP + 1 to CP + PNL do
- PN += TD^.ParamList[J];
- CP += PNL;
- Inc(CP);
- PNL := Ord(TD^.ParamList[CP]);
- WriteLn('Length type: ', PNL);
- TN := '';
- for J := CP + 1 to CP + PNL do
- TN += TD^.ParamList[j];
- CP += PNL + 1;
- WriteLn('Param name: ', I, ': ', PN);
- WriteLn('Type name: ', I, ': ', TN);
- Def := Format('%s%s: %s', [TN, PN, TN]);
- if I < TD^.ParamCount then
- Def += '; ';
- // end;
- end;
- Def := ')';
- end;
- ReadLn;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement