The following C declarations and statements are recognized:
Defines are changed into Pascal constants if they are simple defines. Macros are changed - wherever possible - to functions; however the arguments are all integers, so these must be changed manually. Simple expressions in define statements are recognized, as are most arithmetic operators: addition, subtraction, multiplication, division, logical operators, comparison operators, shift operators. The C construct ( A ? B : C) is also recognized and translated to a Pascal construct with an IF statement. (This is buggy, however).
The conditional preprocessing commands are recognized and translated into equivalent Pascal compiler directives. The special
#ifdef __cplusplus
is also recognized and removed.
A typedef statement is changed into a Pascal type statement. The following basic types are recognized:
char changed to char.
float changed to real (=double in Free Pascal).
int changed to longint.
long changed to longint.
long int changed to longint.
short changed to integer.
unsigned changed to cardinal.
unsigned char changed to byte.
unsigned int changed to cardinal.
unsigned long int changed to cardinal.
unsigned short changed to word.
void ignored.
These types are also changed if they appear in the arguments of a function or procedure.
Functions and procedures are translated as well. Pointer types may be changed to call by reference arguments (using the var argument) by using the -p command line argument. Functions that have a variable number of arguments are changed to a function with a cvar modifier. (This used to be the array of const argument.)
The extern specifier is recognized; however it is ignored. The packed specifier is also recognised and changed with the PACKRECORDS directive. The const specifier is also recognized, but is ignored.
If the -w option is specified, then the following modifiers are recognized:
STDCALL CDECL CALLBACK PASCAL WINAPI APIENTRY WINGDIAPI
as defined in the win32 headers. If additionally the -x option is specified then the
SYS_TRAP
specifier is also recognized.
Enum constructs are changed into enumeration types. Bear in mind that, in C, enumeration types can have values assigned to them. Free Pascal also allows this to a certain degree. If you know that values are assigned to enums, it is best to use the -e option to change the enumerations to a series of integer constants.
Unions are changed to variant records.
Structs are changed to Pascal records, with C packing.