joost 7c65340ff1 Merged revisions 6721,6734,6747,6758-6760,6763-6764,6766,6768,6780,6788-6792,6801,6837,6839-6841,6845,6854,6870,6876-6878 via svnmerge from %!s(int64=18) %!d(string=hai) anos
..
Makefile 7c65340ff1 Merged revisions 6721,6734,6747,6758-6760,6763-6764,6766,6768,6780,6788-6792,6801,6837,6839-6841,6845,6854,6870,6876-6878 via svnmerge from %!s(int64=18) %!d(string=hai) anos
Makefile.fpc 60d19ea1e6 * forgot to commit %!s(int64=18) %!d(string=hai) anos
README 3a56cae749 * moved %!s(int64=26) %!d(string=hai) anos
converu.pas e0200f8fcb * patch from J. Peter Mugaas to fix #7616 %!s(int64=19) %!d(string=hai) anos
h2pas.pas f3cc8354eb * Fixed compilation %!s(int64=19) %!d(string=hai) anos
h2pas.y f3cc8354eb * Fixed compilation %!s(int64=19) %!d(string=hai) anos
h2paspp.pas 790a4fe2d3 * log and id tags removed %!s(int64=20) %!d(string=hai) anos
lexlib.pas 164e1c25e6 + -S, -T, -c modes added %!s(int64=25) %!d(string=hai) anos
options.pas 08c3d44cea use the ctypes unit in h2pas (from jpetermugaas) %!s(int64=19) %!d(string=hai) anos
scan.l 0fbedddd37 - ID tag removed %!s(int64=19) %!d(string=hai) anos
scan.pas c19d5e624d * regenerated %!s(int64=19) %!d(string=hai) anos
testit.h f86c568373 * support for enum enumtype enumvar; fixed %!s(int64=24) %!d(string=hai) anos
yacclib.pas 50778076c3 initial import %!s(int64=20) %!d(string=hai) anos
yylex.cod 3a56cae749 * moved %!s(int64=26) %!d(string=hai) anos
yyparse.cod 3a56cae749 * moved %!s(int64=26) %!d(string=hai) anos

README

This is the h2pas program, a utility to convert C header files to pascal
units. It is part of the Free Pascal distribution.

COMPILING

To compile the program, a simple
'make'
should be sufficient; you need GNU make for this. When using TP, a simple
tpc h2pas.pas
should also be possible.

USAGE

h2pas [-p] [-t] [-o outputfilename] [-l libname] [-u unitname] filename

-t : Prepend 'T' to all type names in typedef definitions. This may help
when the C header use uppercase types and lowercase variables of the
same name.

-p : Use 'P' instead of ^ as a pointer symbol;
This will convert
^char to pchar
^longint to plongint
etc. It will also define a PSOMETYPE pointer for each SOMETYPE struct type
definition in the header file.
Thus
typedef struct somestruct {
...
}
Will be converted to
somestruct = record
...
end;
PSomestruct = ^Somestruct;
If the -t options is used, the -p option takes care of that too.

-l : In the implementation part, the external functions will be
written with 'external libname;' behind it.
If you omit this option, all functions will be declared as
cdecl; external;

-o : specify the outputname. By default, the inputname is used, with
extension '.pp'.

-u : Specify the unit name. By default, the outputname is used, without
extension.

-v : Replaces pointer types in parameter list by call by reference
parameters:
void p(int *i) => procedure p(var i : longint);

Enjoy !