home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-04 | 4.2 KB | 144 lines | [TEXT/MPS ] |
- Perl -Sx "{0}" {"Parameters"}>"{TempFolder}"noweb.run
- "{TempFolder}"noweb.run
- Exit
-
- #!perl
- # Copyright 1991 by Norman Ramsey. All rights reserved.
- # See file COPYRIGHT for more information.
-
- $noquote = "-noquote";
- $noindex = "-noindex";
- $markup = "markup";
-
- @SAVEARGV = @ARGV;
-
- while ($arg = shift @ARGV) {
- if ($arg eq "-latex") {
- $wrapper = "latex" unless ($wrapper eq "none");
- } elsif ($arg eq "-tex") {
- $wrapper = "tex";
- } elsif ($arg eq "-html") {
- $wrapper = "html" unless ($wrapper eq "none");
- $backend = "tohtml -localindex";
- $noquote = "";
- $docanchor = "-docanchor 10";
- } elsif ($arg eq "-latex+html") {
- $wrapper = "latex" unless ($wrapper eq "none");
- $backend = "tohtml -localindex -raw";
- $noquote = "";
- $docanchor = "-docanchor 10";
- } elsif ($arg eq "-n") {
- $wrapper = "none";
- } elsif ($arg eq "-backend") {
- $backend = shift @ARGV;
- } elsif ($arg eq "-markup") {
- $markup = shift @ARGV;
- } elsif ($arg eq "-filter") {
- shift @ARGV;
- } elsif ($arg eq "-x") {
- } elsif ($arg eq "-index") {
- $noindex = "";
- } elsif ($arg eq "-indexfrom") {
- shift @ARGV;
- $noindex = "";
- } elsif ($arg eq "-autodefs") {
- $defs = shift @ARGV;
- $autodefs = "autodefs.$defs";
- die "noweave: don't know how to find definitions for '$defs'"
- unless (-r "||LIB||$autodefs");
- push(@filters, $autodefs);
- } elsif ($arg eq "-showautodefs") {
- opendir(LIB, "||LIB||");
- @defs = grep(s/^autodefs\.//, readdir(LIB));
- closedir(LIB);
- if ($#defs) {
- print "Echo \"This noweave supports -autodefs [ ";
- print join(" ", @defs);
- print "]\"\n";
- } else {
- print "Echo \"This noweave does not support -autodefs [ ";
- }
- } elsif ($arg eq "-autodefs") {
- $newopt = shift @ARGV;
- $noweboptions = $noweboptions ? "$noweboptions,$newopt" : $newopt;
- } elsif ($arg eq "-delay") {
- $delay = $arg;
- $wrapper = "none";
- } elsif ($arg =~ /^-t/) {
- $markopts .= " $arg";
- } elsif ($arg eq "-v") {
- $verbose = 1;
- } elsif ($arg =~ /^-/) {
- die <<USAGE;
- Usage: noweb [options] [files]
- Options recognized are:" 1>&2
- -latex Use LaTeX headers and trailers (default).
- -tex Use TeX headers and trailers.
- -html Use HTML headers and trailers.
- -latex+html Assume LaTeX in documentation, but use HTML in code.
- -n Don't use any header or trailer.
- -markup frontend Parse input with frontend (e.g., numarkup).
- -x Use the default cross-referencer (needs LaTeX or HTML).
- -index Create index using identifiers defined in input files.
- -indexfrom defs Create index of identifers listed in file defs.
- -filter cmd Filter through 'cmd' before weaving; cmd could prettyprint
- or perform other functions.
- -autodefs lang Source is in language 'lang'; find definitions automatically.
- -showautodefs List languages that can be used with -autodefs
- -option opt Add \noweboptions{opt} to header (latex only)
- -delay Delay markup until after first documentation chunk.
- -tk Expand tab stops every k columns
- -t Copy tabs to the output
- -v Print pipeline on standard error
- USAGE
- } else {
- $args .= " $arg";
- }
- }
-
- $wrapper || ($wrapper = "latex");
- @ARGV = @SAVEARGV;
-
- while ($arg = shift @ARGV) {
- if ($arg eq "-filter") {
- push(@filters, shift @ARGV);
- } elsif ($arg eq "-x") {
- push(@filters, "noidx $docanchor $delay");
- } elsif ($arg eq "-index") {
- push(@filters, "finduses $noquote");
- push(@filters, "noidx $docanchor $delay");
- } elsif ($arg eq "-indexfrom") {
- push(@filters, "finduses $noquote" . shift @ARGV);
- push(@filters, "noidx $docanchor $delay");
- }
- }
-
- print "Set Commands \"||LIB||," . $ENV{Commands} ."\"; Export Commands\n";
- print "Begin\n";
-
- if ($wrapper eq "none") {
- } elsif ($wrapper eq "latex") {
- print "echo \"\@header $wrapper $noweboptions\"\n";
- } else {
- print "echo \"\@header $wrapper $args\"\n";
- }
- if ($verbose) {
- print STDERR "$markup $markopts $args |\n";
- for (@filters) {
- print "\t$_ |\n";
- }
- }
-
- unshift(@filters, "$markup $markopts $args");
- print join(" | ", @filters), "\n";
-
- if ($wrapper ne "none") {
- print "echo \"\@trailer $wrapper\"\n";
- }
-
- print "End | $backend $noindex $delay\n";
-
- if ($verbose) {
- print STDERR "$backend $noindex $delay\n";
- }
-