~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to install/man/man1/h2pas.1

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH h2pas 1 "12 Dec 1999" "Free Pascal" "Free Pascal C header conversion utility"
 
2
.SH NAME
 
3
h2pas \- The C header to pascal unit conversion program.
 
4
 
 
5
.SH SYNOPSIS
 
6
 
 
7
.B h2pas
 
8
.I "[options] filename"
 
9
 
 
10
.SH DESCRIPTION
 
11
 
 
12
.B h2pas
 
13
attempts to convert a C header file to a pascal unit. 
 
14
it can handle most C constructs that one finds in a C header file,
 
15
and attempts to translate them to their pascal counterparts. see the 
 
16
.B CONSTRUCTS
 
17
section for a full description of what the translator can handle.
 
18
 
 
19
.SH USAGE
 
20
 
 
21
H2pas is a command-line tool that translates a C header file to a spascal
 
22
unit. It reads the C header file and translates the C declarations to
 
23
equivalent pascal declarations that can be used to access code written in C.
 
24
 
 
25
The output of the h2pas program is written to a file with the same name as
 
26
the C header file that was used as input, but with the extension \fI.pp\fP.
 
27
The output file that h2pas creates can be customized in a number of ways by
 
28
means of many options.
 
29
 
 
30
.SH OPTIONS
 
31
 
 
32
The output of 
 
33
.B h2pas
 
34
can be controlled with the following options:
 
35
 
 
36
 
 
37
.TP
 
38
.B \-d 
 
39
use 
 
40
.I external;
 
41
for all procedure and function declarations.
 
42
.TP
 
43
.B \-D 
 
44
use 
 
45
.B external
 
46
.I libname 
 
47
.B name
 
48
.I 'func\_name'
 
49
for function and procedure declarations.
 
50
.TP
 
51
.B \-e 
 
52
Emit a series of constants instead of an enumeration type for the C 
 
53
.I enum
 
54
construct.
 
55
.TP
 
56
.B \-i
 
57
create an include file instead of a unit (omits the unit header).
 
58
.TP
 
59
.BI \-l " libname"
 
60
specify the library name for external function declarations.
 
61
.TP
 
62
.BI \-o " outfile"
 
63
Specify the output file name. Default is the input file name with 
 
64
the extension replaced by 
 
65
.I ".pp"
 
66
"."
 
67
.TP
 
68
.B \-p
 
69
use the letter  
 
70
.B P
 
71
in front of pointer type parameters instead of "^".
 
72
.TP
 
73
.B \-s
 
74
Strip comments from the input file. By default comments are converted
 
75
to comments, but they may be displaced, since a comment is handled by the
 
76
scanner.
 
77
.TP
 
78
.B \-t
 
79
prepend typedef type names with the letter
 
80
.B T
 
81
(used to follow Borland's convention that all types should be defined with
 
82
T).
 
83
.TP
 
84
.B \-v
 
85
replace pointer parameters by call by reference parameters.
 
86
Use with care because some calls can expect a NIL pointer.
 
87
.TP
 
88
.B \-w
 
89
Header file is a win32 header file (adds support for some special macros).
 
90
.TP
 
91
.B \-x
 
92
handle SYS\_TRAP of the PalmOS header files.
 
93
 
 
94
.SH CONSTRUCTS
 
95
The following C declarations and statements are recognized:
 
96
 
 
97
.TP
 
98
.B defines
 
99
defines are changed into pascal constants if they are simple defines.
 
100
macros are changed - wherever possible to functions; however the arguments
 
101
are all integers, so these must be changed manually. Simple expressions 
 
102
in define staments are recognized, as are most arithmetic operators: 
 
103
addition, substraction, multiplication, division, logical operators, 
 
104
comparision operators, shift operators. The C construct ( A ? B : C)
 
105
is also recognized and translated to a pascal construct with an IF
 
106
statement (this is buggy, however).
 
107
 
 
108
.TP
 
109
.B "preprocessor statements"
 
110
the conditional preprocessing commands are recognized and translated into
 
111
equivalent pascal compiler directives. The special 
 
112
.B "#ifdef \_\_cplusplus"
 
113
is also recognized and removed.
 
114
 
 
115
 
 
116
.TP
 
117
.B typedef
 
118
A typedef statement is changed into a pascal type statement. The following
 
119
basic types are recognized:
 
120
.RS
 
121
.TP
 
122
.I char
 
123
changed to char.
 
124
.TP
 
125
.I float
 
126
changed to real (=double in free pascal).
 
127
.TP
 
128
.I int
 
129
changed to longint.
 
130
.TP
 
131
.I long
 
132
changed to longint.
 
133
.TP 
 
134
.I "long int"
 
135
changed to longint.
 
136
.TP
 
137
.I short
 
138
changed to integer.
 
139
.TP
 
140
.I unsigned
 
141
changed to cardinal.
 
142
.TP
 
143
.I "unsigned char"
 
144
changed to byte.
 
145
.TP 
 
146
.I "unsigned int"
 
147
changed to cardinal.
 
148
.TP
 
149
.I "unsigned long int"
 
150
changed to cardinal.
 
151
.TP
 
152
.I "unsigned short"
 
153
changed to word.
 
154
.TP 
 
155
.I void
 
156
ignored.
 
157
.RE
 
158
These types are also changed if they appear in the arguments of a function
 
159
or procedure.
 
160
.TP 
 
161
.B "functions and procedures"
 
162
functions and procedures are translated as well; pointer types may be
 
163
changed to call by reference arguments (using the 
 
164
.B var
 
165
argument) by using the 
 
166
.B \-p
 
167
command line argument. functions that have a variable number of arguments
 
168
are changed to a function with an 
 
169
.B "array of const"
 
170
argument.
 
171
.TP
 
172
.B specifiers
 
173
the 
 
174
.I extern
 
175
specifier is recognized; however it is ignored. the
 
176
.I packed
 
177
specifier is also recognised and changed with the
 
178
.I PACKRECORDS
 
179
directive. The 
 
180
.I const
 
181
specifier is also recognized, but is ignored.
 
182
 
 
183
.TP
 
184
.B modifiers
 
185
If the 
 
186
.B \-w 
 
187
option is specified, then the following modifiers are recognized:
 
188
.I STDCALL
 
189
 
190
.I CDECL
 
191
 
192
.I CALLBACK
 
193
 
194
.I PASCAL
 
195
 
196
.I WINAPI
 
197
 
198
.I APIENTRY
 
199
 
200
.I WINGDIAPI
 
201
as defined in the win32 headers.
 
202
If additionally the
 
203
.B \-x
 
204
option is specified then the 
 
205
.I SYS\_TRAP
 
206
specifier is also recognized.
 
207
 
 
208
.TP
 
209
.B enums
 
210
enum constructs are changed into enumeration types; bear in mind that in C
 
211
enumeration types can have values assigned to them; Free Pascal also allows
 
212
this to a certain degree. If you know that values are assigned to enums, it
 
213
is best to use the 
 
214
.B \-e
 
215
option to change the enus to a series of integer constants.
 
216
 
 
217
.TP 
 
218
.B unions
 
219
unions are changed to variant records. 
 
220
 
 
221
.TP
 
222
.B structs
 
223
are changed to pascal records, with 
 
224
.B C
 
225
packing.
 
226
 
 
227
.IP 
 
228
 
 
229
.SH SEE ALSO
 
230
.IP 
 
231
.BR  ppc386 (1)
 
232
.BR  ppumove (1)