-
Notifications
You must be signed in to change notification settings - Fork 9
/
sfdc.1
446 lines (446 loc) · 15.6 KB
/
sfdc.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "SFDC 1"
.TH SFDC 1 "2022-04-05" "perl v5.30.0" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
sfdc \- Compile SFD files into someting useful
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
sfdc [options] file1.sfd [file2.sfd ...]
.PP
.Vb 10
\& Options:
\& \-\-addvectors=TYPE Add default functions
\& \-\-gateprefix=PREFIX Prefix for gatestub functions
\& \-\-help \-h Show full help message and exit
\& \-\-libarg=LOCATION Where to pass the libbase
\& \-\-libprefix=PREFIX Prefix for library functions
\& \-\-sdi SDI header compatibility mode
\& \-\-man Show full manual page and exit
\& \-\-mode=MODE What to do
\& \-\-output=FILE \-o FILE Where to store the output
\& \-\-quiet \-q Be quiet
\& \-\-target=TARGET Specifies the machine target
\& \-\-version \-v Show version and exit
.Ve
.SH "OPTIONS"
.IX Header "OPTIONS"
.IP "\fB\-\-addvectors\fR" 8
.IX Item "--addvectors"
This flag adds the standard library/device/BOOPSI functions to the
list of function entries to process. Possible values are \fBnone\fR,
\&\fBlibrary\fR, \fBdevice\fR and \fBboopsi\fR. The default is \fBnone\fR. Useful
when generating gate stub functions.
.IP "\fB\-\-gateprefix\fR" 8
.IX Item "--gateprefix"
Sets a function name prefix for the gate stub functions when
generating gatestubs or gateproto files.
.IP "\fB\-\-help\fR" 8
.IX Item "--help"
Show the full help message and exit.
.IP "\fB\-\-libarg\fR" 8
.IX Item "--libarg"
Specifies where to place the library base argument when generating
gatestubs or gateproto and libproto files. Possible values are
\&\fBnone\fR, \fBfirst\fR and \fBlast\fR. The default is \fBnone\fR.
.IP "\fB\-\-libprefix\fR" 8
.IX Item "--libprefix"
Sets a function name prefix for the local library functions when
generating gatestubs or libproto files.
.IP "\fB\-\-sdi\fR" 8
.IX Item "--sdi"
Turns on the \s-1SDI\s0 header compatibility mode. This will make sure
that all header files (especially the gatestub and gateproto files
are generated to be used in a \s-1SDI\s0 compatible environment.
.IP "\fB\-\-man\fR" 8
.IX Item "--man"
Show the complete manual page and exit.
.IP "\fB\-\-mode\fR" 8
.IX Item "--mode"
Instructs \fIsfdc\fR what to do. \fIsfdc\fR can handle the
following arguments:
.RS 8
.IP "\fBautoopen\fR" 4
.IX Item "autoopen"
Generate C code for automatically opening the module. It is usually
placed in a link library together with C stub functions.
.IP "\fBclib\fR" 4
.IX Item "clib"
Generate C prototypes to be placed in \fIInclude/clib/\fR.
.IP "\fBdump\fR" 4
.IX Item "dump"
Dumps all information gathered from the \s-1SFD\s0 file.
.IP "\fBfd\fR" 4
.IX Item "fd"
Generate an old-style \s-1FD\s0 file.
.IP "\fBfunctable\fR" 4
.IX Item "functable"
Generate a list of function names suitable for inclusion in a library
function table. By defining the preprocessor symbol
\&\fB_\|_SFDC_FUNCTABLE_M68K_\|_\fR, the list of functions will be modified so
it's suitable for AmigaOS 4's m68k function table.
.IP "\fBgateproto\fR" 4
.IX Item "gateproto"
Generate a prototype header file for library gate stubs. Useful for
library and device developers.
.IP "\fBgatestubs\fR" 4
.IX Item "gatestubs"
Generate library gate stubs. Useful for library and device developers.
.IP "\fBinterface\fR" 4
.IX Item "interface"
Generate a struct with function pointers, like that uses in AmigaOS 4.
.IP "\fBlibproto\fR" 4
.IX Item "libproto"
Generate a prototype header file for library functions. This is almost
like \fBclib\fR, but for internal use by library and device developers.
.IP "\fBlvo\fR" 4
.IX Item "lvo"
Generate an assembler \s-1LVO\s0 include file.
.IP "\fBmacros\fR" 4
.IX Item "macros"
Generate a header file containing \fIgcc\fR specific preprocessor macros,
similar to \fIfd2inline\fR's \fB\-\-new\fR switch. For \s-1AROS\s0 targets, it
generates a file suitable to be placed in the \fIInclude/defines/\fR
directory.
.IP "\fBproto\fR" 4
.IX Item "proto"
Generate header file to be placed in \fIInclude/proto/\fR that includes
the C prototypes as well as compiler-specific inlines or pragma files.
.IP "\fBpragmas\fR" 4
.IX Item "pragmas"
Generate a \fI\s-1SAS/C\s0\fR/\fI\s-1LATTICE\s0\fR/\fI\s-1DICE\s0\fR and \fIMaxon C\fR/\fIStorm
C\fR/\fIAztec C\fR pragma file.
.IP "\fBstubs\fR" 4
.IX Item "stubs"
Generate C library stubs suitable to be compiled and archived into
\&\fIlibamiga.a\fR, \fIlibamigastubs.a\fR or
\&\fIlib\fI<module>\fI.a\fR. Using the \fB\f(CB%f\fB\fR escape sequence in the
\&\fB\-\-output\fR switch or a tool like \fIsplitasm.awk\fR strongly is
recommended.
.IP "\fBverify\fR" 4
.IX Item "verify"
Just loads and parses the \s-1SFD\s0 file. This is the default.
.RE
.RS 8
.RE
.IP "\fB\-\-output\fR" 8
.IX Item "--output"
Specifies where the result will be stored. The following escape
sequencies are allowed in the file name. If the sequence \fB\f(CB%f\fB\fR is
present in the name, a new file will be created for each function
processed.
.RS 8
.IP "\fB\f(CB%b\fB\fR" 4
.IX Item "%b"
The library base variable name (\f(CW\*(C`DOSBase\*(C'\fR, for example).
.IP "\fB\f(CB%f\fB\fR" 4
.IX Item "%f"
The current funcion name (\f(CW\*(C`Open\*(C'\fR, for example).
.IP "\fB\f(CB%l\fB\fR" 4
.IX Item "%l"
The name of the library or device (\fIdos.library\fR, for example).
.IP "\fB\f(CB%n\fB\fR" 4
.IX Item "%n"
The base name of the library or device (\f(CW\*(C`dos\*(C'\fR, for example).
.RE
.RS 8
.Sp
If omitted, the result will be sent to the standard output instead of
a file.
.RE
.IP "\fB\-\-quiet\fR" 8
.IX Item "--quiet"
Be quiet.
.IP "\fB\-\-target\fR" 8
.IX Item "--target"
Specifies the target when generating macros etc. The target names
follow the \s-1GNU\s0 autoconf standard. Some possible values are listed
below. The default is \fBm68k\-unknown\-amigaos\fR.
.RS 8
.IP "\fBi?86\-pc\-aros\fR, \fBi?86\-linux\-aros\fR, \fBppc-aros\fR ..." 4
.IX Item "i?86-pc-aros, i?86-linux-aros, ppc-aros ..."
\&\s-1AROS.\s0 Anything goes, as long as it ends in \f(CW\*(C`\-aros\*(C'\fR.
.IP "\fBi?86be\-pc\-amithlon\fR, \fBi?86be\-amithlon\fR" 4
.IX Item "i?86be-pc-amithlon, i?86be-amithlon"
Amithlon/big endian \s-1IA32.\s0
.IP "\fBm68k\-unknown\-amigaos\fR, \fBm68k\-amigaos\fR" 4
.IX Item "m68k-unknown-amigaos, m68k-amigaos"
Traditional AmigaOS/m68k.
.IP "\fBm68kvbcc\-unknown\-amigaos\fR, \fBm68k\-amigaos\fR" 4
.IX Item "m68kvbcc-unknown-amigaos, m68k-amigaos"
Traditional AmigaOS/m68k but with the \s-1VBCC\s0 compiler.
.IP "\fBppc-unknown-amigaos\fR, \fBppc-amigaos\fR" 4
.IX Item "ppc-unknown-amigaos, ppc-amigaos"
AmigaOS 4/PowerPC.
.IP "\fBpowerpc-unknown-morphos\fR, \fBppc-morphos\fR" 4
.IX Item "powerpc-unknown-morphos, ppc-morphos"
MorphOS/PowerPC.
.RE
.RS 8
.RE
.IP "\fB\-\-version\fR" 8
.IX Item "--version"
Prints the version and exits.
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
\&\fIsfdc\fR is an open source replacement for Amiga, Inc.'s \fIsfd\fR tool,
distributed with \fB\s-1NDK 3.9\s0\fR. It is also an replacement for
\&\fIfd2inline\fR from GeekGadgets and the MorphOS team, later improved to
death by Martin Blom. It's now a complete mess and needs a
replacement. \s-1SFD\s0 files and \fIsfdc\fR might to be a good start.
.PP
For developers using \fIgcc\fR, \fIsfdc\fR aims to handle all your needs
when it comes to libraries, devices, datatypes, \s-1BOOPSI\s0 classes or
similar modules. \fIsfdc\fR can also generate \fI\s-1SAS/C\s0\fR, \fI\s-1DICE\s0\fR and
\&\fIStorm C\fR files for end users of such modules.
.PP
The basis for all work performed by \fIsfdc\fR is the \fB\s-1SFD\s0\fR file, which
contains all required information about the module and the functions
provided. From this information, \fIsfdc\fR can:
.IP "\(bu" 4
Generate an old-style \fB\s-1FD\s0\fR file for futher processing with other tools.
.IP "\(bu" 4
Generate a \fBC prototype file\fR, such as those normally found in the
\&\fIInclude/clib/\fR directory.
.IP "\(bu" 4
Generate \fIgcc\fR \fBinlines\fR (actually preprocessor macros) or
\&\fBpragmas\fR for direct library function calls (without going via
library stubs).
.IP "\(bu" 4
Generate the \fIInclude/proto/\fR file, which includes the
\&\fIInclude/clib/\fR file and either the inlines or pragmas.
.IP "\(bu" 4
Generate an \fBassembler \s-1LVO\s0\fR file, which contains the library offset
of all functions in the library.
.IP "\(bu" 4
Generate \fBC stubs\fR, which can be compiled and archived into a stub
library. It can also generate auto-open and auto-close code.
.IP "\(bu" 4
Generate library \fBgateway stubs\fR, which can be used as part of your
module as glue between the module function table and your C functions.
.PP
Additionally, \fIsfdc\fR does all this for several Amiga-like operating
systems: traditional \fBAmigaOS\fR, native \fBAmithlon\fR, \fB\s-1AROS\s0\fR and
\&\fBMorphOS\fR.
.PP
\&\fIsfdc\fR uses \fIautoconf\fR style identifies for the operating systems,
making it easy to generate the correct output. Just make sure
\&\fIconfigure.in\fR contains the \fB\s-1AC_CANONICAL_SYSTEM\s0\fR command and use
\&\fB\f(CB@host\fB@\fR in your \fIMakefile.in\fR. Using \fIautoconf\fR and \fIsfdc\fR, it's
easy to make for example a library that can be compiled or
cross-compiiled for any of the mentioned architectures.
.SH "RETURN VALUE"
.IX Header "RETURN VALUE"
Returns 0 on success and 10 on errors.
.SH "NOTES"
.IX Header "NOTES"
Had I seen \fIcvinclude.pl\fR before I started writing this program, I
might still have been using fd/clib files. Or maybe not.
.SH "AUTHOR"
.IX Header "AUTHOR"
Martin Blom <[email protected]>
.SH "HISTORY"
.IX Header "HISTORY"
.IP "\(bu" 4
\&\fB1.0 (2003\-07\-27)\fR
.Sp
Initial release.
.IP "\(bu" 4
\&\fB1.1 (2003\-12\-22)\fR
.Sp
Added workaround for workbench.library (base name is \*(L"wb\*(R").
Added AmigaOS 4 support.
Added the \fB\-\-addvectors\fR switch.
.IP "\(bu" 4
\&\fB1.2 (2004\-06\-16)\fR
.Sp
Generates files for mathieeedoub*, though probably broken. Well they
are the same as fd2inline generates at least.
.IP "\(bu" 4
\&\fB1.2a (2004\-06\-20)\fR
.Sp
Replace \s-1AROS_LP\s0 with \s-1AROS_LD.\s0 Because it is guaranteed to define the
function prototype. [verhaegs]
.IP "\(bu" 4
\&\fB1.3 (2004\-11\-12)\fR
.Sp
Correctly handle the argument \f(CW\*(C`type **arg\*(C'\fR, where there is no
whitespace between the argument type and the argument name.
.IP "\(bu" 4
Correctly handle the prototype \f(CW\*(C`void function (void)\*(C'\fR, were there is
a whitespace between the function name and the parenthesis and \*(L"void\*(R"
is used to indicate no arguments.
.IP "\(bu" 4
Replace \f(CW\*(C`\-\*(C'\fR with \f(CW\*(C`_\*(C'\fR in base/library name.
.IP "\(bu" 4
New special keyword for register specification (in addition to \fBsysv\fR
and \fBbase\fR): \fBautoreg\fR, which automatically allocates m68k registers
for the arguments.
.IP "\(bu" 4
\&\fBsysv\fR now works correctly with varargs functions. \fBsysv\fR combined
with \fBgatestubs\fR work for m68k and i386 only for now. For \s-1AROS\s0
targets in \fBmacros\fR, the correct \s-1AROS\s0 macro is used to fetch the
function to be called.
.IP "\(bu" 4
New \fB\-\-mode\fR: \fBfunctable\fR. For proper code generation in \s-1AROS,\s0 make
sure gateprotos are included before you include the functable.
.IP "\(bu" 4
\&\fBproto\fR files now include \fIInclude/defines/\fR files when used in \s-1AROS.\s0
.IP "\(bu" 4
\&\fB1.4 (2005\-09\-23)\fR
.Sp
Added AmigaOS 4\-style interfaces (\*(C+ only for non\-OS4 targets, and
without implementation).
.IP "\(bu" 4
The library base in the \fBproto\fR file is now defined for AmigaOS 4
too.
.IP "\(bu" 4
AmigaOS 4 \fBclib\fR files now add \fB_\|_attribute_\|_((linearvarargs))\fR to
varargs functions.
.IP "\(bu" 4
Added AmigaOS 4 support for \fBstubs\fR files.
.IP "\(bu" 4
Added support for the 'iptr' gcc attribute.
.IP "\(bu" 4
Added \fB_\|_SFDC_FUNCTABLE_M68K_\|_\fR check in the \fBfunctable\fR mode.
.IP "\(bu" 4
Added m68k stub functions to AmigaOS 4's \fBgatestubs\fR and
\&\fBgateproto\fR.
.IP "\(bu" 4
Added the \fBautoopen\fR mode.