SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG
DONATE


YUM REPOSITORY

 
 

MAN page from openSUSE Leap 42 fpc-2.6.4-1.1.i586.rpm

h2pas

Section: Free Pascal C header conversion utility (1)
Updated: 12 Dec 1999
Index 

NAME

h2pas - The C header to pascal unit conversion program.

 

SYNOPSIS

h2pas[options] filename

 

DESCRIPTION

h2pasattempts to convert a C header file to a pascal unit. it can handle most C constructs that one finds in a C header file,and attempts to translate them to their pascal counterparts. see the CONSTRUCTSsection for a full description of what the translator can handle.

 

USAGE

H2pas is a command-line tool that translates a C header file to a spascalunit. It reads the C header file and translates the C declarations toequivalent pascal declarations that can be used to access code written in C.

The output of the h2pas program is written to a file with the same name asthe C header file that was used as input, but with the extension .pp.The output file that h2pas creates can be customized in a number of ways bymeans of many options.

 

OPTIONS

The output of h2pascan be controlled with the following options:

-d
use external;for all procedure and function declarations.
-D
use externallibname name'func_name'for function and procedure declarations.
-e
Emit a series of constants instead of an enumeration type for the C enumconstruct.
-i
create an include file instead of a unit (omits the unit header).
-l libname
specify the library name for external function declarations.
-o outfile
Specify the output file name. Default is the input file name with the extension replaced by .pp"."
-p
use the letter Pin front of pointer type parameters instead of "^".
-s
Strip comments from the input file. By default comments are convertedto comments, but they may be displaced, since a comment is handled by thescanner.
-t
prepend typedef type names with the letterT(used to follow Borland's convention that all types should be defined withT).
-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).
-x
handle SYS_TRAP of the PalmOS header files.

 

CONSTRUCTS

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 argumentsare 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 IFstatement (this is buggy, however).

preprocessor statements
the conditional preprocessing commands are recognized and translated intoequivalent pascal compiler directives. The special #ifdef __cplusplusis also recognized and removed.

typedef
A typedef statement is changed into a pascal type statement. The followingbasic 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 functionor procedure.
functions and procedures
functions and procedures are translated as well; pointer types may bechanged to call by reference arguments (using the varargument) by using the -pcommand line argument. functions that have a variable number of argumentsare changed to a function with an array of constargument.
specifiers
the externspecifier is recognized; however it is ignored. thepackedspecifier is also recognised and changed with thePACKRECORDSdirective. The constspecifier 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, WINGDIAPIas defined in the win32 headers.If additionally the-xoption is specified then the SYS_TRAPspecifier is also recognized.

enums
enum constructs are changed into enumeration types; bear in mind that in Cenumeration types can have values assigned to them; Free Pascal also allowsthis to a certain degree. If you know that values are assigned to enums, itis best to use the -eoption to change the enus to a series of integer constants.

unions
unions are changed to variant records.

structs
are changed to pascal records, with Cpacking.

 

SEE ALSO

ppc386(1)ppumove(1)


 

Index

NAME
SYNOPSIS
DESCRIPTION
USAGE
OPTIONS
CONSTRUCTS
SEE ALSO

This document was created byman2html,using the manual pages.