README.txt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. This is the h2pas program, a utility to convert C header files to pascal
  2. units. It is part of the Free Pascal distribution.
  3. COMPILING
  4. To compile the program, a simple
  5. 'make'
  6. should be sufficient; you need GNU make for this. When using TP, a simple
  7. tpc h2pas.pas
  8. should also be possible.
  9. USAGE
  10. h2pas [-p] [-t] [-o outputfilename] [-l libname] [-u unitname] filename
  11. -t : Prepend 'T' to all type names in typedef definitions. This may help
  12. when the C header use uppercase types and lowercase variables of the
  13. same name.
  14. -p : Use 'P' instead of ^ as a pointer symbol;
  15. This will convert
  16. ^char to pchar
  17. ^longint to plongint
  18. etc. It will also define a PSOMETYPE pointer for each SOMETYPE struct type
  19. definition in the header file.
  20. Thus
  21. typedef struct somestruct {
  22. ...
  23. }
  24. Will be converted to
  25. somestruct = record
  26. ...
  27. end;
  28. PSomestruct = ^Somestruct;
  29. If the -t options is used, the -p option takes care of that too.
  30. -l : In the implementation part, the external functions will be
  31. written with 'external libname;' behind it.
  32. If you omit this option, all functions will be declared as
  33. cdecl; external;
  34. -o : specify the outputname. By default, the inputname is used, with
  35. extension '.pp'.
  36. -u : Specify the unit name. By default, the outputname is used, without
  37. extension.
  38. -v : Replaces pointer types in parameter list by call by reference
  39. parameters:
  40. void p(int *i) => procedure p(var i : longint);
  41. Enjoy !