From 5194f77bfd38ce14176b2b5efab2052bf7014bbd Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Thu, 13 Apr 2017 21:54:42 -0700 Subject: [PATCH] doc: add indented paragraphs, valid XHTML, CSS style sheet Add indented paragraphs, which can be used to continue an item in a bulleted list. Produce valid strict XHTML, and include a style sheet with a navbar and other fancy things. Remove archaic output formats. Now only text, XHTML, and PDF are supported. Signed-off-by: H. Peter Anvin --- doc/Makefile.in | 42 +-- doc/changes.src | 77 +++--- doc/genps.pl | 12 +- doc/head.ps | 10 + doc/nasmdoc.css | 61 +++++ doc/nasmdoc.src | 2 +- doc/nasmlogw.png | Bin 0 -> 1699 bytes doc/psfonts.ph | 14 +- doc/rdsrc.pl | 677 ++++++++--------------------------------------- nasm.spec.in | 25 +- tools/release | 5 +- 11 files changed, 250 insertions(+), 675 deletions(-) create mode 100644 doc/nasmdoc.css create mode 100644 doc/nasmlogw.png 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 0000000000000000000000000000000000000000..72594e80f13ba72c5ce16bacd21e12551e0e8311 GIT binary patch literal 1699 zcmV;U23+}xP)2iNra#os_Nj>yq+S@V(cD3Z^J>%PqIua?35Z4{Y_oH%jkY z{u}YWrz6ID->{L??d{Gd^1w6qlkd$r->Gi z=;t*99H};5502Q42?~uYuXn#(L?g=^xnG)qYgctM?!Ij>qVJGf7=!1Nd*e3QViEO# z3>@U)Xx)w%b|LX-EUyV&cU3E-XCSMiwG=SuGS#k;7Qf&w*Txb}9(R7Co{#~567)1A zOAuS!Iir0>TJ(wO^N=htYhkC@Y6IyX2Of3-Wg}Bc54-GPwh*^B?_&zr-N-9g5iU28 z?*2etDB~W7LBp!b=D3HEH?V{^+lYfEy!E>y4@;Bnai2#XmnPK?(%-(+vBrJ+_Q$yU zgNb0hgN&m+`kiG4*Ywh(f6l(4JL z^)BKo*hPA?kNm?pja#>WVV9u%VZ&T|ERT^Ef>g(dBS$dsM;i4p0=;UpU+&3i;w93= z=QPP_LQE6TJ243$P9PUSA?yW`@kK6T%F2se#1u%C0x}3BJSOG!E2QD)q7dTv36Dwn zR|X>G%QTRVUsWI}uhKvUfvSS2D>@OR;a3$Q#PLfPqImg4kPE+b2_YT7J_3rD2%_FV zhL1qrD8lC}qzIzlL7GoM%sYtt1jKrQGAx3;W1KF-5=fa2((x<35Ym4DqS8Tz4?y0U zv(C<1B8W~1Y0^hbLWoNru?Zn`X*$^h!|3* zgm?rp#Qi9Ah}SUlchi<03WPM}xUMpx3dS|*^vCpT{&XS)DT-lUc{gE2+0XrRrx~tG zasbjzaW=$`Zmwx_r|zyt^z@lSQMA*`_A#d0c`}X?c-GGA~OE1+_g{x zkYc%wu?#~~hR$l44H^hi#7Z0fTl&>90E<{EVk0uFkb;5qMGRpI5{jVt24qf^5hESk6%TQ@vSK5EM?z1$H;aS}cSy}b`q&c|EhMCi zJxwh26yy?nu1g{c(#D=v0+|mR3vt&TE>ho4AuJ8iv4lA$Vj|M>kY+*rGtzt(Vy{T^ zd5GRd3L;|s(nCbX*wuYKod@#}J(jP!FDmz3R!~UHw|MHvMgEpReu}O6LtF5&F$XLALKLPntKV+b1-(uWO^hwEh=3NoKJj=>u)q}>qgCEMw~ z?p7~naQQNNM)FVR5=8P(vC~8Hr#;d`+Ed7{`&5)Wg_z%lG^Y^#+mKVn7kys1=CAF( z>4W0mbBBP)4Hf0rAm4LOP$4kIr*t!zJBg%ogI;qIN#~}?lSVo>vVO*WzluMdBy_{~ z>08%D?vEGQPCy2+{7U~8;!Yz*0@3^;EQE+`>QeLTqtG5WB3lMk0;Nl4hb55>sbsd+ zvizzdv=f=;R~4Zx=xTn#3+>n^vcaLqR*j`V!oRF5Ed;R=h~X!^(B`Zn+srC{F22e} z&~D5nKNnvis0Strq{)kHbRfj=)8s`qf{ep#ggt<_;-|@R4C5XzDUc?IG2Frs!%vgL z7;XxF3VXmFu8- zHBhAHkNe&XjDEtez_{;>d<#Z2f84io9z5>bBaeUDw!n~VR(l6WYHpq18x+RFw&|(3 zIVcSQQS2<)njJaMq_^w<-Uwofu{vIyqqT}JM?w@kw$}N0p&^<*?2kjwdn0#ITritu tO;^tctSiWk{yuWcEw|iq%kBSd{{g3ZHth@-PRsxR002ovPDHLkV1l(J62<@k literal 0 HcmV?d00001 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: @@ -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 "\n" if $in_list && $ptype ne "bull"; + $in_code = 0, print "\n" if ($in_code && $ptype ne 'code'); + $in_list = 0, print "\n\n" if ($in_list && $ptype !~ /^(bull|indt|code)$/); + $in_bquo = 0, print "\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 "\n"; select STDOUT; close TEXT; + print "\n\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 = "

$title

\n"; + $h = "

$title

\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 "\n"; select STDOUT; close TEXT; + print "\n\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 "

$title

\n"; + print "

$title

\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>$title\n"; + print "<$hdr id=\"$xref\">$title\n"; } elsif ($ptype eq "code") { - # Code paragraph. - print "

\n";
-      foreach $i (@$pname) {
-	$w = $i;
-	$w =~ s/&/&/g;
-	$w =~ s//>/g;
-        print $w, "\n";
-      }
-      print "
\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 "
    \n" unless $in_list; - $line = '
  • '; + # Code paragraph. + $in_code = 1, print "
    " unless $in_code;
    +	print "\n";
    +	foreach $i (@$pname) {
    +	    $w = $i;
    +	    $w =~ s/&/&/g;
    +	    $w =~ s//>/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 "
      \n"; + } else { + print "\n"; + } + print "
    • \n"; + $line = '

      '; + $endtag = '

      '; + } elsif ($ptype eq 'indt') { + if (!$in_list) { + $in_list = 1; + print "
        \n"; + print "
      • \n"; # This is such a hack + } + $line = '

        '; + $endtag = '

        '; + } elsif ($ptype eq 'bquo') { + $in_bquo = 1, print "
        \n" unless $in_bquo; + $line = '

        '; + $endtag = '

        '; } else { $line = '

        '; + $endtag = '

        '; } @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 "

        Contents\n"; - print "

        "; + print "

        Index

        \n"; + print "
          \n"; &html_index; - print "

          Contents\n"; - print "\n"; + print "

        \n\n\n"; select STDOUT; close TEXT; } sub html_preamble { - print "NASM Manual\n"; - print "

        The Netwide Assembler: NASM

        \n\n"; - &html_jumppoints if $_[0]; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "", $metadata{'title'}, "\n"; + print "\n"; + print "\n"; + print "\n"; + &html_jumppoints; + print "

        ", $metadata{'title'}, "

        \n\n"; } sub html_jumppoints { - print "

        "; - print "Next Chapter |\n" if $html_nextf; - print "Previous Chapter |\n" if $html_lastf; - print "Contents |\n"; - print "Index\n"; + print "

        \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 '–'; + } elsif ($wtype eq "dm") { + return '—'; } elsif ($wmajt eq "c" || $wtype eq "wc") { - return $pfx . "${w}" . $sfx; + return $pfx . "${w}" . $sfx; } elsif ($wtype eq "es") { return "${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) = @_; diff --git a/nasm.spec.in b/nasm.spec.in index 9cdb3001..9ca198ea 100644 --- a/nasm.spec.in +++ b/nasm.spec.in @@ -10,7 +10,7 @@ Source: http://www.nasm.us/pub/nasm/releasebuilds/%{nasm_version}/nasm-%{nasm_ve URL: http://www.nasm.us/ BuildRoot: /tmp/rpm-build-nasm Prefix: %{_prefix} -BuildRequires: perl, asciidoc, xmlto, ghostscript, texinfo, perl-Font-TTF +BuildRequires: perl, asciidoc, xmlto, ghostscript, perl-Font-TTF BuildRequires: adobe-source-sans-pro-fonts, adobe-source-code-pro-fonts BuildRequires: fontconfig, xz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -18,9 +18,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) %package doc Summary: Extensive documentation for NASM Group: Development/Languages -BuildRequires: ghostscript, texinfo -Requires(post): /sbin/install-info -Requires(preun): /sbin/install-info %package rdoff Summary: Tools for the RDOFF binary format, sometimes used with NASM. @@ -32,8 +29,8 @@ NASM is the Netwide Assembler, a free portable assembler for the Intel instruction mnemonics and syntax. %description doc -Extensive documentation for the Netwide Assembler, NASM, in HTML, -info, PostScript and text formats. +Extensive documentation for the Netwide Assembler (NASM) in HTML and +PDF formats. %description rdoff Tools for the operating-system independent RDOFF binary format, which @@ -51,26 +48,17 @@ make %{?_smp_mflags} everything rm -rf "$RPM_BUILD_ROOT" mkdir -p "$RPM_BUILD_ROOT"/%{_bindir} mkdir -p "$RPM_BUILD_ROOT"/%{_mandir}/man1 -mkdir -p "$RPM_BUILD_ROOT"/%{_infodir} mkdir -p "$RPM_BUILD_ROOT"/usr/tempdoc %makeinstall install_everything docdir="$RPM_BUILD_ROOT"/usr/tempdoc cp -a $RPM_BUILD_ROOT/usr/tempdoc/html \ - $RPM_BUILD_ROOT/usr/tempdoc/nasmdoc.{txt,pdf} . -xz -9ef nasmdoc.{pdf,txt} + $RPM_BUILD_ROOT/usr/tempdoc/nasmdoc.pdf . +xz -9ef nasmdoc.pdf # remove unpackaged files from the buildroot rm -rf $RPM_BUILD_ROOT%{_prefix}/tempdoc %clean rm -rf "$RPM_BUILD_ROOT" -%post -/sbin/install-info %{_infodir}/nasm.info.gz %{_infodir}/dir || : - -%preun -if [ $1 = 0 ]; then - /sbin/install-info --delete %{_infodir}/nasm.info.gz %{_infodir}/dir || : -fi - %files %defattr(-,root,root) %doc AUTHORS CHANGES README TODO @@ -78,11 +66,10 @@ fi %{_bindir}/ndisasm %{_mandir}/man1/nasm.1* %{_mandir}/man1/ndisasm.1* -%{_infodir}/nasm.info*.gz %files doc %defattr(-,root,root) -%doc html nasmdoc.txt.xz nasmdoc.pdf.xz +%doc html nasmdoc.pdf.xz %files rdoff %defattr(-,root,root) diff --git a/tools/release b/tools/release index 14e750a6..f7025f13 100755 --- a/tools/release +++ b/tools/release @@ -91,10 +91,9 @@ gzip -9 nasm-"$version"-xdoc.tar mv nasm-"$version"-xdoc.tar.gz nasm-"$version"-xdoc.tar.bz2 nasm-"$version"-xdoc.tar.xz .. # Create doc zipfile (DOS convention: no prefix, convert file endings) -# (Note: generating Win .hlp files requires additional tools) cd nasm-"$version" -zip -9Dlr ../../nasm-"$version"-xdoc.zip doc -x \*.pdf -x \*.info\* -zip -9Dgr ../../nasm-"$version"-xdoc.zip doc -i \*.pdf -i \*.info\* +zip -9Dlr ../../nasm-"$version"-xdoc.zip doc -x \*.pdf +zip -9Dgr ../../nasm-"$version"-xdoc.zip doc -i \*.pdf # Clean up cd ../..