diff options
author | Charles Crayne <chuck@thor.crayne.org> | 2008-01-20 16:27:03 -0800 |
---|---|---|
committer | Charles Crayne <chuck@thor.crayne.org> | 2008-01-20 16:27:03 -0800 |
commit | c17a0eb31b109af863bc7fb5b9e80172d11d4c75 (patch) | |
tree | 15637d263dad4643a11cdcbb92e68c78258ce40a /doc/rdsrc.pl | |
parent | e6c01e659e21f10ad38ad18c304f3b3bbab2a9ff (diff) | |
download | nasm-c17a0eb31b109af863bc7fb5b9e80172d11d4c75.tar.gz |
Add autogenerated instruction list to NASM documentation
1. Allow included files in rdsrc.pl
2. New program inslist.pl to generate instruction list from insns.dat
3. Mark certain comments in insns.dat as documentation subheaders
4. Add Instruction List appendix to nasmdoc.src
5. Update build process to invoke inslist.pl
Diffstat (limited to 'doc/rdsrc.pl')
-rw-r--r-- | doc/rdsrc.pl | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl index 49651728..a6a70083 100644 --- a/doc/rdsrc.pl +++ b/doc/rdsrc.pl @@ -79,6 +79,12 @@ # defines document metadata, such as authorship, title and copyright; # different output formats use this differently. # +# Include subfile +# \&{filename} +# Includes filename. Recursion is allowed. +# + +use IO::File; $diag = 1, shift @ARGV if $ARGV[0] eq "-d"; @@ -96,15 +102,7 @@ $pname = "para000000"; @pnames = @pflags = (); $para = undef; while (<>) { - chomp; - if (!/\S/ || /^\\(IA|IR|M)/) { # special case: \IA \IR \M imply new-paragraph - &got_para($para); - $para = undef; - } - if (/\S/) { - s/\\#.*$//; # strip comments - $para .= " " . $_; - } + &check_include($_); } &got_para($para); print "done.\n"; @@ -143,6 +141,33 @@ print "Producing Documentation Intermediate Paragraphs: "; &write_dip; print "done.\n"; +sub check_include { + local $_ = shift; + if (/\\& (\S+)/) { + &include($1); + } else { + &get_para($_); + } +} +sub get_para($_) { + chomp; + if (!/\S/ || /^\\(IA|IR|M)/) { # special case: \IA \IR \M imply new-paragraph + &got_para($para); + $para = undef; + } + if (/\S/) { + s/\\#.*$//; # strip comments + $para .= " " . $_; + } +} +sub include { + my $name = shift; + my $F = IO::File->new($name) + or die "Cannot open $name: $!"; + while (<$F>) { + &check_include($_); + } +} sub got_para { local ($_) = @_; my $pflags = "", $i, $w, $l, $t; |