├── .gitignore ├── .gitversionmark ├── CHANGES ├── COPYRIGHT ├── CTAN ├── DEBIAN ├── DEBIAN.asc ├── LICENSE ├── Makefile ├── README ├── binaries └── README ├── contrib ├── Makefile ├── README ├── avs │ ├── email │ ├── filelist.txt │ ├── ftpsites.txt │ ├── generate.ksh │ ├── howto386.txt │ ├── icon.1 │ ├── jrtex12a.avs │ ├── make_ico.awk │ ├── make_lib.awk │ ├── make_src.awk │ ├── make_xdo.awk │ ├── mks42bug.0d │ ├── mksfixes.ksh │ ├── myenv.ksh │ ├── norman1.txt │ ├── nw_c.bat │ ├── nwicon.bat │ ├── nwinst.ksh │ ├── readme │ └── report1.bug ├── conrado │ ├── Makefile │ ├── README │ ├── algoritmos.sty │ ├── d2tex │ ├── email │ ├── hospital.nw │ └── keywords.tex ├── davelove │ ├── Makefile │ ├── README │ ├── email │ └── subref.doc ├── fischer │ ├── README │ ├── noscript-0.1.tar.gz │ └── noscript-0.1 │ │ ├── noscript │ │ ├── test-none.nw │ │ ├── test-py.nw │ │ └── test-sh.nw ├── gregory │ ├── README │ ├── dots.nw │ └── email ├── jobling │ ├── Makefile │ ├── README │ ├── correct-refs.bbl │ ├── correct-refs.nw │ └── email ├── jonkrom │ ├── Makefile │ ├── README │ ├── email │ └── noxref.nw ├── kaelin │ ├── README │ ├── email │ └── pp.nw ├── kostas │ ├── C++_translation_table │ ├── C_translation_table │ ├── Makefile │ ├── README │ ├── WHATS_NEW │ ├── defns.nw │ ├── email │ ├── icon_translation_table │ ├── math_translation_table │ ├── mathdefs.nw │ ├── oot_translation_table │ ├── ootdefs.nw │ └── pp.nw ├── leew │ ├── .gitignore │ ├── 2col-defn-hack.tex │ ├── Makefile │ ├── README │ ├── custom-code │ │ ├── README.custom-code │ │ ├── custom-code │ │ ├── example.nw │ │ └── n │ ├── email │ ├── nobrace.nw │ ├── nocond.nw │ ├── pretty-comment.nw │ ├── pretty-comment.zip │ └── strhack.nw ├── leyn │ ├── README │ ├── email │ ├── notangleall │ └── ttroots ├── norman │ ├── Makefile │ ├── README │ ├── cleanchunks.nw │ ├── email │ ├── generate-to │ ├── htmlgif │ │ ├── htmlgif.icn │ │ ├── newer.c │ │ └── pstopbm │ ├── moddate.nw │ ├── numarkup │ │ ├── Makefile │ │ └── numarkup.nw │ ├── pp │ │ ├── mkfile │ │ └── pp.nw │ └── scopehack.icn ├── partingr │ ├── README │ ├── TeXthings │ ├── addscore.nw │ ├── email │ ├── mm2mx63 │ ├── mm2mx64 │ ├── mm2mx65 │ ├── mm2tex │ ├── mx2tex31 │ ├── nwindex.tex │ ├── nwnweave │ ├── nwtangle │ ├── nwweave │ └── xpand ├── rsc │ ├── README │ ├── email │ └── rc │ │ ├── cpif.nw │ │ ├── emptydefn.nw │ │ ├── mkfile │ │ ├── noidx.nw │ │ ├── noindex.nw │ │ ├── noroots.nw │ │ ├── notangle.nw │ │ ├── nountangle.nw │ │ ├── noweave.nw │ │ ├── noweave.simple │ │ ├── noweb.nw │ │ ├── toascii.nw │ │ ├── tohtml.nw │ │ ├── totex.nw │ │ └── unmarkup.nw └── ydirson │ ├── Makefile │ ├── README │ ├── email │ ├── enscript-html │ ├── guesslang │ └── inheritlang ├── echo ├── examples ├── Makefile ├── Makefile.awk ├── README ├── README.h ├── breakmodel.nw ├── compress.nw ├── dag.nw ├── graphs.nw ├── mipscoder.nw ├── multicol.sty ├── primes.nw ├── scanner.nw ├── sharpline ├── test.nw ├── tree.nw ├── wc.nw ├── wc.nw2html └── whitespace ├── nwsrcfilter.icn ├── src ├── .gitignore ├── COPYRIGHT ├── FAQ ├── FAQ.html ├── FAQ.old ├── HPUX ├── INSTALL ├── INSTALL.DOS ├── Makefile ├── README ├── VERSIONS ├── awk │ ├── .gitignore │ ├── Makefile │ ├── noidx │ ├── noidx.nw │ ├── noindex │ ├── noindex.nw │ ├── tohtml │ ├── tohtml.nw │ ├── totex │ ├── totex.nw │ └── totex.nw.bad ├── awkname ├── c │ ├── .gitignore │ ├── Makefile │ ├── columns.c │ ├── columns.h │ ├── columns.nw │ ├── doc.nw │ ├── errors.c │ ├── errors.h │ ├── errors.nw │ ├── fakepretty.nw │ ├── finduses.c │ ├── finduses.nw │ ├── getline.c │ ├── getline.h │ ├── getline.nw │ ├── main.c │ ├── main.nw │ ├── markmain.c │ ├── markmain.nw │ ├── markup.c │ ├── markup.h │ ├── markup.nw │ ├── match.c │ ├── match.h │ ├── match.nw │ ├── mnt.c │ ├── mnt.nw │ ├── modtrees.c │ ├── modtrees.h │ ├── modtrees.nw │ ├── modules.c │ ├── modules.h │ ├── modules.nw │ ├── notangle.c │ ├── notangle.h │ ├── notangle.nw │ ├── nwmktemp.c │ ├── nwmktemp.nw │ ├── pretty.nw │ ├── readme.nw │ ├── recognize.c │ ├── recognize.h │ ├── recognize.nw │ ├── strsave.c │ ├── strsave.h │ └── strsave.nw ├── csmake ├── elisp │ └── noweb-mode.el ├── gitversion ├── icon │ ├── .gitignore │ ├── Makefile │ ├── asdldefs.icn │ ├── asdldefs.nw │ ├── cdefs.icn │ ├── cdefs.nw │ ├── defns.nw │ ├── disambiguate.icn │ ├── disambiguate.nw │ ├── docs2comments.icn │ ├── docs2comments.nw │ ├── elide.icn │ ├── elide.nw │ ├── htmltoc.icn │ ├── htmltoc.nw │ ├── icondefs.icn │ ├── icondefs.nw │ ├── l2h.icn │ ├── l2h.nw │ ├── lrtldefs.icn │ ├── lrtldefs.nw │ ├── mmixdefs.icn │ ├── mmixdefs.nw │ ├── noidx.icn │ ├── noidx.nw │ ├── noindex.icn │ ├── noindex.nw │ ├── noxref.nw │ ├── nwl2h.nw │ ├── pascaldefs.icn │ ├── pascaldefs.nw │ ├── pdcached.icn │ ├── pdcached.nw │ ├── pipedocs.icn │ ├── pipedocs.nw │ ├── promeladefs.icn │ ├── promeladefs.nw │ ├── sl2h.icn │ ├── smldefs.icn │ ├── smldefs.nw │ ├── texdefs.icn │ ├── texdefs.nw │ ├── tohtml.icn │ ├── tohtml.nw │ ├── totex.icn │ ├── totex.nw │ ├── xchunks.icn │ ├── xchunks.nw │ ├── yaccdefs.icn │ └── yaccdefs.nw ├── lib │ ├── Makefile │ ├── btdefn │ ├── emptydefn │ ├── h2a │ ├── noxref.nw │ ├── noxref.sh │ ├── nwmtime │ ├── pipedocs │ ├── toascii │ ├── toascii.nw │ └── unmarkup ├── limake ├── nwmake ├── rhmake ├── shell │ ├── .gitignore │ ├── Makefile │ ├── cpif │ ├── detangle │ ├── htmltoc │ ├── luddite │ ├── nocount │ ├── nodefs │ ├── nonu │ ├── noroff │ ├── noroots │ ├── notangle │ ├── notangle.nw │ ├── nountangle │ ├── noweave │ ├── noweave.hpux │ ├── noweave.nr │ ├── noweave.nw │ ├── noweave.sgi │ ├── noweave.simple │ ├── noweb │ ├── noweb.nw │ ├── nuweb2noweb │ ├── roff.nw │ ├── tmac.w │ ├── toroff │ ├── toroff.nw │ └── unmarkup ├── tex │ ├── .gitignore │ ├── Makefile │ ├── multlang.nw │ ├── n.sty │ ├── noweb.sty │ ├── nwkernel.tex │ ├── nwmac.tex │ ├── support.nw │ └── support.nw.orig └── xdoc │ ├── .gitignore │ ├── Makefile │ ├── chicago.bst │ ├── chicago.sty │ ├── cpif.1 │ ├── cpif.txt │ ├── docdate.nw │ ├── doversion │ ├── guide.tex │ ├── htmltoc.1 │ ├── htmltoc.nw │ ├── htmltoc.txt │ ├── ieee.tex │ ├── manpage.nw │ ├── nodefs.1 │ ├── nodefs.nw │ ├── nodefs.txt │ ├── noindex.1 │ ├── noindex.nw │ ├── noindex.txt │ ├── noroff.1 │ ├── noroff.nw │ ├── noroff.txt │ ├── noroots.1 │ ├── noroots.nw │ ├── noroots.txt │ ├── notangle.1 │ ├── notangle.txt │ ├── noweb.1 │ ├── noweb.txt │ ├── nowebfilters.7 │ ├── nowebfilters.nw │ ├── nowebfilters.txt │ ├── nowebstyle.7 │ ├── nowebstyle.txt │ ├── nuweb2noweb.1 │ ├── nuweb2noweb.txt │ ├── onepage.tex │ ├── representation.tex │ ├── sl2h.1 │ ├── sl2h.nw │ ├── sl2h.txt │ └── techrep.tex └── test └── regression /.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.bbl 3 | *.dvi 4 | *~ 5 | .#* 6 | src/*/#.*# 7 | binaries/dos-* 8 | binaries/linux-* 9 | binaries/win32-* 10 | /DATE 11 | src/c/doc.ps 12 | src/c/doc.aux 13 | src/c/*.aux 14 | contrib/*/*/*.aux 15 | src/c/*.o 16 | /src/c/markup.ps 17 | /nwsrcfilter 18 | /src/icon/autodefs.* 19 | /src/icon/disambiguate 20 | /src/icon/docs2comments 21 | /src/icon/elide 22 | /src/icon/htmltoc 23 | /src/icon/l2h 24 | /src/icon/noidx 25 | /src/icon/noindex 26 | /src/icon/pdcached 27 | /src/icon/pipedocs 28 | /src/icon/sl2h 29 | /src/icon/tohtml 30 | /src/icon/totex 31 | /src/icon/xchunks 32 | /src/c/nwmktemp 33 | /noweb 34 | /src/shell/gitversion.nw 35 | /src/c/gitversion.c 36 | /src/tex/gitversion.nw 37 | -------------------------------------------------------------------------------- /.gitversionmark: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/.gitversionmark -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Noweb is copyright 1989-2018 by Norman Ramsey. All rights reserved. 2 | 3 | Noweb is protected by copyright. It is not public-domain 4 | software or shareware, and it is not protected by a ``copyleft'' 5 | agreement like the one used by the Free Software Foundation. 6 | It may be used and/or redistributed using *either* the terms 7 | stated here *or* by the 2-clause BSD license found in file LICENSE. 8 | 9 | Noweb is available free for any use in any field of endeavor. You may 10 | redistribute noweb in whole or in part provided you acknowledge its 11 | source and include this COPYRIGHT file. You may modify noweb and 12 | create derived works, provided you retain this copyright notice, but 13 | the result may not be called noweb without my written consent. 14 | 15 | You may sell noweb if you wish. For example, you may sell a CD-ROM 16 | including noweb. 17 | 18 | You may sell a derived work, provided that all source code for your 19 | derived work is available, at no additional charge, to anyone who buys 20 | your derived work in any form. You must give permisson for said 21 | source code to be used and modified under the terms of this license. 22 | You must state clearly that your work uses or is based on noweb and 23 | that noweb is available free of change. You must also request that 24 | bug reports on your work be reported to you. 25 | -------------------------------------------------------------------------------- /CTAN: -------------------------------------------------------------------------------- 1 | Administrative notes for CTAN upload: 2 | 3 | - The distribution contains 7 .bbl files, which are there to enable 4 | users to build documentation or examples. 5 | 6 | - The distribution contains many files with duplicate basenames, 7 | e.g., noidx.nw, noindex.nw, noroots.nw, and so on. These 8 | different files have identical basenames because they provide 9 | identical functionality on different platforms, or because they 10 | provide documentation of that functionality. For example, 11 | 12 | src/awk/noindex.nw Index building on Unix using Awk 13 | src/icon/noindex.nw Index building on Unix using Icon 14 | contrib/rsc/rc/noindex.nw Index building using the Plan 9 shell RC 15 | xdoc/noindex.nw Man page for index building 16 | 17 | None of these files is ever exposed to kpathsea or to TeX, so name 18 | clashes should not be a problem. 19 | 20 | - The distribution includes TeX source for two papers about Noweb: a 21 | 1991 technical report and a 1993 submission to IEEE Software. 22 | Both .tex files refer to information that is no longer current, 23 | including the obsolete FTP server ftp.tex.ac.uk. Because the 24 | intent of the distribution is to provide interested readers with 25 | access to these documents as they were published, these references 26 | will not be changed. 27 | 28 | 29 | -------------------------------------------------------------------------------- /DEBIAN: -------------------------------------------------------------------------------- 1 | Under noweb's original licence, anyone may modify noweb and create 2 | derived works, provided he or she retains this copyright notice, but 3 | the result may not be called noweb without my written consent. I 4 | hereby provide my written consent to the Debian project to call their 5 | derived work 'noweb'. I do so under the assumption that Debian's 6 | modifications are normally intended to fix bugs, close security holes, 7 | and bring the software into compliance with Debian policy. I have a 8 | great deal of trust in and respect for the Debian project, so I am in 9 | fact willing for the Debian project to make any modification they deem 10 | necessary and still call the result 'noweb'. In particular, there is 11 | no need for the Debian project to consult me about any contemplated 12 | modification, either now or in the future. I do reserve the right to 13 | revoke my consent in the unlikely event that, in my opinion, future 14 | Debian modifications will have made it misleading to call the package 15 | 'noweb'. 16 | 17 | Under the BSD license, anyone may create a derived work and to call it 18 | noweb without my written consent. 19 | 20 | -------------------------------------------------------------------------------- /DEBIAN.asc: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP SIGNATURE----- 2 | 3 | iQIzBAABCAAdFiEEmrzhALHbgoRRr4rgZfoIXblrJmkFAlsr5Q8ACgkQZfoIXblr 4 | JmmjChAAi23ohCcof9Z8rf6bshdr8gxYPvFuep5YTIJRmi4aw6nMMMCmrEZC9cvk 5 | C7TjDeg8TY9z/t0VelcMSepxwjTnJ/r4rm33xIkyojPp277YfU4bmdbR+LavvE5o 6 | g9z745KAUkemAVBSKH4aieJt+XJ6EMKh/AjPjYzZsGZAfcDrmjCQo4gMM781RSq5 7 | wBTTxmqHstZ9gRiibu9Pxks1zE+zmf/lpKhP8bYNRCRnYzEuVbDzNesVimFnSZkC 8 | erxGnIGjmVaUBc0B1LYAfOj/vTYx0h/mxXpeq/1oUpEsO0mslrGxKnB/WPjDVRg7 9 | /R68gFg6+ptk6IIlwzk9eCIXMcXia1ax10S2RysARmHhYwcGaEkfKFfVcwlK0xlU 10 | 0dhcJ8pSZ2aw+/NP5FLqgBfxt2Fg/YVvwOII37azmkxb3BmUO6UpuxObIsMDmOun 11 | 8fPum5+bzyWGUIevWHSt/cw37BLEWKoS+SKV8MLDZjP2qp5vYlIQNGdW0/pypSHC 12 | qUEghZpTOxTFU7A3qtVO3ksOqTrxIDqc72Qe6f3i8KBT8Nw1xplKygDesYmTJ85t 13 | aftWYTizQ4QQHk2GzW5UPzxoVzUQYYIANTOu5sESdOjf4a99FvHc6lu9pIWMSqvk 14 | 0nqbxMjODpNaYbHRF3LxZx2Qv1nHgj5n+M4le5zzM2PBpgAo1GE= 15 | =y3B3 16 | -----END PGP SIGNATURE----- 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright © 2018, Norman Ramsey 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 13 | * Redistributions in binary form must reproduce the above copyright notice, 14 | this list of conditions and the following disclaimer in the documentation 15 | and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 20 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 21 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /binaries/README: -------------------------------------------------------------------------------- 1 | If you want Win32 binaries, you need to get the DOS binaries as well, 2 | and install the Win32 binaries on top of them. There's more info in 3 | the README file for the Win32 binaries. 4 | -------------------------------------------------------------------------------- /contrib/Makefile: -------------------------------------------------------------------------------- 1 | SHELL=/bin/sh 2 | LIB=/dev/null # to be overridden 3 | DIRS=davelove jonkrom leew norman 4 | 5 | # don't do kostas; it requires gnu make (ugh) 6 | 7 | all: 8 | for i in $(DIRS); do (cd $$i && $(MAKE) $@); done 9 | install: 10 | for i in $(DIRS); do (cd $$i && $(MAKE) LIB=$(LIB) $@); done 11 | source: 12 | for i in $(DIRS); do (cd $$i && $(MAKE) $@); done 13 | clean: 14 | for i in $(DIRS); do (cd $$i && $(MAKE) $@); done 15 | clobber: clean 16 | -------------------------------------------------------------------------------- /contrib/README: -------------------------------------------------------------------------------- 1 | These directories contain software that was contributed by users of 2 | noweb. Each directory contains a file called `email' that has the 3 | email address of the contributor. I don't pretend to have copyright 4 | rights, and I don't provide any warranty or any support. If you find 5 | something useful here, we're both pleased. 6 | 7 | Some contributed software contains binaries or is too big to be 8 | included in the standard noweb distribution. In such cases, the 9 | directories here may contain only pointers to anonymous ftp sites. 10 | -------------------------------------------------------------------------------- /contrib/avs/email: -------------------------------------------------------------------------------- 1 | avs@daimi.aau.dk (Alexandre Valente Sousa) 2 | If this doesn't work (in a couple of years it won't) try avs@monet.inescn.pt 3 | -------------------------------------------------------------------------------- /contrib/avs/make_ico.awk: -------------------------------------------------------------------------------- 1 | # edits noweb/src/icon/makefile for Ms-Dos + PC386 + Icon 386 9.0 + DJGPP + MKS 4.2 2 | # tested with noweb 2.7a 3 | 4 | BEGIN { print "# generated MsDos makefile, original in makefile.old" } 5 | 6 | /SHELL=/ { $0 = "# " $0 } # disable SHELL def 7 | 8 | /BINEXECS=/ { # add .exe extension 9 | s = ""; 10 | for (k = 1; k <= NF; ++k) 11 | s = s sprintf("%s.exe ", $k); 12 | $0 = s 13 | } 14 | 15 | function splitLineTooLong() { # appends to strings s1 & s2 (does not initialize them) 16 | for (k = 1; k <= NF; ++k) 17 | if (match($k, "\\.")) 18 | s1 = s1 $k " "; 19 | else 20 | s2 = s2 $k ".exe "; 21 | } 22 | /LIBEXECS=/ { # split in 2 parts (to avoid 128 chars command.com overflow) and add .exe if no extension is provided 23 | s1 = ""; s2 = ""; 24 | if ($NF == "\\") { # tackles problem of a '\' meaning continue in next line 25 | $NF = ""; 26 | NF = NF - 1; 27 | splitLineTooLong(); 28 | getline; # read next line due to '\' continuation char 29 | } 30 | splitLineTooLong(); 31 | printf("LIBEXECS2=%s\n", s1); 32 | $0 = s2; 33 | } 34 | 35 | /^EXECS=/ { $0 = $0 " $(LIBEXECS2)" } # because now LIBEXECS is split into LIBEXECS and LIBEXECS2 36 | 37 | /cp \$\(LIBEXECS\)/ { printf("\tcp $(LIBEXECS2) $(LIB)\n"); } # the new LIBEXECS2 also need to be copied 38 | 39 | /\/bin\/rm/ { $1 = "\trm" } # rm might not be at "/bin/rm", remember to add the tab \t 40 | 41 | /\$\(ICON.\) -o/ { 42 | if (!match($3, "\\.")) { # if no extension add .exe 43 | sub(/[a-z0-9]+/, "&.exe", $3); 44 | $1 = "\t" $1 " -I" # add -I option to icon translator (see Icon 386 9.0 Ms-Dos docs) 45 | } 46 | } 47 | 48 | /^[a-z0-9]+: [a-z0-9]+\.icn/ && NF == 2 { sub(/[a-z0-9]+/, "&.exe", $1) } # add .exe 49 | 50 | { print $0 } # prints the line (which might have been changed) 51 | -------------------------------------------------------------------------------- /contrib/avs/make_lib.awk: -------------------------------------------------------------------------------- 1 | # edits noweb/src/lib/makefile for Ms-Dos + PC386 + Icon 386 9.0 + DJGPP + MKS 4.2 2 | # tested with noweb 2.7a 3 | 4 | BEGIN { print "# generated MsDos makefile, original in makefile.old"; } 5 | 6 | /SHELL\=/ { $0 = "# " $0 } # disable SHELL def 7 | 8 | /cp unmarkup emptydefn toascii \$/ { # add an extension .ksh) when copying 9 | $0 = "\tcp unmarkup $(LIB)/unmarkup.ksh\n\tcp emptydefn $(LIB)/emptydefn.ksh\n\tcp toascii $(LIB)/toascii.ksh" 10 | } 11 | 12 | { print $0 } # prints the line (which might have been changed) 13 | -------------------------------------------------------------------------------- /contrib/avs/make_xdo.awk: -------------------------------------------------------------------------------- 1 | # edits noweb/src/xdoc/makefile for Ms-Dos + PC386 + Icon 386 9.0 + DJGPP + MKS 4.2 2 | # tested with noweb 2.7a 3 | 4 | BEGIN { print "# generated MsDos makefile, original in makefile.old"; } 5 | 6 | /SHELL\=/ { $0 = "# " $0 } # disable SHELL def 7 | 8 | /WWW=/ { $0 = "WWW=../.." } # Put World Wide Web files in noweb because the dir $(HOME)/www/noweb might not exist 9 | 10 | /\/bin\/rm/ { sub(/\/bin\/rm/, "rm") } # rm might not be at "/bin/rm" 11 | 12 | /\.ps\.gz/ { sub(/\.ps\.gz/, ".pgz"); } # MsDos limitation, use extension .pgz instead of .ps.gz 13 | 14 | { print $0 } # prints the line (which might have been changed) 15 | -------------------------------------------------------------------------------- /contrib/avs/mksfixes.ksh: -------------------------------------------------------------------------------- 1 | if [ -z "$1" -o -z "$2" ] 2 | then 3 | echo Usage $0 BIN TMP >&2 4 | echo Fixes "'BIN/cpif.ksh'" for use with MKS Toolkit "(see 'man mks42bug', cmp entry)" >&2 5 | echo "Fixes 'BIN/noweb.ksh' for use with MKS toolkit (the PATH problem, see howto386.txt)" >&2 6 | echo TMP is for later use by cpif.ksh i.e. at run-time >&2 7 | echo "Changes only line 8 (if it has 'PATH='), line 20 (if it has 'new=') and line 28 (if it has '-eq0')" >&2 8 | exit 1 9 | fi 10 | 11 | cat $1/cpif.ksh | sed -e '8s/\(PATH=.*\)/#\1/' -e '20s@\(new=.*\)@new='$2'/$$@' -e '28s/-eq0.*/ -eq0|-ne1|*2|*3) cp $new $i/' > $2/cpif.tmp 12 | mv $2/cpif.tmp $1/cpif.ksh 13 | 14 | cat $1/noweb.ksh | sed '21,26s/PATH="$PATH:$LIB"//' > $2/noweb.tmp 15 | mv $2/noweb.tmp $1/noweb.ksh -------------------------------------------------------------------------------- /contrib/avs/myenv.ksh: -------------------------------------------------------------------------------- 1 | # You should only edit the line ' myargs=...', see below 2 | 3 | echo Builds and installs Noweb 2.7 from source code 4 | echo "Full documentation in 'howto386.txt'" 5 | echo Assumptions: 6 | echo "1- There is free environment space (between 30 and 40 bytes)" 7 | echo "2- DJGPP is installed (gcc, go32, coff2exe, make)" 8 | echo "3- MKS Toolkit 4.2 (or above?) for Dos is installed" 9 | echo "4- The MKS Toolkit Make is the 1st make in your PATH env var" 10 | echo "5- Icon 9.0 translator binaries are installed" 11 | echo "6- You have enough free Ram (around 600000 bytes)" 12 | echo "7- Your paths are not too long to break some script" 13 | echo " (i.e. 128 bytes Dos command line limit)" 14 | echo "8- To fully use Noweb, LaTeX2e already is or WILL be installed" 15 | echo "9- You are running a not too old Dos version (e.g. 'call batchfile')" 16 | 17 | # Edit the 'myArgs=...' line to adapt for your environment: 18 | # Use always FULLPATHS, i.e. with DRIVE LETTER 19 | # Use only slashes '/' in pathnames, backslashes won't work 20 | # BIN is where the noweb binaries will be installed 21 | # LIB is where the noweb support files will be installed 22 | # MAN is where to put the man pages (MANPATH env var or Mks ROOTDIR/etc) 23 | # DJGPPmake is the fullpath to Gnu make (does not have to be in your PATH) 24 | # TMP is a temporary directory to be used by Noweb at run-time 25 | # ICON is the fullpath to icont (the Icon translator) 26 | # (in both DJGPPmake and ICON the '.exe' is not necessary, 27 | # remove it if you have problems with names too long) 28 | 29 | theArgs="BIN LIB MAN TEXINPUTS DJGPPmake TMP ICON" 30 | myArgs="i:/b g:/usr/local/lib/noweb g:/man h:/emtex/texinputs/local j:/djgpp/bin/make.exe d:/tmp e:/b/icont.exe" 31 | 32 | echo "generate $theArgs" 33 | echo "generate $myArgs" 34 | read f?"Check if the line above is OK for your machine, continue (y/n)? " 35 | if [ "$f" = "y" -o "$f" = "Y" -o "$f" = "yes" -o "$f" = "YES" ] 36 | then 37 | ./generate.ksh $myArgs 38 | fi 39 | -------------------------------------------------------------------------------- /contrib/avs/nw_c.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if %1.==. goto USAGE 3 | if %DJGPPMAKE%.==. goto NOENVVAR 4 | goto DOIT 5 | 6 | :NOENVVAR 7 | echo Aborting, environment var DJGPPMAKE not set 8 | goto THEEND 9 | :USAGE 10 | echo %0 DJGPPmakePath 11 | echo ** Use backslash path in arg & slash path in DJGPPMAKE env var, e.g. 12 | echo set DJGPPMAKE=j:/djgpp/bin/make 13 | echo %0 j:\djgpp\bin\make 14 | goto THEEND 15 | 16 | :FAILURE0 17 | echo Failed to patch src/c/finduses.c (probably the source lines to patch are 18 | echo not any more at lines 44 and 65) 19 | goto THEEND 20 | :FAILURE2 21 | echo Failed to patch src/c/finduses.c, reason unknown 22 | goto THEEND 23 | 24 | :DOIT 25 | rem Requires DJGPP port of GNU gcc (gcc, make) 26 | rem Beware of the Ms-Dos command line 128 chars limit! 27 | rem MKS make won't do, use DJGPP make! 28 | 29 | rem Use UNIX style pathnames in DJGPPMAKE path, otherwise DJGPP make chokes! 30 | rem This is used for make to launch submakes assuming that you might have 2 31 | rem different makes in your path, the MKS make (which we don't want to use) 32 | rem and the DJGPP make (which we want to use) 33 | 34 | rem Avoid using broken tmpfile() function from DJGPP 'libc.a' 35 | if not exist c\finduses.old cp c/finduses.c c/finduses.old 36 | if errorlevel 1 goto THEEND 37 | echo Patching lines 44 and 65 of src/c/finduses.c (DJGPP tmpfile() broken!) 38 | sed '44s/FILE \*tmp = tmpfile()/char *tmpName;FILE*tmp=fopen(tmpName=tempnam(".",NULL),"w+")/' c/finduses.old>c\finduses.tmp 39 | diff c/finduses.old c/finduses.tmp 40 | if errorlevel 2 goto FAILURE2 41 | if errorlevel 1 goto STEP2 42 | if errorlevel 0 goto FAILURE0 43 | :STEP2 44 | sed '65s/add_use_markers(tmp, stdout);/add_use_markers(tmp, stdout); remove(tmpName);/' c/finduses.tmp > c\finduses.new 45 | diff c/finduses.tmp c/finduses.new 46 | if errorlevel 2 goto FAILURE2 47 | if errorlevel 1 goto STEP3 48 | if errorlevel 0 goto FAILURE0 49 | :STEP3 50 | rm c/finduses.tmp 51 | if errorlevel 1 goto THEEND 52 | cmp -s c/finduses.c c/finduses.new 53 | if errorlevel 1 goto DIFFERENT 54 | rm c/finduses.new 55 | goto THEMAKE 56 | :DIFFERENT 57 | mv c/finduses.new c/finduses.c 58 | 59 | :THEMAKE 60 | rem Use Ms-Dos style pathnames here, otherwise command.com chokes! 61 | @echo on 62 | %1 CC=gcc 63 | :THEEND 64 | -------------------------------------------------------------------------------- /contrib/avs/nwicon.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | if %1.==. goto USAGE 3 | if %2.==. goto USAGE 4 | if %3.==. goto USAGE 5 | if %4.==. goto USAGE 6 | if not %5.==. goto USAGE 7 | 8 | if exist ..\..\noweb\src\%0 goto DOIT 9 | if exist ..\..\noweb\src\%0.bat goto DOIT 10 | echo '..\..\noweb\src\%0' not found! 11 | cd 12 | echo Bad startup dir? Aborting. 13 | echo Change to ./noweb/src and run the file installed by msdosfix.bat in there 14 | echo (you cannot use the original in noweb\contrib\avs\nwicon.bat) 15 | goto THEEND 16 | :DOIT 17 | 18 | rem This represents 'make iconlib', but only like this I could put it to work 19 | cd icon 20 | rem j:\djgpp\bin\make ICONC=e:\\\\b\\\\icont ICONT=e:\\\\b\\\\icont 21 | %3 ICONC=%4 ICONT=%4 22 | if errorlevel 1 goto THEEND 23 | cp -p totex.exe ../lib 24 | if errorlevel 1 goto THEEND 25 | cp -p tohtml.exe ../lib 26 | if errorlevel 1 goto THEEND 27 | cp -p noidx.exe ../lib 28 | if errorlevel 1 goto THEEND 29 | cp -p noindex.exe ../shell 30 | if errorlevel 1 goto THEEND 31 | rem j:\djgpp\bin\make ICONC=e:\\\\b\\\\icont ICONT=e:\\\\b\\\\icont LIB=g:/usr/local/lib/noweb BIN=i:/b install 32 | %3 ICONC=%4 ICONT=%4 LIB=%2 BIN=%1 install 33 | if errorlevel 1 goto THEEND 34 | cd .. 35 | goto THEEND 36 | 37 | :USAGE 38 | if not %1.==. echo Wrong usage: %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 39 | echo Usage: %0 BIN LIB DJGPPmakeBackslashPath 4BackslashedIconTranslatorPath 40 | echo e.g. %0 i:/b g:/usr/local/lib/noweb j:\djgpp\bin\make.exe e:\\\\b\\\\icont.exe 41 | echo If you are running this as part of another script abort with CTRL-C 42 | pause 43 | :THEEND 44 | -------------------------------------------------------------------------------- /contrib/avs/nwinst.ksh: -------------------------------------------------------------------------------- 1 | export SHELL=${SHELL:=$ROOTDIR/bin/sh.exe} 2 | if [ -z "$1" ] 3 | then 4 | echo "Usage: $0 BIN LIB MAN TEXINPUTS" 5 | echo "-- Installs noweb using icon" 6 | exit 1 7 | fi 8 | 9 | make CC="gcc" BIN=$1 LIB=$2 MAN=$3 TEXINPUTS=$4 LIBSRC=icon install 10 | -------------------------------------------------------------------------------- /contrib/avs/readme: -------------------------------------------------------------------------------- 1 | version 0.3 (30-May-95) 2 | 3 | How to install noweb 2.7a in a PC386 or above running Dos if you have Mortice 4 | Kern Systems' MKS Toolkit 4.2 for Dos. The rest of the software can be obtained 5 | by ftp (GNU DJGPP, Icon binaries, LaTeX2e, GhostScript). Complete details on 6 | how to get and install everything are provided 7 | 8 | a) Look at filelist.txt, and if you need something look at ftpsites.txt 9 | b) To install noweb if you are lucky you just have to edit 'myenv.ksh' and 10 | to run it, e.g. from the Ms-Dos command.com prompt do: 11 | cd noweb\contrib\avs 12 | edit myenv.ksh 13 | sh -c ./myenv.ksh 14 | automate 15 | c) Test the installation by doing (from the Korn shell prompt): 16 | cd noweb/src/tex 17 | noweb support.nw 18 | latex support 19 | latex support 20 | latex support 21 | v support 22 | (assuming your dvi viewer is a batch file called v.bat) 23 | dvips -o support.ps support 24 | d) See if you have the same problem as I do. If section 2.2 is missing 25 | from page 7, chunk 9b from page 9 and chunk 28b from page 28 then 26 | you also have that problem that some code/doc chunks come out as white 27 | space. The current fix is to add a newline at the start/end of the chunk 28 | to make a paragraph. See report1.bug 29 | e) Further technical details on howto386.txt 30 | 31 | If using this recipe you still run into trouble contact me. As a last resort 32 | I'm willing to supply you by anonymous ftp with everything you need to run 33 | noweb 2.7a (except the MKS toolkit which is commercial software, i.e. I can 34 | supply binaries for LaTeX2e, Icon 9.0 and Noweb 2.7 that fit in 4 * 1.44 MB 35 | floppies) 36 | 37 | My recipe has only been tested in my machine (which is heavily loaded, dozens 38 | of TSR's and has recent versions of most software). I will appreciate receiving 39 | comments that allow it to run smoothly in other environments 40 | -------------------------------------------------------------------------------- /contrib/conrado/Makefile: -------------------------------------------------------------------------------- 1 | LIB=/dev/null # to be overridden by install 2 | 3 | .SUFFIXES: .nw .icn 4 | .nw.icn: 5 | notangle -L'#line %-1L "%F"%N' $< | cpif $@ 6 | 7 | all: d2tex 8 | source: d2tex 9 | install: 10 | cp d2tex $(LIB)/dijkstra.filter 11 | 12 | # TeX files. 13 | hospital.tex: hospital.nw d2tex 14 | noweave -delay -filter ./d2tex hospital.nw > $@ 15 | clean: 16 | rm -f hospital.tex *.dvi *.aux *.log *.blg *.bbl *~ 17 | -------------------------------------------------------------------------------- /contrib/conrado/README: -------------------------------------------------------------------------------- 1 | This is the README file for the collection of files related to d2tex. 2 | These files are: 3 | 4 | - algoritmos.sty: 5 | defines the 'code' environment and several other 6 | related environments (code*, algorithm, ...); the implementation is 7 | not documented and can be difficult to understand, but I have 8 | documented the main features of the environments. 9 | - d2tex: 10 | an noweb filter (written in awk) that prettyprints; for instance, 11 | /* this is a comment */ is replaced by \COMMENT{this is a comment} 12 | <= is replaced by \le 13 | PROCEDURE initialize is replaced by \PROCEDURE |initialize| 14 | 15 | this script does not parse the input; it only uses pattern-matching, 16 | but produces reasonable output if some thumb rules are followed. 17 | d2tex has a list of keywords built in. 18 | 19 | - keywords.tex: 20 | 21 | contains TeX macro definitions for producing keywords in boldface, 22 | special simbols (as the boxes between guarded commands), etc.; most of 23 | the macros include indentation macros \tab and \untab; \tab is sets a 24 | tab and moves the margin tab to the right, while \untab removes a tab 25 | stop and moves to the left the margin tab. Since the 'code' 26 | environment is based upon the tabbing environment, it is useful for 27 | the keyword macros (such as \WHILE) to include these tab/untab 28 | macros. \tab and \untab can be used inside the 'code' environment when 29 | needed, for instance, to override the default indentation or to 30 | correct minor mistakes. 31 | 32 | - hospital.nw: 33 | a weird example of the type of code that d2tex is 'able' to 34 | prettyprint; the documentation is not written in english (several 35 | paragraphs and comments in the code are written in catalan) and the 36 | code is not complete. 37 | 38 | 39 | -------------------------------------------------------------------------------- /contrib/conrado/email: -------------------------------------------------------------------------------- 1 | conrado@moon.upc.es (Conrado Martinez-Parra) 2 | -------------------------------------------------------------------------------- /contrib/conrado/keywords.tex: -------------------------------------------------------------------------------- 1 | \def\COMMENT#1{\{\parbox[t]{\codewidth}{\rm #1\}}} 2 | \def\ASSERT#1{\{\mbox{\rm #1}\}} 3 | \def\PROGRAM{{\bf pro}\tab{\bf gram\ }} 4 | \def\ENDPROGRAM{\untab{\bf end}} 5 | \def\USES{{\bf uses\ }\tab} 6 | \def\ENDUSES{\untab{\bf end}} 7 | \def\MODULE{{\bf mod}\tab{\bf ule\ }} 8 | \def\ENDMODULE{\untab{\bf end}} 9 | \def\SPECIFICATION{{\bf spe}\tab{\bf cification\ }} 10 | \def\ENDSPECIFICATION{\untab{\bf end}} 11 | \def\IMPLEMENTATION{{\bf imp}\tab{\bf lementation\ }} 12 | \def\ENDIMPLEMENTATION{\untab{\bf end}} 13 | \def\IMPORT{{\bf imp}\tab{\bf orts\ }} 14 | \def\ENDIMPORT{\untab{\bf end}} 15 | \def\TYPE{{\bf type\ }\tab} 16 | \def\ENDTYPE{\untab} 17 | \def\VAR{{\bf var\ }\tab} 18 | \def\ENDVAR{\untab} 19 | \def\CONST{{\bf const\ }\tab} 20 | \def\ENDCONST{\untab} 21 | \def\ARRAY{{\bf array\ }} 22 | \def\RECORD{\tab{\bf rec}\tab{\bf ord\ }} 23 | \def\ENDRECORD{\untab{\bf end}$\-$} 24 | \def\BEGIN{} 25 | \def\IF{{\bf if }\tab\ \ \tab} 26 | \def\ELSE{\untab\untab [\!]$\>$} 27 | \def\ENDIF{\untab\untab {\bf fi}} 28 | \def\THEN{\ \longrightarrow\ \ \tab} 29 | \def\SKIP{\emptyset} 30 | \def\WHILE{{\bf whi}\tab{\bf le\ }} 31 | \def\ENDWHILE{\untab{\bf end}} 32 | \def\DO{{\bf\ do\ }} 33 | \def\DDO{{\bf do\ }\tab} 34 | \def\ENDDO{\untab{\bf end}} 35 | \def\FORALL{{\bf for}\tab{\bf\ all\ }} 36 | \def\FOR{{\bf for}\tab\ } 37 | \def\ENDFOR{\untab{\bf end}} 38 | \def\ENDFORALL{\untab{\bf end}} 39 | \def\PARALLEL{{\bf\ parallel\ }} 40 | \def\REPEAT{{\bf rep}\tab{\bf eat\ }} 41 | \def\UNTIL{\untab{\bf until\ }} 42 | \def\AND{\mathbin{\hbox{\bf and}}} 43 | \def\OR{\mathbin{\hbox{\bf or}}} 44 | \def\NOT{\mathop{\hbox{\bf not}}} 45 | \def\CAT{\mathbin{\&}} 46 | \def\OF{{\bf\ of\ }} 47 | \def\IN{{\bf\ in\ }} 48 | \def\DIV{\mathbin{\hbox{\bf div}}} 49 | \def\MOD{\mathbin{\hbox{\bf mod}}} 50 | \def\PROCEDURE{{\bf pro}\tab{\bf cedure\ }} 51 | \def\ENDPROCEDURE{\untab{\bf end}} 52 | \def\FUNCTION{{\bf fun}\tab{\bf ction\ }} 53 | \def\ENDFUNCTION{\untab{\bf end}} 54 | \def\RETURNS{{\bf return\ }} 55 | \def\INP{{\bf in\ }} 56 | \def\OUTP{{\bf out\ }} 57 | \def\INOUTP{{\bf in/out\ }} 58 | \def\PRIVATE{{\bf private\ }} 59 | 60 | -------------------------------------------------------------------------------- /contrib/davelove/Makefile: -------------------------------------------------------------------------------- 1 | SHELL=/bin/sh 2 | all: 3 | source: 4 | install: 5 | clean: 6 | rm -f *.dvi *.log *.aux 7 | -------------------------------------------------------------------------------- /contrib/davelove/README: -------------------------------------------------------------------------------- 1 | subref.doc is a literate version of the code that noxref uses to 2 | number definitions 7a, 7b, 7c, and so on. 3 | -------------------------------------------------------------------------------- /contrib/davelove/email: -------------------------------------------------------------------------------- 1 | d.love@daresbury.ac.uk 2 | -------------------------------------------------------------------------------- /contrib/fischer/README: -------------------------------------------------------------------------------- 1 | Date: Wed, 23 Feb 2011 23:02:00 -0500 2 | From: Greyson Fischer 3 | To: nr@cs.tufts.edu 4 | Subject: noweb + interpreter line = noscript 5 | 6 | 7 | Dear Norman, 8 | 9 | I have been a literate programmer for a few years now. Although I must 10 | limit my use of it most of the time due to corporate pressure, it comes 11 | in extremely handy for particularly new or challenging tasks. Of course 12 | I use noweb for many of my literate programs, preferring it over even 13 | cweb for C and C++ (sure, 'int' isn't bold, but at least it's indented 14 | the way I like to read). 15 | 16 | I found myself repeating a pattern when it came to writing in 17 | interpreted languages; specifically those that use a shebang to specify 18 | their interpreter. I write the literate script, tangle it, and then copy 19 | the result off to be used. The problem with this approach comes when I 20 | want, or need, to edit the script again later. Although I know it came 21 | from noweb (usually because of the complete lack of comments) I couldn't 22 | always track down the original source in a timely manner, leading me to 23 | make changes to the derived script, rather than the source. 24 | 25 | So, I came up with a simple fix. noscript tangles a document on the fly 26 | (assuming the first line has %!) and executes it inline with the 27 | specified interpreter. 28 | 29 | To use it, take a noweb document (for example: myscript.nw) which 30 | tangles <<*>> into, for example, a shell script. Add a "%!/bin/sh" at 31 | the top of the file. Run 'noscript myscript.nw'. Done, the script has 32 | been executed. 33 | 34 | I've attached my version 0.1 in case your interested (along with some 35 | trivial test documents). It's made it quite a bit easier for me to keep 36 | the document and the script together. Perhaps you, or one of your users, 37 | might find it of use. 38 | 39 | Cheers, 40 | Greyson Fischer 41 | -------------------------------------------------------------------------------- /contrib/fischer/noscript-0.1.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/contrib/fischer/noscript-0.1.tar.gz -------------------------------------------------------------------------------- /contrib/fischer/noscript-0.1/noscript: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | SCRIPT="$1"; shift 4 | INTERP=`sed -ne ' 5 | s!/bin/sh!/bin/sh -s!; 6 | 1s/^%!//p 7 | ' "$SCRIPT"` 8 | 9 | case "$INTERP" in 10 | '') 11 | echo 'No interpreter line (%!) found!' >&2 12 | exit 1 13 | ;; 14 | *) notangle "$SCRIPT" | exec $INTERP - "$@" ;; 15 | esac 16 | -------------------------------------------------------------------------------- /contrib/fischer/noscript-0.1/test-none.nw: -------------------------------------------------------------------------------- 1 | @ This is a test script which displays the ability of my new noweb-script to 2 | actually execute a script which is embedded in a noweb styled file. This test 3 | case ensures that nothing is run when there is no interpreter specified. 4 | 5 | <<*>>= 6 | /bin/false -- nothing here. 7 | 8 | @ And that should do it. 9 | -------------------------------------------------------------------------------- /contrib/fischer/noscript-0.1/test-py.nw: -------------------------------------------------------------------------------- 1 | %!/usr/bin/env python 2 | 3 | @ This is a test script which displays the ability of my new noweb-script to 4 | actually execute a script which is embedded in a noweb styled file. 5 | 6 | <<*>>= 7 | <> 8 | 9 | print "Hello Python World!" 10 | print "Args:", sys.argv[1:] 11 | for n in xrange( 0, 10 ): 12 | <> 13 | print 14 | 15 | @ And that should do it, now we just need to do something with the numbers: 16 | 17 | <>= 18 | print n, 19 | 20 | @ Oh yeah, I need to import [[sys]] as well 21 | 22 | <>= 23 | import sys 24 | -------------------------------------------------------------------------------- /contrib/fischer/noscript-0.1/test-sh.nw: -------------------------------------------------------------------------------- 1 | %!/bin/sh 2 | 3 | @ This is a test script which displays the ability of my new noweb-script to 4 | actually execute a script which is embedded in a noweb styled file. 5 | 6 | <<*>>= 7 | echo "Hello Bourne World!" 8 | echo "Args: $*" 9 | 10 | @ And that should do it. 11 | -------------------------------------------------------------------------------- /contrib/gregory/README: -------------------------------------------------------------------------------- 1 | dots.nw enables the use of trailing dots in chunk names. It does the same 2 | job as the example program `disambiguate.nw', but it is written in perl. 3 | -------------------------------------------------------------------------------- /contrib/gregory/email: -------------------------------------------------------------------------------- 1 | gtk@walsh.med.harvard.edu (Gregory Tucker-Kellogg) 2 | -------------------------------------------------------------------------------- /contrib/jobling/Makefile: -------------------------------------------------------------------------------- 1 | PROG=correct-refs 2 | SCRIPTS=list-anchors.awk awk-scripts.awk 3 | 4 | all: correct-refs.tex correct-refs.csh $(SCRIPTS) 5 | 6 | correct-refs.tex: correct-refs.nw 7 | noweave -delay -index correct-refs.nw > $@ 8 | 9 | correct-refs.csh: correct-refs.nw 10 | notangle -R$@ correct-refs.nw | cpif $@ 11 | chmod +x $@ 12 | 13 | list-anchors.awk: correct-refs.nw 14 | notangle -R$@ correct-refs.nw | cpif $@ 15 | 16 | awk-scripts.awk: correct-refs.nw 17 | notangle -R$@ correct-refs.nw | cpif $@ 18 | 19 | install: correct-refs.csh $(SCRIPTS) 20 | cp correct-refs.csh $(HOME)/bin 21 | cp $(SCRIPTS) $(HOME)/lib 22 | 23 | tidy: 24 | rm -f *~ *% *.bak *.log *.blg 25 | 26 | clean: tidy 27 | rm -f *.ps *.dvi *.toc *.aux *.bbl *.dep $(PROG).shar 28 | 29 | realclean: clean 30 | rm -f correct-refs.tex correct-refs.csh $(SCRIPTS) 31 | 32 | shar: 33 | shar README Makefile $(PROG).nw > $(PROG).shar 34 | -------------------------------------------------------------------------------- /contrib/jobling/README: -------------------------------------------------------------------------------- 1 | Correct-refs: 2 | ============ 3 | 4 | A set of awk scripts and to correct the internal anchors and links 5 | produced by noweave -latex+html followed by latex2html. 6 | 7 | This is necessary because the design of the html back-ends for 8 | noweave assume that the resulting HTML file will be the single 9 | document produced by latex2html -split 0 but this is not such 10 | a good idea if the document is large (e.g. the nuweb example). 11 | By default latex2html will split documents into nodes at 12 | section boundaries --- but if the document contains links, 13 | the names have to be changed from "#name" to "noden.html#name". 14 | 15 | The full documentation is contained in correct-refs.nw. Comments 16 | to 17 | 18 | Chris P. Jobling, University of Wales, Swansea 19 | C.P.Jobling@Swansea.ac.uk 20 | 21 | 22 | -------------------------------------------------------------------------------- /contrib/jobling/correct-refs.bbl: -------------------------------------------------------------------------------- 1 | \begin{thebibliography}{1} 2 | 3 | \bibitem{awk-book} 4 | Alfred~V. Aho, Brain~W. Kernighan, and Peter~J. Weinberger. 5 | \newblock {\em The {AWK} Programming Language}. 6 | \newblock Addison Wesley, Reading, MA, USA, 1988. 7 | 8 | \bibitem{gawk-manual} 9 | Diane~Barlow Close, Arnold~D. Robbins, Paul~H. Rubin, and Richard Stallman. 10 | \newblock {\em The {GAWK} Manual}. 11 | \newblock Free Software Foundation, 675 Massachusetts Avenue, Cambridge, MA 12 | 02139, USA, version 0.11 beta edition, October 1989. 13 | 14 | \bibitem{nutshell-unix} 15 | Daniel Gilly. 16 | \newblock {\em UNIX in a Nutsell}. 17 | \newblock O'Reilly \& Associates, Sebastopol, CA, USA, {System V} edition, 18 | 1992. 19 | 20 | \bibitem{ramsey94} 21 | Norman Ramsey. 22 | \newblock Literate programming simplified. 23 | \newblock {\em IEEE Software}, pages 97--105, September 1994. 24 | 25 | \bibitem{perl-llama} 26 | Randal~L. Schwartz. 27 | \newblock {\em Learning perl}. 28 | \newblock O'Reilly \& Associates, Sebastopol, CA, USA, 1993. 29 | 30 | 31 | \bibitem{perl-camel} 32 | Larry Wall and Randal~L. Schwartz. 33 | \newblock {\em Programming perl}. 34 | \newblock O'Reilly \& Associates, Sebastopol, CA, USA, 1991. 35 | 36 | \end{thebibliography} 37 | -------------------------------------------------------------------------------- /contrib/jobling/email: -------------------------------------------------------------------------------- 1 | C.P.Jobling@Swansea.ac.uk 2 | -------------------------------------------------------------------------------- /contrib/jonkrom/Makefile: -------------------------------------------------------------------------------- 1 | LIB=/dev/null # override for installation 2 | SHELL=/bin/sh 3 | all: noxref.krom 4 | 5 | install: 6 | cp noxref.krom $(LIB) 7 | 8 | source: noxref.krom 9 | 10 | noxref.krom: noxref.nw 11 | notangle -Rnoxref noxref.nw > $@ 12 | chmod +x $@ 13 | 14 | clean: 15 | rm -f *.tex *.dvi *.ilg *.idx *.aux *.log *.blg *.bbl *~ *.ind noxref.krom 16 | -------------------------------------------------------------------------------- /contrib/jonkrom/README: -------------------------------------------------------------------------------- 1 | An altered version of noxref (written in awk) that claims to support 2 | the same \chunklist semantics as the Icon version, plus boilerplate 3 | for supporting DOS. 4 | 5 | -------------------------------------------------------------------------------- /contrib/jonkrom/email: -------------------------------------------------------------------------------- 1 | jgk@jet.uk 2 | -------------------------------------------------------------------------------- /contrib/kaelin/README: -------------------------------------------------------------------------------- 1 | Prettyprinters for Icon and C++ based on Kostas's work, but using Computer Modern fonts. 2 | Prettyprinters for Icon and C++ based on Kostas's work, but using Computer Mode 3 | rn fonts. 4 | 5 | Theres is no Makefile 6 | Type 7 | > noweave -x -delay pp.nw > pp.tex < /* creates pp.tex */ 8 | > latex pp.tex < /* creates pp.dvi and warnings */ 9 | > latex pp.tex < /* creates final pp.dvi */ 10 | to get documentation and 11 | > noweb -t pp.nw < /* creates cnw.icn and inw.icn */ 12 | > iconc cnw.icn < /* creates cnw */ 13 | > iconc inw.icn < /* creates inw */ 14 | to get filters named cnw and inw. 15 | (Maybe you have to use full path-names for noweave, noweb, latex and iconc) 16 | 17 | For installation: Look at the other Makefiles in contrib/* 18 | 19 | Cleaning up is trivial: Remove pp.aux, pp.log, pp.tex, inw.icn and cnw.icn 20 | -------------------------------------------------------------------------------- /contrib/kaelin/email: -------------------------------------------------------------------------------- 1 | Kaelin Colclasure 2 | -------------------------------------------------------------------------------- /contrib/kostas/C_translation_table: -------------------------------------------------------------------------------- 1 | # This file defines translations into \TeX\ code for keywords of C. It also defines 2 | # translations for special tokens, such as <=. 3 | 4 | # Initialize the translation table to contain nulls. 5 | translation := table() 6 | 7 | # Reserved words. 8 | translation["auto"] := "{\\ttb{}auto}" 9 | translation["break"] := "{\\ttb{}break}" 10 | translation["case"] := "{\\ttb{}case}" 11 | translation["char"] := "{\\ttb{}char}" 12 | translation["continue"] := "{\\ttb{}continue}" 13 | translation["default"] := "{\\ttb{}default}" 14 | translation["do"] := "{\\ttb{}do}" 15 | translation["double"] := "{\\ttb{}double}" 16 | translation["else"] := "{\\ttb{}else}" 17 | translation["enum"] := "{\\ttb{}enum}" 18 | translation["extern"] := "{\\ttb{}extern}" 19 | translation["float"] := "{\\ttb{}float}" 20 | translation["for"] := "{\\ttb{}for}" 21 | translation["goto"] := "{\\ttb{}goto}" 22 | translation["if"] := "{\\ttb{}if}" 23 | translation["int"] := "{\\ttb{}int}" 24 | translation["long"] := "{\\ttb{}long}" 25 | translation["register"] := "{\\ttb{}register}" 26 | translation["return"] := "{\\ttb{}return}" 27 | translation["short"] := "{\\ttb{}short}" 28 | translation["sizeof"] := "{\\ttb{}sizeof}" 29 | translation["static"] := "{\\ttb{}static}" 30 | translation["struct"] := "{\\ttb{}struct}" 31 | translation["switch"] := "{\\ttb{}switch}" 32 | translation["typedef"] := "{\\ttb{}typedef}" 33 | translation["union"] := "{\\ttb{}union}" 34 | translation["unsigned"] := "{\\ttb{}unsigned}" 35 | translation["void"] := "{\\ttb{}void}" 36 | translation["while"] := "{\\ttb{}while}" 37 | 38 | # Pre-processor directives 39 | translation["#define"] := "{#\\ttb{}define}" 40 | translation["#include"] := "{#\\ttb{}include}" 41 | 42 | # Translations for operators. 43 | translation["{"] := "\\{" 44 | translation["}"] := "\\}" 45 | translation["<"] := "\\(<\\)" 46 | translation[">"] := "\\(>\\)" 47 | translation["<<"] := "\\(\\ll\\)" 48 | translation[">>"] := "\\(\\gg\\)" 49 | translation["!="] := "\\(\\neq\\)" 50 | translation["&&"] := "\\(\\land\\)" 51 | translation["||"] := "\\(\\lor\\)" 52 | translation["<="] := "\\(\\le\\)" 53 | translation[">="] := "\\(\\ge\\)" 54 | translation["->"] := "\\(\\to\\)" 55 | 56 | -------------------------------------------------------------------------------- /contrib/kostas/Makefile: -------------------------------------------------------------------------------- 1 | # Only works with Gnu make. 2 | 3 | LIB=/opt/noweb/lib 4 | ICONC=icont 5 | # This is supposed to be the defns.nw file in the icon directory of the distribution. 6 | defns=defns.nw 7 | TANGLE=notangle 8 | WEAVE=noweave -delay -filter icon.filter -index 9 | 10 | .SUFFIXES: .nw .icn .tex .dvi 11 | 12 | 13 | all: C.filter C++.filter icon.filter oot.filter math.filter \ 14 | autodefs.oot autodefs.math 15 | 16 | install: 17 | mv *.filter $(LIB) 18 | mv autodefs.* $(LIB) 19 | 20 | 21 | # TeX files. 22 | %.tex: %.nw 23 | $(WEAVE) $< > $@ 24 | pp.tex: pp.nw 25 | noweave -delay -autodefs icon -filter icon.filter -index pp.nw > $@ 26 | %.dvi: %.tex 27 | latex $< 28 | # Don't delete the intermediate .tex file. 29 | .PRECIOUS: %.tex 30 | 31 | 32 | # Icon files. 33 | C.icn: pp.nw C_translation_table 34 | $(TANGLE) -R"C" pp.nw > $@ 35 | C++.icn: pp.nw C++_translation_table 36 | $(TANGLE) -R"C++" pp.nw > $@ 37 | icon.icn: pp.nw icon_translation_table 38 | $(TANGLE) -R"Icon" pp.nw > $@ 39 | oot.icn: pp.nw oot_translation_table 40 | $(TANGLE) -R"OOT" pp.nw > $@ 41 | math.icn: pp.nw math_translation_table 42 | $(TANGLE) -R"Mathematica" pp.nw > $@ 43 | 44 | ootdefs.icn: ootdefs.nw 45 | $(TANGLE) $< $(defns) > $@ 46 | mathdefs.icn: mathdefs.nw 47 | $(TANGLE) $< $(defns) > $@ 48 | 49 | 50 | # Executables: filters. 51 | %.filter: %.icn 52 | $(ICONC) -o $@ $< 53 | 54 | # Executables: autodefs. 55 | autodefs.oot: ootdefs.icn 56 | $(ICONC) -o $@ ootdefs.icn 57 | autodefs.math: mathdefs.icn 58 | $(ICONC) -o $@ mathdefs.icn 59 | 60 | 61 | # Cleaning: remove all files that can be recreated from noweb sources. 62 | nowebs := $(wildcard *.nw) 63 | rem := $(nowebs:.nw=.icn) 64 | rem := $(rem) $(nowebs:.nw=.tex) 65 | rem := $(rem) $(nowebs:.nw=.log) 66 | rem := $(rem) $(nowebs:.nw=.aux) 67 | rem := $(rem) $(nowebs:.nw=.toc) 68 | 69 | 70 | # Also remove the Icon files for the filters. 71 | clean: 72 | rm -f $(rem) C.icn C++.icn icon.icn oot.icn math.icn *.filter autodefs.* 73 | -------------------------------------------------------------------------------- /contrib/kostas/README: -------------------------------------------------------------------------------- 1 | This directory contains noweb programs (written in Icon) that extend the basic noweb 2 | with some pretty-printing capabilities. By this we don't mean formatting, but just 3 | printing keywords in bold, comments in roman, mathematical operators using special 4 | symbols, etc. The pretty-printers work as noweb filters. 5 | 6 | There are 4 pretty-printers here, all generated from the same file, pp.nw. The 7 | pretty-printers are for C/C++, Icon, Turing (OOT), and Mathematica. pp.nw contains 8 | full documentation, and is written in a way that adding another language should be 9 | easy. (Let me know if you find it isn't so.) 10 | 11 | The pretty-printers work only with LaTeX2e, and you must have the cmttb10 font. 12 | 13 | There are also filters that write noweb index entries (autodefs) for Turing and 14 | Mathematica. 15 | -------------------------------------------------------------------------------- /contrib/kostas/WHATS_NEW: -------------------------------------------------------------------------------- 1 | WHAT'S NEW: 2 | 3 | 1) Indexing: the pretty-printers now fix up some of the deficiencies of noweb's 4 | indexing mechanism. 5 | 6 | "finduses" generates spurious references to identifiers when it sees a string 7 | matching an identifier inside a comment or string literal. For example, try 8 | 9 | noweave -autodefs c -index t.nw > t.tex 10 | latex t 11 | latex t 12 | 13 | on the file 14 | 15 | <
>= 16 | int num; 17 | <
>= 18 | /* num is the number ... */ 19 | <
>= 20 | printf("num is the number of things\n"); 21 | @ 22 | \nowebindex 23 | 24 | noweave (finduses) will generate a reference to num in each of sections B and C. 25 | 26 | Now try 27 | 28 | noweave -autodefs c -filter C.filter -index t.nw > t.tex 29 | latex t 30 | latex t 31 | 32 | (NOTE: -filter first, -index next!) 33 | You get a pretty-printed version without these references. All pretty-printer 34 | filters suppress these spurious references. 35 | 36 | 37 | 2) A bug in pretty-printing operators has been fixed. For example, if ``=='' is 38 | meant to be typeset as ``\equiv'', say, but ``==='' is supposed to be left alone, the 39 | old version would typeset ``==='' as ``\equiv=''. 40 | 41 | 42 | 3) For those who know about OOT: the autodefs.oot now does not index identifiers 43 | declared in subprograms. This reduces clutter. However, it has the capability to 44 | index such identifiers selectively if the user supplies an argument to the filter, 45 | the name of a file listing subprogram names one per line. (See ootdefs.nw for 46 | details.) 47 | -------------------------------------------------------------------------------- /contrib/kostas/defns.nw: -------------------------------------------------------------------------------- 1 | <<*>>= 2 | procedure go() 3 | local line 4 | while line := read() do { 5 | apply(prepass, line) 6 | write(line) 7 | apply(postpass, line) 8 | } 9 | end 10 | 11 | procedure apply(pass, line) 12 | line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) 13 | end 14 | @ 15 | [[indextext]] is a hack to introduce suitable ``[[@index nl]],'' but it 16 | messes up the line counts! 17 | <<*>>= 18 | procedure writedefn(defn) 19 | static indextext 20 | initial indextext := "" 21 | if /defn then 22 | *indextext > 0 & <> 23 | else { 24 | if *indextext + *defn > 65 then <> 25 | write("@index defn ", defn) 26 | indextext ||:= " " || defn 27 | } 28 | return 29 | end 30 | <>= 31 | { # write("@index nl") # don't! 32 | indextext := "" 33 | } 34 | -------------------------------------------------------------------------------- /contrib/kostas/email: -------------------------------------------------------------------------------- 1 | ko@surya.ho.att.com 2 | -------------------------------------------------------------------------------- /contrib/kostas/mathdefs.nw: -------------------------------------------------------------------------------- 1 | \section{Finding \textsl{Mathematica} definitions} 2 | 3 | This will simply recognize definitions made with ``:=''. 4 | <<*>>= 5 | procedure main(args) 6 | go() 7 | end 8 | <<*>>= 9 | procedure postpass(name, arg) 10 | static kind, id 11 | initial {kind := "bogus"; id := &letters ++ &digits} 12 | case name of { 13 | "begin" : arg ? kind := tab(upto(' ')|0) 14 | "text" : if kind == "code" then 15 | arg ? if s := tab(find(":=")) then 16 | {s ? {tab(many(' ')); writedefn(tab(many(id)))} 17 | } 18 | } 19 | return 20 | end 21 | 22 | procedure prepass(name, arg) 23 | if name == "end" then writedefn(&null) # force newline 24 | end 25 | -------------------------------------------------------------------------------- /contrib/leew/.gitignore: -------------------------------------------------------------------------------- 1 | example.tex 2 | example.log 3 | example.pdf 4 | -------------------------------------------------------------------------------- /contrib/leew/2col-defn-hack.tex: -------------------------------------------------------------------------------- 1 | % 2 | % This hack causes the noweb to display its defined identifiers list 3 | % for each chunk in a 2-column format, using LaTeX's "multicol" package. 4 | % 5 | % It's been modified from the code in noweb.sty. 6 | % 7 | % Occasionly, the "multicols" environment will break the first column 8 | % at an awkward place (the second line, say, of a definition used many 9 | % times). Placing the command "\setcounter{unbalance}{1}" immediately 10 | % before the chunk definition in question will fix this. 11 | % 12 | \usepackage{noweb}\usepackage{multicol} 13 | 14 | \makeatletter 15 | \def\nwidentdefs#1{% list of index pairs 16 | \ifnw@hideunuseddefs\nwix@totaluses{#1}\else\nwix@listcount{#1}\fi 17 | \ifnum\nwix@counter>0 18 | \nwcodecomment{\@nwlangdepdfs:}% 19 | \setlength{\columnsep}{1em}% 20 | \setlength{\columnseprule}{0pt}% 21 | \setlength{\multicolsep}{0pt}% 22 | \begin{minipage}{.8\textwidth}% 23 | \begin{multicols}{2}% 24 | {\def\\##1{\nwix@id@uses ##1}#1}% 25 | \end{multicols}\vspace*{.4em}\end{minipage}% 26 | \fi} 27 | \makeatother 28 | -------------------------------------------------------------------------------- /contrib/leew/Makefile: -------------------------------------------------------------------------------- 1 | SHELL=/bin/sh 2 | all: 3 | install: 4 | source: 5 | clean: 6 | rm -f nocond *.dvi *.log *.aux *.toc *.tex nocond.1 7 | -------------------------------------------------------------------------------- /contrib/leew/README: -------------------------------------------------------------------------------- 1 | Lee Wittenberg has kindly provided his port of noweb to DOS, which 2 | includes executable binaries. It once appeared in the DOS 3 | subdirectory of the standard noweb distribution, but it got superseded 4 | by somebody else's port later on. 5 | 6 | nocond is a slick noweb filter that supports conditional code in a 7 | nicer way than ugly old #ifdef's. 8 | 9 | nobrace looks for unbalanced braces in code chunks. 10 | 11 | pretty-comment uses LaTeX to typeset inline comments... 12 | and it's written in SNOBOL! 13 | 14 | pretty-comment.nw is a reworking of pretty-comment, in awk and Noweb. 15 | 16 | 2col-defn-hack.tex is a LaTeX hack that prints chunk identifier lists 17 | in 2 columns 18 | -------------------------------------------------------------------------------- /contrib/leew/custom-code/README.custom-code: -------------------------------------------------------------------------------- 1 | The "custom-code" script is a simple noweb filter that allows for some 2 | very simple typesetting of code chunks. It simply inserts a 3 | 4 | \bgroup\nwcustomcode ... \egroup 5 | 6 | wrapper around everything in code chunks and quoted code. The user 7 | simply defines the \nwcustomcode macro to typeset the code 8 | appropriately. This is primarily useful for programming languages like 9 | Neliac (and, perhaps, APL), which use specialized character sets (and 10 | don't look quite right when rendered in ``standard'' ASCII characters. 11 | 12 | The "example.nw" file demonstrates "custom-code" in action. Simply 13 | 14 | noweave -t4 -delay -index example.nw -filter custom-code >example.tex 15 | 16 | and run the result through LaTeX for a sample of the same code both 17 | with and without the custom typesetting. 18 | -------------------------------------------------------------------------------- /contrib/leew/custom-code/custom-code: -------------------------------------------------------------------------------- 1 | #!/bin/awk -f 2 | BEGIN { needcontrol = 0; } 3 | /^@begin code / { needcontrol = 1 } 4 | /^@quote$/ { needcontrol = 1 } 5 | /^@text / { if (needcontrol) { 6 | print "@literal \\bgroup\\nwcustomcode{}" 7 | } 8 | needcontrol = 0 9 | } 10 | /^@end code / { print "@literal \\egroup{}" } 11 | /^@endquote$/ { print "@literal \\egroup{}" } 12 | { print } 13 | -------------------------------------------------------------------------------- /contrib/leew/custom-code/n: -------------------------------------------------------------------------------- 1 | Date: Wed, 13 May 2009 19:32:13 -0400 2 | From: Alec 3 | To: Norman Ramsey 4 | Subject: Re: A couple links 5 | 6 | Actually, the pain and suffering from the python article 7 | turns out to be found at his followup post on tail calls on 8 | his regular blog: 9 | http://neopythonic.blogspot.com/2009/04/tail-recursion-elimination.html 10 | 11 | It's truly thrilling. 12 | 13 | -A 14 | 15 | On Wed, May 6, 2009 at 9:44 PM, Norman Ramsey 16 | wrote: 17 | > Thanks! 18 | > 19 | > N 20 | > 21 | -------------------------------------------------------------------------------- /contrib/leew/email: -------------------------------------------------------------------------------- 1 | Lee Wittenberg 2 | 3 | -------------------------------------------------------------------------------- /contrib/leew/pretty-comment.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/contrib/leew/pretty-comment.zip -------------------------------------------------------------------------------- /contrib/leew/strhack.nw: -------------------------------------------------------------------------------- 1 | \documentstyle[11pt,noweb]{article} 2 | \noweboptions{longchunks,noidentxref,smallcode} 3 | \pagestyle{noweb} 4 | 5 | \def\noweb/{{\tt noweb}} 6 | 7 | \title{A Hack for Typesetting Strings in \noweb/\thanks{This 8 | code is hereby placed in the public domain.}} 9 | \author{Lee Wittenberg\\Kean College of New Jersey\\Union, NJ 10 | 07083\\\tt leew@pilot.njin.net} 11 | 12 | \begin{document} 13 | \maketitle 14 | 15 | The following macros adjust things so that \noweb/ will use 16 | ``visible spaces'' in double-quoted strings within code chunks. 17 | The same effect can be 18 | achieved for single-quoted strings by replacing each occurrence 19 | of `[["]]', below, with `[[']]'. 20 | It doesn't work within \verb"[["~\ldots~\verb"]]" (although I 21 | can't figure out why). 22 | <<*>>= 23 | \global\let\xsetup=\setupcode 24 | \bgroup 25 | \catcode`\"=\active\gdef\setupcode{\xsetup 26 | \catcode`\"=\active\def"##1"{\char`\"\xxx{##1}\char`\"}}% 27 | \egroup 28 | \bgroup 29 | \catcode`\ =\active\gdef\xxx#1{{\catcode`\ =\active\chardef ='40#1}}% 30 | \egroup 31 | @ 32 | \end{document} 33 | -------------------------------------------------------------------------------- /contrib/leyn/README: -------------------------------------------------------------------------------- 1 | ttroots 2 | ======= 3 | 4 | -Allows underscores in root chunks that are written to disk. 5 | -All root chunks are printed out in the LaTeX document as 6 | upright verbatim names. 7 | 8 | 9 | notangleall 10 | =========== 11 | 12 | -creates all required directories for the code chunks 13 | -tangles all root chunks (as noweb -t) 14 | -makes all scripts mared executable. The marking is done 15 | as follows: 16 | %unx chmod +x chunk_name 17 | <>= 18 | ... 19 | @ 20 | 21 | Can also be used for other UNIX commands that should be 22 | executed after the tangling. 23 | 24 | -------------------------------------------------------------------------------- /contrib/leyn/email: -------------------------------------------------------------------------------- 1 | Francky.Leyn@esat.kuleuven.ac.be 2 | -------------------------------------------------------------------------------- /contrib/leyn/notangleall: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # notangleall 4 | # 5 | # -creates all required directories for the code chunks 6 | # -tangles all root chunks (as noweb -t) 7 | # -makes all scripts mared executable. The marking is done 8 | # as follows: 9 | # %unx chmod +x chunk_name 10 | # <>= 11 | # ... 12 | # @ 13 | # 14 | # Can also be used for other UNIX commands that should be 15 | # executed after the tangling. 16 | 17 | 18 | echo 'making required subdirs' 19 | noroots $1 | \ 20 | sed '/<<[^/]*>>/d ; s/<<\(.*\)\/[^\/]*>>/\1/' | \ 21 | sort | uniq | sed 's/\(.*\)/mkdir -p \1 ;/' | sh 22 | 23 | echo 'extracting code chunks' 24 | noweb -t $1 25 | 26 | echo 'making scripts executable' 27 | egrep '^%unix' $1 | sed 's/%unix //; s/.*/& ;/' | sh 28 | -------------------------------------------------------------------------------- /contrib/leyn/ttroots: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # ttroots 4 | # 5 | # -Allows underscores in root chunks that are written to disk. 6 | # -All root chunks are printed out in the LaTeX document as 7 | # upright verbatim names. 8 | 9 | gawk ' 10 | { line[NR] = $0 ; } 11 | # a root chunk name can not contain spaces 12 | $1 == "@use" && NF == 2 { used[$2] = 1 ; next ; } 13 | $1 == "@defn" && NF == 2 { defined[$2] = 1 ; } 14 | 15 | END { 16 | # determine root chunks 17 | for (i in defined) 18 | if (!(i in used)) 19 | root_chunks[i] = 1 ; 20 | 21 | # root chunk substitutions 22 | # Root chunk names can be used in 3 contexts: 23 | # @defn name 24 | # @xref notused name 25 | # @xref chunkbegin label name 26 | for (i=1; i<=NR; i++) { 27 | if (line[i] ~ /^(@xref notused|@xref chunkbegin|@defn)/) { 28 | nr = split(line[i], array, " ") ; 29 | stat = array[1] ; 30 | name = array[nr] ; 31 | if ((stat == "@xref" || (stat == "@defn" && nr == 2)) && (name in root_chunks)) { 32 | replace = " \\textup{\\texttt{"name"}}" ; 33 | gsub("_", "\\_", replace) ; 34 | gsub(" "name, replace, line[i]) ; 35 | } ; 36 | } ; 37 | print line[i] ; 38 | } 39 | } 40 | ' 41 | -------------------------------------------------------------------------------- /contrib/norman/Makefile: -------------------------------------------------------------------------------- 1 | LIB=/dev/null # to be overridden 2 | DIRS=numarkup 3 | 4 | all: 5 | for i in $(DIRS); do (cd $$i && $(MAKE) $@); done 6 | install: 7 | for i in $(DIRS); do (cd $$i && $(MAKE) LIB=$(LIB) $@); done 8 | source: 9 | for i in $(DIRS); do (cd $$i && $(MAKE) $@); done 10 | clean: 11 | for i in $(DIRS); do (cd $$i && $(MAKE) $@); done 12 | iconlib: # cheap hack for slackmake 13 | true 14 | -------------------------------------------------------------------------------- /contrib/norman/README: -------------------------------------------------------------------------------- 1 | cleanchunks.nw escape special characters in chunk names 2 | moddate.nw use file modification time as date (POSIX) 3 | numarkup contains a substitute for markup that works with nuweb files 4 | pp contains a very simple prettyprinter 5 | scopehack.icn A hack for scoping files; see the FAQ 6 | generate-to A hack for renumbering lines in tools like yacc 7 | -------------------------------------------------------------------------------- /contrib/norman/cleanchunks.nw: -------------------------------------------------------------------------------- 1 | \section{Code to clean up special characters in chunk names} 2 | 3 | Some people want to use {\tt noweb} to browse big pieces of legacy 4 | code without having to touch any of it by hand. Since legacy code 5 | sometimes uses underscores and other special characters in chunk 6 | names, it makes sense to have a filter to escape special characters in 7 | chunk names. 8 | <<*>>= 9 | procedure main() 10 | local tag, line 11 | while line := read() do 12 | line ? 13 | if tag := =("@defn " | "@use ") then 14 | write(tag, TeXliteral(tab(0))) 15 | else 16 | write(line) 17 | end 18 | @ 19 | <<'\\{}$&#^_ ~%'>>= 20 | <<*>>= 21 | procedure TeXliteral(arg) 22 | static nospace, code, TeXspecials 23 | initial { codes := ["\\", 92, "{", 123, "}", 125, "$", 36, "&", 38, "#", 35, "^", 94, 24 | "_", 95, "%", 37, "~", 126] 25 | code := table() 26 | TeXspecials := '\\{}$&#^_~%' 27 | while (c := get(codes), n := get(codes)) do code[c] := string(n) 28 | if c := !TeXspecials & c ~== " " & not member(code, c) then 29 | stop("internal error, character-code mismatch, report a bug!") 30 | } 31 | s := "" 32 | arg ? { 33 | while s ||:= tab(upto(TeXspecials)) do { 34 | c := move(1) 35 | if member(code, c) then 36 | s ||:= "{\\tt\\char" || code[c] || "}" 37 | else 38 | s ||:= "\\" || c 39 | } 40 | return s || tab(0) 41 | } 42 | end 43 | -------------------------------------------------------------------------------- /contrib/norman/email: -------------------------------------------------------------------------------- 1 | nr@eecs.harvard.edu 2 | -------------------------------------------------------------------------------- /contrib/norman/generate-to: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env lua5.1 2 | 3 | -- Usage: $0 filename 4 | -- Reads from stdin and writes to filename, renumbering directives 5 | -- that say "generated code" 6 | 7 | assert(#arg == 1, 'Usage: $0 outfilename') 8 | local filename = assert(arg[1]) 9 | 10 | local f = assert(io.open(filename, 'w')) 11 | 12 | local n = 0 -- how many lines have already been written to f 13 | local function rewrite() 14 | return string.format('#line %d "%s"', n, filename) 15 | end 16 | for l in io.lines() do 17 | n = n + 1 18 | l = l:gsub('%#line%s+%d+%s*"generated code"', rewrite, 1) 19 | f:write(l, '\n') 20 | end 21 | 22 | f:close() 23 | 24 | -------------------------------------------------------------------------------- /contrib/norman/htmlgif/htmlgif.icn: -------------------------------------------------------------------------------- 1 | # htmlgif -- convert eps references to gifs 2 | 3 | procedure newer(target, prereq) 4 | return system("newer " || target || " " || prereq) == 0 5 | end 6 | 7 | procedure main(args) 8 | if *args > 0 then every cvt(open(!args)) 9 | else cvt(&input) 10 | return 11 | end 12 | 13 | procedure cvt(file) 14 | while line := read(file) do 15 | line ? 16 | if (pre := tab(find("')), optwhite(), =">", 18 | tab(lookfor(s := "PostScript figure " || (ps|strip_quotes(ps)))), 19 | =s, any(' ]<>"'), tab(find("")), post := tab(0)) then 20 | { 21 | ps := strip_quotes(ps) 22 | gif := suffex(ps) || ".gif" 23 | write(pre, ", quote(", 25 | post) 26 | if not newer(gif, ps) then 27 | system("pstopbm " || ps || " | ppmtogif | giftool -rgb white > " || gif) 28 | } else { 29 | write(line) 30 | } 31 | return 32 | end 33 | 34 | procedure lookfor(s) 35 | suspend find(s) 36 | end 37 | 38 | procedure strip_quotes(s) 39 | return if s[1] == s[-1] == "\"" then s[2:-1] else s 40 | end 41 | 42 | procedure suffex(s) 43 | static nodot 44 | initial nodot := ~ '.' 45 | s ? return if (b := tab(upto('.')), =".", tab(many(nodot)), pos(0)) then b else s 46 | end 47 | 48 | procedure quote(s) 49 | return "\"" || s || "\"" 50 | end 51 | 52 | procedure optwhite() 53 | suspend tab(many(' \t')) | "" 54 | end 55 | -------------------------------------------------------------------------------- /contrib/norman/htmlgif/newer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | main(int argc, char *argv[]) { 7 | struct stat b1, b2; 8 | 9 | if (argc != 3) { 10 | fprintf(stderr, "Usage: %s file1 file2\n", argv[0]); 11 | exit (-1); 12 | } else if (stat(argv[1],&b1) < 0) { 13 | perror(argv[1]); 14 | exit(-2); 15 | } else if (stat(argv[2],&b2) < 0) { 16 | perror(argv[2]); 17 | exit(-2); 18 | } else exit(b1.st_mtime > b2.st_mtime ? 0 : 1); 19 | } 20 | -------------------------------------------------------------------------------- /contrib/norman/htmlgif/pstopbm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # exec gs -sDEVICE=djet500 -sOutputFile=- -q -dNOPAUSE "$@" 3 | 4 | device=pbm 5 | case $0 in 6 | *pbm) device=pbm ;; 7 | *ppm) device=ppm ;; 8 | esac 9 | 10 | border=10 11 | leftborder=$border 12 | rightborder=$border 13 | upperborder=$border 14 | lowerborder=$border 15 | translate=yes 16 | showpage=showpage 17 | 18 | while [ $# -gt 0 ]; do 19 | case $1 in 20 | -border) border="$2" 21 | leftborder=$border 22 | rightborder=$border 23 | upperborder=$border 24 | lowerborder=$border 25 | shift ;; 26 | -upper) upperborder="$2" ; shift ;; 27 | -lower) lowerborder="$2" ; shift ;; 28 | -left) leftborder="$2" ; shift ;; 29 | -right) rightborder="$2" ; shift ;; 30 | -notrans) translate= ;; 31 | -showpage) showpage=showpage ;; 32 | -noshowpage) showpage= ;; 33 | -*) echo "Unknown option $1" 1>&2 ; exit 1;; 34 | *) break ;; 35 | esac 36 | shift 37 | done 38 | 39 | tmp=$(mktemp) 40 | tmpa=$(mktemp --suffix=.a) 41 | if [ $# -eq 0 ]; then cat > $tmp; else cat "$@" > $tmp; fi 42 | 43 | if echo "$@" | fgrep .eps > /dev/null; then 44 | echo showpage >> $tmp 45 | fi 46 | 47 | set foo `psbb $tmp` 48 | shift 49 | 50 | if [ -n "$translate" -a $# -eq 4 ]; then 51 | 52 | llx="$1" lly="$2" urx="$3" ury="$4" 53 | llx=`expr $llx - $leftborder` 54 | lly=`expr $lly - $lowerborder` 55 | urx=`expr $urx + $rightborder` 56 | ury=`expr $ury + $upperborder` 57 | width=`expr $urx - $llx` 58 | height=`expr $ury - $lly` 59 | 60 | awk '{print} 61 | /^%%EndComments/ { printf "%d neg %d neg translate\n", '"$llx, $lly"' } 62 | ' $tmp > $tmpa 63 | echo "$showpage" | 64 | gs -q -g"${width}x$height" -sDEVICE=$device -sOutputFile=- -dNOPAUSE $tmpa - 65 | else 66 | echo "$showpage" | 67 | gs -q -sDEVICE=$device -sOutputFile=- -dNOPAUSE $tmp - 68 | fi 69 | 70 | # rm -f $tmp $tmpa 71 | 72 | exit 0 73 | 74 | #### old version 75 | 76 | 77 | 78 | if [ $# -eq 0 ]; then 79 | tmp=$(mktemp) 80 | cat > $tmp 81 | gs -q -sDEVICE=$device -sOutputFile=- -dNOPAUSE -dMAGSTEP=1.0 $tmp 82 | else 83 | gs -q -sDEVICE=$device -sOutputFile=- -dNOPAUSE -dMAGSTEP=1.0 "$@" 84 | fi 85 | rm -rf $tmp 86 | 87 | -------------------------------------------------------------------------------- /contrib/norman/numarkup/Makefile: -------------------------------------------------------------------------------- 1 | LIB=/dev/null # to be overridden 2 | CC=cc 3 | CFLAGS=-O 4 | 5 | TARGET=numarkup 6 | OBJS=main.o pass1.o latex.o input.o scraps.o names.o arena.o global.o 7 | 8 | .SUFFIXES: .nw 9 | .nw.c: 10 | notangle -R"$@"'*' -L $< | cpif $@ 11 | .nw.h: 12 | notangle -R"$@" $< | cpif $@ 13 | 14 | all: 15 | noweb -t numarkup.nw 16 | $(MAKE) $(TARGET) 17 | 18 | install: 19 | noweb -t numarkup.nw 20 | $(MAKE) $(TARGET) 21 | strip $(TARGET) 22 | cp $(TARGET) $(LIB) 23 | 24 | source: main.c pass1.c latex.c input.c scraps.c names.c arena.c global.c 25 | 26 | clean: 27 | rm -f *.o *.c *.h *.tex *.log *.dvi *~ *.blg $(TARGET) *.html 28 | 29 | $(OBJS): global.h 30 | 31 | $(TARGET): $(OBJS) 32 | $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) 33 | 34 | numarkup.html: numarkup.nw 35 | noweave -filter l2h -html -index numarkup.nw > $@ 36 | 37 | numarkup.tex: numarkup.nw 38 | noweb -o numarkup.nw 39 | -------------------------------------------------------------------------------- /contrib/norman/pp/mkfile: -------------------------------------------------------------------------------- 1 | ICONT=icont 2 | 3 | %: %.icn 4 | $ICONT $target 5 | 6 | %.icn: %.nw 7 | notangle -L'#line %-1L "%F"%N' $prereq > $target 8 | 9 | all:V: pp pp.ps pp.html 10 | 11 | $BIN/nwpp: pp.icn 12 | $ICONT -o $target $prereq 13 | 14 | pp.tex: pp.nw 15 | noweave -delay -autodefs icon -index $prereq > $target 16 | 17 | pp.html: pp.nw 18 | noweave -filter l2h -delay -autodefs icon -index -html $prereq > $target 19 | 20 | clean:V: 21 | rm -f *~ *.tex *.dvi *.logf *.icn *.u1 *.u2 *.aux *.toc *.log 22 | 23 | clobber:V: clean 24 | rm -f *.ps *.dvi *.html pp 25 | -------------------------------------------------------------------------------- /contrib/norman/scopehack.icn: -------------------------------------------------------------------------------- 1 | # scopehack; a replacement for totex but splitting output into multiple files 2 | 3 | global totex 4 | 5 | procedure main(args) 6 | totex := "PATH=/usr/local/noweb/lib:/usr/lib/noweb:$PATH totex" 7 | every totex ||:= " '" || !args || "'" 8 | 9 | lines := [] 10 | file 11 | 12 | while line := read() do { 13 | line ? 14 | if ="@fatal" then exit(1) 15 | else if ="@file " then 16 | if =\file & pos(0) then # no change 17 | &null 18 | else { 19 | flush(file, lines) 20 | file := tab(0) 21 | } 22 | put(lines, line) 23 | } 24 | flush(file, lines) 25 | end 26 | 27 | procedure flush(file, lines) 28 | if /file & *lines > 0 then 29 | stop("First line is not @file") 30 | else if *lines = 0 then 31 | return 32 | else { 33 | outfile := suffex(file) || ".tex" 34 | p := open(totex || " > " || outfile, "wp") | stop ("cannot run ", totex) 35 | while write(p, get(lines)) 36 | close(p) 37 | return 38 | } 39 | end 40 | 41 | procedure suffex(s) 42 | return reverse (reverse(s) ? {tab(upto('.')) & ="."; tab(0)}) 43 | end 44 | 45 | -------------------------------------------------------------------------------- /contrib/partingr/TeXthings: -------------------------------------------------------------------------------- 1 | sub convquotes 2 | { 3 | local($line)=@_; 4 | local($pre,$mid,$end,$obrace,$cbrace); 5 | 6 | $obrace=index($line,'[[',0); 7 | while($obrace!=-1) 8 | { 9 | $pre=substr($line,0,$obrace); 10 | $cbrace=index($line,']]',$obrace); 11 | while(substr($line,$cbrace+2,1) eq ']') 12 | { $cbrace++; 13 | } 14 | $mid=substr($line,$obrace+2,$cbrace-$obrace-2); 15 | $end=substr($line,$cbrace+2); 16 | $line=$pre . "\\code{}" . &TeXliteral($mid) . "\\edoc{}" . $end; 17 | $obrace=index($line,'[[',0); 18 | } 19 | return $line; 20 | } 21 | 22 | sub escapebslash 23 | { 24 | local($line)=@_; 25 | 26 | $line=~s/([\\\{\}])/\n\1/g; 27 | $line=~s/\n/\\/g; 28 | return $line; 29 | } 30 | 31 | sub TeXliteral 32 | { 33 | local($_)=@_; 34 | 35 | s/\\/<\\char92>/g; 36 | s/\}/<\\char125}/g; 37 | s/\{/{\\char123}/g; 38 | s/<\\char/{\\char/g; 39 | s/\{\\char92>/{\\char92}/g; 40 | s/\$/{\\char36}/g; 41 | s/&/{\\char38}/g; 42 | s/#/{\\char35}/g; 43 | s/\^/{\\char94}/g; 44 | s/_/{\\char95}/g; 45 | s/%/{\\char37}/g; 46 | s/~/{\\char126}/g; 47 | s/ /\\ /g; 48 | return $_; 49 | } 50 | 51 | 1; 52 | 53 | -------------------------------------------------------------------------------- /contrib/partingr/email: -------------------------------------------------------------------------------- 1 | Robert Partington 2 | 3 | -------------------------------------------------------------------------------- /contrib/partingr/mm2mx63: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/contrib/partingr/mm2mx63 -------------------------------------------------------------------------------- /contrib/partingr/mm2mx64: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/contrib/partingr/mm2mx64 -------------------------------------------------------------------------------- /contrib/partingr/mm2mx65: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/contrib/partingr/mm2mx65 -------------------------------------------------------------------------------- /contrib/partingr/mm2tex: -------------------------------------------------------------------------------- 1 | #!/usr/common/bin/perl 2 | do "TeXthings" || die "$!"; 3 | print "\\input nwmac "; 4 | while(<>) 5 | { 6 | if(/^@begin code (.*)$/) { print "\\nwbegincode{$1}"; $code=1; $text=5; } 7 | elsif(/^@end code/) { print "\\nwendcode{}\\filbreak$defing"; $code=0; } 8 | elsif(/^@begin docs (.*)$/) { print "\\nwbegindocs{$1}"; $text=0; $textmode=0; } 9 | elsif(/^@end docs/) { print "\\nwenddocs{}"; } 10 | elsif(/^@text (.*)$/) 11 | { $text+=length $1; 12 | if($code==1) { print &escapebslash($1); } 13 | elsif($quoting==1) { print &TeXliteral($1); } 14 | else { print $1; } 15 | $textmode=1 if $text>0; 16 | } 17 | elsif(/^@nl$/) 18 | { if($code==0) 19 | { if($text==0) 20 | { if($textmode==1) { print "\\nwdocspar\\noindent\n"; } 21 | else { print "\n"; } 22 | $textmode=1; $text=1; 23 | } 24 | else { print "\n"; } 25 | } 26 | elsif($quoting) { print "\\nwnewline"; } 27 | else { if($text>0) { print "\n"; } } 28 | } 29 | elsif(/^@defn (.*)$/) 30 | { $name=$1; 31 | print "\\moddef{",&convquotes($name),"}\\",@defns{$name},"endmoddef"; 32 | @defns{$name}='plus'; 33 | } 34 | elsif(/^@use (.*)$/) 35 | { print "\\LA{}",&convquotes($1),"\\RA{}"; } 36 | elsif(/^@quote$/) { $quoting=1; print "{\\tt "; } 37 | elsif(/^@endquote$/) { $quoting=0; print "}"; $textmode=0; } 38 | elsif(/^@file (.*)$/) { $filename=$1; print "\\filename{$filename}"; } 39 | elsif(/^@literal (.*)$/) { print "$1"; } 40 | } 41 | print "\\bye\n"; 42 | -------------------------------------------------------------------------------- /contrib/partingr/nwnweave: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | markup $1.nw | mm2mx63 -n -i -m | mx2tex31 -i -n $1 -s 3 | -------------------------------------------------------------------------------- /contrib/partingr/nwtangle: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | markup $1.nw | nt -R'$2' 3 | -------------------------------------------------------------------------------- /contrib/partingr/nwweave: -------------------------------------------------------------------------------- 1 | #!/bin/csh 2 | markup $1.nw | mm2mx63 -i -m | mx2tex31 -i -n $1 -s 3 | -------------------------------------------------------------------------------- /contrib/partingr/xpand: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/contrib/partingr/xpand -------------------------------------------------------------------------------- /contrib/rsc/README: -------------------------------------------------------------------------------- 1 | These scripts support use of Noweb under Plan 9. 2 | -------------------------------------------------------------------------------- /contrib/rsc/email: -------------------------------------------------------------------------------- 1 | Russ Cox 2 | -------------------------------------------------------------------------------- /contrib/rsc/rc/cpif.nw: -------------------------------------------------------------------------------- 1 | <>= 2 | #!/bin/rc 3 | # 4 | # Based on shell script by Norman Ramsey 5 | # Translated from sh to rc by Russ Cox 6 | # 7 | # see /sys/src/cmd/noweb/COPYRIGHT 8 | # 9 | # cpif [ -eq -ne ] file... 10 | # copy standard input to each of the named files 11 | # if new * old is true or old doesn't exist; 12 | # * defaults to -ne 13 | 14 | rfork en 15 | 16 | # set -x 17 | op=-ne 18 | if(~ $1 -eq -ne){ 19 | op=$1 20 | shift 21 | } 22 | if(~ $1 -* || ~ $#* 0) { 23 | echo 'Usage: '$0' [-eq -ne] file...' >[1=2] 24 | exit usage 25 | } 26 | 27 | new=$(mktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; } 28 | 29 | # trap 'rm -f $new; exit 1' 1 2 15 # clean up files 30 | 31 | cat >$new 32 | for(i) { 33 | cmp -s $new $i 34 | 35 | switch($op^$status) { 36 | # differed but we wanted same 37 | case -eq*differ 38 | ; 39 | # didn't differ but we wanted different 40 | case -ne 41 | ; 42 | # got what we wanted or perhaps an error 43 | case * 44 | cp $new $i 45 | } 46 | } 47 | rm -f $new 48 | -------------------------------------------------------------------------------- /contrib/rsc/rc/emptydefn.nw: -------------------------------------------------------------------------------- 1 | <>= 2 | #!/bin/rc 3 | # 4 | # notangle filter that makes the definition of an empty chunk @<<>>= 5 | # stand for a continuation of the previous chunk definition. 6 | 7 | awk 'BEGIN { lastdefn = "@defn " } 8 | /^@defn $/ { print lastdefn; next } 9 | /^@defn / { lastdefn = $0 } 10 | { print }' $* 11 | -------------------------------------------------------------------------------- /contrib/rsc/rc/mkfile: -------------------------------------------------------------------------------- 1 | 2 | RCTARG=cpif noroots noweave notangle nountangle 3 | RCLIBTARG=emptydefn noidx noindex toascii tohtml totex unmarkup noweb 4 | AWKTARG=noidx.awk noindex.awk toascii1.awk toascii2.awk tohtml.awk 5 | 6 | %: %.nw 7 | notangle -R$stem $stem.nw >$stem 8 | 9 | %2.awk: %.nw 10 | notangle -R$target $stem.nw >$target 11 | %1.awk: %.nw 12 | notangle -R$target $stem.nw >$target 13 | %.awk: %.nw 14 | notangle -R$target $stem.nw >$target 15 | 16 | TARG=$RCTARG $RCLIBTARG $AWKTARG 17 | 18 | default:V: $TARG 19 | 20 | clean:V: 21 | rm $TARG 22 | 23 | install:V: 24 | cp $RCTARG /rc/bin 25 | cp $RCLIBTARG /sys/lib/noweb/bin/rc 26 | chmod 775 /rc/bin/^($RCTARG) 27 | chmod 775 /sys/lib/noweb/bin/rc/^($RCLIBTARG) 28 | cp $AWKTARG /sys/lib/noweb 29 | -------------------------------------------------------------------------------- /contrib/rsc/rc/noroots.nw: -------------------------------------------------------------------------------- 1 | <>= 2 | #!/bin/rc 3 | # 4 | # Copyright 1991 by Norman Ramsey. All rights reserved. 5 | # See file /sys/src/cmd/noweb/COPYRIGHT for more information. 6 | # 7 | # set -x 8 | /sys/lib/noweb/bin/$objtype/markup $* | awk ' 9 | /^@quote$/,/^@endquote$/ { next } 10 | /^@defn / { chunk=substr($0,7) ; defined[chunk]=1 } 11 | /^@use / { chunk=substr($0,6) ; used[chunk]=1 } 12 | END { 13 | for (chunk in defined) { 14 | if (defined[chunk]==1 && used[chunk]==0) printf "@<<%s>>\n", chunk 15 | } 16 | }' 17 | -------------------------------------------------------------------------------- /contrib/rsc/rc/notangle.nw: -------------------------------------------------------------------------------- 1 | <>= 2 | #!/bin/rc 3 | # Copyright 1991 by Norman Ramsey. All rights reserved. 4 | # See file /sys/src/cmd/noweb/COPYRIGHT for more information. 5 | # 6 | # Translated from sh to rc by Russ Cox 7 | # bugs -> rsc@plan9.bell-labs.com 8 | # 9 | 10 | rfork en 11 | bind -b /sys/lib/texmf/bin/$objtype /bin 12 | bind -b /sys/lib/texmf/bin/rc /bin 13 | 14 | LIB=/sys/lib/texmf/noweb 15 | markup=markup 16 | opt=() 17 | arg=() 18 | markopt=() 19 | filters=() 20 | 21 | while(! ~ $#* 0) { 22 | switch($1) { 23 | case -m -m3 -awk -icn -icon -pascal -c -c++ -f77 -f90 -tex -w[0-9][0-9] 24 | 25 | ; 26 | case -t 27 | ; 28 | case -t* 29 | markopt=($markopt -t) 30 | opt=($opt $1) 31 | case -filter 32 | filters=($filters $2) 33 | shift 34 | case -markup 35 | markup=$2 36 | shift 37 | case - 38 | arg=($arg $1) 39 | case -L* 40 | opt=($opt -t $1) 41 | markopt=($markopt -t) 42 | case -* 43 | opt=($opt $1) 44 | case * 45 | arg=($arg $1) 46 | } 47 | shift 48 | } 49 | 50 | $markup $markopt $arg | $filters nt $opt 51 | exit $status 52 | -------------------------------------------------------------------------------- /contrib/rsc/rc/noweave.simple: -------------------------------------------------------------------------------- 1 | #!/bin/rc 2 | 3 | rfork en 4 | 5 | LIB=/sys/lib/noweb 6 | 7 | bind -b /sys/lib/noweb/bin/$objtype /bin 8 | bind -b /sys/lib/noweb/bin/rc /bin 9 | 10 | files=() 11 | for(i) { 12 | switch($i) { 13 | case -* 14 | ; 15 | case * 16 | files=($files $i) 17 | } 18 | } 19 | 20 | markup $files | awk ' 21 | BEGIN { code=0 22 | print "\\documentstyle{article}" 23 | print "\\newcommand{\\fragment}[1]{{\\sl$\\langle$#1\\/$\\ran 24 | le$}}" 25 | print "\\begin{document}" 26 | } 27 | END { if (code) print "\\end{trivlist}" 28 | print "\\end{document}" 29 | } 30 | /^@quote$/ { printf "\\verb@"} 31 | /^@endquote$/ { printf "@" } 32 | /^@begin code/ { if (!code) print "\\begin{trivlist}\\raggedright\\obeylines\\ 33 | eftskip=2em\\small\\item[]%"; code=1 } 34 | /^@end code/ { } 35 | /^@begin docs/ { if (code) print "\\end{trivlist}"; code=0 } 36 | /^@end docs/ { } 37 | /^@defn / { gsub(/\[\[/, "\\verb@"); gsub(/]]/, "@") 38 | name = substr($0,7) 39 | printf "\\hspace{-2em}" 40 | printf "\\fragment{%s}", name 41 | defs[name] += 1 42 | if (defs[name] > 1) 43 | printf "$+\\!\\!\\equiv$" 44 | else 45 | printf "$\\equiv$" 46 | printf "\\index{\\fragment{%s}}", name 47 | } 48 | /^@use / { gsub(/\[\[/, "\\verb@"); gsub(/]]/, "@") 49 | name = substr($0,6) 50 | printf "\\fragment{%s}", name 51 | printf "\\index{\\fragment{%s}}", name 52 | } 53 | /^@literal / { printf "%s", substr($0, 10) } 54 | /^@nl$/ { print ""} 55 | /^@text / { if (code) printf "\\verb@%s@", substr($0,7) 56 | else printf "%s", substr($0,7) }' 57 | -------------------------------------------------------------------------------- /contrib/rsc/rc/noweb.nw: -------------------------------------------------------------------------------- 1 | <>= 2 | #!/bin/rc 3 | # Copyright 1991 by Norman Ramsey. All rights reserved. 4 | # See file /sys/src/cmd/noweb/COPYRIGHT for more information. 5 | # 6 | # Translated to rc by Russ Cox 7 | # bugs -> rsc@plan9.bell-labs.com 8 | 9 | rfork en 10 | bind -b /sys/lib/noweb/bin/$objtype /bin 11 | bind -b /sys/lib/noweb/bin/rc /bin 12 | 13 | markup=markup 14 | mntopt=-L 15 | status=0 16 | tex=1 17 | output=1 18 | 19 | break=no 20 | while(! ~ $#* 0 && ~ $break no) { 21 | switch($1) { 22 | case -to -ot 23 | tex='' 24 | output='' 25 | shift 26 | case -t 27 | tex='' 28 | shift 29 | case -o 30 | output='' 31 | shift 32 | case -L* 33 | mntopt=$1 34 | shift 35 | case -markup 36 | markup=$2 37 | shift 38 | shift 39 | case -* 40 | echo unrecognized option $1 >[1=2] 41 | exit usage 42 | case * 43 | break=yes 44 | } 45 | } 46 | 47 | for(source) { 48 | if(test -n $output) { 49 | eval $markup' -t '$source' | mnt -t8 '$mntopt' -all' || status= 50 | 51 | } 52 | if(test -n $tex) { 53 | texname=`{echo $source | sed '/\./s/\.[^.]*$//'} 54 | texname=$texname.tex 55 | eval $markup' '$source | finduses -noquote | noidx -delay | 56 | awk '{print} 57 | /^@defn [^ ]*$/ { print "@literal \\let\\nwnotused=\\nw 58 | utput{}" }' | 59 | totex -delay | cpif $texname || status=1 60 | } 61 | } 62 | 63 | exit $status 64 | -------------------------------------------------------------------------------- /contrib/rsc/rc/unmarkup.nw: -------------------------------------------------------------------------------- 1 | <>= 2 | #!/bin/rc 3 | # 4 | # Copyright 1991 by Norman Ramsey. All rights reserved. 5 | # See file /sys/src/cmd/noweb/COPYRIGHT for more information. 6 | # 7 | # Translated to rc by Russ Cox 8 | # bugs -> rsc@plan9.bell-labs.com 9 | # 10 | 11 | awk ' 12 | BEGIN { 13 | rcsid = "$Id: unmarkup,v 1.5 1999/02/16 21:11:54 nr Exp nr $" 14 | rcsname = "$Name: v2_9a $" 15 | } 16 | /^@begin docs 0$/ { next } 17 | /^@begin docs / { printf "@ " } 18 | /^@begin code / { code = 1 } 19 | /^@end [cd]o[dc][es] / { 20 | code = 0 21 | if (dangling_text) printf "\n" 22 | dangling_text = 0 23 | printf "%s", deflines 24 | if (defline != "") printf "%s\n", defline 25 | deflines = "" ; defline = "" 26 | } 27 | /^@defn / { printf "@<<%s>>=", substr($0,7) } 28 | /^@text $/ {next} 29 | /^@text / { 30 | gsub("@<<", "@@<<"); 31 | gsub("@>>", "@@>>"); 32 | if (!(code || quoting)) { 33 | gsub(/\[\[/, "@[["); 34 | gsub(/\]\]/, "@]]"); 35 | } 36 | printf "%s", substr($0,7) 37 | dangling_text = 1 38 | } 39 | /^@quote$/ { printf("[["); dangling_text = 1; quoting = 1 } 40 | /^@endquote$/ { printf("]]"); dangling_text = 1; quoting = 0 } 41 | /^@nl$/ { printf "\n"; dangling_text = 0} 42 | 43 | /^@index defn / { 44 | if (defline == "") defline = "@ %def" 45 | defline = defline " " substr($0, 13) 46 | } 47 | /^@index nl$/ { 48 | deflines = deflines defline "\n" 49 | defline = "" 50 | } 51 | /^@use / { printf "@<<%s>>", substr($0,6) 52 | dangling_text = 1 53 | }' $* | sed 's/^@ $/@/' 54 | -------------------------------------------------------------------------------- /contrib/ydirson/Makefile: -------------------------------------------------------------------------------- 1 | LIB=/dev/null # to be overridden 2 | 3 | FILTERS=guesslang inheritlang enscript-html 4 | 5 | # nothing to tangle or weave 6 | all: 7 | source: 8 | clean: 9 | 10 | install: 11 | cp -p $(FILTERS) $(LIB) 12 | -------------------------------------------------------------------------------- /contrib/ydirson/README: -------------------------------------------------------------------------------- 1 | guesslang 2 | Attempts to set the @language of given root chunks. 3 | Note: Currently only inspects '#!' lines, not filename. 4 | inheritlang 5 | Propagates @language to non-root chunks. 6 | enscript-html 7 | Uses enscript(1) to pretty-print chunks in HTML according to @language. 8 | Most useful enscript flags include --color and --style=... 9 | 10 | Note: Should ultimately work with all languages 11 | supported by enscript, but needs extra info about how 12 | to mangle @use clauses. If it complains "Don't know 13 | how to mangle @use" for your language, you can edit 14 | mangle_use() and demangle_use() to turn the @use 15 | clause into a meaningfull language clause, and then 16 | convert back in @use form. 17 | 18 | Note: Supports all highlighting styles of enscript 19 | 1.6.4, but the regexp in demangle_use() may need to be 20 | adapted in the future. 21 | 22 | Typical use lokks like: 23 | noweave -html \ 24 | -filter "guesslang ${NOWEBOUTSRC} | inheritlang | enscript-html" \ 25 | -x 26 | 27 | Be sure to specify -x or possibly other filters *after* the -filter, 28 | since the pretty-printer does not preserve the position of remaining 29 | directives (esp. @xref) within code chunks. 30 | 31 | Sample output is viewable at 32 | http://ydirson.free.fr/en/software/noweb/dh-kpatches.html 33 | -------------------------------------------------------------------------------- /contrib/ydirson/email: -------------------------------------------------------------------------------- 1 | ydirson@altern.org 2 | -------------------------------------------------------------------------------- /contrib/ydirson/guesslang: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # Noweb filter which attempt to add @language directives to root 4 | # chunks named on command-line. 5 | 6 | # Copyright (c) 2003 by Yann Dirson 7 | 8 | # Distribute under the terms of the GNU General Public Licence, 9 | # version 2. 10 | 11 | # TODO: Currently only look at the 1st line of the chunk, expecting to 12 | # find a standard UN*X "#!" declaration. Still has to look at file 13 | # names/suffixes as well. 14 | 15 | use strict; 16 | use File::Basename; 17 | 18 | my @roots = @ARGV; 19 | 20 | my %interpreters = ( 21 | '[gn]awk' => 'awk', 22 | 'perl[0-9.]*' => 'perl', 23 | 'python[0-9.]*' => 'python', 24 | '(wish|tclsh)[0-9.]*' => 'tcl', 25 | '(|k|ba|z)sh' => 'sh', 26 | ); 27 | 28 | while () { 29 | if (m/^\@defn (.*)$/ and grep (/^$1$/, @roots)) { 30 | my $language; 31 | my $defn = $_; 32 | 33 | # FIXME: should lookup a filename-based hash first (or second ?) 34 | 35 | # memorize all lines until we can guess the language 36 | my @buffer; 37 | while (defined($_ = ) and not m/^\@text/) { 38 | push @buffer, $_; 39 | } 40 | # we have found the 1st @text line in the file, go see if it's a hash-bang 41 | if (m/^\@text #!\s*(\/\S+)/) { 42 | my $interp = basename ($1); 43 | 44 | # lookup in our knowledge base 45 | foreach my $re (keys %interpreters) { 46 | $language=$interpreters{$re} if $interp =~ m/^$re$/; 47 | } 48 | # default to interpreter's name (FIXME: ugly, should be optional) 49 | $language = $interp unless defined $language; 50 | } 51 | # 52 | print $defn; 53 | print "\@language $language\n" if defined $language; 54 | print @buffer; 55 | } 56 | print $_; 57 | } 58 | -------------------------------------------------------------------------------- /contrib/ydirson/inheritlang: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl -w 2 | 3 | # Noweb filter to propagate @language directive from a chunk to used 4 | # chunks. Assumes that root chunks already have a @language directive 5 | # (see guesslang filter). Takes no argument. 6 | 7 | # Copyright (c) 2003 by Yann Dirson 8 | 9 | # Distribute under the terms of the GNU General Public Licence, 10 | # version 2. 11 | 12 | use strict; 13 | 14 | my (%chunklangs, %chunkchildren); 15 | 16 | # FIXME: we could bufferize as needed, if we want to grow more complex 17 | my @data = ; 18 | 19 | # register the chunk hierarchy 20 | { 21 | my $thischunk = undef; 22 | foreach (@data) { 23 | if (m/^\@end code/) { # this one first to limit to code chunks 24 | $thischunk = undef; 25 | } elsif (m/^\@use (.*)$/) { 26 | push @{$chunkchildren{$thischunk}}, $1 if defined $thischunk; 27 | } elsif (m/^\@defn (.*)$/) { 28 | $thischunk = $1; 29 | } elsif (m/^\@language (.*)$/) { 30 | die "\@language without a \@defn: $_" unless defined $thischunk; 31 | $chunklangs{$thischunk} = $1; 32 | } 33 | } 34 | } 35 | 36 | # propagate to argument's children 37 | sub propagate { 38 | my ($thischunk) = @_; 39 | if (defined $chunklangs{$thischunk}) { 40 | foreach my $child (@{$chunkchildren{$thischunk}}) { 41 | if (defined $chunklangs{$child}) { 42 | if ($chunklangs{$child} eq $chunklangs{$thischunk}) { 43 | print STDERR "Notice: chunk used more than once: \`$child'\n"; 44 | } else { 45 | die "Chunk cannot inherits languages \`$chunklangs{$child}' and " . 46 | "\`$chunklangs{$thischunk}': \`$child'\n"; 47 | } 48 | } else { 49 | $chunklangs{$child} = $chunklangs{$thischunk}; 50 | } 51 | 52 | # recurse 53 | propagate($child); 54 | } 55 | } else { 56 | print STDERR "Warning: could not infer language for \`$thischunk'\n"; 57 | } 58 | } 59 | 60 | # propagate from all known chunks 61 | foreach my $chunk (keys %chunklangs) { 62 | propagate($chunk); 63 | } 64 | 65 | # output 66 | foreach (@data) { 67 | if (m/^\@defn (.*)$/) { 68 | print $_; 69 | print "\@language $chunklangs{$1}\n" if (defined $chunklangs{$1}) 70 | } elsif (m/^\@language /) { 71 | # Do not output twice. Since we already asserted consistency we can 72 | # simply ignore this one. 73 | } else { 74 | print $_; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /echo: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # version of echo that does -n 4 | 5 | if [ "x$1" = "x-n" ]; then 6 | shift 7 | cat << echoEOF | tr -d '\012' 8 | $* 9 | echoEOF 10 | 11 | else 12 | cat << echoEOF 13 | $* 14 | echoEOF 15 | 16 | fi 17 | 18 | exit 0 19 | 20 | 21 | if [ -x /bin/echo ]; then 22 | exec /bin/echo "$@" 23 | elif [ -x /usr/bin/echo ]; then 24 | exec /usr/bin/echo "$@" 25 | else 26 | echo "$@" 27 | fi 28 | -------------------------------------------------------------------------------- /examples/Makefile: -------------------------------------------------------------------------------- 1 | WWW=$(HOME)/www/noweb/examples 2 | SHELL=/bin/sh 3 | NOTANGLE=nountangle -m3 4 | NOWEAVE=noweave 5 | 6 | .SUFFIXES: .i3 .m3 .nw .tex .dvi .html 7 | .nw.html: 8 | $(NOWEAVE) -filter l2h -filter btdefn -index -html $< > $@ 9 | .nw.tex: 10 | $(NOWEAVE) -index -filter btdefn $< > $@ 11 | .nw.i3: 12 | $(NOTANGLE) -Rinterface -L'<* LINE %L "%F" *>%N' $< > $@ 13 | .nw.m3: 14 | $(NOTANGLE) -L'<* LINE %L "%F" *>%N' $< > $@ 15 | .tex.dvi: 16 | latex '\scrollmode \input '"$*"; while grep -s 'Rerun to get cross-references right' $*.log; do latex '\scrollmode \input '"$*"; done 17 | 18 | HTML=breakmodel.html compress.html dag.html graphs.html mipscoder.html primes.html \ 19 | scanner.html test.html tree.html wc.html wcni.html 20 | 21 | 22 | www: $(HTML) 23 | copy -v $(HTML) $(WWW) 24 | copy -v README.h $(WWW)/index.html 25 | 26 | clean: 27 | rm -f *~ *.aux *.tex *.dvi *.log *.html *.toc 28 | 29 | clobber: clean 30 | 31 | compress.html: compress.nw 32 | $(NOWEAVE) -filter l2h -index -autodefs c -html compress.nw > $@ 33 | compress.tex: compress.nw 34 | $(NOWEAVE) -index -autodefs c compress.nw > $@ 35 | dag.html: dag.nw 36 | $(NOWEAVE) -filter l2h -index -autodefs icon -html dag.nw > $@ 37 | dag.tex: dag.nw 38 | $(NOWEAVE) -index -autodefs icon dag.nw > $@ 39 | mipscoder.html: mipscoder.nw 40 | $(NOWEAVE) -filter l2h -index -autodefs sml -html mipscoder.nw > $@ 41 | mipscoder.tex: mipscoder.nw 42 | $(NOWEAVE) -autodefs sml -index mipscoder.nw > $@ 43 | scanner.html: scanner.nw 44 | $(NOWEAVE) -filter l2h -index -autodefs c -autodefs yacc -html scanner.nw > $@ 45 | scanner.tex: scanner.nw 46 | $(NOWEAVE) -index -autodefs c -autodefs yacc scanner.nw > $@ 47 | tree.html: tree.nw 48 | $(NOWEAVE) -filter l2h -index -autodefs icon -html tree.nw > $@ 49 | tree.tex: tree.nw 50 | $(NOWEAVE) -index -autodefs icon tree.nw > $@ 51 | test.html: test.nw 52 | $(NOWEAVE) -filter l2h -html test.nw > $@ 53 | test.tex: test.nw 54 | $(NOWEAVE) test.nw > $@ 55 | wc.html: wc.nw2html 56 | $(NOWEAVE) -autodefs c -filter btdefn -index -html -n wc.nw2html > $@ 57 | wcni.html: wc.nw2html 58 | $(NOWEAVE) -filter btdefn -x -html -n wc.nw2html > $@ 59 | wc.tex: wc.nw 60 | $(NOWEAVE) -autodefs c -filter btdefn -index wc.nw > $@ 61 | -------------------------------------------------------------------------------- /examples/Makefile.awk: -------------------------------------------------------------------------------- 1 | WWW=$(HOME)/www/noweb/examples 2 | SHELL=/bin/sh 3 | NOTANGLE=nountangle -m3 4 | NOWEAVE=noweave 5 | 6 | .SUFFIXES: .i3 .m3 .nw .tex .dvi .html 7 | .nw.html: 8 | $(NOWEAVE) -filter btdefn -index -html $< > $@ 9 | .nw.tex: 10 | $(NOWEAVE) -index -filter btdefn $< > $@ 11 | .nw.i3: 12 | $(NOTANGLE) -Rinterface -L'<* LINE %L "%F" *>%N' $< > $@ 13 | .nw.m3: 14 | $(NOTANGLE) -L'<* LINE %L "%F" *>%N' $< > $@ 15 | .tex.dvi: 16 | latex '\scrollmode \input '"$*"; while grep -s 'Rerun to get cross-references right' $*.log; do latex '\scrollmode \input '"$*"; done 17 | 18 | HTML=breakmodel.html compress.html dag.html graphs.html mipscoder.html primes.html \ 19 | scanner.html test.html tree.html wc.html wcni.html 20 | DVI=compress.dvi dag.dvi mipscoder.dvi scanner.dvi tree.dvi test.dvi wc.dvi 21 | 22 | 23 | texonly: $(DVI) 24 | 25 | www: $(HTML) 26 | copy -v $(HTML) $(WWW) 27 | copy -v README.h $(WWW)/index.html 28 | 29 | clean: 30 | rm -f *~ *.aux *.tex *.dvi *.log *.html *.toc 31 | 32 | clobber: clean 33 | 34 | compress.html: compress.nw 35 | $(NOWEAVE) -index -html compress.nw > $@ 36 | compress.tex: compress.nw 37 | $(NOWEAVE) -index compress.nw > $@ 38 | dag.html: dag.nw 39 | $(NOWEAVE) -index -html dag.nw > $@ 40 | dag.tex: dag.nw 41 | $(NOWEAVE) -index dag.nw > $@ 42 | mipscoder.html: mipscoder.nw 43 | $(NOWEAVE) -index -html mipscoder.nw > $@ 44 | mipscoder.tex: mipscoder.nw 45 | $(NOWEAVE) -index mipscoder.nw > $@ 46 | scanner.html: scanner.nw 47 | $(NOWEAVE) -index -html scanner.nw > $@ 48 | scanner.tex: scanner.nw 49 | $(NOWEAVE) -index scanner.nw > $@ 50 | tree.html: tree.nw 51 | $(NOWEAVE) -index -html tree.nw > $@ 52 | tree.tex: tree.nw 53 | $(NOWEAVE) -index tree.nw > $@ 54 | test.html: test.nw 55 | $(NOWEAVE) -html test.nw > $@ 56 | test.tex: test.nw 57 | $(NOWEAVE) test.nw > $@ 58 | wc.html: wc.nw2html 59 | $(NOWEAVE) -filter btdefn -index -html -n wc.nw2html > $@ 60 | wcni.html: wc.nw2html 61 | $(NOWEAVE) -filter btdefn -x -html -n wc.nw2html > $@ 62 | wc.tex: wc.nw 63 | $(NOWEAVE) -filter btdefn -index wc.nw > $@ 64 | -------------------------------------------------------------------------------- /examples/README: -------------------------------------------------------------------------------- 1 | All these examples have been set up to work with latex, although I 2 | often prefer plain TeX because latex's page breaking is so bad and so 3 | hard to control. breakmodel.nw is the only one that requires 4 | cross-referencing (noweave -x). I have included the nonstandard 5 | `multicol' style file, although it is readily available as part of the 6 | Mainz distribution. 7 | 8 | Except for breakmodel.nw, each example file is a fragment of a larger 9 | program. noweb itself is not a good example of literate programming. 10 | It is harder than most people realize to write a truly literate 11 | program, and noweb wasn't worth the effort. 12 | 13 | If you have installed noweb with LIBSRC=awk instead of LIBSRC=icon, 14 | you need to use Makefile.awk instead of Makefile. 15 | 16 | The files are: 17 | 18 | Makefile Shows some sample default rules for use 19 | in a Makefile. Try `make tree.tex tree.dvi'. 20 | Makefile.awk Like Makefile but doesn't require Icon. 21 | None of the HTML examples will be readable 22 | without Icon. 23 | breakmodel.nw A formal model of breakpoints using the 24 | Promela modeling language. 25 | dag.nw Fragment of an Icon program that compiles 26 | patterns into decision-tree pattern-matching 27 | code. tree.nw builds the decision trees; 28 | dag.nw turns them into dags. 29 | graphs.nw Several graphs written in jgraph (write 30 | plank@cs.utk.edu for information about jgraph). 31 | mipscoder.nw Part of the original MIPS code generator from 32 | Standard ML of New Jersey. Writting in Standard ML. 33 | primes.nw noweb version of DEK's original prime-number program. 34 | scanner.nw Part of a student compiler project. Includes 35 | C code and lex and yacc specifications, all in 36 | a single file. 37 | sharpline A noweb filter that makes noweb `see' #line directives 38 | in a noweb file. 39 | test.nw A simple test file. 40 | tree.nw Fragment of an Icon program that compiles 41 | patterns into decision-tree pattern-matching 42 | code. tree.nw builds the decision trees; 43 | dag.nw turns them into dags. 44 | wc.nw A re-implementation in noweb of the CWEB 45 | example from DEK's book. This example is 46 | intended to be as exact a copy as possible; no 47 | attempt was made to improve the code. 48 | whitespace A noweb filter that makes whitespace insignificant 49 | within chunk names. 50 | -------------------------------------------------------------------------------- /examples/sharpline: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # noweb filter to handle #line directives in noweb input 4 | # 5 | # sample usage: 6 | # 7 | # preprocessor files | notangle -L -filter sharpline - > result.c 8 | # 9 | 10 | nawk ' 11 | BEGIN { linestart = 1 } 12 | /^(@nl|@index nl)$/ { linestart = 1; print; next } 13 | /^@text #line +[0-9]+$/ { 14 | if (linestart) 15 | printf "@line %d\n", $3 16 | else 17 | print 18 | linestart = 0; next 19 | } 20 | /^@text #line +[0-9]+ +".*"$/ { 21 | if (linestart) { 22 | thisline = $3 23 | sub(/^@text #line +[0-9]+ +/, "") 24 | thisfile = substr($0, 2, length($0) - 2) 25 | printf "@file %s\n@line %d\n", thisfile, thisline 26 | } else 27 | print 28 | linestart = 0; next 29 | } 30 | /^@(text |quote )/ { linestart = 0 } 31 | { print }' "$@" 32 | -------------------------------------------------------------------------------- /examples/test.nw: -------------------------------------------------------------------------------- 1 | % Copyright 1991 by Norman Ramsey. All rights reserved. 2 | % See file COPYRIGHT for more information. 3 | <<*>>= 4 | one <> <> # uses two and three 5 | @ %def one 6 | <>= 7 | first of two 8 | second of two 9 | third of two 10 | @ %def fish fowl duck 11 | @ %def two 12 | <>= 13 | first of three 14 | second of three 15 | third of three 16 | @ %def three 17 | 18 | -------------------------------------------------------------------------------- /examples/whitespace: -------------------------------------------------------------------------------- 1 | 2 | # whitespace -- noweb filter to make multiple whitespace 3 | # characters equivalent to a single space, so that 4 | # << Hello World>>, <>, 5 | # and <> all refer to the chunk 6 | # <> 7 | 8 | sed -e '/^@use /s/[ \t][ \t]*/ /g' -e '/^@defn /s/[ \t][ \t]*/ /g' \ 9 | -e '/^@use /s/[ \t]*$//g' -e '/^@defn /s/[ \t]*$//g' 10 | 11 | -------------------------------------------------------------------------------- /nwsrcfilter.icn: -------------------------------------------------------------------------------- 1 | # nwsrcfilter -- filter out irrelevant files, put .nw files first 2 | 3 | procedure main(args) 4 | while line := read() do 5 | if not (line[-1] == "~" | line == "." | find("/RCS", line) | 6 | match("./.git", line) | find("/.#", line) | 7 | find("/.gitignore", line) | 8 | (line ? (tab(find("./binaries/")), move(1))) | 9 | line[3] == line[-1] == "#" | line == "./nwsrcfilter") then 10 | line ? (="./" & save_file(tab(0))) 11 | dump_files() 12 | end 13 | 14 | global root 15 | 16 | global files_in_input 17 | 18 | procedure save_file(name) 19 | initial {root := table(); files_in_input := set()} 20 | insert(files_in_input, name) 21 | name ? do_save(root) 22 | return 23 | end 24 | 25 | procedure do_save(root) 26 | if key := tab(upto('/')) & tab(many('/')) then { 27 | /root[key] := table() 28 | do_save(root[key]) 29 | } else 30 | /root[tab(0)] := table() 31 | end 32 | 33 | procedure dump_files(prefix, r) 34 | /prefix := "" 35 | /r := root 36 | if *r = 0 then return 37 | l := sort(r) 38 | bubblenw(l) 39 | every p := !l do 40 | if *p[2] > 0 then { 41 | dump_files(prefix || p[1] || "/", p[2]) 42 | if member(files_in_input, prefix || p[1]) then write(prefix, p[1]) 43 | # only dump directories if they were given explicitly 44 | } else { 45 | write(prefix, p[1]) 46 | } 47 | end 48 | 49 | procedure bubblenw(l) 50 | lo := 1 # first non-nw 51 | while l[lo][1][-3:0] == ".nw" do lo +:= 1 52 | hi := lo +1 # first succeeding nw 53 | while l[hi][1][-3:0] ~== ".nw" do hi +:= 1 54 | while hi <= *l do { 55 | i := hi 56 | while i > lo do {l[i] :=: l[i-1]; i -:= 1} 57 | lo +:= 1 58 | hi +:= 1 59 | while l[hi][1][-3:0] ~== ".nw" do hi +:= 1 60 | } 61 | return l 62 | end 63 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | /texhash 2 | /solmake 3 | -------------------------------------------------------------------------------- /src/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Noweb is copyright 1989-2000 by Norman Ramsey. All rights reserved. 2 | 3 | Noweb is protected by copyright. It is not public-domain 4 | software or shareware, and it is not protected by a ``copyleft'' 5 | agreement like the one used by the Free Software Foundation. 6 | 7 | You may use and distribute noweb for any purpose, for free. You may 8 | redistribute noweb in whole or in part provided you acknowledge its 9 | source and include this COPYRIGHT file. You may modify noweb and 10 | create derived works, provided you retain this copyright notice, but 11 | the result may not be called noweb without my written consent. 12 | 13 | You may sell noweb if you wish. For example, you may sell a CD-ROM 14 | including noweb. 15 | 16 | You may use noweb in products as long as you charge for only those 17 | components that are entirely your own and you acknowledge the use of 18 | noweb clearly in all product documentation and distribution media. You 19 | must state clearly that your product uses or is based on noweb and 20 | that noweb is available free of change. You must also request that 21 | bug reports on your product be reported to you. 22 | -------------------------------------------------------------------------------- /src/HPUX: -------------------------------------------------------------------------------- 1 | HPUX awk has bugs. I recommend that you use Brian Kernighan's 2 | implementation of awk, which is available for free from AT&T. 3 | Try http://cm.bell-labs.com/who/bwk/. 4 | 5 | If you must use HPUX awk, Steven Ooms kindly provided the following 6 | changes to the awk script "totex". The problem lines are all situated 7 | in the function "indexlabel( ident, l )": 8 | 9 | ---------------start included text--------------- 10 | totex: gsub(/{/, ":lb", l) # left brace 11 | ... 12 | totex: gsub(/{/, "{\\char123}", arg) 13 | ... 14 | totex: gsub(/{\\char92>/, "{\\char92}", arg) 15 | ---------------end included text--------------- 16 | 17 | The corresponding new lines look as follows: 18 | 19 | ---------------start included text--------------- 20 | totex: gsub(/\{/, ":lb", l) # left brace 21 | ... 22 | totex: gsub(/\{/, "{\\char123}", arg) 23 | ... 24 | totex: gsub(/\{\\char92>/, "{\\char92}", arg) 25 | ---------------end included text--------------- 26 | 27 | Also, I'm told that in src/Makefile the strip command in an HPUX8 28 | machine causes the make to fail. Commenting out the 'strip' fixes the 29 | problem. 30 | -------------------------------------------------------------------------------- /src/INSTALL.DOS: -------------------------------------------------------------------------------- 1 | Lee Wittenburg kindly provided this account of his efforts in getting 2 | noweb working on a DOS machine using the MKS toolkit. 3 | 4 | 1. All the shell scripts without an extension required a .KSH. The 5 | makefile, of course needed to be changed accordingly. Also, the 6 | normal .o to .obj and to .exe was necessary in the 7 | makefile. No other changes were necessary, except minor ones due to 8 | bugs in MKS make. 9 | 10 | 2. Rename INSTALL to INSTALL.NIX to keep make from getting confused. 11 | 12 | 3. I changed all references to "nawk" to "awk". 13 | 14 | 4. There is a bug in MKS Awk that requires a couple of changes in 15 | NOWEAVE. There's a problem with backslashes in the 2nd argument to 16 | gsub() that requires a couple of changes to NOWEAVE. The lines 17 | 18 | gsub("\\\\", "\\\\", line) 19 | gsub("{", "\\{", line); gsub("}", "\\}", line) 20 | 21 | need to be 22 | 23 | gsub("\\\\", "\\\\\\", line) 24 | gsub("{", "\\\{", line); gsub("}", "\\\}", line) 25 | 26 | I've reported this bug to MKS (when I first found it in version 27 | 3.2), but it still hasn't been fixed. It's not a NOWEB bug, but 28 | MKS Awk NOWEB users need to know about it. 29 | 30 | 5. MKS Awk is POSIX compiliant with regard to regular expression 31 | syntax; Unix Awk isn't; GNU Awk swings both ways (I believe); other 32 | Awks I couldn't say about. This causes a problem ONLY in NOXREF. 33 | I had to change the line 34 | 35 | gsub(/[\[\]\\{} -]/, "*", key) 36 | 37 | to 38 | 39 | gsub(/[[\{} -]|\]/, "*", key) 40 | 41 | which probably won't work on a Unix Awk. There's likely to be 42 | a Unix/POSIX discrepency in Awks for quite a while. 43 | 44 | -------------------------------------------------------------------------------- /src/README: -------------------------------------------------------------------------------- 1 | These are the base sources and documents for version 2.13 of 2 | ``noweb'', a simple, extensible literate-programming tool. noweb is 3 | available from https://github.com/nrnrnr/noweb. The file INSTALL 4 | tells how to build noweb. The file FAQ answers some frequently asked 5 | questions about building and using noweb. 6 | 7 | 8 | STRUCTURE OF THE BASE SOURCES 9 | 10 | This part of the distribution contains the following directories: 11 | 12 | awk pipeline stages and back ends in awk and sh 13 | src C source code for nt, markup, and finduses 14 | icon pipeline stages and back ends in Icon 15 | lib other pipeline stages and back ends, not available in Icon 16 | rc replacements for shell scripts; useful on Plan 9 17 | shell the shell scripts that make up the actual commands 18 | tex supporting tex code for /usr/local/lib/tex/macros 19 | xdoc man pages, hacker's guide (named to be unpacked last) 20 | 21 | -------------------------------------------------------------------------------- /src/VERSIONS: -------------------------------------------------------------------------------- 1 | 2.11: Bug fix in parsing; a dozen small repairs 2 | 2.10: nountangle becomes a filter; multilanguage support; ... 3 | 2.9: Support for hyperref; many small repairs 4 | 2.8: LaTeX2e, support for HTML tables 5 | 2.7: Reads nuweb files, converts latex to HTML 6 | 2.6: HTML support, necessitating a rewrite of cross-referencer 7 | 2.5: Index of identifiers and identifier cross-reference 8 | 2.4: Icon versions of the major pipeline stages 9 | 2.0: Fully detailed pipeline representation 10 | 1: Pipelined architecture 11 | 0: Monolithic notangle; noweave as unholy awk script 12 | -------------------------------------------------------------------------------- /src/awk/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/src/awk/.gitignore -------------------------------------------------------------------------------- /src/awk/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 1993 by Norman Ramsey. All rights reserved. 2 | # See file COPYRIGHT for more information. 3 | 4 | LIB=/dev/null # must be overridden 5 | BIN=/dev/null # must be overridden 6 | SHELL=/bin/sh 7 | 8 | LIBEXECSBARE=noidx tohtml 9 | LIBEXECSDEP=totex 10 | LIBEXECS=$(LIBEXECSBARE) $(LIBEXECSDEP) 11 | BINEXECS=noindex 12 | EXECS=$(BINEXECS) $(LIBEXECS) 13 | 14 | all: $(EXECS) 15 | sources: $(EXECS) 16 | touch: $(EXECS) 17 | touch $(EXECS) 18 | boot: 19 | touch $(EXECS) 20 | 21 | install: all 22 | cp $(LIBEXECSBARE) $(LIB) 23 | for i in $(LIBEXECSDEP); do \ 24 | sed "s@|LIBDIR|@$(LIB)@" $$i > $(LIB)/$$i && chmod +x $(LIB)/$$i; \ 25 | done 26 | cp $(BINEXECS) $(BIN) 27 | 28 | uninstall: 29 | for i in $(LIBEXECS); do rm -f $(LIB)/$$i; done 30 | for i in $(BINEXECS); do rm -f $(BIN)/$$i; done 31 | 32 | source: $(EXECS) 33 | 34 | totex: totex.nw 35 | notangle -R$@ totex.nw > $@ 36 | chmod +x $@ 37 | 38 | noidx: noidx.nw 39 | notangle noidx.nw > $@ 40 | chmod +x $@ 41 | 42 | tohtml: tohtml.nw 43 | notangle tohtml.nw > $@ 44 | chmod +x $@ 45 | 46 | noindex: noindex.nw 47 | notangle -R$@ noindex.nw > $@ 48 | chmod +x $@ 49 | 50 | clean: 51 | rm -f *.log *.blg *.dvi *.toc *.aux *.tex *~ *.html 52 | clobber: clean 53 | rm -f totex noidx tohtml noindex 54 | -------------------------------------------------------------------------------- /src/awkname: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case $# in 4 | 1) ;; 5 | *) echo "Usage: `basename $0` [awk|nawk|gawk]" 1>&2; exit 1 6 | esac 7 | 8 | rc=0 9 | new=$(mktemp); old=$(mktemp) 10 | 11 | for file in lib/emptydefn lib/unmarkup lib/toascii lib/btdefn \ 12 | awk/noidx awk/totex awk/tohtml awk/noindex \ 13 | shell/noroff shell/toroff lib/pipedocs \ 14 | shell/nocount shell/nountangle shell/noweb shell/noroots 15 | do 16 | trap 'rm -f $new $old; exit 1' 1 2 15 # clean up files 17 | if sed -e "s/nawk '/$1 '/" -e "s/nawk -f/$1 -f/" -e "s/AWK=nawk/AWK=$1/" <$file >$new 18 | then 19 | cp $file $old # save original file 20 | trap 'trap "" 1 2 15; cp $old $file # ignore signals 21 | rm -f $new $old; exit 1' 1 2 15 # during restore 22 | cp $new $file 23 | else 24 | echo "awkname: failed to change $file" 1>&2 25 | rc=1 26 | fi 27 | done 28 | rm -f $new $old 29 | exit $rc 30 | 31 | -------------------------------------------------------------------------------- /src/c/.gitignore: -------------------------------------------------------------------------------- 1 | /finduses 2 | /markup 3 | /mnt 4 | /nt 5 | -------------------------------------------------------------------------------- /src/c/columns.c: -------------------------------------------------------------------------------- 1 | #line 18 "columns.nw" 2 | #include 3 | #include "columns.h" 4 | 5 | int tabsize = 8; 6 | #line 23 "columns.nw" 7 | int columnwidth (char *s) { /* width of a string in columns */ 8 | return limitcolumn(s, 0); 9 | } 10 | #line 27 "columns.nw" 11 | int limitcolumn (char *s, int col) { 12 | while (*s) { 13 | col++; 14 | if (*s=='\t' && tabsize > 0) while (col % tabsize != 0) col++; 15 | s++; 16 | } 17 | return col; 18 | } 19 | #line 36 "columns.nw" 20 | void indent_for (int width, FILE *fp) { 21 | /* write whitespace [[width]] columns wide */ 22 | /*fprintf(fp,"<%2d>",width); if (width>4) {fprintf(fp," "); width -= 4;}*/ 23 | if (tabsize > 1) 24 | while (width >= tabsize) { 25 | putc('\t', fp); 26 | width -= tabsize; 27 | } 28 | while (width > 0) { 29 | putc(' ', fp); 30 | width--; 31 | } 32 | } 33 | 34 | -------------------------------------------------------------------------------- /src/c/columns.h: -------------------------------------------------------------------------------- 1 | extern int tabsize; 2 | extern int columnwidth (char *s); /* number of columns string occupies */ 3 | extern int limitcolumn (char *s, int startcolumn); 4 | /* width of startcolumn blanks plus s */ 5 | extern void indent_for (int width, FILE *fp); 6 | /* indent to width; next char -> width+1 */ 7 | -------------------------------------------------------------------------------- /src/c/columns.nw: -------------------------------------------------------------------------------- 1 | % Copyright 1991 by Norman Ramsey. All rights reserved. 2 | % See file COPYRIGHT for more information. 3 | \subsection{Managing indentation and columns} 4 | These functions are used to help accumulate indentations across module 5 | boundaries by measuring the widths of various strings 6 | in columns. 7 | The size of things depends on [[tabsize]] as defined in columns.h. 8 | If [[tabsize == 0]], tabs shouldn't be touched on input and won't be 9 | generated on output. 10 | <
>= 11 | extern int tabsize; 12 | extern int columnwidth (char *s); /* number of columns string occupies */ 13 | extern int limitcolumn (char *s, int startcolumn); 14 | /* width of startcolumn blanks plus s */ 15 | extern void indent_for (int width, FILE *fp); 16 | /* indent to width; next char -> width+1 */ 17 | <<*>>= 18 | #include 19 | #include "columns.h" 20 | 21 | int tabsize = 8; 22 | <<*>>= 23 | int columnwidth (char *s) { /* width of a string in columns */ 24 | return limitcolumn(s, 0); 25 | } 26 | <<*>>= 27 | int limitcolumn (char *s, int col) { 28 | while (*s) { 29 | col++; 30 | if (*s=='\t' && tabsize > 0) while (col % tabsize != 0) col++; 31 | s++; 32 | } 33 | return col; 34 | } 35 | <<*>>= 36 | void indent_for (int width, FILE *fp) { 37 | /* write whitespace [[width]] columns wide */ 38 | /*fprintf(fp,"<%2d>",width); if (width>4) {fprintf(fp," "); width -= 4;}*/ 39 | if (tabsize > 1) 40 | while (width >= tabsize) { 41 | putc('\t', fp); 42 | width -= tabsize; 43 | } 44 | while (width > 0) { 45 | putc(' ', fp); 46 | width--; 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /src/c/doc.nw: -------------------------------------------------------------------------------- 1 | % $Id: doc.nw,v 1.21 2008/10/06 01:03:05 nr Exp nr $ 2 | 3 | \documentclass[twoside]{article} 4 | \usepackage{noweb,multicol} 5 | \makeatletter 6 | \newenvironment{fields}{\@fields}{\crcr\egroup\par\end{quote}} 7 | \def\@fields{\@ifnextchar[{\@@fields}{\@@fields[4in]}} 8 | \def\@@fields[#1]{\begin{quote}\catcode`\_=\other 9 | \tabskip=\leftmargin 10 | \halign\bgroup\tt##\hfil\tabskip=2em& 11 | {\hsize=#1\vtop{\noindent\raggedright\let\\=\cr 12 | \strut##\strut\par}}\tabskip=0pt\cr} 13 | \makeatother 14 | \pagestyle{noweb}\raggedbottom\noweboptions{shift} 15 | 16 | \title{{\tt noweb} Source Code\thanks{{\tt noweb} is copyright 1989--2000 by Norman Ramsey. 17 | Although it is freely available, it is not in the public domain.}} 18 | \author{Norman Ramsey\thanks{Section~\ref{preston} is the 19 | generous contribution of Preston Briggs}\\{\tt nr@eecs.harvard.edu}} 20 | \begin{document} 21 | \maketitle 22 | \section*{Preface} 23 | This isn't a real literate program---there's just enough documentation 24 | here to get the job done. 25 | One of my observations is that the cost of creating a high-quality, well-documented 26 | literate program adds 1--3 times the amount of effort it took to create the program 27 | in the first place. 28 | Most programs I write aren't worth that kind of effort, and {\tt noweb} is 29 | no exception. 30 | Don't expect too much. 31 | 32 | \tableofcontents 33 | 34 | \input{allcode.tex} 35 | 36 | \bibliographystyle{plain} 37 | \bibliography{web} 38 | 39 | \section{List of all chunks from all files} 40 | 41 | \nowebchunks 42 | 43 | \begin{multicols}{2}[\section{Index}] 44 | \nowebindex 45 | \end{multicols} 46 | 47 | \end{document} 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/c/errors.c: -------------------------------------------------------------------------------- 1 | #line 17 "errors.nw" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "errors.h" 7 | 8 | #line 32 "errors.nw" 9 | enum errorlevel errorlevel = Normal; 10 | int finalstage = 0; 11 | char *progname = NULL; 12 | #line 42 "errors.nw" 13 | void nowebexit(char *msg) { 14 | if (!finalstage && errorlevel > Normal) 15 | printf("@fatal %s %s\n", progname != NULL ? progname : "a-noweb-filter", 16 | msg != NULL ? msg : "an unspecified error occurred"); 17 | exit(errorlevel); 18 | } 19 | #line 56 "errors.nw" 20 | void errormsg(enum errorlevel level, char *s,...) { 21 | va_list args; /* see K&R, page 174 */ 22 | va_start(args,s); 23 | 24 | #line 77 "errors.nw" 25 | if (level > errorlevel) 26 | errorlevel = level; 27 | vfprintf(stderr, s, args); 28 | fprintf(stderr,"\n"); 29 | #line 60 "errors.nw" 30 | va_end(args); 31 | if (level >= Fatal) 32 | nowebexit(s); 33 | } 34 | #line 67 "errors.nw" 35 | void errorat(char *filename, int lineno, enum errorlevel level, char *s, ...) { 36 | va_list args; /* see K&R, page 174 */ 37 | va_start(args,s); 38 | fprintf(stderr, "%s:%d: ", filename, lineno); 39 | 40 | #line 77 "errors.nw" 41 | if (level > errorlevel) 42 | errorlevel = level; 43 | vfprintf(stderr, s, args); 44 | fprintf(stderr,"\n"); 45 | #line 72 "errors.nw" 46 | va_end(args); 47 | if (level >= Fatal) 48 | nowebexit(s); 49 | } 50 | -------------------------------------------------------------------------------- /src/c/errors.h: -------------------------------------------------------------------------------- 1 | enum errorlevel { Normal=0, Warning, Error, Fatal, Impossible }; 2 | extern enum errorlevel errorlevel; 3 | extern int finalstage; /* set nonzero if this main() is a final stage */ 4 | extern char *progname; /* set to name of program if main() is a filter */ 5 | extern void nowebexit(char *optional_msg); 6 | void errormsg(enum errorlevel level, char *s, ...); 7 | #define overflow(S) errormsg(Fatal,"Capacity exceeded: %s", S) 8 | #define impossible(S) errormsg(Impossible, "This can't happen: %s", S) 9 | #define checkptr(P) do { if (!(P)) overflow("memory"); } while (0) 10 | void errorat(char *filename, int lineno, enum errorlevel level, char *s, ...); 11 | -------------------------------------------------------------------------------- /src/c/fakepretty.nw: -------------------------------------------------------------------------------- 1 | \section{A fake prettyprinter} 2 | This ``prettyprinter'' builds a code brick. 3 | <<*>>= 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "pretty.h" 9 | 10 | struct prettyprinter { 11 | int column; 12 | int trailswhite; 13 | PrettyPrinterCallback callback; 14 | void *cb; 15 | }; 16 | <<*>>= 17 | static void addwhite(PrettyPrinter pp) { 18 | if (!pp->trailswhite) { 19 | pp->callback(pp->cb, STRING, " "); 20 | pp->column++; 21 | pp->trailswhite = 1; 22 | } 23 | } 24 | <<*>>= 25 | static void flushout(PrettyPrinter pp) { 26 | if (pp->column > 0) { 27 | pp->callback(pp->cb, NEWLINE, (char *)0); 28 | pp->column = 0; 29 | pp->trailswhite = 1; 30 | } 31 | } 32 | <<*>>= 33 | static void addthing(PrettyPrinter pp, Parttype type, char *contents) { 34 | addwhite(pp); 35 | if (pp->column + strlen(contents) > 70) flushout(pp); 36 | pp->callback(pp->cb, type, contents); 37 | pp->column += strlen(contents); 38 | pp->trailswhite = 0; 39 | } 40 | #define addtoken(PP,T) addthing(pp, STRING, T) 41 | #define adduse(PP,C) addthing(pp, USE_CHUNK, C) 42 | @ 43 | <<*>>= 44 | void prettyprint(PrettyPrinter pp, Parttype type, char *contents) { 45 | switch(type) { 46 | case START_OF_CHUNK: break; 47 | case END_OF_CHUNK: if (pp->column > 0) flushout(pp); break; 48 | case STRING: <> break; 49 | case USE_CHUNK: adduse(pp, contents); break; 50 | case NEWLINE: addwhite(pp); break; 51 | case WHATSIT: pp->callback(pp->cb, type, contents); break; 52 | default: assert(0); 53 | } 54 | } 55 | 56 | PrettyPrinter new_prettyprinter(PrettyPrinterCallback callback, void *closure) { 57 | PrettyPrinter pp = (PrettyPrinter) malloc(sizeof *pp); 58 | pp->callback = callback; 59 | pp->cb = closure; 60 | pp->column = 0; 61 | pp->trailswhite = 0; 62 | return pp; 63 | } 64 | @ 65 | <>= 66 | { char *p = contents; 67 | char *q; 68 | 69 | while (*p && isspace(*p)) p++; 70 | while (*p) { 71 | for (q = p; *q && !isspace(*q); q++); 72 | { char c = *q; 73 | *q = 0; 74 | addtoken(pp, p); 75 | *q = c; 76 | } 77 | p = q; 78 | while (*p && isspace(*p)) p++; 79 | } 80 | } 81 | @ 82 | 83 | 84 | -------------------------------------------------------------------------------- /src/c/getline.c: -------------------------------------------------------------------------------- 1 | #line 17 "getline.nw" 2 | #define START_SIZE 128 /* initial buffer size */ 3 | 4 | #include 5 | #include 6 | #include 7 | #include "columns.h" 8 | #include "errors.h" 9 | #include "getline.h" 10 | 11 | static char *buf1 = NULL, *buf2 = NULL; /* lines without, with tabs expanded */ 12 | static int buf_size = START_SIZE; /* size of both buffers if non-NULL */ 13 | 14 | #line 42 "getline.nw" 15 | void new_buffers(void) { 16 | checkptr(buf1 = (char *) realloc(buf1, buf_size)); 17 | checkptr(buf2 = (char *) realloc(buf2, buf_size)); 18 | } 19 | #line 47 "getline.nw" 20 | char *getline_nw (FILE *fp) { 21 | 22 | 23 | #line 82 "getline.nw" 24 | if (buf1==NULL) { 25 | checkptr(buf1 = (char *) malloc (buf_size)); 26 | checkptr(buf2 = (char *) malloc (buf_size)); 27 | } 28 | #line 50 "getline.nw" 29 | 30 | buf1=fgets(buf1, buf_size, fp); 31 | if (buf1==NULL) return buf1; /* end of file */ 32 | while (buf1[strlen(buf1)-1] != '\n') { /* failed to get whole line */ 33 | buf_size *= 2; 34 | new_buffers(); 35 | if (fgets(buf1+strlen(buf1),buf_size-strlen(buf1),fp)==NULL) 36 | return buf1; /* end of file */ 37 | } 38 | return buf1; 39 | } 40 | #line 62 "getline.nw" 41 | char *getline_expand (FILE *fp) { 42 | char *s, *t; 43 | int width; 44 | 45 | if (getline_nw(fp)==NULL) return NULL; 46 | 47 | #line 87 "getline.nw" 48 | if (columnwidth(buf1) > buf_size - 1) { 49 | while (columnwidth(buf1) > buf_size - 1) buf_size *= 2; 50 | new_buffers(); 51 | } 52 | #line 68 "getline.nw" 53 | s = buf1; t = buf2; width=0; 54 | while (*s) 55 | if (*s=='\t' && tabsize > 0) { 56 | do { 57 | *t++ = ' '; width++; 58 | } while (width % tabsize != 0); 59 | s++; 60 | } else { 61 | *t++ = *s++; width++; 62 | } 63 | *t='\0'; 64 | return buf2; 65 | } 66 | -------------------------------------------------------------------------------- /src/c/getline.h: -------------------------------------------------------------------------------- 1 | char *getline_expand (FILE *fp); 2 | /* grab a line in buffer, return new buffer or NULL for eof 3 | tabs in line are expanded according to tabsize */ 4 | char *getline_nw (FILE *fp); 5 | /* grab a line in the buffer, return a new buffer or NULL for eof 6 | no expansion of tabs */ 7 | -------------------------------------------------------------------------------- /src/c/main.c: -------------------------------------------------------------------------------- 1 | #line 7 "main.nw" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "notangle.h" 7 | #include "errors.h" 8 | #include "columns.h" 9 | #include "modules.h" 10 | #include "modtrees.h" 11 | 12 | #line 23 "main.nw" 13 | int main(int argc, char **argv) { 14 | int i; 15 | char *locformat = ""; 16 | char *Clocformat = "#line %L \"%F\"%N"; 17 | int root_options_seen = 0; 18 | 19 | tabsize = 0; /* default for nt is not to use tabs */ 20 | progname = argv[0]; 21 | finalstage = 1; 22 | 23 | for (i=1; i 3 | #include "match.h" 4 | static int matches(char *line, char *search) { 5 | return !strncmp(line,search,strlen(search)); 6 | } 7 | #line 20 "match.nw" 8 | int is_keyword(char *line, char *keyword) { 9 | char low_at_sign = '@'; 10 | return *line==low_at_sign && matches(line+1,keyword) && 11 | (line[strlen(keyword)+1]==' ' || line[strlen(keyword)+1]=='\n' || 12 | line[strlen(keyword)+1]=='\0'); 13 | } 14 | int is_begin(char *line, char *type) { 15 | return is_keyword(line,"begin") && matches(line+1+6,type); 16 | } 17 | int is_end(char *line, char *type) { 18 | return is_keyword(line,"end") && matches (line+1+4,type); 19 | } 20 | int is_index(char *line, char *type) { 21 | return is_keyword(line,"index") && matches(line+1+6,type); 22 | } 23 | -------------------------------------------------------------------------------- /src/c/match.h: -------------------------------------------------------------------------------- 1 | extern int is_keyword(char *line, char *keyword); 2 | extern int is_begin(char *line, char *type); 3 | extern int is_end(char *line, char *type); 4 | extern int is_index(char *line, char *type); 5 | -------------------------------------------------------------------------------- /src/c/match.nw: -------------------------------------------------------------------------------- 1 | \subsection{Code to recognize [[noweb]] markup on input} 2 | We recognize the input using matching functions, which can find [[@begin]], 3 | [[@end]], and other useful information. 4 | <
>= 5 | extern int is_keyword(char *line, char *keyword); 6 | extern int is_begin(char *line, char *type); 7 | extern int is_end(char *line, char *type); 8 | extern int is_index(char *line, char *type); 9 | <<*>>= 10 | #include 11 | #include "match.h" 12 | static int matches(char *line, char *search) { 13 | return !strncmp(line,search,strlen(search)); 14 | } 15 | @ 16 | On 24 March 1996, I changed this to accept zero as a terminator 17 | because I strip newlines in the prettyprinter. 18 | Too bad if we just got worse at detecting bogus filters. 19 | <<*>>= 20 | int is_keyword(char *line, char *keyword) { 21 | char low_at_sign = '@'; 22 | return *line==low_at_sign && matches(line+1,keyword) && 23 | (line[strlen(keyword)+1]==' ' || line[strlen(keyword)+1]=='\n' || 24 | line[strlen(keyword)+1]=='\0'); 25 | } 26 | int is_begin(char *line, char *type) { 27 | return is_keyword(line,"begin") && matches(line+1+6,type); 28 | } 29 | int is_end(char *line, char *type) { 30 | return is_keyword(line,"end") && matches (line+1+4,type); 31 | } 32 | int is_index(char *line, char *type) { 33 | return is_keyword(line,"index") && matches(line+1+6,type); 34 | } 35 | -------------------------------------------------------------------------------- /src/c/modtrees.c: -------------------------------------------------------------------------------- 1 | #line 14 "modtrees.nw" 2 | #include 3 | #include 4 | #include 5 | #include "strsave.h" 6 | #include "modules.h" 7 | #include "modtrees.h" 8 | #include "errors.h" 9 | 10 | typedef struct tnode { /* tree node */ 11 | struct tnode *left, *right; 12 | Module data; 13 | } TNODE; 14 | 15 | static struct tnode *root=NULL; 16 | 17 | #line 58 "modtrees.nw" 18 | static Module insert_tree(TNODE **rootptr, char *modname); 19 | static Module lookup_tree(TNODE **rootptr, char *modname); 20 | #line 31 "modtrees.nw" 21 | Module insert (char *modname) { 22 | return insert_tree (&root, modname); 23 | } 24 | 25 | static Module 26 | insert_tree(TNODE **rootptr, char *modname) { 27 | if (*rootptr==NULL) { 28 | 29 | #line 54 "modtrees.nw" 30 | checkptr(*rootptr=(struct tnode *) malloc (sizeof(struct tnode))); 31 | (*rootptr)->left = (*rootptr)->right = NULL; 32 | #line 39 "modtrees.nw" 33 | return (*rootptr)->data = newmodule(modname); 34 | } 35 | if (strcmp((*rootptr)->data->name,modname)==0) { 36 | return (*rootptr)->data; 37 | } else if (strcmp((*rootptr)->data->name,modname)<0) { 38 | return insert_tree(&((*rootptr)->left),modname); 39 | } else /* >0 */ { 40 | return insert_tree(&((*rootptr)->right),modname); 41 | } 42 | 43 | } 44 | #line 62 "modtrees.nw" 45 | Module lookup (char *modname) { 46 | return lookup_tree (&root, modname); 47 | } 48 | 49 | static Module 50 | lookup_tree(TNODE **rootptr, char *modname) { 51 | if (*rootptr==NULL) { 52 | return NULL; 53 | } 54 | if (strcmp((*rootptr)->data->name,modname)==0) { 55 | return (*rootptr)->data; 56 | } else if (strcmp((*rootptr)->data->name,modname)<0) { 57 | return lookup_tree(&((*rootptr)->left),modname); 58 | } else /* >0 */ { 59 | return lookup_tree(&((*rootptr)->right),modname); 60 | } 61 | } 62 | #line 86 "modtrees.nw" 63 | static 64 | void apply_to_tree(TNODE *p, void (*fun)(Module)) { 65 | if (p != NULL) { 66 | apply_to_tree(p->left,fun); 67 | (*fun)(p->data); 68 | apply_to_tree(p->right,fun); 69 | } 70 | } 71 | void apply_each_module(void (*fun)(Module)) { 72 | apply_to_tree(root,fun); 73 | } 74 | -------------------------------------------------------------------------------- /src/c/modtrees.h: -------------------------------------------------------------------------------- 1 | Module insert (char *modname); /* add a module to the world */ 2 | Module lookup (char *modname); /* return ptr to module or NULL */ 3 | void apply_each_module(void (*fun)(Module)); 4 | /* apply [[fun]] to each module in the tree */ 5 | -------------------------------------------------------------------------------- /src/c/modules.h: -------------------------------------------------------------------------------- 1 | typedef struct location { /* identify lines of source */ 2 | char *filename; 3 | int lineno; 4 | } Location; 5 | 6 | typedef enum parttype {STRING=1, MODULE, NEWLINE} Parttype; 7 | 8 | struct modpart { 9 | Parttype ptype; /* type of fragment: STRING, MODULE, NEWLINE */ 10 | char *contents; 11 | Location loc; /* for String, where's it from ? */ 12 | struct modpart *next; 13 | }; 14 | typedef struct module { 15 | char *name; 16 | int usecount; 17 | struct modpart *head, *tail; 18 | } *Module; 19 | Module newmodule(char *modname); /* create a new, blank module */ 20 | #define addstring(MP,S,L) add_part(MP,S,STRING,&L) 21 | /* add a string to a module definition (stripping final newline) */ 22 | #define addmodule(MP,S) add_part(MP,S,MODULE,0) 23 | /* add a module reference to a module definition (stripping final newline) */ 24 | #define addnewline(MP) add_part(MP,0,NEWLINE,0) 25 | void add_part (Module mp, char *s, Parttype type, Location *loc); 26 | typedef struct parent { 27 | Module this; 28 | struct parent *parent; 29 | } *Parent; 30 | 31 | int expand (Module mp, int indent, int partial_distance, Parent parent, 32 | char *locformat, FILE *out); 33 | /* expand a module, writing to file out */ 34 | void resetloc(void); 35 | int printloc(FILE *fp, char *fmt, Location loc, int partial); 36 | void remove_final_newline (Module mp); 37 | /* remove trailing newline that must be in module */ 38 | -------------------------------------------------------------------------------- /src/c/notangle.h: -------------------------------------------------------------------------------- 1 | void emit_module_named (FILE *out, char *rootname, char *locformat); 2 | void read_defs(FILE *in); /* read module definitions */ 3 | -------------------------------------------------------------------------------- /src/c/nwmktemp.c: -------------------------------------------------------------------------------- 1 | #line 10 "nwmktemp.nw" 2 | #define _POSIX_C_SOURCE 200809L 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #line 21 "nwmktemp.nw" 11 | static const char *tmpdir(void) { 12 | char *tmpdir = getenv("TMPDIR"); 13 | if (tmpdir && *tmpdir) 14 | return tmpdir; 15 | else 16 | return "/tmp"; 17 | } 18 | #line 29 "nwmktemp.nw" 19 | int main(int argc, char **argv) { 20 | char template[] = "nwtemp.XXXXXXXXXX"; 21 | const char *tmp = tmpdir(); 22 | char *path = malloc(strlen(tmp) + strlen(template) + 3); /* slash, newline, \0 */ 23 | int fd; 24 | 25 | assert(argc == 1); 26 | 27 | assert(path); 28 | strcpy(path, tmp); 29 | path[strlen(tmp)] = '/'; 30 | strcpy(path+strlen(tmp)+1, template); 31 | 32 | fd = mkstemp(path); 33 | if (fd < 0) { 34 | perror(argv[0]); 35 | free(path); 36 | return 1; 37 | } else { 38 | printf("%s\n", path); 39 | free(path); 40 | close(fd); 41 | return 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/c/nwmktemp.nw: -------------------------------------------------------------------------------- 1 | % -*- mode: Noweb; noweb-code-mode: c-mode -*- 2 | % Copyright 2018 by Norman Ramsey. All rights reserved. 3 | % See file COPYRIGHT for more information. 4 | 5 | \section{Temporary files} 6 | 7 | Noweb's shell scripts need a way to create a temporary file, securely. 8 | This program is a thin wrapper around [[mkstemp]]. 9 | <<*>>= 10 | #define _POSIX_C_SOURCE 200809L 11 | 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | @ 19 | Find a temporary directory. 20 | <<*>>= 21 | static const char *tmpdir(void) { 22 | char *tmpdir = getenv("TMPDIR"); 23 | if (tmpdir && *tmpdir) 24 | return tmpdir; 25 | else 26 | return "/tmp"; 27 | } 28 | <<*>>= 29 | int main(int argc, char **argv) { 30 | char template[] = "nwtemp.XXXXXXXXXX"; 31 | const char *tmp = tmpdir(); 32 | char *path = malloc(strlen(tmp) + strlen(template) + 3); /* slash, newline, \0 */ 33 | int fd; 34 | 35 | assert(argc == 1); 36 | 37 | assert(path); 38 | strcpy(path, tmp); 39 | path[strlen(tmp)] = '/'; 40 | strcpy(path+strlen(tmp)+1, template); 41 | 42 | fd = mkstemp(path); 43 | if (fd < 0) { 44 | perror(argv[0]); 45 | free(path); 46 | return 1; 47 | } else { 48 | printf("%s\n", path); 49 | free(path); 50 | close(fd); 51 | return 0; 52 | } 53 | } 54 | @ 55 | -------------------------------------------------------------------------------- /src/c/readme.nw: -------------------------------------------------------------------------------- 1 | % Copyright 1991-2018 by Norman Ramsey. All rights reserved. 2 | % See file COPYRIGHT for more information. 3 | % $Id: readme.nw,v 2.19 2008/10/06 01:03:05 nr Exp nr $ 4 | 5 | Guidebook. 6 | 7 | Here's a breakdown of files by function. 8 | 9 | columns.nw Used to help accumulate indentations across module 10 | boundaries by measuring the widths of various strings 11 | in columns. Depends on your notion of tabs. 12 | 13 | errors.nw Functions that issue error messages. 14 | 15 | getline.nw Used to read text a line at a time, no matter how 16 | long lines might be. 17 | 18 | main.nw Process options and so on before calling notangle. 19 | 20 | markup.nw Encapsulates all the definitions of how things are 21 | labeled in the text: what is a module definition, 22 | what terminates it, and so on. 23 | 24 | modtrees.nw Provides a table of modules with insert and lookup 25 | (no delete). Also can apply an arbitrary function 26 | to each module in the table. 27 | 28 | modules.nw Defines the abstraction of a module and the operations 29 | on it. 30 | 31 | notangle.nw Reads a text on one file and writes a program on another. 32 | Works by reading module definitions, then expanding 33 | the module ``*''. 34 | 35 | strsave.nw Return a pointer to a fresh copy of a string. 36 | 37 | 38 | @ History of features. 39 | 40 | 2 Feb 89: improve the visual quality of the output by removing the trailing 41 | newline from every module and by tracking indentation. 42 | 43 | 9 Feb 89: parameterize notangle by the name of the root module, and 44 | make it a command line option. This will help in writing 45 | multiple outputs from a single input. 46 | 47 | 21 Mar 89: Make markup front end for noweave and notangle. 48 | This breaks passing of options for notangle. 49 | Tough. 50 | 51 | Much improved cleanliness of implementation. 52 | 53 | ?? ??? 90: Track string locations for emitting \#line pragmas 54 | 55 | Summer 91: Version 2: second syntax for tools, added noroots. 56 | 57 | 58 | @ Bugs. 59 | There's no distinction between errors and warnings. 60 | 61 | Also see the man page. 62 | -------------------------------------------------------------------------------- /src/c/recognize.h: -------------------------------------------------------------------------------- 1 | typedef struct recognizer *Recognizer; 2 | typedef void (*Callback) (void *closure, char *id, char *instance); 3 | Recognizer new_recognizer(char *alphanum, char *symbols); 4 | void add_ident(Recognizer r, char *id); 5 | void stop_adding(Recognizer r); 6 | void search_for_ident(Recognizer r, char *input, Callback f, void *closure); 7 | -------------------------------------------------------------------------------- /src/c/strsave.c: -------------------------------------------------------------------------------- 1 | #line 6 "strsave.nw" 2 | #include 3 | #include 4 | #include 5 | #include "strsave.h" 6 | #include "errors.h" 7 | 8 | char *strsave (char *s) { 9 | char *t = malloc (strlen(s)+1); 10 | checkptr(t); 11 | strcpy(t,s); 12 | return t; 13 | } 14 | -------------------------------------------------------------------------------- /src/c/strsave.h: -------------------------------------------------------------------------------- 1 | char *strsave (char *s); /* returns a pointer to a fresh copy of s */ 2 | -------------------------------------------------------------------------------- /src/c/strsave.nw: -------------------------------------------------------------------------------- 1 | % Copyright 1991 by Norman Ramsey. All rights reserved. 2 | % See file COPYRIGHT for more information. 3 | <
>= 4 | char *strsave (char *s); /* returns a pointer to a fresh copy of s */ 5 | <<*>>= 6 | #include 7 | #include 8 | #include 9 | #include "strsave.h" 10 | #include "errors.h" 11 | 12 | char *strsave (char *s) { 13 | char *t = malloc (strlen(s)+1); 14 | checkptr(t); 15 | strcpy(t,s); 16 | return t; 17 | } 18 | -------------------------------------------------------------------------------- /src/csmake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ $# -eq 0 ]; then set all install; fi # "$@" breaks make for empty args 3 | make CC=gcc BIN=/homes/nr/pkg/noweb/bin LIB=/homes/nr/pkg/noweb/lib MAN=/homes/nr/pkg/noweb/man TEXINPUTS=/homes/nr/pkg/tex/inputs "$@" 4 | -------------------------------------------------------------------------------- /src/gitversion: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case $1 in 4 | -prefix) prefix="Git version: " ;; 5 | *) prefix="" ;; 6 | esac 7 | 8 | notversioned="${prefix}Not under Git versioning" 9 | 10 | search=. 11 | 12 | while [ ! -r "$search/.gitversionmark" ]; do 13 | search="$search/.." 14 | case $search in 15 | ./../../../../../../..*) echo "$0: Cannot find git version mark" 16 | echo "$notversioned" 17 | exit 18 | ;; 19 | esac 20 | done 21 | 22 | if [ -r "$search/.git/refs/heads/master" ]; then 23 | echo "$prefix$(git describe --abbrev=20 --dirty --always --tags)" 24 | else 25 | echo "$notversioned" 26 | fi 27 | -------------------------------------------------------------------------------- /src/icon/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/src/icon/.gitignore -------------------------------------------------------------------------------- /src/icon/asdldefs.nw: -------------------------------------------------------------------------------- 1 | % -*- mode: Noweb; noweb-code-mode: icon-mode -*- 2 | \section{Finding definitions in $\lambda$-RTL} 3 | <<*>>= 4 | procedure main(args) 5 | go() 6 | end 7 | <<*>>= 8 | global idchars 9 | procedure postpass(name, arg) 10 | static kind 11 | initial { idchars := &letters ++ &digits ++ '_.' 12 | kind := "bogus" 13 | } 14 | case name of { 15 | "begin" : arg ? kind := tab(upto(' ')|0) 16 | "text" : if kind == "code" then (arg || "--") ? (tab(find("--") \ 1) ? { 17 | if (optwhite(), any(&lcase), t := tab(many(idchars)), optwhite(), ="=") 18 | then 19 | undotted(t) 20 | while tab(upto(idchars)) do 21 | if (="imports", any(' \t')) then 22 | (tab(upto(idchars)), tab(many(idchars))) 23 | else if any(&ucase) then undotted(tab(many(idchars))) 24 | else tab(many(idchars)) 25 | }) 26 | } 27 | return 28 | end 29 | 30 | procedure undotted(s) 31 | return if upto('.', s) then &null else writedefn(s) 32 | end 33 | 34 | procedure prepass(name, arg) 35 | if name == "end" then writedefn(&null) # force newline 36 | end 37 | 38 | procedure optwhite() 39 | suspend tab(many(' \t')) | "" 40 | end 41 | <<*>>= 42 | procedure rcsinfo () 43 | return "$Id: asdldefs.nw,v 1.15 2008/10/06 01:03:05 nr Exp nr $" || 44 | "$Name: v2_12 $" 45 | end 46 | @ 47 | -------------------------------------------------------------------------------- /src/icon/defns.nw: -------------------------------------------------------------------------------- 1 | <<*>>= 2 | procedure go() 3 | local line 4 | while line := read() do { 5 | apply(prepass, line) 6 | write(line) 7 | if match("@fatal ", line) then exit(1) 8 | apply(postpass, line) 9 | } 10 | end 11 | 12 | procedure apply(pass, line) 13 | line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) 14 | end 15 | @ 16 | [[indextext]] is a hack to introduce suitable ``[[@index nl]],'' but it 17 | messes up the line counts! 18 | <<*>>= 19 | procedure writedefn(defn, locl) 20 | static indextext 21 | initial indextext := "" 22 | if /defn then 23 | *indextext > 0 & <> 24 | else { 25 | if *indextext + *defn > 65 then <> 26 | write(if \locl then "@index localdefn " else "@index defn ", defn) 27 | indextext ||:= " " || defn 28 | } 29 | return 30 | end 31 | <>= 32 | { # write("@index nl") # don't! 33 | indextext := "" 34 | } 35 | <<*>>= 36 | procedure rcsinfo_too () 37 | return "$Id: defns.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 38 | "$Name: v2_12 $" 39 | end 40 | @ 41 | -------------------------------------------------------------------------------- /src/icon/disambiguate.icn: -------------------------------------------------------------------------------- 1 | #line 7 "disambiguate.nw" 2 | global chunknames 3 | 4 | procedure remember(name) 5 | initial chunknames := table() 6 | if *name = 0 then fail 7 | /chunknames[name[1]] := set() 8 | insert(chunknames[name[1]], name) 9 | return 10 | end 11 | #line 20 "disambiguate.nw" 12 | procedure disambiguate(arg) 13 | local s 14 | if *arg = 0 then fail 15 | search := chunknames[arg[1]] 16 | if /search then fatal("Can't resolve ", arg, "...") 17 | every match(arg, n := !search) do 18 | if /s then s := n 19 | else fatal("Ambiguous abbreviation: <<", arg, "...>> could denote\n\t<<", 20 | s, ">> or\n\t<<", n, ">>") 21 | if *s = 0 then fatal("Can't resolve ", arg, "...") 22 | return s 23 | end 24 | #line 35 "disambiguate.nw" 25 | global lines, defns, uses, names, firstdefnout 26 | 27 | procedure main(args) 28 | lines := [] 29 | while put(lines, line := read()) do 30 | apply(pass1, line) 31 | every apply(pass2, !lines) 32 | end 33 | 34 | procedure apply(pass, line) 35 | line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) 36 | end 37 | 38 | procedure pass1(name, chunkname) 39 | initial chunknames := set() 40 | case name of { 41 | "defn" | "use" : 42 | if chunkname[0-:3] ~== "..." then remember(chunkname) 43 | } 44 | return 45 | end 46 | 47 | procedure pass2(name, arg) 48 | case name of { 49 | "defn" | "use" : 50 | if arg[0:-3] == "..." then arg := disambiguate(arg[1:-3]) 51 | } 52 | write("@", name, (" " || \arg) | "") 53 | if name == "fatal" then exit(1) 54 | return 55 | end 56 | #line 68 "disambiguate.nw" 57 | procedure fatal(L[]) 58 | write!(["@fatal disambiguate "] ||| L) 59 | write!([&errout, "noweb error in disambiguate: "] ||| L) 60 | exit(1) 61 | end 62 | 63 | #line 75 "disambiguate.nw" 64 | procedure rcsinfo () 65 | return "$Id: disambiguate.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 66 | "$Name: v2_12 $" 67 | end 68 | -------------------------------------------------------------------------------- /src/icon/disambiguate.nw: -------------------------------------------------------------------------------- 1 | \section{Disambiguating abbreviated chunk names} 2 | This code disambiguates chunk names ending in [[...]]. 3 | If used, it belongs right after [[markup]] in the pipeline. 4 | 5 | The first pass calls [[remember]] on each name {\em not} ending in dots. 6 | For efficiency, I keep a table of sets indexed by the first character of the name. 7 | <<*>>= 8 | global chunknames 9 | 10 | procedure remember(name) 11 | initial chunknames := table() 12 | if *name = 0 then fail 13 | /chunknames[name[1]] := set() 14 | insert(chunknames[name[1]], name) 15 | return 16 | end 17 | @ 18 | 19 | The second pass calls [[disambiguate]] on each name that {\em does} end in dots. 20 | <<*>>= 21 | procedure disambiguate(arg) 22 | local s 23 | if *arg = 0 then fail 24 | search := chunknames[arg[1]] 25 | if /search then fatal("Can't resolve ", arg, "...") 26 | every match(arg, n := !search) do 27 | if /s then s := n 28 | else fatal("Ambiguous abbreviation: @<<", arg, "...@>> could denote\n\t@<<", 29 | s, "@>> or\n\t@<<", n, "@>>") 30 | if *s = 0 then fatal("Can't resolve ", arg, "...") 31 | return s 32 | end 33 | @ 34 | The 35 | <<*>>= 36 | global lines, defns, uses, names, firstdefnout 37 | 38 | procedure main(args) 39 | lines := [] 40 | while put(lines, line := read()) do 41 | apply(pass1, line) 42 | every apply(pass2, !lines) 43 | end 44 | 45 | procedure apply(pass, line) 46 | line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) 47 | end 48 | 49 | procedure pass1(name, chunkname) 50 | initial chunknames := set() 51 | case name of { 52 | "defn" | "use" : 53 | if chunkname[0-:3] ~== "..." then remember(chunkname) 54 | } 55 | return 56 | end 57 | 58 | procedure pass2(name, arg) 59 | case name of { 60 | "defn" | "use" : 61 | if arg[0:-3] == "..." then arg := disambiguate(arg[1:-3]) 62 | } 63 | write("@", name, (" " || \arg) | "") 64 | if name == "fatal" then exit(1) 65 | return 66 | end 67 | @ 68 | <<*>>= 69 | procedure fatal(L[]) 70 | write!(["@fatal disambiguate "] ||| L) 71 | write!([&errout, "noweb error in disambiguate: "] ||| L) 72 | exit(1) 73 | end 74 | 75 | <<*>>= 76 | procedure rcsinfo () 77 | return "$Id: disambiguate.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 78 | "$Name: v2_12 $" 79 | end 80 | @ 81 | -------------------------------------------------------------------------------- /src/icon/elide.icn: -------------------------------------------------------------------------------- 1 | #line 17 "elide.nw" 2 | procedure main(args) 3 | elide := [] 4 | every put(elide, globpat(!args)) 5 | while line := read() do 6 | if match("@begin code ", line) then 7 | { 8 | #line 35 "elide.nw" 9 | accum := [line] 10 | while line := read() & not match("@defn ", line) do 11 | put(accum, line) 12 | line ? { 13 | ="@defn " | fatal("This can't happen") 14 | if globmatch(!elide) then { 15 | while line := get(accum) | read() & not match("@end code ", line) do # drain 16 | if line == "@nl" then write("@index nl") # grotesque, but may keep lines right 17 | } else 18 | every write(!accum | line) 19 | } 20 | #line 22 "elide.nw" 21 | } 22 | else { 23 | write(line) 24 | if match("@fatal ", line) then exit(1) 25 | } 26 | return 27 | end 28 | #line 61 "elide.nw" 29 | procedure globpat(s) 30 | static specials 31 | initial specials := '?*\\' 32 | l := [] 33 | s ? 34 | while not pos(0) do 35 | put(l, 36 | if not any(specials) then 37 | tab(upto(specials)|0) 38 | else case move(1) of { 39 | "?" : &cset 40 | "*" : &null 41 | "\\" : move(1) 42 | }) 43 | return l 44 | end 45 | #line 82 "elide.nw" 46 | procedure doglobmatch(pat, i) 47 | local p 48 | suspend if p := pat[i] then 49 | case type(p) of { 50 | "string" : =p 51 | "cset" : tab(any(p)) 52 | "null" : tab(&pos to *&subject+1) 53 | } || doglobmatch(pat, i+1) 54 | else (pos(0), "") 55 | end 56 | #line 96 "elide.nw" 57 | procedure globmatch(pattern, s) 58 | return if \s then s ? doglobmatch(pattern, 1) 59 | else doglobmatch(pattern, 1) 60 | end 61 | #line 101 "elide.nw" 62 | procedure fatal(L[]) 63 | write!(["@fatal elide "] ||| L) 64 | write!([&errout, "noweb error in elide: "] ||| L) 65 | exit(1) 66 | end 67 | #line 107 "elide.nw" 68 | procedure rcsinfo () 69 | return "$Id: elide.nw,v 1.19 2008/10/06 01:03:05 nr Exp nr $" || 70 | "$Name: v2_12 $" 71 | end 72 | -------------------------------------------------------------------------------- /src/icon/icondefs.icn: -------------------------------------------------------------------------------- 1 | #line 2 "icondefs.nw" 2 | global showlocal 3 | procedure main(args) 4 | showlocal := !args == "-local" 5 | go() 6 | end 7 | #line 8 "icondefs.nw" 8 | procedure postpass(name, arg) 9 | static kind, definers 10 | initial { kind := "bogus" 11 | definers := ["global"] 12 | if \showlocal then every put(definers, "local" | "static") 13 | } 14 | case name of { 15 | "begin" : arg ? kind := tab(upto(' ')|0) 16 | "text" : if kind == "code" then arg ? 17 | if =("procedure "|"record ") then { 18 | tab(many(' ')) 19 | writedefn(tab(upto(' ()'))) 20 | } else if (tab(many(' ')) | "", =!definers, tab(many(' '))) then { 21 | while (not any('#')) & writedefn(tab(upto(', #'))) do tab(many(', ')) 22 | if not any('#') then writedefn(tab(0)) 23 | } 24 | } 25 | return 26 | end 27 | 28 | procedure prepass(name, arg) 29 | if name == "end" then writedefn(&null) # force newline 30 | end 31 | #line 32 "icondefs.nw" 32 | procedure rcsinfo () 33 | return "$Id: icondefs.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 34 | "$Name: v2_12 $" 35 | end 36 | #line 1 "defns.nw" 37 | procedure go() 38 | local line 39 | while line := read() do { 40 | apply(prepass, line) 41 | write(line) 42 | if match("@fatal ", line) then exit(1) 43 | apply(postpass, line) 44 | } 45 | end 46 | 47 | procedure apply(pass, line) 48 | line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) 49 | end 50 | #line 18 "defns.nw" 51 | procedure writedefn(defn, locl) 52 | static indextext 53 | initial indextext := "" 54 | if /defn then 55 | *indextext > 0 & 56 | #line 31 "defns.nw" 57 | { # write("@index nl") # don't! 58 | indextext := "" 59 | } 60 | #line 23 "defns.nw" 61 | else { 62 | if *indextext + *defn > 65 then 63 | #line 31 "defns.nw" 64 | { # write("@index nl") # don't! 65 | indextext := "" 66 | } 67 | #line 25 "defns.nw" 68 | write(if \locl then "@index localdefn " else "@index defn ", defn) 69 | indextext ||:= " " || defn 70 | } 71 | return 72 | end 73 | #line 35 "defns.nw" 74 | procedure rcsinfo_too () 75 | return "$Id: defns.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 76 | "$Name: v2_12 $" 77 | end 78 | -------------------------------------------------------------------------------- /src/icon/icondefs.nw: -------------------------------------------------------------------------------- 1 | \section{Finding Icon definitions} 2 | <<*>>= 3 | global showlocal 4 | procedure main(args) 5 | showlocal := !args == "-local" 6 | go() 7 | end 8 | <<*>>= 9 | procedure postpass(name, arg) 10 | static kind, definers 11 | initial { kind := "bogus" 12 | definers := ["global"] 13 | if \showlocal then every put(definers, "local" | "static") 14 | } 15 | case name of { 16 | "begin" : arg ? kind := tab(upto(' ')|0) 17 | "text" : if kind == "code" then arg ? 18 | if =("procedure "|"record ") then { 19 | tab(many(' ')) 20 | writedefn(tab(upto(' ()'))) 21 | } else if (tab(many(' ')) | "", =!definers, tab(many(' '))) then { 22 | while (not any('#')) & writedefn(tab(upto(', #'))) do tab(many(', ')) 23 | if not any('#') then writedefn(tab(0)) 24 | } 25 | } 26 | return 27 | end 28 | 29 | procedure prepass(name, arg) 30 | if name == "end" then writedefn(&null) # force newline 31 | end 32 | <<*>>= 33 | procedure rcsinfo () 34 | return "$Id: icondefs.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 35 | "$Name: v2_12 $" 36 | end 37 | @ 38 | -------------------------------------------------------------------------------- /src/icon/lrtldefs.nw: -------------------------------------------------------------------------------- 1 | % -*- mode: Noweb; noweb-code-mode: icon-mode -*- 2 | \section{Finding definitions in $\lambda$-RTL} 3 | <<*>>= 4 | procedure main(args) 5 | go() 6 | end 7 | <<*>>= 8 | procedure postpass(name, arg) 9 | static kind, definers 10 | initial { kind := "bogus" 11 | definers := ["fun", "val", "structure", "signature", 12 | "type", "rtlop"] 13 | } 14 | case name of { 15 | "begin" : arg ? kind := tab(upto(' ')|0) 16 | "text" : if kind == "code" then arg ? 17 | if =(""|" "|" ") & =!definers & tab(many(' ')) then { 18 | skiptyvars(); optwhite() 19 | if ="[" then 20 | while define_id() 21 | else 22 | define_id() 23 | } 24 | } 25 | return 26 | end 27 | 28 | procedure define_id() 29 | static id1, id2, reserved 30 | initial { id1 := &letters ++ &digits ++ '\'_' 31 | id2 := '!%&$+-/:<=>?@\\~^|#*`' 32 | reserved := set() 33 | every insert(reserved, !"*|:=#_" | "->" | "=>") 34 | } 35 | optwhite() 36 | if id := tab(many(id1 | id2)) then { 37 | member(reserved, id) | writedefn(id) 38 | return id 39 | } 40 | fail 41 | end 42 | 43 | procedure prepass(name, arg) 44 | if name == "end" then writedefn(&null) # force newline 45 | end 46 | 47 | procedure skiptyvars() 48 | suspend =("'"|"#") || tab(many(&letters ++ &digits ++ '\'_')) | 49 | ="(" || bal(')', '(', ')') || =")" 50 | end 51 | 52 | procedure optwhite() 53 | suspend tab(many(' \t')) | "" 54 | end 55 | <<*>>= 56 | procedure rcsinfo () 57 | return "$Id: lrtldefs.nw,v 1.17 2008/10/06 01:03:05 nr Exp nr $" || 58 | "$Name: v2_12 $" 59 | end 60 | @ 61 | -------------------------------------------------------------------------------- /src/icon/mmixdefs.icn: -------------------------------------------------------------------------------- 1 | #line 3 "mmixdefs.nw" 2 | procedure main(args) 3 | go() 4 | end 5 | #line 7 "mmixdefs.nw" 6 | global idchars 7 | procedure postpass(name, arg) 8 | static kind, lets 9 | initial { idchars := &letters ++ &digits ++ '_:' 10 | lets := &letters ++ '_' 11 | kind := "bogus" 12 | } 13 | case name of { 14 | "begin" : arg ? kind := tab(upto(' ')|0) 15 | "text" : if kind == "code" then arg ? 16 | if (any(lets), t := tab(many(idchars)), any('\t ')) then 17 | writedefn(t) 18 | } 19 | return 20 | end 21 | 22 | procedure prepass(name, arg) 23 | if name == "end" then writedefn(&null) # force newline 24 | end 25 | #line 27 "mmixdefs.nw" 26 | procedure rcsinfo () 27 | return "$Id: mmixdefs.nw,v 1.15 2008/10/06 01:03:05 nr Exp nr $" || 28 | "$Name: v2_12 $" 29 | end 30 | #line 1 "defns.nw" 31 | procedure go() 32 | local line 33 | while line := read() do { 34 | apply(prepass, line) 35 | write(line) 36 | if match("@fatal ", line) then exit(1) 37 | apply(postpass, line) 38 | } 39 | end 40 | 41 | procedure apply(pass, line) 42 | line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) 43 | end 44 | #line 18 "defns.nw" 45 | procedure writedefn(defn, locl) 46 | static indextext 47 | initial indextext := "" 48 | if /defn then 49 | *indextext > 0 & 50 | #line 31 "defns.nw" 51 | { # write("@index nl") # don't! 52 | indextext := "" 53 | } 54 | #line 23 "defns.nw" 55 | else { 56 | if *indextext + *defn > 65 then 57 | #line 31 "defns.nw" 58 | { # write("@index nl") # don't! 59 | indextext := "" 60 | } 61 | #line 25 "defns.nw" 62 | write(if \locl then "@index localdefn " else "@index defn ", defn) 63 | indextext ||:= " " || defn 64 | } 65 | return 66 | end 67 | #line 35 "defns.nw" 68 | procedure rcsinfo_too () 69 | return "$Id: defns.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 70 | "$Name: v2_12 $" 71 | end 72 | -------------------------------------------------------------------------------- /src/icon/mmixdefs.nw: -------------------------------------------------------------------------------- 1 | % -*- mode: Noweb; noweb-code-mode: icon-mode -*- 2 | \section{Finding definitions in MMIX} 3 | <<*>>= 4 | procedure main(args) 5 | go() 6 | end 7 | <<*>>= 8 | global idchars 9 | procedure postpass(name, arg) 10 | static kind, lets 11 | initial { idchars := &letters ++ &digits ++ '_:' 12 | lets := &letters ++ '_' 13 | kind := "bogus" 14 | } 15 | case name of { 16 | "begin" : arg ? kind := tab(upto(' ')|0) 17 | "text" : if kind == "code" then arg ? 18 | if (any(lets), t := tab(many(idchars)), any('\t ')) then 19 | writedefn(t) 20 | } 21 | return 22 | end 23 | 24 | procedure prepass(name, arg) 25 | if name == "end" then writedefn(&null) # force newline 26 | end 27 | <<*>>= 28 | procedure rcsinfo () 29 | return "$Id: mmixdefs.nw,v 1.15 2008/10/06 01:03:05 nr Exp nr $" || 30 | "$Name: v2_12 $" 31 | end 32 | @ 33 | -------------------------------------------------------------------------------- /src/icon/pascaldefs.nw: -------------------------------------------------------------------------------- 1 | \section{Finding Pascal definitions} 2 | <<*>>= 3 | global showlocal 4 | procedure main(args) 5 | showlocal := !args == "-local" 6 | go() 7 | end 8 | <<*>>= 9 | procedure postpass(name, arg) 10 | static kind 11 | initial { kind := "bogus" } 12 | case name of { 13 | "begin" : arg ? kind := tab(upto(' ')|0) 14 | "text" : if kind == "code" then arg ? 15 | if (optwhite(), =("function "|"procedure "), not hasword(arg, "forward")) then{ 16 | tab(many(' ')) 17 | writedefn(tab(upto(' ():;'))) 18 | } else if (optwhite(), x := allupper(), optwhite(), ="=") then { 19 | writedefn(x) 20 | } 21 | } 22 | return 23 | end 24 | 25 | procedure prepass(name, arg) 26 | if name == "end" then writedefn(&null) # force newline 27 | end 28 | 29 | procedure words() 30 | static alnum 31 | initial alnum := &letters ++ &digits ++ '_' 32 | suspend if any(alnum) then tab(many(alnum)) 33 | else if pos(0) then fail 34 | else if tab(upto(alnum)) then words() 35 | end 36 | 37 | procedure hasword(s, w) 38 | suspend (tab(0) ? words()) == w 39 | end 40 | 41 | procedure optwhite() 42 | suspend tab(many(' \t')) | "" 43 | end 44 | 45 | procedure allupper() 46 | static uppers 47 | initial uppers := &ucase ++ &digits ++ '_' 48 | suspend tab(many(uppers)) 49 | end 50 | 51 | 52 | procedure rcsinfo () 53 | return "$Id: pascaldefs.nw,v 1.17 2008/10/06 01:03:05 nr Exp nr $" || 54 | "$Name: v2_12 $" 55 | end 56 | -------------------------------------------------------------------------------- /src/icon/pipedocs.icn: -------------------------------------------------------------------------------- 1 | #line 5 "pipedocs.nw" 2 | procedure main(args) 3 | if args[1] == "-nearcode" then 4 | nearcode := get(args) 5 | cmd := get(args) | stop("pipedocs: no command") 6 | 7 | cmd := "sed '/^@begin docs /s/[0-9][0-9]*/0/' | unmarkup | " || cmd || 8 | " | awk ' NR == 1 && /^[ \t]*$/ {next}\n{print}\n' | markup | grep -v '^@file $'" 9 | 10 | last := &null 11 | 12 | while line := read() do 13 | {## write("====> process ", image(line), "; last = ", type(last), 14 | ## "(", *\last | "?", "), lastcode = ", image(lastcode)) 15 | if match("@begin code ", line) then { 16 | if type(last) == "list" then 17 | pipeout(last, cmd) 18 | last := "code" 19 | until match("@end code ", line) do { 20 | write(line) 21 | line := read() 22 | } 23 | write(line) 24 | #write("******until completed with ", line) 25 | } else if match("@begin docs ", line) then { 26 | l := [line] 27 | until match("@end docs ", line) do 28 | put(l, line := read()) 29 | #write("******until completed with ", line) 30 | put(l, line) 31 | if /nearcode then { 32 | pipeout(l, cmd) 33 | last := &null 34 | } else if last === "code" & notblank(l) then { 35 | pipeout(l, cmd) 36 | every write("@begin docs 0" | "@nl" | "@end docs 0") 37 | last := &null 38 | } else { 39 | last := l 40 | } 41 | } else { 42 | write(line) 43 | } 44 | } 45 | return 46 | end 47 | 48 | #line 52 "pipedocs.nw" 49 | procedure pipeout(lines, cmd) 50 | f := open(cmd, "wp") 51 | every write(f, !lines) 52 | return close(f) 53 | end 54 | 55 | #line 59 "pipedocs.nw" 56 | procedure notblank(l) 57 | every x := !l do 58 | x ? 59 | if ="@nl" & pos(0) then 60 | fail 61 | else if ="@text " & { tab(many(' \t')); not(pos(0)) } then 62 | return x 63 | end 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/icon/pipedocs.nw: -------------------------------------------------------------------------------- 1 | % -*- mode: Noweb; noweb-code-mode: icon-mode -*- 2 | This code pipes documentation chunks through a command. 3 | If given option [[-nearcode]], it pipes only documentation chunks that 4 | are next to code chunks; it drops all other documentation chunks. 5 | <<*>>= 6 | procedure main(args) 7 | if args[1] == "-nearcode" then 8 | nearcode := get(args) 9 | cmd := get(args) | stop("pipedocs: no command") 10 | 11 | cmd := "sed '/^@begin docs /s/[0-9][0-9]*/0/' | unmarkup | " || cmd || 12 | " | awk ' NR == 1 && /^[ \t]*$/ {next}\n{print}\n' | markup | grep -v '^@file $'" 13 | 14 | last := &null 15 | 16 | while line := read() do 17 | {## write("====> process ", image(line), "; last = ", type(last), 18 | ## "(", *\last | "?", "), lastcode = ", image(lastcode)) 19 | if match("@begin code ", line) then { 20 | if type(last) == "list" then 21 | pipeout(last, cmd) 22 | last := "code" 23 | until match("@end code ", line) do { 24 | write(line) 25 | line := read() 26 | } 27 | write(line) 28 | #write("******until completed with ", line) 29 | } else if match("@begin docs ", line) then { 30 | l := [line] 31 | until match("@end docs ", line) do 32 | put(l, line := read()) 33 | #write("******until completed with ", line) 34 | put(l, line) 35 | if /nearcode then { 36 | pipeout(l, cmd) 37 | last := &null 38 | } else if last === "code" & notblank(l) then { 39 | pipeout(l, cmd) 40 | every write("@begin docs 0" | "@nl" | "@end docs 0") 41 | last := &null 42 | } else { 43 | last := l 44 | } 45 | } else { 46 | write(line) 47 | } 48 | } 49 | return 50 | end 51 | 52 | <<*>>= 53 | procedure pipeout(lines, cmd) 54 | f := open(cmd, "wp") 55 | every write(f, !lines) 56 | return close(f) 57 | end 58 | 59 | <<*>>= 60 | procedure notblank(l) 61 | every x := !l do 62 | x ? 63 | if ="@nl" & pos(0) then 64 | fail 65 | else if ="@text " & { tab(many(' \t')); not(pos(0)) } then 66 | return x 67 | end 68 | 69 | 70 | -------------------------------------------------------------------------------- /src/icon/promeladefs.nw: -------------------------------------------------------------------------------- 1 | \section{Finding Promela definitions} 2 | <<*>>= 3 | global showlocal 4 | procedure rcsinfo () 5 | return "$Id: promeladefs.nw,v 1.17 2008/10/06 01:03:05 nr Exp nr $" || 6 | "$Name: v2_12 $" 7 | end 8 | procedure main(args) 9 | showlocal := !args == "-local" 10 | go() 11 | end 12 | <<*>>= 13 | procedure postpass(name, arg) 14 | static kind, mtype 15 | initial { kind := "bogus" } 16 | case name of { 17 | "begin" : arg ? kind := tab(upto(' ')|0) 18 | "text" : if kind == "code" then arg ? 19 | if \mtype then 20 | mtype := write_mtypes() 21 | else if (optwhite(), =("proctype "|"chan ")) then { 22 | tab(many(' ')) 23 | writedefn(tab(upto(' ():;'))) 24 | } else if (optwhite(), ="mtype", optwhite(), ="{") then 25 | mtype := write_mtypes() 26 | } 27 | return 28 | end 29 | 30 | procedure write_mtypes() 31 | static start, alnum 32 | initial { start := &letters ++ '/,}'; alnum := &letters ++ &digits ++ '_' } 33 | optwhite() 34 | while any(start) do { 35 | if ="/*" then tab(upto("*/") | 0) 36 | else if ="," then &null 37 | else if ="}" then return &null 38 | else if any(alnum) then writedefn(tab(many(alnum))) 39 | else if pos(0) then return 1 40 | else if ="/" then return &null 41 | else { write(&errout, "bad mtype ", tab(0)); return &null } 42 | optwhite(); 43 | } 44 | return if pos(0) then 1 else &null 45 | end 46 | 47 | 48 | procedure prepass(name, arg) 49 | if name == "end" then writedefn(&null) # force newline 50 | end 51 | 52 | procedure optwhite() 53 | suspend tab(many(' \t')) | "" 54 | end 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/icon/smldefs.nw: -------------------------------------------------------------------------------- 1 | % -*- mode: Noweb; noweb-code-mode: icon-mode -*- 2 | \section{Finding definitions in Standard ML} 3 | <<*>>= 4 | procedure rcsinfo () 5 | return "$Id: smldefs.nw,v 1.19 2008/10/06 01:03:05 nr Exp nr $" || 6 | "$Name: v2_12 $" 7 | end 8 | procedure main(args) 9 | go() 10 | end 11 | <<*>>= 12 | procedure postpass(name, arg) 13 | static kind, definers, id1, id2, reserved 14 | initial { kind := "bogus" 15 | definers := ["fun", "val", "structure", "signature", "and", "functor", 16 | "type", "eqtype", "datatype", "withtype", "exception"] 17 | id1 := &letters ++ &digits ++ '\'_' 18 | id2 := '!%&$+-/:<=>?@\\~^|#*`' 19 | reserved := set() 20 | every insert(reserved, !"*|:=#_" | "->" | "=>") 21 | } 22 | case name of { 23 | "begin" : arg ? kind := tab(upto(' ')|0) 24 | "text" : if kind == "code" then arg ? 25 | if =(""|" "|" ") & =!definers & tab(many(' ')) then { 26 | skiptyvars(); optwhite() 27 | writedefn(1(id := tab(many(id1 | id2)), not member(reserved, id))) 28 | } 29 | } 30 | return 31 | end 32 | 33 | procedure prepass(name, arg) 34 | if name == "end" then writedefn(&null) # force newline 35 | end 36 | 37 | procedure skiptyvars() 38 | suspend ="'" || tab(many(&letters ++ &digits ++ '\'_')) | 39 | ="(" || tab(bal(')', '(', ')')) || =")" 40 | end 41 | 42 | procedure optwhite() 43 | suspend tab(many(' \t')) | "" 44 | end 45 | -------------------------------------------------------------------------------- /src/icon/texdefs.icn: -------------------------------------------------------------------------------- 1 | #line 2 "texdefs.nw" 2 | procedure rcsinfo () 3 | return "$Id: texdefs.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 4 | "$Name: v2_12 $" 5 | end 6 | procedure main(args) 7 | go() 8 | end 9 | #line 10 "texdefs.nw" 10 | procedure postpass(name, arg) 11 | static kind, idchars, definers, newcommand 12 | initial { kind := "bogus"; idchars := &letters ++ '@' 13 | definers := ["def", "newdimen", "newif", "newcount", "newwrite", 14 | "newbox", "global\\def", "long\\def", "gdef" ] 15 | newcommand := ["newcommand", "renewcommand"] 16 | } 17 | case name of { 18 | "begin" : arg ? kind := tab(upto(' ')|0) 19 | "text" : if kind == "code" then arg ? { 20 | if =("\\" || !definers || "\\") then 21 | writedefn("\\" || (tab(many(idchars)) | move(1))) 22 | else if =("\\" || !newcommand || "{") then 23 | writedefn(tab(upto('}'))) 24 | } 25 | } 26 | return 27 | end 28 | 29 | procedure prepass(name, arg) 30 | if name == "end" then writedefn(&null) # force newline 31 | end 32 | #line 1 "defns.nw" 33 | procedure go() 34 | local line 35 | while line := read() do { 36 | apply(prepass, line) 37 | write(line) 38 | if match("@fatal ", line) then exit(1) 39 | apply(postpass, line) 40 | } 41 | end 42 | 43 | procedure apply(pass, line) 44 | line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) 45 | end 46 | #line 18 "defns.nw" 47 | procedure writedefn(defn, locl) 48 | static indextext 49 | initial indextext := "" 50 | if /defn then 51 | *indextext > 0 & 52 | #line 31 "defns.nw" 53 | { # write("@index nl") # don't! 54 | indextext := "" 55 | } 56 | #line 23 "defns.nw" 57 | else { 58 | if *indextext + *defn > 65 then 59 | #line 31 "defns.nw" 60 | { # write("@index nl") # don't! 61 | indextext := "" 62 | } 63 | #line 25 "defns.nw" 64 | write(if \locl then "@index localdefn " else "@index defn ", defn) 65 | indextext ||:= " " || defn 66 | } 67 | return 68 | end 69 | #line 35 "defns.nw" 70 | procedure rcsinfo_too () 71 | return "$Id: defns.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 72 | "$Name: v2_12 $" 73 | end 74 | -------------------------------------------------------------------------------- /src/icon/texdefs.nw: -------------------------------------------------------------------------------- 1 | \section{Finding {\TeX} definitions} 2 | <<*>>= 3 | procedure rcsinfo () 4 | return "$Id: texdefs.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 5 | "$Name: v2_12 $" 6 | end 7 | procedure main(args) 8 | go() 9 | end 10 | <<*>>= 11 | procedure postpass(name, arg) 12 | static kind, idchars, definers, newcommand 13 | initial { kind := "bogus"; idchars := &letters ++ '@' 14 | definers := ["def", "newdimen", "newif", "newcount", "newwrite", 15 | "newbox", "global\\def", "long\\def", "gdef" ] 16 | newcommand := ["newcommand", "renewcommand"] 17 | } 18 | case name of { 19 | "begin" : arg ? kind := tab(upto(' ')|0) 20 | "text" : if kind == "code" then arg ? { 21 | if =("\\" || !definers || "\\") then 22 | writedefn("\\" || (tab(many(idchars)) | move(1))) 23 | else if =("\\" || !newcommand || "{") then 24 | writedefn(tab(upto('}'))) 25 | } 26 | } 27 | return 28 | end 29 | 30 | procedure prepass(name, arg) 31 | if name == "end" then writedefn(&null) # force newline 32 | end 33 | -------------------------------------------------------------------------------- /src/icon/yaccdefs.icn: -------------------------------------------------------------------------------- 1 | #line 2 "yaccdefs.nw" 2 | procedure rcsinfo () 3 | return "$Id: yaccdefs.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 4 | "$Name: v2_12 $" 5 | end 6 | procedure main(args) 7 | go() 8 | end 9 | 10 | procedure postpass(name, arg) 11 | static kind 12 | case name of { 13 | "begin" : arg ? kind := tab(upto(' ')|0) 14 | "text" : if kind == "code" then arg ? 15 | if id := tab(many(&letters)) then { 16 | tab(many(' \t')) 17 | if =":" & any(&letters ++ ' ([{') then writedefn(id) 18 | } 19 | } 20 | return 21 | end 22 | 23 | procedure prepass(name, arg) 24 | if name == "end" then writedefn(&null) # force newline 25 | end 26 | #line 1 "defns.nw" 27 | procedure go() 28 | local line 29 | while line := read() do { 30 | apply(prepass, line) 31 | write(line) 32 | if match("@fatal ", line) then exit(1) 33 | apply(postpass, line) 34 | } 35 | end 36 | 37 | procedure apply(pass, line) 38 | line ? (="@" & pass(tab(upto(' ')|0), if =" " then tab(0) else &null)) 39 | end 40 | #line 18 "defns.nw" 41 | procedure writedefn(defn, locl) 42 | static indextext 43 | initial indextext := "" 44 | if /defn then 45 | *indextext > 0 & 46 | #line 31 "defns.nw" 47 | { # write("@index nl") # don't! 48 | indextext := "" 49 | } 50 | #line 23 "defns.nw" 51 | else { 52 | if *indextext + *defn > 65 then 53 | #line 31 "defns.nw" 54 | { # write("@index nl") # don't! 55 | indextext := "" 56 | } 57 | #line 25 "defns.nw" 58 | write(if \locl then "@index localdefn " else "@index defn ", defn) 59 | indextext ||:= " " || defn 60 | } 61 | return 62 | end 63 | #line 35 "defns.nw" 64 | procedure rcsinfo_too () 65 | return "$Id: defns.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 66 | "$Name: v2_12 $" 67 | end 68 | -------------------------------------------------------------------------------- /src/icon/yaccdefs.nw: -------------------------------------------------------------------------------- 1 | \section{Finding {\tt yacc} definitions} 2 | <<*>>= 3 | procedure rcsinfo () 4 | return "$Id: yaccdefs.nw,v 1.18 2008/10/06 01:03:05 nr Exp nr $" || 5 | "$Name: v2_12 $" 6 | end 7 | procedure main(args) 8 | go() 9 | end 10 | 11 | procedure postpass(name, arg) 12 | static kind 13 | case name of { 14 | "begin" : arg ? kind := tab(upto(' ')|0) 15 | "text" : if kind == "code" then arg ? 16 | if id := tab(many(&letters)) then { 17 | tab(many(' \t')) 18 | if =":" & any(&letters ++ ' ([{') then writedefn(id) 19 | } 20 | } 21 | return 22 | end 23 | 24 | procedure prepass(name, arg) 25 | if name == "end" then writedefn(&null) # force newline 26 | end 27 | -------------------------------------------------------------------------------- /src/lib/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 1993 by Norman Ramsey. All rights reserved. 2 | # See file COPYRIGHT for more information. 3 | 4 | LIB=/dev/null 5 | SHELL=/bin/sh 6 | CINAME= 7 | CIMSG= 8 | RCSFILES=emptydefn toascii.nw unmarkup Makefile nwmtime pipedocs h2a btdefn 9 | 10 | all: toascii 11 | chmod +x unmarkup emptydefn nwmtime pipedocs h2a btdefn 12 | 13 | install: all 14 | cp unmarkup emptydefn toascii nwmtime btdefn $(LIB) 15 | for i in pipedocs h2a; do \ 16 | sed "s@|LIBDIR|@$(LIB)@g" $$i > $(LIB)/$$i && chmod +x $(LIB)/$$i; \ 17 | done 18 | 19 | uninstall: 20 | for i in unmarkup emptydefn toascii nwmtime pipedocs h2a btdefn; do \ 21 | rm -f $(LIB)/$$i; \ 22 | done 23 | 24 | source: toascii 25 | touch: toascii 26 | touch toascii 27 | boot: 28 | touch toascii 29 | 30 | toascii: toascii.nw 31 | notangle -R$@ toascii.nw > $@ 32 | chmod +x $@ 33 | 34 | clean: 35 | rm -f *.log *.blg *.dvi *.toc *.aux *.tex *~ 36 | clobber: clean 37 | rm -f toascii 38 | -------------------------------------------------------------------------------- /src/lib/btdefn: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # turn backticks into definitions 4 | 5 | nawk ' 6 | /^@begin code / { code = 1 } 7 | /^@end code / { code = 0 } 8 | code && /^@text .*".*`.*"/ { print; next } 9 | code && /^@text .*`/ { 10 | while (i = match($0, /`[a-zA-Z_][a-zA-Z0-9_]*/)) { 11 | id = substr($0, i+1, RLENGTH-1) 12 | sub(/`[a-zA-Z_][a-zA-Z0-9_]*/, id) 13 | print "@index defn " id 14 | } 15 | } 16 | {print}' 17 | -------------------------------------------------------------------------------- /src/lib/emptydefn: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # notangle filter that makes the definition of an empty chunk <<>>= 4 | # stand for a continuation of the previous chunk definition. 5 | 6 | nawk 'BEGIN { lastdefn = "@defn " } 7 | /^@defn $/ { print lastdefn; next } 8 | /^@defn / { lastdefn = $0 } 9 | { print }' "$@" 10 | -------------------------------------------------------------------------------- /src/lib/h2a: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | LIB=|LIBDIR| 4 | opts="-nolist" 5 | 6 | case $1 in 7 | -[0-9]*) opts="$opts -width=`expr 0 - $1`" ; shift ;; 8 | esac 9 | 10 | html=$($LIB/nwmktemp) || { echo "$0: Cannot create temporary file" >&2; exit 1; } 11 | trap 'rm -f $html; exit 1' 1 2 15 # clean up files 12 | 13 | awk ' 14 | /^ *$/ { if (NR == 1) { print ; next } } 15 | { print > "'"$html"'" }' 16 | if [ -r $html ]; then lynx -dump $opts $html | sed '1d'; fi 17 | rm -f $html 18 | -------------------------------------------------------------------------------- /src/lib/nwmtime: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # nwmtime -- emit defn of modification time of first file 4 | # 5 | 6 | eval 'exec perl -S $0 ${1+"$@"}' 7 | if $running_under_some_shell; 8 | 9 | $first = 1; 10 | while(<>) { 11 | print; 12 | if ($first && /\@file\s*(\S+)/) { 13 | $mtime_file = $1; 14 | $first = 0; 15 | } 16 | } 17 | 18 | if (!$first) { 19 | my $filename = $mtime_file; 20 | my $mtime; 21 | 22 | # localtime if you really want local time... 23 | $mtime = gmtime((stat $filename)[9]); 24 | print <>=", substr($0,7) } 23 | /^@text $/ {next} 24 | /^@text / { 25 | gsub("<<", "@<<"); 26 | gsub(">>", "@>>"); 27 | if (!(code || quoting)) { 28 | gsub(/\[\[/, "@[["); 29 | gsub(/\]\]/, "@]]"); 30 | } 31 | printf "%s", substr($0,7) 32 | dangling_text = 1 33 | } 34 | /^@quote$/ { printf("[["); dangling_text = 1; quoting = 1 } 35 | /^@endquote$/ { printf("]]"); dangling_text = 1; quoting = 0 } 36 | /^@nl$/ { printf "\n"; dangling_text = 0} 37 | 38 | /^@index defn / { 39 | if (defline == "") defline = "@ %def" 40 | defline = defline " " substr($0, 13) 41 | } 42 | /^@index nl$/ { 43 | deflines = deflines defline "\n" 44 | defline = "" 45 | } 46 | /^@use / { printf "<<%s>>", substr($0,6) 47 | dangling_text = 1 48 | }' "$@" | sed 's/^@ $/@/' 49 | -------------------------------------------------------------------------------- /src/limake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ $# -eq 0 ]; then set all install; fi # "$@" breaks make for empty args 3 | /usr/bin/make CC=gcc CFLAGS="-ansi -pedantic -O -Wall -Werror" LIBSRC=icon BIN=/usr/local/noweb/bin LIB=/usr/local/noweb/lib MAN=/usr/local/noweb/man TEXINPUTS=/usr/share/texmf/tex/plain/misc ELISP=$HOME/emacs "$@" 4 | -------------------------------------------------------------------------------- /src/nwmake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ $# -eq 0 ]; then set iconlib all install; fi # "$@" breaks make for empty args 3 | /bin/make CC=lcc CFLAGS="-A -A" BIN=/usr/local/bin LIB=/usr/local/lib/noweb MAN=/usr/local/man TEXINPUTS=/usr/local/lib/tex/inputs "$@" 4 | -------------------------------------------------------------------------------- /src/rhmake: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if [ $# -eq 0 ]; then set all install; fi # "$@" breaks make for empty args 3 | /usr/bin/make CC=lcc CFLAGS="-A" LIBSRC=icon BIN=/usr/local/noweb/bin LIB=/usr/local/noweb/lib MAN=/usr/local/noweb/man TEXINPUTS=/usr/share/texmf/tex/latex/local ELISP=$HOME/emacs "$@" 4 | -------------------------------------------------------------------------------- /src/shell/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/src/shell/.gitignore -------------------------------------------------------------------------------- /src/shell/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright 1993 by Norman Ramsey. All rights reserved. 2 | # See file COPYRIGHT for more information. 3 | SHELL=/bin/sh 4 | LIB=/usr/public/pkg/noweb/lib 5 | 6 | EXEC=noweave noweb notangle noroff toroff 7 | SRCS=$(EXEC) tmac.w 8 | RCSFILES=noweave.nw notangle.nw noweb.nw noroff.nw noroots nocount Makefile 9 | CINAME= 10 | CIMSG= 11 | 12 | all: $(SRCS) 13 | source: $(SRCS) 14 | touch: $(SRCS) 15 | touch $(SRCS) 16 | boot: 17 | touch $(SRCS) 18 | 19 | noweave: noweave.nw 20 | notangle -R$@ noweave.nw > $@ 21 | 22 | notangle: notangle.nw 23 | notangle -R$@ notangle.nw > $@ 24 | 25 | noweb: noweb.nw 26 | notangle -R$@ noweb.nw > $@ 27 | 28 | noroff toroff tmac.w: roff.nw 29 | noweb -t roff.nw 30 | 31 | clean: 32 | rm -f *.log *.blg *.dvi *.toc *.aux *.tex *~ *.nwt roff.mm 33 | clobber: clean 34 | rm -f $(SRCS) 35 | -------------------------------------------------------------------------------- /src/shell/cpif: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # cpif [ -eq -ne ] file... 4 | # copy standard input to each of the named files 5 | # if new * old is true or old doesn't exist; 6 | # * defaults to -ne 7 | 8 | PATH=/bin:/usr/bin 9 | LIB=|LIBDIR| 10 | 11 | # set -x 12 | op=-ne 13 | case "$1" in 14 | -eq|-ne) op=$1; shift ;; 15 | -*) echo 'Usage: '`basename $0`' [ -eq -ne ] file...' 1>&2; exit 2 16 | esac 17 | case $# in 18 | 0) echo 'Usage: '`basename $0`' [ -eq -ne ] file...' 1>&2; exit 2 19 | esac 20 | 21 | new=$($LIB/nwmktemp) 22 | trap 'rm -f $new; exit 1' 1 2 15 # clean up files 23 | 24 | cat >$new 25 | for i 26 | do 27 | cmp -s $new $i 28 | case $op$? in 29 | -eq0|-ne1|*2) cp $new $i || { rm -f $new; exit 1; } 30 | esac 31 | done 32 | rm -f $new 33 | -------------------------------------------------------------------------------- /src/shell/htmltoc: -------------------------------------------------------------------------------- 1 | eval 'exec perl -S $0 ${1+"$@"}' 2 | if 0; 3 | 4 | $sentinel = ""; 5 | $sentinel_end = ""; 6 | 7 | while (<>) { 8 | push(@file, $_) unless (/^$sentinel/ .. /^$sentinel_end/); 9 | push(@file, $_) if (/^$sentinel/ || /^$sentinel_end/); 10 | } 11 | 12 | $intro = -1; 13 | 14 | $outerlevel = 1; 15 | 16 | $curlevel = $outerlevel; 17 | foreach $i (0..$#file) { 18 | 19 | if ($file[$i] =~ m|$sentinel|) {$intro = $i;} 20 | 21 | next unless $file[$i] =~ m|<[hH]([23])>\s*((.*\S)*)\s*|; 22 | $nowlevel = $1; 23 | $label = $heading = $2; 24 | 25 | while ($nowlevel > $curlevel) { 26 | push(@toc, "
    \n"); 27 | $curlevel++; 28 | } 29 | while ($nowlevel < $curlevel) { 30 | push(@toc, "
\n"); 31 | $curlevel--; 32 | } 33 | if ($file[$i] =~ m/name="([^"]+)"/i) { 34 | $label = $1; 35 | $heading =~ s/name="/href="#/i; 36 | push(@toc, "
  • $heading\n"); 37 | } else { 38 | $label =~ s/\W//g; 39 | $label =~ tr/A-Z/a-z/; 40 | $label = substr($label, 0, 6) . "00"; 41 | $label++ while (defined $labels{$label}); 42 | # $file[$i] =~ s|\Q$heading\E|$&|; 43 | $file[$i] =~ s|$heading|$&|; 44 | push(@toc, qq{
  • $heading\n}); 45 | } 46 | $labels{$label}++; 47 | } 48 | $nowlevel = $outerlevel; 49 | while ($nowlevel > $curlevel) { 50 | push(@toc, "
      \n"); 51 | $curlevel++; 52 | } 53 | while ($nowlevel < $curlevel) { 54 | push(@toc, "
    \n"); 55 | $curlevel--; 56 | } 57 | 58 | if ($intro >= 0) { 59 | print @file[0..$intro]; 60 | print @toc; 61 | print @file[$intro+1 .. $#file]; 62 | } else { 63 | print @file; 64 | } 65 | 66 | 67 | -------------------------------------------------------------------------------- /src/shell/luddite: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # set -x 3 | LIB=|LIBDIR| 4 | opt= arg= 5 | comment='function comment(s) { 6 | gsub("\\*/", "* /", s) 7 | return sprintf("/* %-72s */",s) 8 | }' 9 | 10 | for i do 11 | case $i in 12 | -ml|-m3) comment='function comment(s) { 13 | gsub("\\*\\)", "* )", s) 14 | return sprintf("(* %-72s *)",s) 15 | }' ;; 16 | -awk) comment='function comment(s) { 17 | 18 | return sprintf("# %s",s) 19 | }' ;; 20 | -c) comment='function comment(s) { 21 | gsub("\\*/", "* /", s) 22 | return sprintf("/* %-72s */",s) 23 | }' ;; 24 | -L*) ;; # deliberately ignore requests for #line 25 | -*) opt="$opt '$i'" ;; 26 | *) arg="$arg '$i'" ;; 27 | esac 28 | done 29 | 30 | eval "$LIB/markup $arg" | expand | 31 | nawk 'BEGIN { line = 0; capture = 0 } 32 | '"$comment"' 33 | 34 | /^@end doc/ { capture = 0; holding[line++] = "" ; next } 35 | /^@begin doc/ { capture = 1; next } 36 | 37 | capture == 1 { holding[line++] = comment($0); next } 38 | 39 | /@name / { print 40 | print comment("<"substr($0,7)">=") # may want to omit this line 41 | for (i=0; i&2 17 | foundautodefs=$i 18 | fi 19 | done 20 | if [ -z "$foundautodefs" ]; then 21 | echo "This `basename $0` does not support -autodefs" 22 | fi 23 | ;; 24 | *) 25 | $LIB/markup "$@" | sed -n 's/^@index defn //p' 26 | ;; 27 | esac 28 | exit $? 29 | -------------------------------------------------------------------------------- /src/shell/nonu: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | LIB=|LIBDIR| 3 | # attempt to convert nuweb to noweb using sam 4 | 5 | tmp=$($LIB/nwmktemp) 6 | trap '/bin/rm -f $tmp; exit 1' 1 2 15 # clean up files 7 | cp $1 $tmp || exit 1 8 | 9 | notat='([^@]|\n)' 10 | white='[ \n]' 11 | sam -d $tmp << EOF 12 | ,x/\@\@/c/{{{the magic at sign}}}/ 13 | ,x/<>/c/{{{double right brackets}}}/ 15 | ,x/@m/c/\\nowebchunks/ 16 | ,x/@u/c/\\nowebindex/ 17 | ,x/\@[oO][^@]*$/x/ -[dit][a-zA-Z]*/v/..../d 18 | ,x/\@[dDoO|}]/i/\n/ 19 | ,x/\n\n\@[dDoO|}]/s/\n\n/\n/ 20 | ,x/\@[dDoO]${notat}*\@{/s/\n/ /g 21 | ,x/\@[dDoO]${notat}*\@{/{ 22 | s/\@[dDoO] */<>=\n/ 24 | } 25 | ,s/\@/>>/g 27 | ,x/<<[^>]*(>[^>][^>]*)*>>/s/[ ][ ]*/ /g 28 | ,x/<< | >>/s/ // 29 | ,x/\@\|$notat*\@}/x/\n/a/@ %def / 30 | ,x/\@ %def \@}/c/@ / 31 | ,x/\@\|/c/@ %def / 32 | ,s/\@}/@ /g 33 | ,x/\n\@ %def.*\n\@ *\n/x/\n\@ *\n/c/\n/ 34 | ,x/^\@ %def.*$/s/[ ]+/ /g 35 | ,x/{{{the magic at sign}}}/c/@/ 36 | ,x/{{{double left brackets}}}/c/@<>/ 38 | w 39 | EOF 40 | $LIB/markup $tmp | $LIB/disambiguate | $LIB/unmarkup 41 | rm $tmp 42 | -------------------------------------------------------------------------------- /src/shell/noroots: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 1991 by Norman Ramsey. All rights reserved. 4 | # See file COPYRIGHT for more information. 5 | # set -x 6 | LIB=|LIBDIR| 7 | $LIB/markup "$@" | nawk ' 8 | /^@quote$/,/^@endquote$/ { next } 9 | /^@defn / { chunk=substr($0,7) ; defined[chunk]=1 } 10 | /^@use / { chunk=substr($0,6) ; used[chunk]=1 } 11 | END { 12 | for (chunk in defined) { 13 | if (defined[chunk]==1 && used[chunk]==0) printf "<<%s>>\n", chunk 14 | } 15 | }' 16 | -------------------------------------------------------------------------------- /src/shell/notangle: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 1991 by Norman Ramsey. All rights reserved. 3 | # See file COPYRIGHT for more information. 4 | LIB=|LIBDIR| 5 | markup=$LIB/markup opt= arg= markopt= filters= 6 | while [ $# -gt 0 ]; do 7 | case $1 in 8 | -gitversion) echo "|GITVERSION|" ; exit ;; 9 | -ml|-m3|-awk|-icn|-icon|-pascal|-c|-c++|-f77|-f90|-tex|-w[0-9][0-9]*) ;; 10 | # deliberately ignore nountangle args 11 | -t) ;; # this is default 12 | -t*) markopt="$markopt -t" ; opt="$opt '$1'" ;; 13 | # copy tabs at markup, use width given in notangle 14 | -filter) filters="$filters $2 | " ; shift ;; 15 | -markup) markup="$2" ; shift ;; 16 | -) arg="$arg '$1'" ;; 17 | -L*) opt="$opt -t '$1'" ; markopt="$markopt -t" ;; 18 | -*) opt="$opt '$1'" ;; 19 | *) arg="$arg '$1'" ;; 20 | esac 21 | shift 22 | done 23 | PATH="$PATH:$LIB" 24 | export PATH 25 | eval "$markup $markopt $arg | $filters $LIB/nt $opt "'; rc=$?' 26 | exit $rc 27 | -------------------------------------------------------------------------------- /src/shell/notangle.nw: -------------------------------------------------------------------------------- 1 | <>= 2 | # Copyright 1991 by Norman Ramsey. All rights reserved. 3 | # See file COPYRIGHT for more information. 4 | <>= 5 | #!/bin/sh 6 | <> 7 | LIB=|LIBDIR| 8 | markup=$LIB/markup opt= arg= markopt= filters= 9 | while [ $# -gt 0 ]; do 10 | case $1 in 11 | -gitversion) echo "|GITVERSION|" ; exit ;; 12 | -ml|-m3|-awk|-icn|-icon|-pascal|-c|-c++|-f77|-f90|-tex|-w[0-9][0-9]*) ;; 13 | # deliberately ignore nountangle args 14 | -t) ;; # this is default 15 | -t*) markopt="$markopt -t" ; opt="$opt '$1'" ;; 16 | # copy tabs at markup, use width given in notangle 17 | -filter) filters="$filters $2 | " ; shift ;; 18 | -markup) markup="$2" ; shift ;; 19 | -) arg="$arg '$1'" ;; 20 | -L*) opt="$opt -t '$1'" ; markopt="$markopt -t" ;; 21 | -*) opt="$opt '$1'" ;; 22 | *) arg="$arg '$1'" ;; 23 | esac 24 | shift 25 | done 26 | PATH="$PATH:$LIB" 27 | export PATH 28 | eval "$markup $markopt $arg | $filters $LIB/nt $opt "'; rc=$?' 29 | exit $rc 30 | -------------------------------------------------------------------------------- /src/shell/noweave.hpux: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 1991 by Norman Ramsey. All rights reserved. 4 | # See file COPYRIGHT for more information. 5 | # options: -l == use LaTeX -x == generate LaTeX cross-reference goo 6 | 7 | # fix for backlash for HP-UX contributed by Gary Leavens. 8 | 9 | LIB=|LIBDIR| 10 | latex=0 tex=1 xref=0 11 | args= 12 | markopts= 13 | 14 | for i do 15 | case $i in 16 | -l) latex=1 ; tex=0 ;; 17 | -n) latex=0 ; tex=0 ;; 18 | -x) xref=1 ; if [ $tex -eq 1 ]; then tex=0 ; latex=1; fi ;; 19 | -t*) markopts="$markopts $i" ;; 20 | -*) echo "$0: Unrecognized argument '$i'" 1>&2 ; exit ;; 21 | *) arg="$arg $i" ;; 22 | esac 23 | done 24 | 25 | if [ $tex -eq 1 ]; then echo '\\\c' ; echo input nwmac; fi 26 | if [ $latex -eq 1 ]; then 27 | echo '\\\c'; echo "documentstyle[noweb]{article}"; 28 | echo '\\\c' ; echo 'begin{document}' 29 | fi 30 | 31 | if [ $xref -eq 0 ]; then 32 | $LIB/markup $markopts $arg 33 | else 34 | $LIB/markup $markopts $arg | $LIB/noxref 35 | fi | nawk ' 36 | BEGIN { code=0 ; quoting=0 } 37 | /^@begin code/ { code=1 ; printf "\\begincode{%s}\n", substr($0, 13) } 38 | /^@begin docs/ { printf "\\begindocs{%s}\n", substr($0, 13) } 39 | /^@end code/ { code=0 ; printf "\\endcode\n" } 40 | /^@end docs/ { printf "\\enddocs\n" } 41 | /^@text / { line = substr($0, 7) 42 | if (code || quoting) { 43 | gsub("\\\\", "\\\\", line) 44 | gsub("{", "\\{", line) ; gsub("}", "\\}", line) 45 | } 46 | printf "%s", line 47 | } 48 | /^@nl$/ { printf "\n" } 49 | /^@defn / { gsub("\\[\\[", "\\code{}") ; gsub("\\]\\]", "\\edoc{}") 50 | printf "\\moddef{%s}\\%sendmoddef", substr($0, 7), defns[substr($0, 7)] 51 | defns[substr($0, 7)] = "plus" 52 | } 53 | /^@use / { gsub("\\[\\[", "\\code{}") ; gsub("\\]\\]", "\\edoc{}") 54 | printf "\\LA{}%s\\RA{}", substr($0, 6) 55 | } 56 | /^@quote$/ { quoting = 1 ; printf "\\code{}" } 57 | /^@endquote$/ { quoting = 0 ; printf "\\edoc{}" } 58 | /^@file / { printf "\\filename{%s}\n", substr($0, 7) } 59 | /^@literal / { printf "%s", substr($0, 10) }' 60 | status=$? 61 | if [ $tex -eq 1 ]; then echo '\\\c' ; echo bye; fi 62 | if [ $latex -eq 1 ]; then echo '\\\c'; echo 'end{document}' ; fi 63 | exit $status 64 | -------------------------------------------------------------------------------- /src/shell/noweave.simple: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | LIB=|LIBDIR| 4 | awk=nawk 5 | 6 | for i do 7 | case "$i" in 8 | -*) ;; # ignore 9 | *) files="$files $i" ;; 10 | esac 11 | done 12 | 13 | $LIB/markup $files | $awk ' 14 | BEGIN { code=0 15 | print "\\documentstyle{article}" 16 | print "\\newcommand{\\fragment}[1]{{\\sl$\\langle$#1\\/$\\rangle$}}" 17 | print "\\begin{document}" 18 | } 19 | END { if (code) print "\\end{trivlist}" 20 | print "\\end{document}" 21 | } 22 | /^@quote$/ { printf "\\verb@"} 23 | /^@endquote$/ { printf "@" } 24 | /^@begin code/ { if (!code) print "\\begin{trivlist}\\raggedright\\obeylines\\leftskip=2em\\small\\item[]%"; code=1 } 25 | /^@end code/ { } 26 | /^@begin docs/ { if (code) print "\\end{trivlist}"; code=0 } 27 | /^@end docs/ { } 28 | /^@defn / { gsub(/\[\[/, "\\verb@"); gsub(/]]/, "@") 29 | name = substr($0,7) 30 | printf "\\hspace{-2em}" 31 | printf "\\fragment{%s}", name 32 | defs[name] += 1 33 | if (defs[name] > 1) 34 | printf "$+\\!\\!\\equiv$" 35 | else 36 | printf "$\\equiv$" 37 | printf "\\index{\\fragment{%s}}", name 38 | } 39 | /^@use / { gsub(/\[\[/, "\\verb@"); gsub(/]]/, "@") 40 | name = substr($0,6) 41 | printf "\\fragment{%s}", name 42 | printf "\\index{\\fragment{%s}}", name 43 | } 44 | /^@literal / { printf "%s", substr($0, 10) } 45 | /^@nl$/ { print ""} 46 | /^@text / { if (code) printf "\\verb@%s@", substr($0,7) 47 | else printf "%s", substr($0,7) }' 48 | 49 | -------------------------------------------------------------------------------- /src/shell/noweb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 1991 by Norman Ramsey. All rights reserved. 3 | # See file COPYRIGHT for more information. 4 | LIB=|LIBDIR| 5 | markup=$LIB/markup mntopt=-L status=0 tex=1 output=1 6 | while [ $# -gt 0 ]; do 7 | case $1 in 8 | -gitversion) echo "|GITVERSION|" ; exit ;; 9 | -to|-ot) tex= output= ; shift ;; 10 | -t) tex= ; shift ;; 11 | -o) output= ; shift ;; 12 | -L*) mntopt="$1" ; shift ;; 13 | -markup) markup="$2" ; shift; shift ;; 14 | -*) echo "Unrecognized option $1" 1>&2; exit 1 ;; 15 | *) break ;; 16 | esac 17 | done 18 | if [ $# -eq 0 ]; then echo "Usage: $0 [-L[fmt] -t -o] file [...]" 1>&2; exit 1; fi 19 | 20 | for source do 21 | if [ -n "$output" ]; then 22 | PATH="$PATH:$LIB" $markup -t "$source" | $LIB/mnt -t8 "$mntopt" -all || status=1 23 | fi 24 | if [ -n "$tex" ]; then 25 | texname=`echo "$source" | sed '/\./s/\.[^.]*$//'` 26 | texname="$texname.tex" 27 | PATH="$PATH:$LIB" $markup "$source" | $LIB/finduses -noquote | $LIB/noidx -delay | 28 | nawk '{print} 29 | /^@defn [^ ]*$/ { print "@literal \\let\\nwnotused=\\nwoutput{}" }' | 30 | $LIB/totex -delay | cpif $texname || status=1 31 | fi 32 | done 33 | exit $status 34 | -------------------------------------------------------------------------------- /src/shell/nuweb2noweb: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # convert nuweb to noweb 4 | 5 | LIB=|LIBDIR| 6 | 7 | $LIB/numarkup "$@" | $LIB/unmarkup 8 | -------------------------------------------------------------------------------- /src/shell/unmarkup: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Copyright 1991 by Norman Ramsey. All rights reserved. 4 | # See file COPYRIGHT for more information. 5 | 6 | nawk ' 7 | /^@file / { 8 | # if (file) printf "EndOf%s\n", file 9 | # file = substr($0,7); 10 | # printf "diff %s - <<'"'EndOf%s'"'\n", file, file 11 | } 12 | 13 | END { 14 | # if (file) printf "EndOf%s\n", file 15 | } 16 | 17 | /^@begin docs 0$/ { next } 18 | /^@begin docs / { printf "@ " } 19 | /^@end docs / { } 20 | 21 | /^@begin code / { } 22 | /^@defn / { printf "<<%s>>=", substr($0,7) } 23 | 24 | /^@text $/ {next} 25 | /^@text / { 26 | gsub("<<", "@<<"); 27 | gsub(">>", "@>>"); 28 | printf "%s", substr($0,7) 29 | } 30 | /^@quote$/ { printf("[[") } 31 | /^@endquote$/ { printf("]]") } 32 | /^@nl$/ { printf "\n"} 33 | 34 | /^@use / { printf "<<%s>>", substr($0,6) }' "$@" | sed 's/^@ $/@/' 35 | -------------------------------------------------------------------------------- /src/tex/.gitignore: -------------------------------------------------------------------------------- 1 | /support.log 2 | /support.out 3 | /support.pdf 4 | /support.ps 5 | /support.toc 6 | -------------------------------------------------------------------------------- /src/tex/Makefile: -------------------------------------------------------------------------------- 1 | SHELL=/bin/sh 2 | NAME="name of version checked in" 3 | CIMSG="message for version checked in" 4 | RCSFILES=support.nw Makefile 5 | 6 | all: nwmac.tex noweb.sty 7 | source: nwmac.tex noweb.sty 8 | touch: nwmac.tex noweb.sty 9 | touch nwmac.tex noweb.sty 10 | boot: 11 | touch nwmac.tex noweb.sty 12 | 13 | nwmac.tex: support.nw 14 | notangle -R$@ support.nw > $@ 15 | 16 | noweb.sty: support.nw 17 | notangle -R$@ support.nw > $@ 18 | 19 | support.tex: support.nw 20 | noweave -delay -x support.nw > $@ 21 | 22 | clean: 23 | rm -f *~ *.dvi *.aux *.log *.blg *.bbl *.toc 24 | rm -f support.tex 25 | clobber: clean 26 | -------------------------------------------------------------------------------- /src/tex/noweb.sty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/src/tex/noweb.sty -------------------------------------------------------------------------------- /src/tex/support.nw: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrnrnr/noweb/0600cca537f8231fa4e62612235966946b24d049/src/tex/support.nw -------------------------------------------------------------------------------- /src/xdoc/.gitignore: -------------------------------------------------------------------------------- 1 | *.aux 2 | *.lot 3 | *.toc 4 | -------------------------------------------------------------------------------- /src/xdoc/cpif.1: -------------------------------------------------------------------------------- 1 | .TH CPIF 1 "local 10/40/2008" 2 | .SH NAME 3 | cpif \- selectively update files 4 | .SH SYNOPSIS 5 | .B cpif 6 | [\fB\-eq\fP|\fB\-ne\fP] file ... 7 | .SH DESCRIPTION 8 | .I cpif 9 | is an auxiliary tool for use with 10 | .IR notangle (1) 11 | and 12 | .IR make (1). 13 | .I cpif 14 | compares its standard input to each of the named files, 15 | overwriting the file if the comparison succeeds or if 16 | the named file does not exist. 17 | If neither 18 | .B \-eq 19 | or 20 | .B \-ne 21 | is specified, the default is 22 | .BR \-ne . 23 | Typical usage is in the following default rule, suitable for use in a Makefile. 24 | .br 25 | .nw.h: ; notangle \-Rheader $*.nw | cpif $*.h 26 | .br 27 | .SH SEE ALSO 28 | .IR notangle (1) 29 | .SH VERSION 30 | This man page is from 31 | .I noweb 32 | version 2.12. 33 | .SH AUTHOR 34 | Norman Ramsey, Tufts University. 35 | Internet address \fBNorman.Ramsey@tufts.edu\fP. 36 | .br 37 | Noweb home page at \fBhttp://www.cs.tufts.edu/~nr/noweb\fP. 38 | 39 | -------------------------------------------------------------------------------- /src/xdoc/cpif.txt: -------------------------------------------------------------------------------- 1 | CPIF(1) General Commands Manual CPIF(1) 2 | 3 | 4 | 5 | NNAAMMEE 6 | cpif - selectively update files 7 | 8 | SSYYNNOOPPSSIISS 9 | ccppiiff [--eeqq|--nnee] file ... 10 | 11 | DDEESSCCRRIIPPTTIIOONN 12 | _c_p_i_f is an auxiliary tool for use with _n_o_t_a_n_g_l_e(1) and _m_a_k_e(1). _c_p_i_f 13 | compares its standard input to each of the named files, overwriting the 14 | file if the comparison succeeds or if the named file does not exist. 15 | If neither --eeqq or --nnee is specified, the default is --nnee. Typical usage 16 | is in the following default rule, suitable for use in a Makefile. 17 | .nw.h: ; notangle -Rheader $*.nw | cpif $*.h 18 | 19 | SSEEEE AALLSSOO 20 | _n_o_t_a_n_g_l_e(1) 21 | 22 | VVEERRSSIIOONN 23 | This man page is from _n_o_w_e_b version 2.12. 24 | 25 | AAUUTTHHOORR 26 | Norman Ramsey, Tufts University. Internet address NNoorrmmaann..RRaamm‐‐ 27 | sseeyy@@ttuuffttss..eedduu. 28 | Noweb home page at hhttttpp::////wwwwww..ccss..ttuuffttss..eedduu//~~nnrr//nnoowweebb. 29 | 30 | 31 | 32 | 33 | local 10/40/2008 CPIF(1) 34 | -------------------------------------------------------------------------------- /src/xdoc/docdate.nw: -------------------------------------------------------------------------------- 1 | <>= 2 | 10/40/2008 3 | <>= 4 | .SH VERSION 5 | This man page is from 6 | .I noweb 7 | version $Name: v2_12 $. 8 | .SH AUTHOR 9 | Norman Ramsey, Tufts University. 10 | Internet address \fBNorman.Ramsey@tufts.edu\fP. 11 | .br 12 | Noweb home page at \fBhttp://www.cs.tufts.edu/~nr/noweb\fP. 13 | 14 | -------------------------------------------------------------------------------- /src/xdoc/doversion: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sed '/^version $Name:/s/_/./g;/^version $Name:/s/ $\././;/^version $Name:/s/$Name: v//' 3 | -------------------------------------------------------------------------------- /src/xdoc/htmltoc.1: -------------------------------------------------------------------------------- 1 | .TH NOWEB 1 "local 10/40/2008" 2 | .SH NAME 3 | htmltoc \- add table of contents to HTML document 4 | .SH SYNOPSIS 5 | \fBhtmltoc\fP [\fB\-2345\fP] [file] 6 | .SH DESCRIPTION 7 | .I htmltoc 8 | adds a table of contents to the HTML document named on the command 9 | line or provided as standard input. 10 | The table of contents is inserted between 11 | .B 12 | and 13 | .B , 14 | which must appear on lines by themselves. 15 | Any text between those two markers is 16 | .I discarded. 17 | These markers are inserted automatically by the 18 | .IR sl2h (1) 19 | filter. 20 | .PP 21 | The table of contents includes only headers at levels 2, 3, 4, and 5. 22 | This can be changed by using a command-line 23 | option, e.g., \fB\-123456789\P to include all possible headers. 24 | .SH BUGS 25 | .I htmltoc 26 | can't cope with a header that is split across multiple lines, 27 | even though this is legal HTML. 28 | .SH SEE ALSO 29 | .IR nowebfilters (7), 30 | .IR sl2h (1) 31 | .SH VERSION 32 | This man page is from 33 | .I noweb 34 | version 2.12. 35 | .SH AUTHOR 36 | Norman Ramsey, Tufts University. 37 | Internet address \fBNorman.Ramsey@tufts.edu\fP. 38 | .br 39 | Noweb home page at \fBhttp://www.cs.tufts.edu/~nr/noweb\fP. 40 | 41 | .PP 42 | Stephen Parker provided a preliminary version. 43 | -------------------------------------------------------------------------------- /src/xdoc/htmltoc.nw: -------------------------------------------------------------------------------- 1 | <<*>>= 2 | .TH NOWEB 1 "local <>" 3 | .SH NAME 4 | htmltoc \- add table of contents to HTML document 5 | .SH SYNOPSIS 6 | \fBhtmltoc\fP [\fB\-2345\fP] [file] 7 | .SH DESCRIPTION 8 | .I htmltoc 9 | adds a table of contents to the HTML document named on the command 10 | line or provided as standard input. 11 | The table of contents is inserted between 12 | .B 13 | and 14 | .B , 15 | which must appear on lines by themselves. 16 | Any text between those two markers is 17 | .I discarded. 18 | These markers are inserted automatically by the 19 | .IR sl2h (1) 20 | filter. 21 | .PP 22 | The table of contents includes only headers at levels 2, 3, 4, and 5. 23 | This can be changed by using a command-line 24 | option, e.g., \fB\-123456789\P to include all possible headers. 25 | .SH BUGS 26 | .I htmltoc 27 | can't cope with a header that is split across multiple lines, 28 | even though this is legal HTML. 29 | .SH SEE ALSO 30 | .IR nowebfilters (7), 31 | .IR sl2h (1) 32 | <> 33 | .PP 34 | Stephen Parker provided a preliminary version. 35 | -------------------------------------------------------------------------------- /src/xdoc/htmltoc.txt: -------------------------------------------------------------------------------- 1 | NOWEB(1) General Commands Manual NOWEB(1) 2 | 3 | 4 | 5 | NNAAMMEE 6 | htmltoc - add table of contents to HTML document 7 | 8 | SSYYNNOOPPSSIISS 9 | hhttmmllttoocc [--22334455] [file] 10 | 11 | DDEESSCCRRIIPPTTIIOONN 12 | _h_t_m_l_t_o_c adds a table of contents to the HTML document named on the com‐ 13 | mand line or provided as standard input. The table of contents is 14 | inserted between <> and <>,, which must 15 | appear on lines by themselves. Any text between those two markers is 16 | _d_i_s_c_a_r_d_e_d_. These markers are inserted automatically by the _s_l_2_h(1) 17 | filter. 18 | 19 | The table of contents includes only headers at levels 2, 3, 4, and 5. 20 | This can be changed by using a command-line option, e.g., --112233445566778899PP 21 | ttoo iinncclluuddee aallll ppoossssiibbllee hheeaaddeerrss.. 22 | 23 | BBUUGGSS 24 | _h_t_m_l_t_o_c can't cope with a header that is split across multiple lines, 25 | even though this is legal HTML. 26 | 27 | SSEEEE AALLSSOO 28 | _n_o_w_e_b_f_i_l_t_e_r_s(7), _s_l_2_h(1) 29 | 30 | VVEERRSSIIOONN 31 | This man page is from _n_o_w_e_b version 2.12. 32 | 33 | AAUUTTHHOORR 34 | Norman Ramsey, Tufts University. Internet address NNoorrmmaann..RRaamm‐‐ 35 | sseeyy@@ttuuffttss..eedduu. 36 | Noweb home page at hhttttpp::////wwwwww..ccss..ttuuffttss..eedduu//~~nnrr//nnoowweebb. 37 | 38 | 39 | Stephen Parker provided a preliminary version. 40 | 41 | 42 | 43 | local 10/40/2008 NOWEB(1) 44 | -------------------------------------------------------------------------------- /src/xdoc/nodefs.1: -------------------------------------------------------------------------------- 1 | .TH NOWEB 1 "local 10/40/2008" 2 | .SH NAME 3 | nodefs \- find definitions in noweb file 4 | .SH SYNOPSIS 5 | .B nodefs 6 | [\fB\-auto\fP \fIlang\fP] 7 | [\fB\-showauto\fP] 8 | file ... 9 | .SH DESCRIPTION 10 | .I nodefs 11 | is an auxiliary tool that produces output for use with the 12 | .B \-indexfrom 13 | option of 14 | .IR noweave (1). 15 | .I nodefs 16 | searches a 17 | .I noweb 18 | file for identifier definitions, printing the identifiers on standard output, 19 | one per line. 20 | If the 21 | .B \-auto \fIlang\fP 22 | option is given, 23 | .I nodefs 24 | tries to discover definitions automatically, assuming the program 25 | is written in language \fIlang\fP. 26 | The 27 | .B \-showauto 28 | option displays permissible values of \fIlang\fP, which vary but may include 29 | .B tex 30 | or 31 | .BR icon . 32 | .PP 33 | For a complete description of using 34 | .I nodefs 35 | together with 36 | .IR noweave (1) 37 | and 38 | .IR noindex (1), 39 | see the man page for 40 | .IR noindex (1). 41 | .SH SEE ALSO 42 | .IR noweave (1), 43 | .IR noweb (1), 44 | .IR noindex (1) 45 | .SH VERSION 46 | This man page is from 47 | .I noweb 48 | version 2.12. 49 | .SH AUTHOR 50 | Norman Ramsey, Tufts University. 51 | Internet address \fBNorman.Ramsey@tufts.edu\fP. 52 | .br 53 | Noweb home page at \fBhttp://www.cs.tufts.edu/~nr/noweb\fP. 54 | 55 | -------------------------------------------------------------------------------- /src/xdoc/nodefs.nw: -------------------------------------------------------------------------------- 1 | <<*>>= 2 | .TH NOWEB 1 "local <>" 3 | .SH NAME 4 | nodefs \- find definitions in noweb file 5 | .SH SYNOPSIS 6 | .B nodefs 7 | [\fB\-auto\fP \fIlang\fP] 8 | [\fB\-showauto\fP] 9 | file ... 10 | .SH DESCRIPTION 11 | .I nodefs 12 | is an auxiliary tool that produces output for use with the 13 | .B \-indexfrom 14 | option of 15 | .IR noweave (1). 16 | .I nodefs 17 | searches a 18 | .I noweb 19 | file for identifier definitions, printing the identifiers on standard output, 20 | one per line. 21 | If the 22 | .B \-auto \fIlang\fP 23 | option is given, 24 | .I nodefs 25 | tries to discover definitions automatically, assuming the program 26 | is written in language \fIlang\fP. 27 | The 28 | .B \-showauto 29 | option displays permissible values of \fIlang\fP, which vary but may include 30 | .B tex 31 | or 32 | .BR icon . 33 | .PP 34 | For a complete description of using 35 | .I nodefs 36 | together with 37 | .IR noweave (1) 38 | and 39 | .IR noindex (1), 40 | see the man page for 41 | .IR noindex (1). 42 | .SH SEE ALSO 43 | .IR noweave (1), 44 | .IR noweb (1), 45 | .IR noindex (1) 46 | <> 47 | -------------------------------------------------------------------------------- /src/xdoc/nodefs.txt: -------------------------------------------------------------------------------- 1 | NOWEB(1) General Commands Manual NOWEB(1) 2 | 3 | 4 | 5 | NNAAMMEE 6 | nodefs - find definitions in noweb file 7 | 8 | SSYYNNOOPPSSIISS 9 | nnooddeeffss [--aauuttoo _l_a_n_g] [--sshhoowwaauuttoo] file ... 10 | 11 | DDEESSCCRRIIPPTTIIOONN 12 | _n_o_d_e_f_s is an auxiliary tool that produces output for use with the 13 | --iinnddeexxffrroomm option of _n_o_w_e_a_v_e(1). _n_o_d_e_f_s searches a _n_o_w_e_b file for 14 | identifier definitions, printing the identifiers on standard output, 15 | one per line. If the --aauuttoo _l_a_n_g option is given, _n_o_d_e_f_s tries to dis‐ 16 | cover definitions automatically, assuming the program is written in 17 | language _l_a_n_g. The --sshhoowwaauuttoo option displays permissible values of 18 | _l_a_n_g, which vary but may include tteexx or iiccoonn. 19 | 20 | For a complete description of using _n_o_d_e_f_s together with _n_o_w_e_a_v_e(1) and 21 | _n_o_i_n_d_e_x(1), see the man page for _n_o_i_n_d_e_x(1). 22 | 23 | SSEEEE AALLSSOO 24 | _n_o_w_e_a_v_e(1), _n_o_w_e_b(1), _n_o_i_n_d_e_x(1) 25 | 26 | VVEERRSSIIOONN 27 | This man page is from _n_o_w_e_b version 2.12. 28 | 29 | AAUUTTHHOORR 30 | Norman Ramsey, Tufts University. Internet address NNoorrmmaann..RRaamm‐‐ 31 | sseeyy@@ttuuffttss..eedduu. 32 | Noweb home page at hhttttpp::////wwwwww..ccss..ttuuffttss..eedduu//~~nnrr//nnoowweebb. 33 | 34 | 35 | 36 | 37 | local 10/40/2008 NOWEB(1) 38 | -------------------------------------------------------------------------------- /src/xdoc/noroff.1: -------------------------------------------------------------------------------- 1 | .TH NOWEB 1 "local 10/40/2008" 2 | .SH NAME 3 | noroff \- format woven \fItroff\fP documentation 4 | .SH SYNOPSIS 5 | .B noroff 6 | .RI [ " groff options " ] 7 | files ... 8 | .SH DESCRIPTION 9 | .I Noroff 10 | formats documents that have been woven with 11 | .IR "noweave \-troff" . 12 | It passes on any options (flags) to 13 | .IR groff (1), 14 | and treats any remaining non-option arguments as files to be processed. 15 | The 16 | .I groff 17 | options allow the easy invocation of the 18 | .IR gpic , 19 | .IR gtbl , 20 | and/or 21 | .IR geqn , 22 | preprocessors. 23 | .PP 24 | If no options are supplied, it defaults to using the 25 | .B \-mm 26 | macros, with PostScript output. 27 | .SH BUGS 28 | The shell script is probably still not as robust as it needs to be. 29 | .SH SEE ALSO 30 | .IR groff (1), 31 | .IR noweave (1), 32 | .IR nodefs (1), 33 | .IR cpif (1) 34 | .br 35 | .I "Converting noweb markup to troff markup" 36 | in the file 37 | .B src/shell/roff.nw 38 | in the 39 | .I noweb 40 | distribution. 41 | .SH VERSION 42 | This man page is from 43 | .I noweb 44 | version 2.12. 45 | .SH AUTHOR 46 | Norman Ramsey, Tufts University. 47 | Internet address \fBNorman.Ramsey@tufts.edu\fP. 48 | .br 49 | Noweb home page at \fBhttp://www.cs.tufts.edu/~nr/noweb\fP. 50 | 51 | .PP 52 | .I Noroff 53 | was written by Phil Bewig for SoftQuad 54 | .IR troff , 55 | and enhanced and ported to GNU 56 | .I troff 57 | by Arnold Robbins. 58 | -------------------------------------------------------------------------------- /src/xdoc/noroff.nw: -------------------------------------------------------------------------------- 1 | <<*>>= 2 | .TH NOWEB 1 "local <>" 3 | .SH NAME 4 | noroff \- format woven \fItroff\fP documentation 5 | .SH SYNOPSIS 6 | .B noroff 7 | .RI [ " groff options " ] 8 | files ... 9 | .SH DESCRIPTION 10 | .I Noroff 11 | formats documents that have been woven with 12 | .IR "noweave \-troff" . 13 | It passes on any options (flags) to 14 | .IR groff (1), 15 | and treats any remaining non-option arguments as files to be processed. 16 | The 17 | .I groff 18 | options allow the easy invocation of the 19 | .IR gpic , 20 | .IR gtbl , 21 | and/or 22 | .IR geqn , 23 | preprocessors. 24 | .PP 25 | If no options are supplied, it defaults to using the 26 | .B \-mm 27 | macros, with PostScript output. 28 | .SH BUGS 29 | The shell script is probably still not as robust as it needs to be. 30 | .SH SEE ALSO 31 | .IR groff (1), 32 | .IR noweave (1), 33 | .IR nodefs (1), 34 | .IR cpif (1) 35 | .br 36 | .I "Converting noweb markup to troff markup" 37 | in the file 38 | .B src/shell/roff.nw 39 | in the 40 | .I noweb 41 | distribution. 42 | <> 43 | .PP 44 | .I Noroff 45 | was written by Phil Bewig for SoftQuad 46 | .IR troff , 47 | and enhanced and ported to GNU 48 | .I troff 49 | by Arnold Robbins. 50 | -------------------------------------------------------------------------------- /src/xdoc/noroff.txt: -------------------------------------------------------------------------------- 1 | NOWEB(1) General Commands Manual NOWEB(1) 2 | 3 | 4 | 5 | NNAAMMEE 6 | noroff - format woven _t_r_o_f_f documentation 7 | 8 | SSYYNNOOPPSSIISS 9 | nnoorrooffff [ _g_r_o_f_f _o_p_t_i_o_n_s ] files ... 10 | 11 | DDEESSCCRRIIPPTTIIOONN 12 | _N_o_r_o_f_f formats documents that have been woven with _n_o_w_e_a_v_e _-_t_r_o_f_f. It 13 | passes on any options (flags) to _g_r_o_f_f(1), and treats any remaining 14 | non-option arguments as files to be processed. The _g_r_o_f_f options allow 15 | the easy invocation of the _g_p_i_c, _g_t_b_l, and/or _g_e_q_n, preprocessors. 16 | 17 | If no options are supplied, it defaults to using the --mmmm macros, with 18 | PostScript output. 19 | 20 | BBUUGGSS 21 | The shell script is probably still not as robust as it needs to be. 22 | 23 | SSEEEE AALLSSOO 24 | _g_r_o_f_f(1), _n_o_w_e_a_v_e(1), _n_o_d_e_f_s(1), _c_p_i_f(1) 25 | _C_o_n_v_e_r_t_i_n_g _n_o_w_e_b _m_a_r_k_u_p _t_o _t_r_o_f_f _m_a_r_k_u_p in the file ssrrcc//sshheellll//rrooffff..nnww 26 | in the _n_o_w_e_b distribution. 27 | 28 | VVEERRSSIIOONN 29 | This man page is from _n_o_w_e_b version 2.12. 30 | 31 | AAUUTTHHOORR 32 | Norman Ramsey, Tufts University. Internet address NNoorrmmaann..RRaamm‐‐ 33 | sseeyy@@ttuuffttss..eedduu. 34 | Noweb home page at hhttttpp::////wwwwww..ccss..ttuuffttss..eedduu//~~nnrr//nnoowweebb. 35 | 36 | 37 | _N_o_r_o_f_f was written by Phil Bewig for SoftQuad _t_r_o_f_f, and enhanced and 38 | ported to GNU _t_r_o_f_f by Arnold Robbins. 39 | 40 | 41 | 42 | local 10/40/2008 NOWEB(1) 43 | -------------------------------------------------------------------------------- /src/xdoc/noroots.1: -------------------------------------------------------------------------------- 1 | .TH NOWEB 1 "local 10/40/2008" 2 | .SH NAME 3 | noroots \- print roots of a noweb file 4 | .SH SYNOPSIS 5 | .B noroots 6 | [file] ... 7 | .SH DESCRIPTION 8 | .I noroots 9 | finds the roots of a 10 | .I noweb 11 | file: it prints the names of all code chunks that are defined but not used. 12 | See 13 | .IR noweb (1) 14 | for an explanation of 15 | the format of 16 | .I noweb 17 | files. 18 | .SH SEE ALSO 19 | .IR noweb (1), 20 | .IR notangle (1) 21 | .SH VERSION 22 | This man page is from 23 | .I noweb 24 | version 2.12. 25 | .SH AUTHOR 26 | Norman Ramsey, Tufts University. 27 | Internet address \fBNorman.Ramsey@tufts.edu\fP. 28 | .br 29 | Noweb home page at \fBhttp://www.cs.tufts.edu/~nr/noweb\fP. 30 | 31 | -------------------------------------------------------------------------------- /src/xdoc/noroots.nw: -------------------------------------------------------------------------------- 1 | <<*>>= 2 | .TH NOWEB 1 "local <>" 3 | .SH NAME 4 | noroots \- print roots of a noweb file 5 | .SH SYNOPSIS 6 | .B noroots 7 | [file] ... 8 | .SH DESCRIPTION 9 | .I noroots 10 | finds the roots of a 11 | .I noweb 12 | file: it prints the names of all code chunks that are defined but not used. 13 | See 14 | .IR noweb (1) 15 | for an explanation of 16 | the format of 17 | .I noweb 18 | files. 19 | .SH SEE ALSO 20 | .IR noweb (1), 21 | .IR notangle (1) 22 | <> 23 | -------------------------------------------------------------------------------- /src/xdoc/noroots.txt: -------------------------------------------------------------------------------- 1 | NOWEB(1) General Commands Manual NOWEB(1) 2 | 3 | 4 | 5 | NNAAMMEE 6 | noroots - print roots of a noweb file 7 | 8 | SSYYNNOOPPSSIISS 9 | nnoorroooottss [file] ... 10 | 11 | DDEESSCCRRIIPPTTIIOONN 12 | _n_o_r_o_o_t_s finds the roots of a _n_o_w_e_b file: it prints the names of all 13 | code chunks that are defined but not used. See _n_o_w_e_b(1) for an expla‐ 14 | nation of the format of _n_o_w_e_b files. 15 | 16 | SSEEEE AALLSSOO 17 | _n_o_w_e_b(1), _n_o_t_a_n_g_l_e(1) 18 | 19 | VVEERRSSIIOONN 20 | This man page is from _n_o_w_e_b version 2.12. 21 | 22 | AAUUTTHHOORR 23 | Norman Ramsey, Tufts University. Internet address NNoorrmmaann..RRaamm‐‐ 24 | sseeyy@@ttuuffttss..eedduu. 25 | Noweb home page at hhttttpp::////wwwwww..ccss..ttuuffttss..eedduu//~~nnrr//nnoowweebb. 26 | 27 | 28 | 29 | 30 | local 10/40/2008 NOWEB(1) 31 | -------------------------------------------------------------------------------- /src/xdoc/nuweb2noweb.1: -------------------------------------------------------------------------------- 1 | .TH NOWEB 1 "10/40/2008" 2 | .SH NAME 3 | nuweb2noweb \- convert nuweb files to noweb form 4 | .SH SYNOPSIS 5 | .B nuweb2noweb 6 | file ... 7 | .SH DESCRIPTION 8 | .I Nuweb2noweb 9 | converts a file or files in 10 | .I nuweb 11 | format to 12 | .I noweb 13 | format, writing the results on standard output. 14 | Input is from the file(s) named on the command line. 15 | .SH SEE ALSO 16 | .PP 17 | .IR noweb (1), 18 | .IR nuweb (1) 19 | .SH VERSION 20 | This man page is from 21 | .I noweb 22 | version 2.12. 23 | .SH AUTHOR 24 | Norman Ramsey, Tufts University. 25 | Internet address \fBNorman.Ramsey@tufts.edu\fP. 26 | .br 27 | Noweb home page at \fBhttp://www.cs.tufts.edu/~nr/noweb\fP. 28 | 29 | -------------------------------------------------------------------------------- /src/xdoc/nuweb2noweb.txt: -------------------------------------------------------------------------------- 1 | NOWEB(1) General Commands Manual NOWEB(1) 2 | 3 | 4 | 5 | NNAAMMEE 6 | nuweb2noweb - convert nuweb files to noweb form 7 | 8 | SSYYNNOOPPSSIISS 9 | nnuuwweebb22nnoowweebb file ... 10 | 11 | DDEESSCCRRIIPPTTIIOONN 12 | _N_u_w_e_b_2_n_o_w_e_b converts a file or files in _n_u_w_e_b format to _n_o_w_e_b format, 13 | writing the results on standard output. Input is from the file(s) 14 | named on the command line. 15 | 16 | SSEEEE AALLSSOO 17 | _n_o_w_e_b(1), _n_u_w_e_b(1) 18 | 19 | VVEERRSSIIOONN 20 | This man page is from _n_o_w_e_b version 2.12. 21 | 22 | AAUUTTHHOORR 23 | Norman Ramsey, Tufts University. Internet address NNoorrmmaann..RRaamm‐‐ 24 | sseeyy@@ttuuffttss..eedduu. 25 | Noweb home page at hhttttpp::////wwwwww..ccss..ttuuffttss..eedduu//~~nnrr//nnoowweebb. 26 | 27 | 28 | 29 | 30 | 10/40/2008 NOWEB(1) 31 | -------------------------------------------------------------------------------- /src/xdoc/sl2h.1: -------------------------------------------------------------------------------- 1 | .TH NOWEB 1 "local 10/40/2008" 2 | .SH NAME 3 | sl2h \- simple latex to HTML converter 4 | .SH SYNOPSIS 5 | \fBsl2h\fP [\fB\-show\-unknowns\fP] [\fB\-html\-quotes\fP] [file ...] 6 | .SH DESCRIPTION 7 | .I sl2h 8 | is a simple converter from 9 | .IR latex (1) 10 | format to HTML 11 | (which can be used with, e.g., \fInetscape\fP(1) or \fIMosaic\fP(1)). 12 | If the \fB\-show\-unknowns\fP options is given, unrecognized 13 | .I LaTeX 14 | control 15 | sequences appear in bold in the output. 16 | If the \fB\-html\-quotes\fP option is given, 17 | .B sl2h 18 | converts LaTeX double-quote ligatures into HTML 4 double-quote entities. 19 | .I sl2h 20 | uses the LaTeX-generated .toc and .bbl files to help create table of contents 21 | and bibliography. 22 | .SH BUGS 23 | It is possible to tell 24 | .B sl2h 25 | about new control sequences by putting special TeX comments in one's 26 | documentation chunks, but there's no documentation. 27 | Use the source, Luke. 28 | .SH SEE ALSO 29 | .IR nowebfilters (7), 30 | .IR htmltoc (1) 31 | .SH VERSION 32 | This man page is from 33 | .I noweb 34 | version 2.12. 35 | .SH AUTHOR 36 | Norman Ramsey, Tufts University. 37 | Internet address \fBNorman.Ramsey@tufts.edu\fP. 38 | .br 39 | Noweb home page at \fBhttp://www.cs.tufts.edu/~nr/noweb\fP. 40 | 41 | -------------------------------------------------------------------------------- /src/xdoc/sl2h.nw: -------------------------------------------------------------------------------- 1 | <<*>>= 2 | .TH NOWEB 1 "local <>" 3 | .SH NAME 4 | sl2h \- simple latex to HTML converter 5 | .SH SYNOPSIS 6 | \fBsl2h\fP [\fB\-show\-unknowns\fP] [\fB\-html\-quotes\fP] [file ...] 7 | .SH DESCRIPTION 8 | .I sl2h 9 | is a simple converter from 10 | .IR latex (1) 11 | format to HTML 12 | (which can be used with, e.g., \fInetscape\fP(1) or \fIMosaic\fP(1)). 13 | If the \fB\-show\-unknowns\fP options is given, unrecognized 14 | .I LaTeX 15 | control 16 | sequences appear in bold in the output. 17 | If the \fB\-html\-quotes\fP option is given, 18 | .B sl2h 19 | converts LaTeX double-quote ligatures into HTML 4 double-quote entities. 20 | .I sl2h 21 | uses the LaTeX-generated .toc and .bbl files to help create table of contents 22 | and bibliography. 23 | .SH BUGS 24 | It is possible to tell 25 | .B sl2h 26 | about new control sequences by putting special TeX comments in one's 27 | documentation chunks, but there's no documentation. 28 | Use the source, Luke. 29 | .SH SEE ALSO 30 | .IR nowebfilters (7), 31 | .IR htmltoc (1) 32 | <> 33 | -------------------------------------------------------------------------------- /src/xdoc/sl2h.txt: -------------------------------------------------------------------------------- 1 | NOWEB(1) General Commands Manual NOWEB(1) 2 | 3 | 4 | 5 | NNAAMMEE 6 | sl2h - simple latex to HTML converter 7 | 8 | SSYYNNOOPPSSIISS 9 | ssll22hh [--sshhooww--uunnkknnoowwnnss] [--hhttmmll--qquuootteess] [file ...] 10 | 11 | DDEESSCCRRIIPPTTIIOONN 12 | _s_l_2_h is a simple converter from _l_a_t_e_x(1) format to HTML (which can be 13 | used with, e.g., _n_e_t_s_c_a_p_e(1) or _M_o_s_a_i_c(1)). If the --sshhooww--uunnkknnoowwnnss 14 | options is given, unrecognized _L_a_T_e_X control sequences appear in bold 15 | in the output. If the --hhttmmll--qquuootteess option is given, ssll22hh converts 16 | LaTeX double-quote ligatures into HTML 4 double-quote entities. _s_l_2_h 17 | uses the LaTeX-generated .toc and .bbl files to help create table of 18 | contents and bibliography. 19 | 20 | BBUUGGSS 21 | It is possible to tell ssll22hh about new control sequences by putting spe‐ 22 | cial TeX comments in one's documentation chunks, but there's no docu‐ 23 | mentation. Use the source, Luke. 24 | 25 | SSEEEE AALLSSOO 26 | _n_o_w_e_b_f_i_l_t_e_r_s(7), _h_t_m_l_t_o_c(1) 27 | 28 | VVEERRSSIIOONN 29 | This man page is from _n_o_w_e_b version 2.12. 30 | 31 | AAUUTTHHOORR 32 | Norman Ramsey, Tufts University. Internet address NNoorrmmaann..RRaamm‐‐ 33 | sseeyy@@ttuuffttss..eedduu. 34 | Noweb home page at hhttttpp::////wwwwww..ccss..ttuuffttss..eedduu//~~nnrr//nnoowweebb. 35 | 36 | 37 | 38 | 39 | local 10/40/2008 NOWEB(1) 40 | --------------------------------------------------------------------------------