System.pas overwrite

Top  Previous  Next

User interface > Translation options > Input options > Extended "System.pas"

"System.pas" is a source file of special importance in Delphi projects.Fundamental type definitions, procedures and functions are defined in the System unit, which is implicitly included in every unit. For example TObject is defined there. There are other intrinsic definitions like the Read, Write or Str function, which are accessible in each unit too. These intrinsic function are built into the Delphi compiler. Delphi2Cpp must know the signatures of such intrinsic functions and tries to find them in the System.pas. So the original incomplete System.pas either has to be replaced by an extended copy or a the original System.pas has to be supplemented by an additional source file.

 

In the options dialog you can set the name of such an additional System.pas extension file.

 

 

System_pas

 

 

 

Such an individual System.pas called d2c_system.pas is in the Source folder of the Delphi2Cpp installation. No matter which name the file has, it internally is renamed to "d2c_system". With this name it is shown in the log-tree.

 

If a System.pas overwrite is used, the specially treated RTL/VCL functions and some compile time functions (Abs, High, Low, Odd, Pred, Succ) might have to be defined in this file for types, that cannot be handled by the built-in translation alternatives. Such a case is the incrementation of values of enumerated types. Of course, these definitions are only needed, if such cases really appear in the source code.

 

Some examples are explained in the following topics:

 

procedure SetString

Memory management

procedures Inc and Dec

 

 

The System.pas overwrite gets always preprocessed, even if the option to pre-process files is disabled for all other files.

Because this file is very basic, it may not use other files.

 

Lookup algorithm

 

Delphi2Cpp looks up system types and functions etc. in following order::

 

1.Delphi2Cpp will look for declarations at first in the System.pas overwrite, if it exists.
2.If the declaration is not found there, Delphi2Cpp will look in the System.pas of your Delphi installation, if the path to this file is set in the options.
3.If neither a System.pas overwrite exists nor the path to the original System.pas is set, Delphi2Cpp simulates the most important parts of this file.

 

Mostly Delphi2Cpp cannot distinguish different elements with the same name. Delphi2Cpp takes just the first declaration it finds. If there are several functions with the same name the translator tries to match the declaration found first.

 

 



This page belongs to the Delphi2Cpp Documentation

Delphi2Cpp home  Content