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
|
#!/bin/sh
if [ "$#" -ne 2 ]
then
echo "Usage: $0 <ghc commands> <libdir>"
exit 1
fi
GHC_COMMANDS="$1"
LIBDIR="$2"
cat <<'EOF'
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE xsl:stylesheet [
]>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/TR/xhtml1/strict">
<xsl:output method="text" omit-xml-declaration="yes" />
<xsl:template match="/">.\"
.\" This is a generated file. Changes might get clobbered. Edit at own's risk.
.\"
.TH GHC 1 "2002-10-25" "Glasgow FP Suite" "Glasgow Haskell Compiler"
.SH NAME
GHC \- the Glasgow Haskell Compiler
.SH SYNOPSIS
EOF
STARTED=0
for GHC_COMMAND in $GHC_COMMANDS
do
if [ "$STARTED" -ne 0 ]
then
echo ".br"
fi
STARTED=1
cat <<EOF
.B $GHC_COMMAND
.RI [ option | filename ]...
EOF
done
cat <<'EOF'
.SH DESCRIPTION
This manual page documents briefly the
.B ghc
and
.B ghci
commands.
Note that
.B ghci
is not yet available on all architectures.
Extensive documentation is available in various other formats
including DVI, PostScript and HTML; see below.
.PP
Each of GHC's command line options is classified as either
.IR static " or " dynamic .
A static flag may only be specified on the command line, whereas a
dynamic flag may also be given in an \f(CROPTIONS\fP pragma in a
source file or set from the GHCi command-line with \f(CR:set\fP.
As a rule of thumb, all the language options are dynamic, as are the
warning options and the debugging options.
The rest are static, with the notable exceptions of
.BR \-v ", " \-cpp ", " \-fasm ", " \-fvia\-C ", " \-fllvm ", and
" \-#include .
The OPTIONS sections lists the status of each flag.
.PP
Common suffixes of file names for Haskell are:
.TP
.B .hs
Haskell source code; preprocess, compile
.TP
.B .lhs
literate Haskell source; unlit, preprocess, compile
.TP
.B .hi
Interface file; contains information about exported
symbols
.TP
.B .hc
intermediate C files
.TP
.BI . x _o
way
.I x
object files; common ways are:
.BR p ", " u ", " s
.TP
.BI . x _hi
way
.I x
interface files
.SH OPTIONS
<xsl:apply-templates select="sect1/sect2" mode="overview"/>
<xsl:apply-templates select="sect1/sect2"/>
.SH FILES
EOF
echo ".I $LIBDIR"
cat <<'EOF'
.SH COPYRIGHT
Copyright 2002, The University Court of the University of Glasgow.
.br
All rights reserved.
.SH AUTHOR
This manual page was generated from the XML documentation of GHC with blood,
sweat, tears and a breaks-if-you-look-at-it-the-wrong-way XSL
stylesheet originally written by Michael Weber <michaelw@debian.org>
for the Debian GNU/Linux system (but may be used by others).
.\" End
</xsl:template>
<xsl:template match="sect1/sect2" mode="overview">
<xsl:choose>
<xsl:when test="contains(title/.,' (')">
.SS <xsl:value-of select="substring-before(title/.,' (')"/>
</xsl:when>
<xsl:otherwise>
.SS <xsl:value-of select="title/."/>
</xsl:otherwise>
</xsl:choose>
.nh
<xsl:apply-templates select="informaltable/tgroup/tbody/row" mode="overview"/>
.hy
</xsl:template>
<xsl:template match="sect1/sect2">
<xsl:choose>
<xsl:when test="contains(title/.,' (')">
.SH <xsl:value-of select='translate(substring-before(title/.," ("),"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")'/>
</xsl:when>
<xsl:otherwise>
.SH <xsl:value-of select='translate(title/.,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")'/>
</xsl:otherwise>
</xsl:choose><xsl:text>
</xsl:text>
<xsl:apply-templates select="informaltable/tgroup/tbody/row"/>
</xsl:template>
<xsl:template match="informaltable/tgroup/tbody/row" mode="overview">
<xsl:apply-templates select="entry[1]|entry[4]" mode="overview"/>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="informaltable/tgroup/tbody/row">
.TP
<xsl:apply-templates select="entry[1]"/><xsl:text>
</xsl:text>
<xsl:variable name="x">
<xsl:apply-templates select="entry[2]"/>
</xsl:variable>
<xsl:value-of select="normalize-space($x)"/>
.rj
[<xsl:apply-templates select="entry[3]"/>]
<!-- IGNORE NEGATIVE OPTIONS
<xsl:if test="not(entry[4]='-')">
<xsl:text>.TP
</xsl:text>
<xsl:apply-templates select="entry[4]/option"/>
</xsl:if>
-->
</xsl:template>
<xsl:template match="option" mode="escape-dash">
<xsl:variable name="x">
<xsl:value-of select="."/>
</xsl:variable>
<xsl:variable name="y">
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$x"/>
<xsl:with-param name="from" select="'-'"/>
<xsl:with-param name="to" select="'\-'"/>
</xsl:call-template>
</xsl:variable>
<xsl:value-of select="$y"/>
</xsl:template>
<xsl:template match="option" mode="overview">
<xsl:apply-templates select="." mode="escape-dash"/>
</xsl:template>
<xsl:template match="option">
<xsl:text>\fB</xsl:text>
<xsl:apply-templates select="." mode="escape-dash"/>
<xsl:text>\fP</xsl:text>
</xsl:template>
<xsl:template match="entry[1]" mode="overview">
<xsl:apply-templates mode="overview"/>
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="entry[1]">
<xsl:apply-templates/><xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="entry[4]" mode="overview">
<xsl:if test="not(.='-')">
<xsl:apply-templates select="option" mode="overview"/>
<xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="entry[4]">
<xsl:if test="not(.='-')">
<xsl:value-of select="."/><xsl:text> </xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="replaceable" mode="overview">
<xsl:apply-templates select="."/>
</xsl:template>
<xsl:template match="replaceable">
<xsl:text>\fI</xsl:text>
<xsl:value-of select='.'/>
<xsl:text>\fP</xsl:text>
</xsl:template>
<xsl:template match="literal">
<xsl:text>\f(CR</xsl:text>
<xsl:value-of select="."/>
<xsl:text>\fP</xsl:text>
</xsl:template>
<!-- reusable replace-string function -->
<xsl:template name="replace-string">
<xsl:param name="text"/>
<xsl:param name="from"/>
<xsl:param name="to"/>
<xsl:choose>
<xsl:when test="contains($text, $from)">
<xsl:variable name="before" select="substring-before($text, $from)"/>
<xsl:variable name="after" select="substring-after($text, $from)"/>
<xsl:variable name="prefix" select="concat($before, $to)"/>
<xsl:value-of select="$before"/>
<xsl:value-of select="$to"/>
<xsl:call-template name="replace-string">
<xsl:with-param name="text" select="$after"/>
<xsl:with-param name="from" select="$from"/>
<xsl:with-param name="to" select="$to"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
EOF
|