|-d||use external; for all procedure and function declarations.|
|-D||use external libname name func_name for function and procedure declarations.|
|-e||Emit a series of constants instead of an enumeration type for the C enum construct.|
|-i||create an include file instead of a unit (omits the unit header).|
|specify the library name for external function declarations.|
|Specify the output file name. Default is the input file name with the extension replaced by .pp "."|
|-p||use the letter P in front of pointer type parameters instead of "^".|
|-s||Strip comments from the input file. By default comments are converted to comments, but they may be displaced, since a comment is handled by the scanner.|
|-t||prepend typedef type names with the letter T (used to follow Borlands convention that all types should be defined with T).|
|-v||replace pointer parameters by call by reference parameters. Use with care because some calls can expect a NIL pointer.|
|-w||Header file is a win32 header file (adds support for some special macros).|
handle SYS_TRAP of the PalmOS header files.
The following C declarations and statements are recognized:
defines 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 staments are recognized, as are most arithmetic operators: addition, substraction, multiplication, division, logical operators, comparision 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).
preprocessor statements the conditional preprocessing commands are recognized and translated into equivalent pascal compiler directives. The special #ifdef __cplusplus is also recognized and removed.
typedef A typedef statement is changed into a pascal type statement. The following basic types are recognized:
These types are also changed if they appear in the arguments of a function or procedure.
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. functions and procedures 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 an array of const argument. specifiers 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.
modifiers 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.
enums 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 enus to a series of integer constants.
unions unions are changed to variant records.
structs are changed to pascal records, with C packing.
|Free Pascal||H2PAS (1)||12 Dec 1999|