HCoop backport of SML/NJ for ml-nlffigen
[hcoop/zz_old/debian/smlnj.git] / debian / ml-nlffigen.1
CommitLineData
4dd335d4
JM
1.TH ml-nlffigen 1 "April 25, 2003"
2.SH NAME
3ml-nlffigen \- SML No Longer Foreign Function Interface tool
4.SH SYNOPSIS
5.B ml-nlffigen
6.RI [ option ]
7--
8.I file
9.br
10.SH DESCRIPTION
11This manual page documents briefly the
12.B ml-nlffigen
13command.
14This manual page was written for the Debian distribution
15because the original program does not have a manual page.
16.PP
17.BR ml-nlffigen ,
18a glue-code generator for
19the new
20.SM NLFFI
21foreign function interface. The generator reads
22C source code and emits ML code along with a description file for CM.
23.SH OPTIONS
24A summary of options is included below.
25.IP "\fB-dir \fIdir" 4
26.PD 0
27.IP "\fB-d \fId" 4
28.PD
29Output directory where all generated files are placed.
30.BR default :
31.IR NLFFI-Generated .
32.IP "\fB-allSU"
33.PD
34Instructs
35.B ml-nlffigen
36to include all structs and unions,
37even those that are defined in included files (as opposed
38to files explicitly listed as arguments).
39.BR default :
40.IR off .
41.IP "\fB-width \fIw"
42.PD 0
43.IP "\fB-w \fIw"
44.PD
45Sets output line width (just a guess) to
46.IR w .
47.BR default :
48.IR 75 .
49.IP "\fB-smloption \fIx"
50.PD
51Instructs
52.B ml-nlffigen
53to include
54.I x
55into the list
56of options to annotate .sml entries in the generated .cm
57file with.
58.BR default :
59.IR noguid .
60.IP "\fB-guid"
61.PD
62Removes the default
63.B -noguid
64from the list of sml options.
65(This re-enables strict handling of type- and object-identity
66but can have negative impact on CM cutoff recompilation
67performance if the programmer routinely removes the entire
68tree of ml-nlffigen-generated files during development.)
69.IP "\fB-lambdasplit \fIx"
70.PD 0
71.IP "\fB-ls \fIx"
72.PD
73Instructs
74.B ml-nlffigen
75to generate "lambdasplit"
76options for all ML files (see CM manual for what this means;
77it does not currently work anyway because cross-module
78inlining is broken).
79.BR default :
80nothing.
81.IP "\fB-target \fIt"
82.PD 0
83.IP "\fB-t \fIt"
84.PD
85Sets the target to
86.I t
87(which must be one of "sparc-unix","x86-unix", or "x86-win32").
88.BR default :
89current architecture.
90.IP "\fB-light"
91.PD 0
92.IP "\fB-l"
93.PD
94Suppress "heavy" versions of function wrappers and
95field accessors; also resets any earlier
96.B -heavy
97to default.
98.BR default ": not suppressed."
99.IP "\fB-heavy"
100.PD 0
101.IP "\fB-h"
102.PD
103suppress "light" versions of function wrappers and
104field accessors; also resets any earlier
105.B -light
106to default.
107.BR default ": not suppressed"
108.IP "\fB-namedargs"
109.PD 0
110.IP "\fB-na"
111.PD
112Instruct
113.B ml-nlffigen
114to generated function wrappers that
115use named arguments (ML records) instead of tuples if
116there is enough information for this in the C source;
117(this is not always very useful).
118.BR default ": off."
119.IP "\fB-nocollect"
120.PD
121Do not do the following:
122Collect enum constants from truly unnamed enumerations
123(those without tags that occur at toplevel or in an
124unnamed context, i.e., not in a typedef or another
125named struct or union) into a single artificial
126enumeration tagged by ' (single apostrohe). The corresponding
127ML-side representative will be a structure named E_'.
128.IP "\fB-enum-constructors"
129.PD 0
130.IP "\fB-ec"
131.PD
132When possible (i.e., if all values of a given enumeration
133are different from each other), make the ML representation
134type of the enumeration a datatype. The default (and
135fallback) is to make that type the same as
136.BR MLRep.Signed.int .
137.IP "\fB-libhandle \fIh"
138.PD 0
139.IP "\fB-lh \fIh"
140.PD
141Use the variable
142.I h
143to refer to the handle to the
144shared library object. Given the constraints of CM,
145.I h
146must have the form of a long ML identifier, e.g.,
147.BR MyLibrary.libhandle . default : Library.libh .
148.IP "\fB-include \fIf"
149.PD 0
150.IP "\fB-add \fIf"
151.PD
152Mention file
153.I f
154in the generated .cm file. This option
155is necessary at least once for providing the library handle.
156It can be used arbitrarily many times, resulting in more
157than one such programmer-supplied file to be mentioned.
158If
159.I f
160is relative, then it must be relative to the directory
161specified in the
162.BI -dir " dir"
163option.
164.IP "\fB-cmfile \fIf"
165.PD 0
166.IP "\fB-cm \fIf"
167.PD
168Specify name of the generated .cm file, relative to
169the directory specified by the
170.BI -dir " dir"
171option.
172.BR default :
173.IR nlffi-generated.cm .
174.IP "\fB-cppopt \fIo"
175.PD
176The string
177.I o
178gets added to the list of options to be
179passed to cpp (the C preprocessor). The list of options
180gets substituted for
181.I %o
182in the cpp command line template.
183.IP "\fB-U \fIx"
184.PD
185The string
186.BI -U x
187gets added to the list of cpp options.
188.IP "\fB-D \fIx"
189.PD
190The string
191.BI -D x
192gets added to the list of cpp options.
193.IP "\fB-I \fIx"
194.PD
195The string
196.BI -I x
197gets added to the list of cpp options.
198.IP "\fB-version"
199.PD
200Just write the version number of
201.B ml-nlffigen
202to standard
203output and then quit.
204.IP "\fB-match \fIr"
205.PD 0
206.IP "\fB-m \fIr"
207.PD
208Normally
209.B ml-nlffigen
210will include ML definitions for a C
211declaration if the C declaration textually appears in
212one of the files specified at the command line. Definitions
213in #include-d files will normally not appear (unless
214their absence would lead to inconsistencies).
215By specifying
216.BI -match r
217,
218.B ml-nlffigen
219will also include
220definitions that occur in recursively #include-d files
221for which the
222.BR awk -style
223regular expression
224.I r
225matches their names.
226.IP "\fB-prefix \fIp"
227.PD 0
228.IP "\fB-p \fIp"
229.PD
230Generated ML structure names will all have prefix
231.I p
232(in addition to the usual "S_" or "U_" or "F_" ...)
233.IP "\fB-gensym \fIg"
234.IP "\fB-g \fIg"
235Names "gensym-ed" by
236.B ml-nlffigen
237(for anonymous struct/union/
238enums) will get an additional suffix
239.RI _ g.
240(This should
241be used if output from several indepdendent runs of
242.B ml-nlffigen
243are to coexist in the same ML program.)
244.IP "\fB--"
245Terminate processing of options, remaining arguments are
246taken to be C sources.
247.SH SEE ALSO
248.BR sml (1),
249.BR ml-build (1).
250.br
251This program described in more detail in
252.I No-Longer-Foreign: Teaching an ML compiler to speak C \"natively\"
253, Matthias Blume,
254which is available via <http://cm.bell-labs.com/who/blume/papers/nlffi.pdf>.
255.SH AUTHOR
256This manual page was written by Aaron Matthew Read <amread@nyx.net>,
257for the Debian GNU/Linux system (but may be used by others).