How to generate ap_system.pas?

Hello Forum,

I try to generate the ap_system.pas for Tokyo 10.2.2, but the get parsing error at 847,7

    var
      [Volatile] FLockCount: Integer;    

Anyone successfully created the import files for Tokyo 10.2.2 ?

We would like to use method "TDirectory.GetFileSystemEntries" which is implemented in system.pas.

Thanks,

The import tool can't parse attributes. The import tool is not recommended these days, as now there is the enchanted RTTI in newer Delphi versions and you can use DefineClassByRTTI to automatically register methods. 

Also to register specific methods like this, it's also easy to just register a define for that method specifically.
Hello Wagner,

Will the Import tool get updated to support newer features of Delphi?

Regards,

Yogesh

Hi Yogesh,

With the new RTTI in recent Delphi versions, we have unfortunately no plans to improve the import tool to support the new Delphi language features. It's become a legacy tool.

Hello Wagner,

thank you for your suggestion to use DefineClassByRTTI.

But "TDirectory" in System.IOUtils is defined as "TDirectory = record".

So I tried to use this statement:
  Scripter.DefineRecordByRTTI(TypeInfo(TDirectory));

This compiles fine. But when I use TDirectory.GetFiles('c:\temp') from within the script-engine, the error:
Exception in classe EatScripterRuntime with message "RUNTIME ERROR File library FormUnit: Cannot execute record method. No tyoe infor available.

Did I something wrong or is your suggestion not working?

Regards,
Sam

Advanced records (class methods, for example) are not supported. In this case you will have to register it manually, defining a fake class in scripter and then defining each method manually, as a wrapper around the real class:




procedure TForm3.Button1Click(Sender: TObject);
begin
  IDEScripter1.SourceCode := IDEMemo1.Lines;
  IDEScripter1.Execute;
end;


procedure TForm3.FormCreate(Sender: TObject);
var
  C: TatClass;
begin
  C := IDEScripter1.DefineClass(TObject, 'TDirectory');
  C.DefineMethod('IsEmpty', 1, tkEnumeration, nil, IsEmptyProc, True);
end;

Thank you,

I would prefer a proper import tool.
The way with RTTI seems to have a lot of limitations.

You may place the importtool at sourceforge.net, so the community can improve it?

Regards,
Sam

Full source code of import tool is available under the "demos" folder.