aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.in42
-rw-r--r--doc/changes.src77
-rwxr-xr-xdoc/genps.pl12
-rw-r--r--doc/head.ps10
-rw-r--r--doc/nasmdoc.css61
-rw-r--r--doc/nasmdoc.src2
-rw-r--r--doc/nasmlogw.pngbin0 -> 1699 bytes
-rw-r--r--doc/psfonts.ph14
-rw-r--r--doc/rdsrc.pl677
9 files changed, 242 insertions, 653 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 6a2d5a7e..cc6969ec 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -18,42 +18,41 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
PERL = perl -I$(srcdir)
-MAKEINFO = makeinfo
-TEXI2DVI = texi2dvi
-TEXI2IPF = texi2ipf
-IPFC = ipfc
PDFOPT = @PDFOPT@
RM_F = rm -f
RM_RF = rm -rf
+CP_F = cp -f
-SRCS = nasmdoc.src inslist.src changes.src version.src
-OUT = info html nasmdoc.txt nasmdoc.pdf
+SRCS = nasmdoc.src inslist.src changes.src version.src \
+ nasmdoc.css nasmlogw.png
+OUT = html nasmdoc.txt nasmdoc.pdf
.SUFFIXES: .pfa .ph
all: $(OUT)
-os2: nasm.inf
-
inslist.src: inslist.pl ../x86/insns.dat
$(PERL) $(srcdir)/inslist.pl $(srcdir)/../x86/insns.dat
.PHONY: html
-html: html/nasmdoc0.html
+html: html/nasmdoc0.html html/nasmdoc.css html/nasmlogw.png
RDSRC = $(PERL) $(srcdir)/rdsrc.pl -I$(srcdir)/
html/nasmdoc0.html: $(SRCS) rdsrc.pl
$(RDSRC) -ohtml html nasmdoc.src
+html/nasmdoc.css: nasmdoc.css
+ $(CP_F) nasmdoc.css html/nasmdoc.css
+
+html/nasmlogw.png: nasmlogw.png
+ $(CP_F) nasmlogw.png html/nasmlogw.png
+
nasmdoc.dip: $(SRCS) rdsrc.pl
$(RDSRC) dip nasmdoc.src
-nasmdoc.texi: $(SRCS) rdsrc.pl
- $(RDSRC) texi nasmdoc.src
-
nasmdoc.txt: $(SRCS) rdsrc.pl
$(RDSRC) txt nasmdoc.src
@@ -69,25 +68,6 @@ nasmdoc.ps: nasmdoc.dip genps.pl afmmetrics.ph ttfmetrics.ph \
nasmdoc.pdf: nasmdoc.ps pspdf.pl
$(PERL) pspdf.pl $(PDFOPT) nasmdoc.ps nasmdoc.pdf
-.PHONY: info
-info: info/nasm.info
-
-info/nasm.info: nasmdoc.texi
- mkdir -p info
- $(MAKEINFO) $<
- mv -f *.info *.info-* info
-
-# DVI output from texinfo (optional)
-nasmdoc.dvi: nasmdoc.texi
- $(TEXI2DVI) nasmdoc.texi
-
-# Rules for building an OS/2 book
-nasmdoc.ipf: nasmdoc.texi
- $(TEXI2IPF) $< >$@
-
-nasm.inf: nasmdoc.ipf
- $(IPFC) -i -s $< $@
-
clean:
-$(RM_F) *.rtf *.hpj *.texi *.gid *.ipf *.dip
-$(RM_F) *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr
diff --git a/doc/changes.src b/doc/changes.src
index 502d242d..cf66ca3a 100644
--- a/doc/changes.src
+++ b/doc/changes.src
@@ -394,7 +394,7 @@ instruction.
\c XRELEASE MOV [absolute],AL
-Previous versions would incorrectly generate \c{F3 A2} for this
+\> Previous versions would incorrectly generate \c{F3 A2} for this
instruction and issue a warning; correct behavior is to emit \c{F3 88
05}.
@@ -418,7 +418,7 @@ only integer logarithms. See \k{pkg_ifunc}.
\c mov r64,imm32 ; 7 bytes
\c mov r64,imm64 ; 10 bytes
-To force a specific form, use the \c{STRICT} keyword, see \k{strict}.
+\> To force a specific form, use the \c{STRICT} keyword, see \k{strict}.
\b Add support for the Intel AVX2 instruction set.
@@ -1388,34 +1388,30 @@ from the current BITS setting (16 or 32).
\b Changed definition of the optimization flag:
- -O0 strict two-pass assembly, JMP and Jcc are
- handled more like 0.98, except that back-
- ward JMPs are short, if possible.
-
- -O1 strict two-pass assembly, but forward
- branches are assembled with code guaranteed
- to reach; may produce larger code than
- -O0, but will produce successful assembly
- more often if branch offset sizes are not
- specified.
-
- -O2 multi-pass optimization, minimize branch
- offsets; also will minimize signed immed-
- iate bytes, overriding size specification.
-
- -O3 like -O2, but more passes taken, if needed
+\c -O0 strict two-pass assembly, JMP and Jcc are
+\c handled more like 0.98, except that back-
+\c ward JMPs are short, if possible.
+\c
+\c -O1 strict two-pass assembly, but forward
+\c branches are assembled with code guaranteed
+\c to reach; may produce larger code than
+\c -O0, but will produce successful assembly
+\c more often if branch offset sizes are not
+\c specified.
+\c
+\c -O2 multi-pass optimization, minimize branch
+\c offsets; also will minimize signed immed-
+\c iate bytes, overriding size specification.
+\c
+\c -O3 like -O2, but more passes taken, if needed
\S{cl-0.98.07 released 01/28/01} Version 0.98.07 released 01/28/01
-\b Added Stepane Denis' SSE2 instructions to a *working*
+\b Added Stepane Denis' SSE2 instructions to a *working*
version of the code - some earlier versions were based on
broken code - sorry 'bout that. version "0.98.07"
-
-01/28/01
-
-
\b Cosmetic modifications to nasm.c, nasm.h,
AUTHORS, MODIFIED
@@ -1423,8 +1419,9 @@ from the current BITS setting (16 or 32).
\S{cl-0.98.06f released 01/18/01} Version 0.98.06f released 01/18/01
-\b - Add "metalbrain"s jecxz bug fix in insns.dat
- - alter nasmdoc.src to match - version "0.98.06f"
+\b Add "metalbrain"s jecxz bug fix in insns.dat
+
+\b Alter nasmdoc.src to match - version "0.98.06f"
\S{cl-0.98.06e released 01/09/01} Version 0.98.06e released 01/09/01
@@ -1433,8 +1430,6 @@ from the current BITS setting (16 or 32).
\b Removed the "outforms.h" file - it appears to be
someone's old backup of "outform.h". version "0.98.06e"
-01/09/01
-
\b fbk - finally added the fix for the "multiple %includes bug",
known since 7/27/99 - reported originally (?) and sent to
us by Austin Lunnen - he reports that John Fine had a fix
@@ -1450,8 +1445,6 @@ from the current BITS setting (16 or 32).
\b Brian Raiter / fbk - "elfso bug" fix - applied to aoutb format
as well - testing might be desirable...
-08/07/00
-
\b James Seter - -postfix, -prefix command line switches.
\b Yuri Zaporozhets - rdoff utility changes.
@@ -1487,7 +1480,7 @@ form 'Jnotcc $+3/JMP label', in cases where a short offset
is out of bounds. If compiling for a 386 or higher CPU, then
the 386 form of Jcc will be used instead.
-This feature is controlled by a new command-line switch: "O",
+\> This feature is controlled by a new command-line switch: "O",
(upper case letter O). "-O0" reverts the assembler to no
extra optimization passes, "-O1" allows up to 5 extra passes,
and "-O2"(default), allows up to 10 extra optimization passes.
@@ -1578,7 +1571,7 @@ in macros etc. For example:
\c abc %$here
\c %$here
- Now last line will be expanded into "hello" as expected. This also allows
+\> Now last line will be expanded into "hello" as expected. This also allows
for lots of goodies, a good example are extended "proc" macros included
in this archive.
@@ -1588,7 +1581,7 @@ in macros etc. For example:
\c %ifdef %$abc
\c %endif
- to work without warnings even in no context.
+\> to work without warnings even in no context.
\b Added a check for "cstk" in %if*ctx and %elif*ctx directives -
this allows to use \c{%ifctx} without excessive warnings. If there is
@@ -1606,7 +1599,7 @@ in macros etc. For example:
\c %define %$name andy
\c %error "hello(%$name)"
- Same happened with \c{%include} directive.
+\> Same happened with \c{%include} directive.
\b Now all directives that expect an identifier will try to expand and
concatenate everything without whitespaces in between before usage.
@@ -1616,21 +1609,21 @@ in macros etc. For example:
\c %define __%$abc goodbye
\c __%$abc
- would produce "incorrect" output: last line will expand to
+\> would produce "incorrect" output: last line will expand to
\c hello goodbyehello
- Not quite what you expected, eh? :-) The answer is that preprocessor
+\> Not quite what you expected, eh? :-) The answer is that preprocessor
treats the \c{%define} construct as if it would be
\c %define __ %$abc goodbye
- (note the white space between __ and %$abc). After my "fix" it
+\> (note the white space between __ and %$abc). After my "fix" it
will "correctly" expand into
\c goodbye
- as expected. Note that I use quotes around words "correct", "incorrect"
+\> as expected. Note that I use quotes around words "correct", "incorrect"
etc because this is rather a feature not a bug; however current behaviour
is more logical (and allows more advanced macro usage :-).
@@ -1656,7 +1649,7 @@ in macros etc. For example:
\c
\c push eax,ebx,ecx
- will produce a warning, but if we remove the first line we won't see it
+\> will produce a warning, but if we remove the first line we won't see it
anymore (which is The Right Thing To Do {tm} IMHO since C preprocessor
eats such constructs without warnings at all).
@@ -1671,7 +1664,7 @@ in macros etc. For example:
\c %define cextern(x) _ %+ x
\c cextern (myfunc)
- After first expansion, third line will become "_myfunc". After this
+\> After first expansion, third line will become "_myfunc". After this
expansion is performed again so it becomes "_otherunc".
\b Now if preprocessor is in a non-emitting state, no warning or error
@@ -1697,13 +1690,13 @@ in macros etc. For example:
\c %pop
\c %pop
- will expand correctly the fourth line to [esp]; if we'll define another
+\> will expand correctly the fourth line to [esp]; if we'll define another
%$a inside the "inner" context, it will take precedence over outer
definition. However, this modification has been applied only to
expand_smacro and not to smacro_define: as a consequence expansion
looks in outer contexts, but \c{%ifdef} won't look in outer contexts.
- This behaviour is needed because we don't want nested contexts to
+\> This behaviour is needed because we don't want nested contexts to
act on already defined local macros. Example:
\c %define %$arg1 [esp+4]
@@ -1712,7 +1705,7 @@ in macros etc. For example:
\c mov eax,%$arg1
\c endif
- In this example the "if" mmacro enters into the "if" context, so %$arg1
+\> In this example the "if" mmacro enters into the "if" context, so %$arg1
is not valid anymore inside "if". Of course it could be worked around
by using explicitely %$$arg1 but this is ugly IMHO.
diff --git a/doc/genps.pl b/doc/genps.pl
index 7a72b732..e3b799b5 100755
--- a/doc/genps.pl
+++ b/doc/genps.pl
@@ -57,7 +57,7 @@ require 'findfont.ph'; # Find fonts in the system
pymarg => 24, # Page number position relative to bot margin
startcopyright => 75, # How much above the bottom margin is the
# copyright notice stuff
- bulladj => 12, # How much to indent a bullet paragraph
+ bulladj => 12, # How much to indent a bullet/indented paragraph
tocind => 12, # TOC indentation per level
tocpnz => 24, # Width of TOC page number only zone
tocdots => 8, # Spacing between TOC dots
@@ -129,6 +129,8 @@ while ( $arg = shift(@ARGV) ) {
'subh' => $psconf{paraskip},
'norm' => $psconf{paraskip},
'bull' => $psconf{paraskip},
+ 'indt' => $psconf{paraskip},
+ 'bquo' => $psconf{paraskip},
'code' => $psconf{paraskip},
'toc0' => $psconf{tocskip},
'toc1' => $psconf{tocskip},
@@ -730,8 +732,10 @@ sub ps_break_lines($$) {
$ls[0]->[0]->[2] = [[$AuxStr,$secn]];
} elsif ( $ptype eq 'norm' ) {
@ls = ps_flow_lines($linewidth, \%BodyFont, $ptype, @data);
- } elsif ( $ptype eq 'bull' ) {
+ } elsif ( $ptype =~ /^(bull|indt)$/ ) {
@ls = ps_flow_lines($bullwidth, \%BodyFont, $ptype, @data);
+ } elsif ( $ptypq eq 'bquo' ) {
+ @ls = ps_flow_lines($bullwidth, \%BquoFont, $ptype, @data);
} elsif ( $ptype =~ /^toc/ ) {
unless ( $xtype =~/^\S+ :([^:]*):(.*)$/ ) {
die "Bad para";
@@ -1134,10 +1138,10 @@ $ps_page = 0;
# Title page
ps_start_page();
$title = $metadata{'title'} || '';
-$title =~ s/ \- / $charcode{'emdash'} /;
+$title =~ s/ \- / $charcode{'endash'} /;
$subtitle = $metadata{'subtitle'} || '';
-$subtitle =~ s/ \- / $charcode{'emdash'} /;
+$subtitle =~ s/ \- / $charcode{'endash'} /;
# Print title
print "/ti ", ps_string($title), " def\n";
diff --git a/doc/head.ps b/doc/head.ps
index 48b7af21..7fbb3a90 100644
--- a/doc/head.ps
+++ b/doc/head.ps
@@ -258,6 +258,16 @@
/bull3 { dup lmarg exch moveto bullet bfont showstream
bullmarg exch moveto bfont showstream } def
+/indt0 { bullmarg exch moveto bfont bwidth showstreamjust } def
+/indt1 { bullmarg exch moveto bfont bwidth showstreamjust } def
+/indt2 { bullmarg exch moveto bfont showstream } def
+/indt3 { bullmarg exch moveto bfont showstream } def
+
+/bquo0 { bullmarg exch moveto qfont bwidth showstreamjust } def
+/bquo1 { bullmarg exch moveto qfont bwidth showstreamjust } def
+/bquo2 { bullmarg exch moveto qfont showstream } def
+/bquo3 { bullmarg exch moveto qfont showstream } def
+
/tocw0 lwidth tocpnz sub def
/tocw1 tocw0 tocind sub def
/tocw2 tocw1 tocind sub def
diff --git a/doc/nasmdoc.css b/doc/nasmdoc.css
new file mode 100644
index 00000000..a709c015
--- /dev/null
+++ b/doc/nasmdoc.css
@@ -0,0 +1,61 @@
+body {
+ font-family: "source sans pro", "clear sans", "liberation sans",
+ "arial", "sans-serif";
+ background: white;
+}
+h1 {
+ text-align: center;
+}
+code, pre {
+ font-family: "source code pro", "liberation mono", "monospace";
+}
+pre, blockquote {
+ margin-left: 4em;
+ margin-right: 4em;
+}
+code {
+ display: inline;
+ white-space: nowrap;
+}
+@media not screen {
+ ul.navbar {
+ display: none;
+ }
+}
+@media screen {
+ body {
+ padding: 0;
+ margin: 10px;
+ }
+ ul.navbar {
+ display: block;
+ position: sticky;
+ top: 10px;
+ width: 100%;
+ margin: 0;
+ padding: 0;
+ overflow: hidden;
+ white-space: nowrap;
+ list-style-type: none;
+ background: #336 url("nasmlogw.png") no-repeat right center;
+ background-size: contain;
+ }
+
+ ul.navbar li {
+ float: left;
+ }
+ ul.navbar li.last {
+ border-right: none;
+ }
+ ul.navbar a {
+ border-right: 1px solid #bbb;
+ display: block;
+ color: white;
+ text-align: center;
+ padding: 14px 16px;
+ text-decoration: none;
+ }
+ ul.navbar a:hover {
+ background-color: #448;
+ }
+}
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index fd3c6b6f..c7a4126e 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -345,7 +345,7 @@ distribution archive, for the license conditions under which you may
use NASM. NASM is now under the so-called 2-clause BSD license, also
known as the simplified BSD license.
-Copyright 1996-2016 the NASM Authors - All rights reserved.
+Copyright 1996-2017 the NASM Authors - All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
diff --git a/doc/nasmlogw.png b/doc/nasmlogw.png
new file mode 100644
index 00000000..72594e80
--- /dev/null
+++ b/doc/nasmlogw.png
Binary files differ
diff --git a/doc/psfonts.ph b/doc/psfonts.ph
index ad1762c7..093d9dc4 100644
--- a/doc/psfonts.ph
+++ b/doc/psfonts.ph
@@ -15,8 +15,12 @@ my @HItal = ('SourceSansPro-SemiboldIt', 'ClearSans-BoldItalic',
my @HCode = ('SourceCodePro-Semibold', 'LiberationMono-Bold', 'Courier-Bold');
my @BText = ('SourceSansPro-Regular', 'ClearSans', 'LiberationSans', 'Arial', 'Helvetica');
my @BItal = ('SourceSansPro-It', 'ClearSans-Italic', 'LiberationSans-Italic',
- 'Arial-Italic', 'Helvetica-BoldItalic');
-my @BCode = ('SourceCodePro-Regular', 'LiberationMono', 'Courier-Bold');
+ 'Arial-Italic', 'Helvetica-Italic');
+my @BCode = ('SourceCodePro-Regular', 'LiberationMono', 'Courier');
+my @QText = ('SourceSansPro-It', 'ClearSans-Italic', 'LiberationSans-Italic',
+ 'Arial-Italic', 'Helvetica-Italic');
+my @QBold = ('SourceSansPro-BoldIt', 'ClearSans-BoldItalic', 'LiberationSans-BoldItalic', 'Arial-Bold', 'Helvetica-BoldItalic');
+my @QCode = ('SourceCodePro-Regular', 'LiberationMono', 'Courier');
# The fonts we want to use for various things
# The order is: <normal> <emphatic> <code>
@@ -36,10 +40,14 @@ my @BCode = ('SourceCodePro-Regular', 'LiberationMono', 'Courier-Bold');
%BodyFont = (name => 'bfont',
leading => 12,
fonts => [[10, \@BText], [10, \@BItal], [10, \@BCode]]);
+%BquoFont = (name => 'qfont',
+ leading => 10.8,
+ fonts => [[9, \@QText], [9, \@QBold], [9, \@QCode]]);
#
# List of all fontsets; used to compute the list of fonts needed
#
-@AllFonts = ( \%TitlFont, \%ChapFont, \%HeadFont, \%SubhFont, \%BodyFont );
+@AllFonts = ( \%TitlFont, \%ChapFont, \%HeadFont, \%SubhFont, \%BodyFont,
+ \%BquoFont);
# OK
1;
diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl
index 65c716cf..afe93d68 100644
--- a/doc/rdsrc.pl
+++ b/doc/rdsrc.pl
@@ -48,6 +48,14 @@
# HTML, consecutive groups of bulleted paragraphs become unordered
# lists.
#
+# Indent \>
+# Indents the paragraph equvalently to a bulleted paragraph. In HTML,
+# an indented paragraph following a bulleted paragraph is included in the
+# same list item.
+#
+# Blockquote \q
+# Marks the paragraph as a block quote.
+#
# Emphasis \e{foobar}
# produces `_foobar_' in text and italics in HTML, PS, RTF
#
@@ -185,14 +193,6 @@ if ($out_format eq 'txt') {
print "Producing HTML output: ";
&write_html;
print "done.\n";
-} elsif ($out_format eq 'texi') {
- print "Producing Texinfo output: ";
- &write_texi;
- print "done.\n";
-} elsif ($out_format eq 'hlp') {
- print "Producing WinHelp output: ";
- &write_hlp;
- print "done.\n";
} elsif ($out_format eq 'dip') {
print "Producing Documentation Intermediate Paragraphs: ";
&write_dip;
@@ -362,11 +362,16 @@ sub got_para {
die "badly formed metadata: $_\n" if !/^\\M\{([^\}]*)}\{([^\}]*)\}\s*$/;
$metadata{$1} = $2;
return; # avoid word-by-word code
- } elsif (/^\\b/) {
- # A bulleted paragraph. Strip off the initial \b and let the
- # word-by-word code take care of the rest.
- $pflags = "bull";
- s/^\\b\s*//;
+ } elsif (/^\\([b\>q])/) {
+ # An indented paragraph of some sort. Strip off the initial \b and let the
+ # word-by-word code take care of the rest.
+ my %ipar = (
+ 'b' => 'bull',
+ '>' => 'indt',
+ 'q' => 'bquo',
+ );
+ $pflags = $ipar{$1};
+ s/^\\[b\>q]\s*//;
} else {
# A normal paragraph. Just set $pflags: the word-by-word code does
# the rest.
@@ -382,7 +387,8 @@ sub got_para {
#
# Type codes are:
# "n " for normal
- # "da" for a dash
+ # "da" for an en dash
+ # "dm" for an em desh
# "es" for first emphasised word in emphasised bit
# "e " for emphasised in mid-emphasised-bit
# "ee" for last emphasised word in emphasised bit
@@ -478,8 +484,10 @@ sub got_para {
$w =~ s/\\\}/\}/g;
$w =~ s/\\-/-/g;
$w =~ s/\\\\/\\/g;
- if ($w eq "-") {
- push @$pname,"da";
+ if ($w eq '--') {
+ push @$pname, 'dm';
+ } elsif ($w eq '-') {
+ push @$pname, 'da';
} else {
push @$pname,"n $w";
}
@@ -606,7 +614,7 @@ sub write_txt {
select TEXT;
# Preamble.
- $title = "The Netwide Assembler: NASM";
+ $title = $metadata{'title'};
$spaces = ' ' x ((75-(length $title))/2);
($underscore = $title) =~ s/./=/g;
print "$spaces$title\n$spaces$underscore\n";
@@ -657,13 +665,13 @@ sub write_txt {
warn "code line longer than 68 chars: $i\n" if length $i > 68;
print ' 'x7, $i, "\n";
}
- } elsif ($ptype eq "bull" || $ptype eq "norm") {
- # Ordinary paragraph, optionally bulleted. We wrap, with ragged
+ } elsif ($ptype =~ /^(norm|bull|indt|bquo)$/) {
+ # Ordinary paragraph, optionally indented. We wrap, with ragged
# 75-char right margin and either 7 or 11 char left margin
# depending on bullets.
- if ($ptype eq "bull") {
- $line = ' 'x7 . '(*) ';
- $next = ' 'x11;
+ if ($ptype ne 'norm') {
+ $line = ' 'x7 . (($ptype eq 'bull') ? '(*) ' : ' ');
+ $next = ' 'x11;
} else {
$line = $next = ' 'x7;
}
@@ -709,7 +717,7 @@ sub word_txt {
return $w;
} elsif ($wtype eq "sp") {
return ' ';
- } elsif ($wtype eq "da") {
+ } elsif ($wtype eq 'da' || $wtype eq 'dm') {
return '-';
} elsif ($wmajt eq "c" || $wtype eq "wc") {
return "`${w}'";
@@ -773,19 +781,26 @@ sub write_html {
$html_lastf = '';
$in_list = 0;
+ $in_bquo = 0;
+ $in_code = 0;
for ($para = 0; $para <= $#pnames; $para++) {
$pname = $pnames[$para];
$pflags = $pflags[$para];
$ptype = substr($pflags,0,4);
- $in_list = 0, print "</ul>\n" if $in_list && $ptype ne "bull";
+ $in_code = 0, print "</pre>\n" if ($in_code && $ptype ne 'code');
+ $in_list = 0, print "</li>\n</ul>\n" if ($in_list && $ptype !~ /^(bull|indt|code)$/);
+ $in_bquo = 0, print "</blockquote>\n" if ($in_bquo && $ptype ne 'bquo');
+
+ $endtag = '';
+
if ($ptype eq "chap") {
# Chapter heading. Begin a new file.
$pflags =~ /chap (.*) :(.*)/;
$title = "Chapter $1: ";
$xref = $2;
- &html_jumppoints; print "</body></html>\n"; select STDOUT; close TEXT;
+ print "</body>\n</html>\n"; select STDOUT; close TEXT;
$html_lastf = $html_fnames{$chapternode};
$chapternode = $nodexrefs{$xref};
$html_nextf = $html_fnames{$tstruct_mnext{$chapternode}};
@@ -796,14 +811,14 @@ sub write_html {
$ww = &word_html($i);
$title .= $ww unless $ww eq "\001";
}
- $h = "<h2><a name=\"$xref\">$title</a></h2>\n";
+ $h = "<h2 id=\"$xref\">$title</h2>\n";
print $h; print FULL $h;
} elsif ($ptype eq "appn") {
# Appendix heading. Begin a new file.
$pflags =~ /appn (.*) :(.*)/;
$title = "Appendix $1: ";
$xref = $2;
- &html_jumppoints; print "</body></html>\n"; select STDOUT; close TEXT;
+ print "</body>\n</html>\n"; select STDOUT; close TEXT;
$html_lastf = $html_fnames{$chapternode};
$chapternode = $nodexrefs{$xref};
$html_nextf = $html_fnames{$tstruct_mnext{$chapternode}};
@@ -814,7 +829,7 @@ sub write_html {
$ww = &word_html($i);
$title .= $ww unless $ww eq "\001";
}
- print "<h2><a name=\"$xref\">$title</a></h2>\n";
+ print "<h2 id=\"$xref\">$title</h2>\n";
} elsif ($ptype eq "head" || $ptype eq "subh") {
# Heading or subheading.
$pflags =~ /.... (.*) :(.*)/;
@@ -825,27 +840,45 @@ sub write_html {
$ww = &word_html($i);
$title .= $ww unless $ww eq "\001";
}
- print "<$hdr><a name=\"$xref\">$title</a></$hdr>\n";
+ print "<$hdr id=\"$xref\">$title</$hdr>\n";
} elsif ($ptype eq "code") {
- # Code paragraph.
- print "<p><pre>\n";
- foreach $i (@$pname) {
- $w = $i;
- $w =~ s/&/&amp;/g;
- $w =~ s/</&lt;/g;
- $w =~ s/>/&gt;/g;
- print $w, "\n";
- }
- print "</pre>\n";
- } elsif ($ptype eq "bull" || $ptype eq "norm") {
- # Ordinary paragraph, optionally bulleted. We wrap, with ragged
- # 75-char right margin and either 7 or 11 char left margin
- # depending on bullets.
- if ($ptype eq "bull") {
- $in_list = 1, print "<ul>\n" unless $in_list;
- $line = '<li>';
+ # Code paragraph.
+ $in_code = 1, print "<pre>" unless $in_code;
+ print "\n";
+ foreach $i (@$pname) {
+ $w = $i;
+ $w =~ s/&/&amp;/g;
+ $w =~ s/</&lt;/g;
+ $w =~ s/>/&gt;/g;
+ print $w, "\n";
+ }
+ } elsif ($ptype =~ /^(norm|bull|indt|bquo)$/) {
+ # Ordinary paragraph, optionally indented.
+ if ($ptype eq 'bull') {
+ if (!$in_list) {
+ $in_list = 1;
+ print "<ul>\n";
+ } else {
+ print "</li>\n";
+ }
+ print "<li>\n";
+ $line = '<p>';
+ $endtag = '</p>';
+ } elsif ($ptype eq 'indt') {
+ if (!$in_list) {
+ $in_list = 1;
+ print "<ul>\n";
+ print "<li class=\"indt\">\n"; # This is such a hack
+ }
+ $line = '<p>';
+ $endtag = '</p>';
+ } elsif ($ptype eq 'bquo') {
+ $in_bquo = 1, print "<blockquote>\n" unless $in_bquo;
+ $line = '<p>';
+ $endtag = '</p>';
} else {
$line = '<p>';
+ $endtag = '</p>';
}
@a = @$pname;
$wd = $wprev = '';
@@ -866,8 +899,9 @@ sub write_html {
} while ($w ne '' && $w ne undef);
if ($line =~ /\S/) {
$line =~ s/\s*$//; # trim trailing spaces
- print "$line\n";
+ print $line;
}
+ print $endtag, "\n";
}
}
@@ -881,27 +915,35 @@ sub write_html {
open TEXT, '>', File::Spec->catfile($out_path, 'nasmdoci.html');
select TEXT;
&html_preamble(0);
- print "<p align=center><a href=\"nasmdoc0.html\">Contents</a>\n";
- print "<p>";
+ print "<h2 class=\"index\"><a href=\"nasmdoc0.html\">Index</a></h1>\n";
+ print "<ul class=\"index\">\n";
&html_index;
- print "<p align=center><a href=\"nasmdoc0.html\">Contents</a>\n";
- print "</body></html>\n";
+ print "</ul>\n</body>\n</html>\n";
select STDOUT;
close TEXT;
}
sub html_preamble {
- print "<html><head><title>NASM Manual</title></head>\n";
- print "<body><h1 align=center>The Netwide Assembler: NASM</h1>\n\n";
- &html_jumppoints if $_[0];
+ print "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?>\n";
+ print "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" ";
+ print "\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n";
+ print "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n";
+ print "<head>\n";
+ print "<title>", $metadata{'title'}, "</title>\n";
+ print "<link href=\"nasmdoc.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
+ print "</head>\n";
+ print "<body>\n";
+ &html_jumppoints;
+ print "<h1>", $metadata{'title'}, "</h1>\n\n";
}
sub html_jumppoints {
- print "<p align=center>";
- print "<a href=\"$html_nextf\">Next Chapter</a> |\n" if $html_nextf;
- print "<a href=\"$html_lastf\">Previous Chapter</a> |\n" if $html_lastf;
- print "<a href=\"nasmdoc0.html\">Contents</a> |\n";
- print "<a href=\"nasmdoci.html\">Index</a>\n";
+ print "<ul class=\"navbar\">\n";
+ print "<li class=\"first\"><a class=\"prev\" href=\"$html_lastf\">Previous Chapter</a></li>\n" if $html_lastf;
+ print "<li><a class=\"next\" href=\"$html_nextf\">Next Chapter</a></li>\n" if $html_nextf;
+ print "<li><a class=\"toc\" href=\"nasmdoc0.html\">Contents</a></li>\n";
+ print "<li class=\"last\"><a class=\"index\" href=\"nasmdoci.html\">Index</a></li>\n";
+ print "</ul>\n";
}
sub html_index {
@@ -963,9 +1005,11 @@ sub word_html {
} elsif ($wtype eq "sp") {
return ' ';
} elsif ($wtype eq "da") {
- return '-'; # sadly, en-dashes are non-standard in HTML
+ return '&ndash;';
+ } elsif ($wtype eq "dm") {
+ return '&mdash;';
} elsif ($wmajt eq "c" || $wtype eq "wc") {
- return $pfx . "<code><nobr>${w}</nobr></code>" . $sfx;
+ return $pfx . "<code>${w}</code>" . $sfx;
} elsif ($wtype eq "es") {
return "<em>${w}";
} elsif ($wtype eq "ee") {
@@ -993,517 +1037,6 @@ sub word_html {
}
}
-sub write_texi {
- # This is called from the top level, so I won't bother using
- # my or local.
-
- # Open file.
- print "writing file...";
- open TEXT,'>', File::Spec->catfile($out_path, 'nasmdoc.texi');
- select TEXT;
-
- # Preamble.
- print "\\input texinfo \@c -*-texinfo-*-\n";
- print "\@c \%**start of header\n";
- print "\@setfilename ",$metadata{'infofile'},".info\n";
- print "\@dircategory ",$metadata{'category'},"\n";
- print "\@direntry\n";
- printf "* %-28s %s.\n",
- sprintf('%s: (%s).', $metadata{'infoname'}, $metadata{'infofile'}),
- $metadata{'infotitle'};
- print "\@end direntry\n";
- print "\@settitle ", $metadata{'title'},"\n";
- print "\@setchapternewpage odd\n";
- print "\@c \%**end of header\n";
- print "\n";
- print "\@ifinfo\n";
- print $metadata{'summary'}, "\n";
- print "\n";
- print "Copyright ",$metadata{'year'}," ",$metadata{'author'},"\n";
- print "\n";
- print $metadata{'license'}, "\n";
- print "\@end ifinfo\n";
- print "\n";
- print "\@titlepage\n";
- $title = $metadata{'title'};
- $title =~ s/ - / --- /g;
- print "\@title ${title}\n";
- print "\@author ",$metadata{'author'},"\n";
- print "\n";
- print "\@page\n";
- print "\@vskip 0pt plus 1filll\n";
- print "Copyright \@copyright{} ",$metadata{'year'},' ',$metadata{'author'},"\n";
- print "\n";
- print $metadata{'license'}, "\n";
- print "\@end titlepage\n";
- print "\n";
- print "\@node Top, $tstruct_next{'Top'}, (dir), (dir)\n";
- print "\@top ",$metadata{'infotitle'},"\n";
- print "\n";
- print "\@ifinfo\n";
- print $metadata{'summary'}, "\n";
- print "\@end ifinfo\n";
-
- $node = "Top";
-
- $bulleting = 0;
- for ($para = 0; $para <= $#pnames; $para++) {
- $pname = $pnames[$para];
- $pflags = $pflags[$para];
- $ptype = substr($pflags,0,4);
-
- $bulleting = 0, print "\@end itemize\n" if $bulleting && $ptype ne "bull";
- print "\n"; # always one of these before a new paragraph
-
- if ($ptype eq "chap") {
- # Chapter heading. Begin a new node.
- &texi_menu($node)
- if $tstruct_level{$tstruct_next{$node}} > $tstruct_level{$node};
- $pflags =~ /chap (.*) :(.*)/;
- $node = "Chapter $1";
- $title = "Chapter $1: ";
- foreach $i (@$pname) {
- $ww = &word_texi($i);
- $title .= $ww unless $ww eq "\001";
- }
- print "\@node $node, $tstruct_next{$node}, $tstruct_prev{$node},";
- print " $tstruct_up{$node}\n\@unnumbered $title\n";
- } elsif ($ptype eq "appn") {
- # Appendix heading. Begin a new node.
- &texi_menu($node)
- if $tstruct_level{$tstruct_next{$node}} > $tstruct_level{$node};
- $pflags =~ /appn (.*) :(.*)/;
- $node = "Appendix $1";
- $title = "Appendix $1: ";
- foreach $i (@$pname) {
- $ww = &word_texi($i);
- $title .= $ww unless $ww eq "\001";
- }
- print "\@node $node, $tstruct_next{$node}, $tstruct_prev{$node},";
- print " $tstruct_up{$node}\n\@unnumbered $title\n";
- } elsif ($ptype eq "head" || $ptype eq "subh") {
- # Heading or subheading. Begin a new node.
- &texi_menu($node)
- if $tstruct_level{$tstruct_next{$node}} > $tstruct_level{$node};
- $pflags =~ /.... (.*) :(.*)/;
- $node = "Section $1";
- $title = "$1. ";
- foreach $i (@$pname) {
- $ww = &word_texi($i);
- $title .= $ww unless $ww eq "\001";
- }
- print "\@node $node, $tstruct_next{$node}, $tstruct_prev{$node},";
- print " $tstruct_up{$node}\n";
- $hdr = ($ptype eq "subh" ? "\@unnumberedsubsec" : "\@unnumberedsec");
- print "$hdr $title\n";
- } elsif ($ptype eq "code") {
- # Code paragraph. Surround with @example / @end example.
- print "\@example\n";
- foreach $i (@$pname) {
- warn "code line longer than 68 chars: $i\n" if length $i > 68;
- $i =~ s/\@/\@\@/g;
- $i =~ s/\{/\@\{/g;
- $i =~ s/\}/\@\}/g;
- print "$i\n";
- }
- print "\@end example\n";
- } elsif ($ptype eq "bull" || $ptype eq "norm") {
- # Ordinary paragraph, optionally bulleted. We wrap, FWIW.
- if ($ptype eq "bull") {
- $bulleting = 1, print "\@itemize \@bullet\n" if !$bulleting;
- print "\@item\n";
- }
- $line = '';
- @a = @$pname;
- $wd = $wprev = '';
- do {
- do { $w = &word_texi(shift @a); } while $w eq "\001"; # hack
- $wd .= $wprev;
- if ($wprev =~ /-$/ || $w eq ' ' || $w eq '' || $w eq undef) {
- if (length ($line . $wd) > 75) {
- $line =~ s/\s*$//; # trim trailing spaces
- print "$line\n";
- $line = '';
- $wd =~ s/^\s*//; # trim leading spaces
- }
- $line .= $wd;
- $wd = '';
- }
- $wprev = $w;
- } while ($w ne '' && $w ne undef);
- if ($line =~ /\S/) {
- $line =~ s/\s*$//; # trim trailing spaces
- print "$line\n";
- }
- }
- }
-
- # Write index.
- &texi_index;
-
- # Close file.
- print "\n\@contents\n\@bye\n";
- select STDOUT;
- close TEXT;
-}
-
-# Side effect of this procedure: update global `texiwdlen' to be the length
-# in chars of the formatted version of the word.
-sub word_texi {
- my ($w) = @_;
- my $wtype, $wmajt;
-
- return undef if $w eq '' || $w eq undef;
- $wtype = substr($w,0,2);
- $wmajt = substr($wtype,0,1);
- $w = substr($w,2);
- $wlen = length $w;
- $w =~ s/\@/\@\@/g;
- $w =~ s/\{/\@\{/g;
- $w =~ s/\}/\@\}/g;
- $w =~ s/<.*>// if $wmajt eq "w"; # remove web links
- substr($w,0,1) =~ tr/a-z/A-Z/, $capital = 0 if $capital;
- if ($wmajt eq "n" || $wtype eq "e " || $wtype eq "w ") {
- $texiwdlen = $wlen;
- return $w;
- } elsif ($wtype eq "sp") {
- $texiwdlen = 1;
- return ' ';
- } elsif ($wtype eq "da") {
- $texiwdlen = 2;
- return '--';
- } elsif ($wmajt eq "c" || $wtype eq "wc") {
- $texiwdlen = 2 + $wlen;
- return "\@code\{$w\}";
- } elsif ($wtype eq "es") {
- $texiwdlen = 1 + $wlen;
- return "\@emph\{${w}";
- } elsif ($wtype eq "ee") {
- $texiwdlen = 1 + $wlen;
- return "${w}\}";
- } elsif ($wtype eq "eo") {
- $texiwdlen = 2 + $wlen;
- return "\@emph\{${w}\}";
- } elsif ($wtype eq "x ") {
- $texiwdlen = 0; # we don't need it in this case
- $capital = 1; # hack
- return "\@ref\{";
- } elsif ($wtype eq "xe") {
- $texiwdlen = 0; # we don't need it in this case
- return "\}";
- } elsif ($wmajt eq "i") {
- $texiwdlen = 0; # we don't need it in this case
- return "\001";
- } else {
- die "panic in word_texi: $wtype$w\n";
- }
-}
-
-sub texi_menu {
- my ($topitem) = @_;
- my $item, $i, $mpname, $title, $wd;
-
- $item = $tstruct_next{$topitem};
- print "\@menu\n";
- while ($item) {
- $title = "";
- $mpname = $tstruct_pname{$item};
- foreach $i (@$mpname) {
- $wd = &word_texi($i);
- $title .= $wd unless $wd eq "\001";
- }
- print "* ${item}:: $title\n";
- $item = $tstruct_mnext{$item};
- }
- print "* Index::\n" if $topitem eq "Top";
- print "\@end menu\n";
-}
-
-sub texi_index {
- my $itag, $ientry, @a, $wd, $item, $len;
- my $subnums = "123456789ABCDEFGHIJKLMNOPQRSTU" .
- "VWXYZabcdefghijklmnopqrstuvwxyz";
-
- print "\@ifinfo\n\@node Index, , $FIXMElastnode, Top\n";
- print "\@unnumbered Index\n\n\@menu\n";
-
- foreach $itag (@itags) {
- $ientry = $idxmap{$itag};
- @a = @$ientry;
- $item = '';
- $len = 0;
- foreach $i (@a) {
- $wd = &word_texi($i);
- $item .= $wd, $len += $texiwdlen unless $wd eq "\001";
- }
- $i = 0;
- foreach $node (@nodes) {
- next if !$idxnodes{$node,$itag};
- printf "* %s%s (%s): %s.\n",
- $item, " " x (40-$len), substr($subnums,$i++,1), $node;
- }
- }
- print "\@end menu\n\@end ifinfo\n";
-}
-
-sub write_hlp {
- # This is called from the top level, so I won't bother using
- # my or local.
-
- # Build the index-tag text forms.
- print "building index entries...";
- @hlp_index = map {
- my $i,$ww;
- my $ientry = $idxmap{$_};
- my $title = "";
- foreach $i (@$ientry) {
- $ww = &word_hlp($i,0);
- $title .= $ww unless $ww eq "\001";
- }
- $title;
- } @itags;
-
- # Write the HPJ project-description file.
- print "writing .hpj file...";
- open HPJ, '>', File::Spec->catfile($out_path, 'nasmdoc.hpj');
- print HPJ "[OPTIONS]\ncompress=true\n";
- print HPJ "title=NASM: The Netwide Assembler\noldkeyphrase=no\n\n";
- print HPJ "[FILES]\nnasmdoc.rtf\n\n";
- print HPJ "[CONFIG]\n";
- print HPJ 'CreateButton("btn_up", "&Up",'.
- ' "JumpContents(`nasmdoc.hlp'."'".')")';
- print HPJ "\nBrowseButtons()\n";
- close HPJ;
-
- # Open file.
- print "\n writing .rtf file...";
- open TEXT,'>', File::Spec->catfile($out_path, 'nasmdoc.rtf');
- select TEXT;
-
- # Preamble.
- print "{\\rtf1\\ansi{\\fonttbl\n";
- print "\\f0\\froman Times New Roman;\\f1\\fmodern Courier New;\n";
- print "\\f2\\fswiss Arial;\\f3\\ftech Wingdings}\\deff0\n";
- print "#{\\footnote Top}\n";
- print "\${\\footnote Contents}\n";
- print "+{\\footnote browse:00000}\n";
- print "!{\\footnote DisableButton(\"btn_up\")}\n";
- print "\\keepn\\f2\\b\\fs30\\sb0\n";
- print "NASM: The Netwide Assembler\n";
- print "\\par\\pard\\plain\\sb120\n";
- print "This file documents NASM, the Netwide Assembler: an assembler \n";
- print "targetting the Intel x86 series of processors, with portable source.\n";
-
- $node = "Top";
- $browse = 0;
-
- $newpar = "\\par\\sb120\n";
- for ($para = 0; $para <= $#pnames; $para++) {
- $pname = $pnames[$para];
- $pflags = $pflags[$para];
- $ptype = substr($pflags,0,4);
-
- print $newpar;
- $newpar = "\\par\\sb120\n";
-
- if ($ptype eq "chap") {
- # Chapter heading. Begin a new node.
- &hlp_menu($node)
- if $tstruct_level{$tstruct_next{$node}} > $tstruct_level{$node};
- $pflags =~ /chap (.*) :(.*)/;
- $node = "Chapter $1";
- $title = $footnotetitle = "Chapter $1: ";
- foreach $i (@$pname) {
- $ww = &word_hlp($i,1);
- $title .= $ww, $footnotetitle .= &word_hlp($i,0) unless $ww eq "\001";
- }
- print "\\page\n";
- printf "#{\\footnote %s}\n", &hlp_sectkw($node);
- print "\${\\footnote $footnotetitle}\n";
- printf "+{\\footnote browse:%05d}\n", ++$browse;
- printf "!{\\footnote ChangeButtonBinding(\"btn_up\"," .
- "\"JumpId(\`nasmdoc.hlp',\`%s')\");\n",
- &hlp_sectkw($tstruct_up{$node});
- print "EnableButton(\"btn_up\")}\n";
- &hlp_keywords($node);
- print "\\keepn\\f2\\b\\fs30\\sb60\\sa60\n";
- print "$title\n";
- $newpar = "\\par\\pard\\plain\\sb120\n";
- } elsif ($ptype eq "appn") {
- # Appendix heading. Begin a new node.
- &hlp_menu($node)
- if $tstruct_level{$tstruct_next{$node}} > $tstruct_level{$node};
- $pflags =~ /appn (.*) :(.*)/;
- $node = "Appendix $1";
- $title = $footnotetitle = "Appendix $1: ";
- foreach $i (@$pname) {
- $ww = &word_hlp($i,1);
- $title .= $ww, $footnotetitle .= &word_hlp($i,0) unless $ww eq "\001";
- }
- print "\\page\n";
- printf "#{\\footnote %s}\n", &hlp_sectkw($node);
- print "\${\\footnote $footnotetitle}\n";
- printf "+{\\footnote browse:%05d}\n", ++$browse;
- printf "!{\\footnote ChangeButtonBinding(\"btn_up\"," .
- "\"JumpId(\`nasmdoc.hlp',\`%s')\");\n",
- &hlp_sectkw($tstruct_up{$node});
- print "EnableButton(\"btn_up\")}\n";
- &hlp_keywords($node);
- print "\\keepn\\f2\\b\\fs30\\sb60\\sa60\n";
- print "$title\n";
- $newpar = "\\par\\pard\\plain\\sb120\n";
- } elsif ($ptype eq "head" || $ptype eq "subh") {
- # Heading or subheading. Begin a new node.
- &hlp_menu($node)
- if $tstruct_level{$tstruct_next{$node}} > $tstruct_level{$node};
- $pflags =~ /.... (.*) :(.*)/;
- $node = "Section $1";
- $title = $footnotetitle = "$1. ";
- foreach $i (@$pname) {
- $ww = &word_hlp($i,1);
- $title .= $ww, $footnotetitle .= &word_hlp($i,0) unless $ww eq "\001";
- }
- print "\\page\n";
- printf "#{\\footnote %s}\n", &hlp_sectkw($node);
- print "\${\\footnote $footnotetitle}\n";
- printf "+{\\footnote browse:%05d}\n", ++$browse;
- printf "!{\\footnote ChangeButtonBinding(\"btn_up\"," .
- "\"JumpId(\`nasmdoc.hlp',\`%s')\");\n",
- &hlp_sectkw($tstruct_up{$node});
- print "EnableButton(\"btn_up\")}\n";
- &hlp_keywords($node);
- print "\\keepn\\f2\\b\\fs30\\sb60\\sa60\n";
- print "$title\n";
- $newpar = "\\par\\pard\\plain\\sb120\n";
- } elsif ($ptype eq "code") {
- # Code paragraph.
- print "\\keep\\f1\\sb120\n";
- foreach $i (@$pname) {
- my $x = $i;
- warn "code line longer than 68 chars: $i\n" if length $i > 68;
- $x =~ s/\\/\\\\/g;
- $x =~ s/\{/\\\{/g;
- $x =~ s/\}/\\\}/g;
- print "$x\\par\\sb0\n";
- }
- $newpar = "\\pard\\f0\\sb120\n";
- } elsif ($ptype eq "bull" || $ptype eq "norm") {
- # Ordinary paragraph, optionally bulleted. We wrap, FWIW.
- if ($ptype eq "bull") {
- print "\\tx360\\li360\\fi-360{\\f3\\'9F}\\tab\n";
- $newpar = "\\par\\pard\\sb120\n";
- } else {
- $newpar = "\\par\\sb120\n";
- }
- $line = '';
- @a = @$pname;
- $wd = $wprev = '';
- do {
- do { $w = &word_hlp((shift @a),1); } while $w eq "\001"; # hack
- $wd .= $wprev;
- if ($w eq ' ' || $w eq '' || $w eq undef) {
- if (length ($line . $wd) > 75) {
- $line =~ s/\s*$//; # trim trailing spaces
- print "$line \n"; # and put one back
- $line = '';
- $wd =~ s/^\s*//; # trim leading spaces
- }
- $line .= $wd;
- $wd = '';
- }
- $wprev = $w;
- } while ($w ne '' && $w ne undef);
- if ($line =~ /\S/) {
- $line =~ s/\s*$//; # trim trailing spaces
- print "$line\n";
- }
- }
- }
-
- # Close file.
- print "\\page}\n";
- select STDOUT;
- close TEXT;
-}
-
-sub word_hlp {
- my ($w, $docode) = @_;
- my $wtype, $wmajt;
-
- return undef if $w eq '' || $w eq undef;
- $wtype = substr($w,0,2);
- $wmajt = substr($wtype,0,1);
- $w = substr($w,2);
- $w =~ s/\\/\\\\/g;
- $w =~ s/\{/\\\{/g;
- $w =~ s/\}/\\\}/g;
- $w =~ s/<.*>// if $wmajt eq "w"; # remove web links
- substr($w,0,length($w)-1) =~ s/-/\\\'AD/g if $wmajt ne "x"; #nonbreakhyphens
- if ($wmajt eq "n" || $wtype eq "e " || $wtype eq "w ") {
- return $w;
- } elsif ($wtype eq "sp") {
- return ' ';
- } elsif ($wtype eq "da") {
- return "\\'96";
- } elsif ($wmajt eq "c" || $wtype eq "wc") {
- $w =~ s/ /\\\'A0/g; # make spaces non-breaking
- return $docode ? "{\\f1 ${w}}" : $w;
- } elsif ($wtype eq "es") {
- return "{\\i ${w}";
- } elsif ($wtype eq "ee") {
- return "${w}}";
- } elsif ($wtype eq "eo") {
- return "{\\i ${w}}";
- } elsif ($wtype eq "x ") {
- return "{\\uldb ";
- } elsif ($wtype eq "xe") {
- $w = &hlp_sectkw($w);
- return "}{\\v ${w}}";
- } elsif ($wmajt eq "i") {
- return "\001";
- } else {
- die "panic in word_hlp: $wtype$w\n";
- }
-}
-
-sub hlp_menu {
- my ($topitem) = @_;
- my $item, $kword, $i, $mpname, $title;
-
- $item = $tstruct_next{$topitem};
- print "\\li360\\fi-360\n";
- while ($item) {
- $title = "";
- $mpname = $tstruct_pname{$item};
- foreach $i (@$mpname) {
- $ww = &word_hlp($i, 0);
- $title .= $ww unless $ww eq "\001";
- }
- $kword = &hlp_sectkw($item);
- print "{\\uldb ${item}: $title}{\\v $kword}\\par\\sb0\n";
- $item = $tstruct_mnext{$item};
- }
- print "\\pard\\sb120\n";
-}
-
-sub hlp_sectkw {
- my ($node) = @_;
- $node =~ tr/A-Z/a-z/;
- $node =~ tr/- ./___/;
- $node;
-}
-
-sub hlp_keywords {
- my ($node) = @_;
- my $pfx = "K{\\footnote ";
- my $done = 0;
- foreach $i (0..$#itags) {
- (print $pfx,$hlp_index[$i]), $pfx = ";\n", $done++
- if $idxnodes{$node,$itags[$i]};
- }
- print "}\n" if $done;
-}
-
# Make tree structures. $tstruct_* is top-level and global.
sub add_item {
my ($item, $level) = @_;