├── cweave.1 ├── ctangle.1 ├── refsort.1 ├── twinx.1 ├── twill-refsort ├── tests ├── ham.bux ├── gb_types.w ├── ham.scn ├── gb_save.hux ├── ham.aux ├── ham.idx ├── system.bux ├── gb_graph.hux ├── index.tex ├── ham.sref ├── ham.ref ├── ham.ch └── ham.w ├── texinputs ├── twimac-web.tex ├── icwebmac.tex ├── dctwimac.tex ├── dproofmac.tex ├── dcwebstrings.tex ├── Xcwebmac.tex ├── pdfwebtocfront.tex └── dcwebmac.tex ├── examples ├── wc-ansi.ch ├── extex-ansi.ch ├── treeprint-ansi.ch ├── wordtest-ansi.ch ├── wmerg-borlandc.ch ├── wmerg-output.ch ├── README.p11 ├── Makefile.sas ├── wmerg-ansi.ch ├── wmerge.dsp ├── wmerg-patch.ch └── wmerg-memory.ch ├── vault ├── arexx │ ├── compile.ced │ ├── start_web.ced │ └── catalogs │ │ ├── cweb_arexx.cd │ │ ├── cweb_arexx.e.ct │ │ ├── cweb_arexx.f.ct │ │ ├── cweb_arexx.i.ct │ │ ├── english │ │ └── cweb_arexx.catalog │ │ ├── francais │ │ └── cweb_arexx.catalog │ │ └── italiano │ │ └── cweb_arexx.catalog ├── comm-arexx.hch ├── cwebbin.dsw ├── comm-translation.hch ├── ctang-borlandc.ch ├── comm-memory.hch ├── comm-borlandc.hch ├── ctangle.dsp ├── cweav-borlandc.ch ├── ctang-memory.ch ├── cweave.dsp └── cweav-memory.ch ├── comm-newpage.ch ├── ctang-newpage.ch ├── cweav-newpage.ch ├── twinx-startup.tex ├── 0004-Add-silent-datecontentspage-macro.patch ├── ctwill-man.ch ├── comm-extensions.hch ├── cweav-texlive.ch ├── common.bux ├── cwebinputs ├── c++1xlib.w ├── cweb_ecma94.w ├── cweb_hp8.w ├── amiga_types.w ├── cweb_pc850.w └── cweb_mac8.w ├── texlive.w ├── LICENSE ├── comm-output.hch ├── po ├── cweb-tl.pot ├── de │ └── cweb-tl.po └── web2c-help.pot ├── prod-cweave.ch ├── refsort.ch ├── cwtw-texlive.ch ├── system.bux ├── prod-twill.ch ├── comm-i18n.hch ├── comm-texlive.hch ├── ctang-texlive.ch ├── ctang+u.ch ├── 0002-Purge-redundant-TeX-macro.patch ├── cweav-output.ch ├── ctwill.bux ├── 0006-Rename-page-dimensions-to-match-cwebmac.patch ├── cwebman-patch.ch ├── ctwill-texlive.ch ├── proofsort ├── 0001-Support-extended-syntax-for-numeric-literals.patch ├── README.md ├── comm-output.ch ├── 0005-Update-CTWILL-macros-for-CWEB-4.9.patch ├── twinx.ch └── comm-mini.ch /cweave.1: -------------------------------------------------------------------------------- 1 | .so man1/cweb.1 2 | -------------------------------------------------------------------------------- /ctangle.1: -------------------------------------------------------------------------------- 1 | .so man1/cweb.1 2 | -------------------------------------------------------------------------------- /refsort.1: -------------------------------------------------------------------------------- 1 | .so man1/ctwill.1 2 | -------------------------------------------------------------------------------- /twinx.1: -------------------------------------------------------------------------------- 1 | .so man1/ctwill.1 2 | -------------------------------------------------------------------------------- /twill-refsort: -------------------------------------------------------------------------------- 1 | /opt/github/web/refsort -------------------------------------------------------------------------------- /tests/ham.bux: -------------------------------------------------------------------------------- 1 | @i gb_graph.hux 2 | @i gb_save.hux 3 | -------------------------------------------------------------------------------- /texinputs/twimac-web.tex: -------------------------------------------------------------------------------- 1 | /opt/github/web/twimac.tex -------------------------------------------------------------------------------- /examples/wc-ansi.ch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/examples/wc-ansi.ch -------------------------------------------------------------------------------- /examples/extex-ansi.ch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/examples/extex-ansi.ch -------------------------------------------------------------------------------- /texinputs/icwebmac.tex: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/texinputs/icwebmac.tex -------------------------------------------------------------------------------- /vault/arexx/compile.ced: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/compile.ced -------------------------------------------------------------------------------- /vault/arexx/start_web.ced: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/start_web.ced -------------------------------------------------------------------------------- /examples/treeprint-ansi.ch: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/examples/treeprint-ansi.ch -------------------------------------------------------------------------------- /vault/arexx/catalogs/cweb_arexx.cd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/catalogs/cweb_arexx.cd -------------------------------------------------------------------------------- /vault/arexx/catalogs/cweb_arexx.e.ct: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/catalogs/cweb_arexx.e.ct -------------------------------------------------------------------------------- /vault/arexx/catalogs/cweb_arexx.f.ct: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/catalogs/cweb_arexx.f.ct -------------------------------------------------------------------------------- /vault/arexx/catalogs/cweb_arexx.i.ct: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/catalogs/cweb_arexx.i.ct -------------------------------------------------------------------------------- /comm-newpage.ch: -------------------------------------------------------------------------------- 1 | @x 2 | \def\contentspagenumber{29} 3 | @y 4 | \def\contentspagenumber{31} 5 | \input Xcwebmac 6 | \input pdfwebtocfront 7 | @z 8 | -------------------------------------------------------------------------------- /ctang-newpage.ch: -------------------------------------------------------------------------------- 1 | @x 2 | \def\contentspagenumber{65} 3 | @y 4 | \def\contentspagenumber{73} 5 | \input Xcwebmac 6 | \input pdfwebtocfront 7 | @z 8 | -------------------------------------------------------------------------------- /vault/arexx/catalogs/english/cweb_arexx.catalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/catalogs/english/cweb_arexx.catalog -------------------------------------------------------------------------------- /vault/arexx/catalogs/francais/cweb_arexx.catalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/catalogs/francais/cweb_arexx.catalog -------------------------------------------------------------------------------- /vault/arexx/catalogs/italiano/cweb_arexx.catalog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ascherer/cwebbin/HEAD/vault/arexx/catalogs/italiano/cweb_arexx.catalog -------------------------------------------------------------------------------- /cweav-newpage.ch: -------------------------------------------------------------------------------- 1 | @x 2 | \def\contentspagenumber{109} 3 | @y 4 | \def\contentspagenumber{117} 5 | \input Xcwebmac 6 | \input pdfwebtocfront 7 | @z 8 | -------------------------------------------------------------------------------- /examples/wordtest-ansi.ch: -------------------------------------------------------------------------------- 1 | @x 2 | @d PHICLONE 2654435769 /* $\approx 2^{32}/\phi$ */ 3 | @y 4 | @d PHICLONE 2654435769u /* $\approx 2^{32}/\phi$ */ 5 | @z 6 | -------------------------------------------------------------------------------- /tests/gb_types.w: -------------------------------------------------------------------------------- 1 | @q This file makes CWEAVE treat Graph, Arc, Vertex, etc. as reserved words. @> 2 | 3 | @s Graph int 4 | @s Arc int 5 | @s Vertex int 6 | @s Area int 7 | @s util int 8 | @s siz_t int 9 | -------------------------------------------------------------------------------- /twinx-startup.tex: -------------------------------------------------------------------------------- 1 | % special TeX strings from 'ctwill.w': 2 | \def\copyxTeX{\\{copy\_\TEX/}} 3 | \def\skipxTeX{\\{skip\_\TEX/}} 4 | \def\TeXxstring{\\{\TEX/\_string}} 5 | 6 | \pageno=101 % dummy page number 7 | \preinx % pre-index text on full pagewidth 8 | \noindent Some introductory words about this full index. 9 | \inx % two-column index 10 | -------------------------------------------------------------------------------- /texinputs/dctwimac.tex: -------------------------------------------------------------------------------- 1 | \ifx\undefined\documentclass\input ctwimac.tex 2 | \else\endinput\fi % LaTeX will use other macros 3 | 4 | \let\pdffalse=\relax 5 | \input dcwebstrings.tex 6 | 7 | \def\fin{\parfillskip 0pt plus 1fil 8 | \let\topsecno=\nullsec 9 | \redeffin 10 | \def\note##1##2.{\quad{\eightrm##1~##2.}} 11 | \def\I{\par\hangindent 2em}\let\*=* 12 | \readsections} 13 | -------------------------------------------------------------------------------- /vault/comm-arexx.hch: -------------------------------------------------------------------------------- 1 | Changes for COMMON.H by Andreas Scherer, May 10, 1995. 2 | 3 | This set of changees introduces communication between CWEB and the message 4 | browser of the SAS/C++ 6.55 development system. You need not apply this 5 | file if you use CWEB on a non-Amiga system or with a different C compiler. 6 | 7 | This change file requires COMM-ANSI.HCH, COMM-EXTENSIONS.HCH, 8 | COMM-MEMORY.HCH, COMM-TRANSLATION.HCH to be applied as well. 9 | 10 | For a complete history of the changes made to COMMON.H see COMM-PATCH.CH. 11 | 12 | @x l.168 13 | @d show_happiness flags['h'] /* should lack of errors be announced? */ 14 | @y 15 | @d send_error_messages flags['m'] /* should {\mc AREXX} communication be used? */ 16 | @d show_happiness flags['h'] /* should lack of errors be announced? */ 17 | @z 18 | -------------------------------------------------------------------------------- /0004-Add-silent-datecontentspage-macro.patch: -------------------------------------------------------------------------------- 1 | From abcfe710f5d5ce3b6801e391ac57105046cb446e Mon Sep 17 00:00:00 2001 2 | From: Andreas Scherer 3 | Date: Thu, 10 Feb 2022 09:24:39 +0100 4 | Subject: [PATCH 4/6] Add silent \datecontentspage macro. 5 | 6 | --- 7 | ctwimac.tex | 2 +- 8 | 1 file changed, 1 insertion(+), 1 deletion(-) 9 | 10 | diff --git a/ctwimac.tex b/ctwimac.tex 11 | index df24900..014168b 100644 12 | --- a/ctwimac.tex 13 | +++ b/ctwimac.tex 14 | @@ -460,7 +460,7 @@ 15 | \def\I{\par\hangindent 2em}\let\*=* 16 | \readsections} 17 | \def\readsections{\input \jobname.sscn} 18 | -\def\datethis{} 19 | +\def\datethis{} \def\datecontentspage{} 20 | 21 | % To produce only a subset of pages, put the page numbers on separate 22 | % lines in a file called pages.tex 23 | -- 24 | 2.47.1 25 | 26 | -------------------------------------------------------------------------------- /tests/ham.scn: -------------------------------------------------------------------------------- 1 | \I\X8:Decrease \PB{\|t}, if possible, and try the next possibility; or \PB{% 2 | \&{goto} \\{done}}\X 3 | \U4. 4 | \I\X6:Downdate the data structures to the state they were in when level \PB{% 5 | \|t} was entered\X 6 | \U4. 7 | \I\X4:Find all simple paths of length \PB{$\|g\MG\|n-\T{2}$} from \PB{\|v} to % 8 | \PB{\|z}, avoiding \PB{\|x}\X 9 | \U1. 10 | \I\X5:Increase \PB{\|t} and update the data structures to show that vertex \PB{% 11 | \|v} is now taken; \PB{\&{goto} \\{backtrack}} if no further moves are possible% 12 | \X 13 | \U4. 14 | \I\X7:Look at edge \PB{\|a} and its successors, advancing if it is a valid move% 15 | \X 16 | \U4. 17 | \I\X3:Prepare \PB{\|g} for backtracking, and find a vertex \PB{\|x} of minimum 18 | degree\X 19 | \U1. 20 | \I\X2:Process the command line, inputting the graph\X 21 | \U1. 22 | \I\X9:Record a solution\X 23 | \U5. 24 | -------------------------------------------------------------------------------- /ctwill-man.ch: -------------------------------------------------------------------------------- 1 | Change file to help make Appendix G of the full CWEB manual 2 | @x 3 | \def\botofcontents{\vfill 4 | \noindent 5 | Copyright \copyright\ 1987, 1990, 1993, 2000 Silvio Levy and Donald E. Knuth 6 | \bigskip\noindent 7 | Permission is granted to make and distribute verbatim copies of this 8 | document provided that the copyright notice and this permission notice 9 | are preserved on all copies. 10 | 11 | \smallskip\noindent 12 | Permission is granted to copy and distribute modified versions of this 13 | document under the conditions for verbatim copying, provided that the 14 | entire resulting derived work is given a different name and distributed 15 | under the terms of a permission notice identical to this one. 16 | } 17 | @y 18 | \def\botofcontents{\vfill\titlefalse} 19 | \def\contentspagenumber{239} 20 | \input Xcwebmac 21 | \input pdfwebtocfront 22 | \def\title{APPENDIX G: CTWILL} 23 | \let\K=\leftarrow 24 | @z 25 | -------------------------------------------------------------------------------- /tests/gb_save.hux: -------------------------------------------------------------------------------- 1 | @$MAX_SV_STRING {GB\_\,SAVE}1 =\T{4095}@> 2 | @$MAX_SV_ID {GB\_\,SAVE}1 =\T{154}@> 3 | 4 | @$restore_graph {GB\_\,SAVE}4 \&{Graph} ${}{*}(\,){}$@> 5 | 6 | @$panic {GB\_\,SAVE}5 =macro (\,)@> 7 | 8 | @$fillin {GB\_\,SAVE}7 =macro (\,)@> 9 | 10 | @$buffer {GB\_\,SAVE}13 =macro@> 11 | 12 | @$bad_type_code {GB\_\,SAVE}19 =\T{\^1}@> 13 | @$string_too_long {GB\_\,SAVE}19 =\T{\^2}@> 14 | @$addr_not_in_data_area {GB\_\,SAVE}19 =\T{\^4}@> 15 | @$addr_in_mixed_block {GB\_\,SAVE}19 =\T{\^8}@> 16 | @$bad_string_char {GB\_\,SAVE}19 =\T{\^10}@> 17 | @$ignored_data {GB\_\,SAVE}19 =\T{\^20}@> 18 | 19 | @$unk {GB\_\,SAVE}21 =\T{0}@> 20 | @$ark {GB\_\,SAVE}21 =\T{1}@> 21 | @$vrt {GB\_\,SAVE}21 =\T{2}@> 22 | @$mxt {GB\_\,SAVE}21 =\T{3}@> 23 | @$block_rep {GB\_\,SAVE}21 =\&{struct}@> 24 | 25 | @$lookup {GB\_\,SAVE}25 =macro (\,)@> 26 | 27 | @$append_comma {GB\_\,SAVE}37 =macro@> 28 | 29 | @$trans {GB\_\,SAVE}39 =macro (\,)@> 30 | -------------------------------------------------------------------------------- /comm-extensions.hch: -------------------------------------------------------------------------------- 1 | Changes for COMMON.H by Andreas Scherer, July 2021. 2 | 3 | This set of changes introduces several extensions to the standard behaviour 4 | of the CWEB system. Several new command line options are provided here. 5 | See CWEBMAN-EXTENSIONS.CH for details about these new features. 6 | 7 | For a complete history of the changes made to COMMON.H see COMM-PATCH.CH. 8 | 9 | Section 2. Add CTWILL. 10 | 11 | @x l.32 12 | @d ctangle false 13 | @d cweave true 14 | 15 | @y 16 | @z 17 | 18 | @x l.38 19 | extern bool program; /* \.{CWEAVE} or \.{CTANGLE}? */ 20 | @y 21 | typedef enum { 22 | @!ctangle, @!cweave, @!ctwill 23 | } cweb; 24 | extern cweb program; /* \.{CTANGLE} or \.{CWEAVE} or \.{CTWILL}? */ 25 | @z 26 | 27 | Section 14. 28 | 29 | @x l.232 30 | extern bool flags[]; /* an option for each 7-bit code */ 31 | @y 32 | extern bool flags[]; /* an option for each 7-bit code */ 33 | extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */ 34 | @z 35 | -------------------------------------------------------------------------------- /cweav-texlive.ch: -------------------------------------------------------------------------------- 1 | % Original Kpathsea changes for CWEB by Wlodek Bzyl and Olaf Weber 2 | % This file is in the Public Domain. 3 | 4 | % Most of the original changes were merged with the set of change files 5 | % of the CWEBbin project. This stripped change file is last in line of 6 | % cweav-patch.ch, cweav-extensions.ch, cweav-output.ch, cweav-i18n.ch, 7 | % cwtw-texlive.ch and cweav-texlive.ch that get tie'd into cweav-w2c.ch 8 | % that is used as a monolithic changefile for cweave.w in TeX Live. 9 | 10 | Material in limbo. 11 | 12 | @x l.35 and CWEAV-PATCH.CH 13 | \def\title{CWEAVE (@VERSION@)} 14 | @y 15 | \def\title{CWEAVE (Version 4.12.2 [\TeX~Live])} 16 | @z 17 | 18 | @x l.54 and CWTW-TEXLIVE.ch. 19 | }} 20 | @y 21 | }}\datecontentspage 22 | @z 23 | 24 | Section 1. 25 | 26 | @x l.70 and CWEAV-PATCH.CH and CWEAV-I18N.CH 27 | @d banner _("This is CWEAVE (@VERSION@)") 28 | @y 29 | @d banner "This is CWEAVE, Version 4.12.2" 30 | /* will be extended by the \TeX~Live |versionstring| */ 31 | @z 32 | -------------------------------------------------------------------------------- /common.bux: -------------------------------------------------------------------------------- 1 | @$ctangle {COMMON}2 \&{cweb}@> 2 | @$cweave {COMMON}2 \&{cweb}@> 3 | @$ctwill {COMMON}2 \&{cweb}@> 4 | 5 | @$text_info {CTANGLE.W}20 \&{text} [\,]@> 6 | 7 | @$equiv {CTANGLE.W}22 \\{equiv\_or\_xref}@> 8 | 9 | @$ac {CWEAVE.W}2 \&{int}@> 10 | @$av {CWEAVE.W}2 \&{char} ${*}{*}$@> 11 | @$main {CWEAVE.W}2 \&{int} (\,)@> 12 | 13 | @$ilk {CWEAVE.W}11 \\{dummy.Ilk}@> 14 | 15 | @$xmem {CWEAVE.W}23 \&{xref\_info} [\,]@> 16 | 17 | @$xref {CWEAVE.W}24 \\{equiv\_or\_xref}@> 18 | 19 | @$init_node {CWEAVE.W}32 \&{void} (\,)@> 20 | @$names_match {CWEAVE.W}32 \&{bool} (\,)@> 21 | 22 | @$print_stats {CWEAVE.W}270 \&{void} (\,)@> 23 | 24 | @$kpse_set_program_name "" \zip@> 25 | @$kpse_find_file "" \zip@> 26 | @$kpathsea_debug "" \zip@> 27 | @$kpse_cweb_format "" \zip@> 28 | @$kpse_program_name "" \zip@> 29 | @$kpse_var_expand "" \zip@> 30 | @$printversionandexit "" \zip@> 31 | @$versionstring "" \zip@> 32 | -------------------------------------------------------------------------------- /cwebinputs/c++1xlib.w: -------------------------------------------------------------------------------- 1 | @q This file defines type names introduced in modern dialects of C++ as @> 2 | @q special items for formatting; see http://en.cppreference.com/w/cpp/header @> 3 | @q only the std::class names listed there are included here. @> 4 | 5 | @q @@i'nclude this file in addition to the file 'c++lib.w' @> 6 | 7 | @s type_index int 8 | @s initializer_list int 9 | @s tuple int 10 | @s any int 11 | @s optional int 12 | @s variant int 13 | @s error_code int 14 | @s basic_string_view int 15 | @s array int 16 | @s forward_list int 17 | @s unordered_set int 18 | @s unordered_multiset int 19 | @s unordered_map int 20 | @s unordered_multimap int 21 | @s thread int 22 | @s path int 23 | 24 | @q add more std::classes from (some) C++1x headers @> 25 | 26 | @s integral_constant int 27 | @s bool_constant int 28 | @s function int 29 | @s mem_fn int 30 | @s bad_function_call int 31 | @s is_bind_expression int 32 | @s is_placeholder int 33 | @s reference_wrapper int 34 | @s hash int 35 | @s unique_ptr int 36 | @s shared_ptr int 37 | @s weak_ptr int 38 | -------------------------------------------------------------------------------- /tests/ham.aux: -------------------------------------------------------------------------------- 1 | @$deg {HAM}1 =\|u.\|I@> 2 | @$argc {HAM}1 \&{int}@> 3 | @$argv {HAM}1 \&{char} ${}{*}[\,]{}$@> 4 | @$main {HAM}1 \&{int} (\,)@> 5 | @$g {HAM}1 \&{Graph} ${}{*}{}$@> 6 | @$x {HAM}1 \&{Vertex} ${}{*}{}$@> 7 | @$y {HAM}1 \&{Vertex} ${}{*}{}$@> 8 | @$z {HAM}1 \&{Vertex} ${}{*}{}$@> 9 | @$tmax {HAM}1 \&{Vertex} ${}{*}{}$@> 10 | @$t {HAM}1 \&{register} \&{Vertex} ${}{*}{}$@> 11 | @$u {HAM}1 \&{register} \&{Vertex} ${}{*}{}$@> 12 | @$v {HAM}1 \&{register} \&{Vertex} ${}{*}{}$@> 13 | @$a {HAM}1 \&{register} \&{Arc} ${}{*}{}$@> 14 | @$aa {HAM}1 \&{register} \&{Arc} ${}{*}{}$@> 15 | @$d {HAM}1 \&{register} \&{int}@> 16 | @$b {HAM}1 \&{Arc} ${}{*}{}$@> 17 | @$bb {HAM}1 \&{Arc} ${}{*}{}$@> 18 | @$count {HAM}1 \&{int}@> 19 | @$dmin {HAM}1 \&{int}@> 20 | @$modulus {HAM}1 \&{int}@> 21 | @$taken {HAM}3 =\|v.\|I@> 22 | @$vert {HAM}4 =\|w.\|V@> 23 | @$ark {HAM}4 =\|x.\|A@> 24 | @$advance {HAM}4 label@> 25 | @$try_next {HAM}4 label@> 26 | @$restore {HAM}4 label@> 27 | @$backtrack {HAM}4 label@> 28 | @$done {HAM}4 label@> 29 | @$restore_all {HAM}7 label@> 30 | -------------------------------------------------------------------------------- /tests/ham.idx: -------------------------------------------------------------------------------- 1 | \I\|{a}, \[1]. 2 | \I\\{aa}, \[1], 5, 6, 7. 3 | \I\\{advance}, \[4], 5, 7. 4 | \I\&{Arc}, 1. 5 | \I\\{arcs}, 1, 3, 5, 6. 6 | \I\\{argc}, \[1], 2. 7 | \I\\{argv}, \[1], 2. 8 | \I\\{ark}, \[4], 5, 7, 8. 9 | \I\|{b}, \[1]. 10 | \I\\{backtrack}, \[4], 5. 11 | \I\\{bb}, \[1]. 12 | \I\\{count}, \[1], 9. 13 | \I\|{d}, \[1]. 14 | \I\\{deg}, \[1], 3, 5, 6. 15 | \I\\{dmin}, \[1], 3. 16 | \I\\{done}, \[4], 8. 17 | \I\\{exit}, 2. 18 | \I\\{fprintf}, 2. 19 | \I\|{g}, \[1]. 20 | \I\&{Graph}, 1. 21 | \I\\{main}, \[1]. 22 | \I\\{modulus}, \[1], 2, 9. 23 | \I\\{name}, 1, 9. 24 | \I\\{next}, 1, 3, 5, 6, 7, 8. 25 | \I\\{printf}, 1, 9. 26 | \I\\{restore}, \[4], 5, 7. 27 | \I\\{restore_all}, \[7], 8. 28 | \I\\{restore_graph}, 1, 2. 29 | \I\\{sscanf}, 2. 30 | \I\\{stderr}, 2. 31 | \I\|{t}, \[1]. 32 | \I\\{taken}, \[3], 4, 5, 7, 8. 33 | \I\\{tip}, 1, 5, 6, 7. 34 | \I\\{tmax}, \[1], 4, 5, 9. 35 | \I\\{try_next}, \[4], 8. 36 | \I\|{u}, \[1]. 37 | \I\|{v}, \[1]. 38 | \I\\{vert}, \[4], 5, 6, 8, 9. 39 | \I\&{Vertex}, 1. 40 | \I\\{vertices}, 1, 3, 4, 8, 9. 41 | \I\|{x}, \[1]. 42 | \I\|{y}, \[1]. 43 | \I\|{z}, \[1]. 44 | -------------------------------------------------------------------------------- /texinputs/dproofmac.tex: -------------------------------------------------------------------------------- 1 | \ifx\undefined\documentclass\input proofmac.tex 2 | \else\endinput\fi % LaTeX will use other macros 3 | 4 | \let\pdffalse=\relax 5 | \input dcwebstrings.tex 6 | 7 | \def\fin{\par\vfill\eject % this is done when we are ending the index 8 | \ifpagesaved\null\vfill\eject\fi % output a null index column 9 | \if L\lr\else\null\vfill\eject\fi % finish the current page 10 | \parfillskip 0pt plus 1fil 11 | \let\topsecno=\nullsec 12 | \redeffin 13 | \output={\normaloutput\page\lheader\rheader} 14 | \setpage 15 | \def\note##1##2.{\quad{\eightrm##1~##2.}} 16 | \def\I{\par\hangindent 2em}\let\*=* 17 | \readsections} 18 | \def\con{\par\vfill\eject % finish the section names 19 | \rightskip 0pt \hyphenpenalty 50 \tolerance 200 20 | \setpage \output={\normaloutput\page\lheader\rheader} 21 | \titletrue % prepare to output the table of contents 22 | \pageno=\contentspagenumber 23 | \redefcon 24 | \topofcontents 25 | \line{\headerline} 26 | \let\ZZ=\contentsline 27 | \readcontents\relax % read the contents info 28 | \botofcontents \end} % print the contents page(s) and terminate 29 | -------------------------------------------------------------------------------- /vault/cwebbin.dsw: -------------------------------------------------------------------------------- 1 | Microsoft Developer Studio Workspace File, Format Version 6.00 2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! 3 | 4 | ############################################################################### 5 | 6 | Project: "ctangle"=".\ctangle.dsp" - Package Owner=<4> 7 | 8 | Package=<5> 9 | {{{ 10 | }}} 11 | 12 | Package=<4> 13 | {{{ 14 | }}} 15 | 16 | ############################################################################### 17 | 18 | Project: "cweave"=".\cweave.dsp" - Package Owner=<4> 19 | 20 | Package=<5> 21 | {{{ 22 | }}} 23 | 24 | Package=<4> 25 | {{{ 26 | }}} 27 | 28 | ############################################################################### 29 | 30 | Project: "wmerge"=".\examples\wmerge.dsp" - Package Owner=<4> 31 | 32 | Package=<5> 33 | {{{ 34 | }}} 35 | 36 | Package=<4> 37 | {{{ 38 | }}} 39 | 40 | ############################################################################### 41 | 42 | Global: 43 | 44 | Package=<5> 45 | {{{ 46 | }}} 47 | 48 | Package=<3> 49 | {{{ 50 | }}} 51 | 52 | ############################################################################### 53 | 54 | -------------------------------------------------------------------------------- /texlive.w: -------------------------------------------------------------------------------- 1 | @q Changes for CWEB in TeX Live from numerous contributors. @> 2 | @q This file is in the Public Domain. @> 3 | 4 | @q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @> 5 | @q were merged with the set of change files of the CWEBbin project; @> 6 | @q see https://github.com/ascherer/cwebbin for the original parts. @> 7 | 8 | @q This stripped change file {comm,ctang,cweav,ctwill,cwebman}-w2c.ch @> 9 | @q has been created from the elaborate set of change files @> 10 | @q {comm,ctang,cweav,cwebman}-patch.ch, @> 11 | @q {comm,cweav,cwebman}-extensions.ch, {comm,ctang,cweav}-output.ch, @> 12 | @q {comm,ctang,cweav}-i18n.ch, and cweav-twill.ch for CTWILL, and @> 13 | @q {comm,ctang,cweav,ctwill,cwebman}-texlive.ch with the 'tie' processor @> 14 | @q and is used as a monolithic changefile for {common,ctangle,cweave}.w @> 15 | @q and cwebman.tex in TeX Live. @> 16 | 17 | @q Please send comments, suggestions, etc. to tex-k@@tug.org. @> 18 | 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Andreas Scherer 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/system.bux: -------------------------------------------------------------------------------- 1 | @$memcmp "" \zip@> 2 | @$strcat "" \zip@> 3 | @$strcmp "" \zip@> 4 | @$strcpy "" \zip@> 5 | @$strlen "" \zip@> 6 | @$strncmp "" \zip@> 7 | @$strncpy "" \zip@> 8 | 9 | @$BUFSIZ "" \zip@> 10 | @$fclose "" \zip@> 11 | @$feof "" \zip@> 12 | @$fflush "" \zip@> 13 | @$fopen "" \zip@> 14 | @$fprintf "" \zip@> 15 | @$fputs "" \zip@> 16 | @$fread "" \zip@> 17 | @$fwrite "" \zip@> 18 | @$printf "" \zip@> 19 | @$putc "" \zip@> 20 | @$putchar "" \zip@> 21 | @$puts "" \zip@> 22 | @$rename "" \zip@> 23 | @$remove "" \zip@> 24 | @$sprintf "" \zip@> 25 | @$sscanf "" \zip@> 26 | @$stdout "" \zip@> 27 | @$stderr "" \zip@> 28 | 29 | @$exit "" \zip@> 30 | 31 | @$isalpha "" \zip@> 32 | @$isdigit "" \zip@> 33 | @$islower "" \zip@> 34 | @$isspace "" \zip@> 35 | @$isupper "" \zip@> 36 | @$isxdigit "" \zip@> 37 | @$tolower "" \zip@> 38 | @$toupper "" \zip@> 39 | 40 | @$gettext "" \zip@> 41 | @$textdomain "" \zip@> 42 | -------------------------------------------------------------------------------- /comm-output.hch: -------------------------------------------------------------------------------- 1 | Changes for COMMON.H by Andreas Scherer, January 2021. 2 | 3 | This set of changes modifies the output behaviour of the CWEB system. 4 | Instead of writing directly to the C or TeX file as described in the 5 | manual, the current run is documented in a temporary output file which is 6 | copied to the expected file in the last moment. In case of an user abort, 7 | previous results are not destroyed. 8 | 9 | For a complete history of the changes made to COMMON.H see COMM-PATCH.CH. 10 | 11 | Section 14. 12 | 13 | @x l.223 14 | @d make_xrefs flags['x'] /* should cross references be output? */ 15 | @y 16 | @d make_xrefs flags['x'] /* should cross references be output? */ 17 | @d check_for_change flags['c'] /* check temporary output for changes */ 18 | @z 19 | 20 | @x l.231 21 | extern char scn_file_name[]; /* name of |scn_file| */ 22 | @y 23 | extern char scn_file_name[]; /* name of |scn_file| */ 24 | extern char check_file_name[]; /* name of |check_file| */ 25 | @z 26 | 27 | Section 15. 28 | 29 | @x l.244 30 | extern FILE *active_file; /* currently active file for \.{CWEAVE} output */ 31 | @y 32 | extern FILE *active_file; /* currently active file for \.{CWEAVE} output */ 33 | extern FILE *check_file; /* temporary output file */ 34 | @z 35 | -------------------------------------------------------------------------------- /po/cweb-tl.pot: -------------------------------------------------------------------------------- 1 | # International version of CWEB (CWEBbin, TeXLive). 2 | # Copyright (C) 2023 Andreas Scherer et al. 3 | # This file is distributed under the same license as the CWEB package. 4 | # Andreas Scherer . 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: CWEBbin 2025\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2025-01-01 15:08+0100\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: comm-texlive.ch:547 21 | #, c-format 22 | msgid "" 23 | "\n" 24 | "\nPackage home page: %s.\n" 25 | msgstr "" 26 | 27 | #: comm-texlive.ch:511 28 | #, c-format 29 | msgid "%s: Need one to three file arguments.\n" 30 | msgstr "" 31 | 32 | #: ctang-texlive.ch:39 33 | msgid "This is CTANGLE, Version 4.12.1" 34 | msgstr "" 35 | 36 | #: ctwill-texlive.ch:39 37 | msgid "This is CTWILL, Version 4.12.1" 38 | msgstr "" 39 | 40 | #: cweav-texlive.ch:39 41 | msgid "This is CWEAVE, Version 4.12.1" 42 | msgstr "" 43 | 44 | #: comm-texlive.ch:512 45 | #, c-format 46 | msgid "Try `%s --help' for more information.\n" 47 | msgstr "" 48 | -------------------------------------------------------------------------------- /po/de/cweb-tl.po: -------------------------------------------------------------------------------- 1 | # International version of CWEB (CWEBbin, TeXLive). 2 | # Copyright (C) 2025 Andreas Scherer et al. 3 | # This file is distributed under the same license as the CWEB package. 4 | # Andreas Scherer . 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: CWEBbin 2025\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2025-01-01 15:08+0100\n" 11 | "PO-Revision-Date: 2025-07-27 15:08+0200\n" 12 | "Last-Translator: Andreas Scherer \n" 13 | "Language-Team: German\n" 14 | "Language: de\n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=UTF-8\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 19 | 20 | #: comm-texlive.ch:531 21 | #, c-format 22 | msgid "" 23 | "\n" 24 | "Email bug reports to %s.\n" 25 | "\nPackage home page: %s.\n" 26 | msgstr "" 27 | "\n" 28 | "Weitergehende Informationen auf %s.\n" 29 | 30 | #: comm-texlive.ch:511 31 | #, c-format 32 | msgid "%s: Need one to three file arguments.\n" 33 | msgstr "%s: Benötige ein bis drei Dateiargumente.\n" 34 | 35 | #: ctang-texlive.ch:39 36 | msgid "This is CTANGLE, Version 4.12.2" 37 | msgstr "Dies ist CTANGLE, Version 4.12.2" 38 | 39 | #: ctwill-texlive.ch:39 40 | msgid "This is CTWILL, Version 4.12.2" 41 | msgstr "Dies ist CTWILL, Version 4.12.2" 42 | 43 | #: cweav-texlive.ch:39 44 | msgid "This is CWEAVE, Version 4.12.2" 45 | msgstr "Dies ist CWEAVE, Version 4.12.2" 46 | 47 | #: comm-texlive.ch:512 48 | #, c-format 49 | msgid "Try `%s --help' for more information.\n" 50 | msgstr "Versuche `%s --help' für weitere Informationen.\n" 51 | -------------------------------------------------------------------------------- /prod-cweave.ch: -------------------------------------------------------------------------------- 1 | Section 111. 2 | 3 | @x 4 | \+& |exp| \altt|lbrace| |int_like| |decl| 5 | @y 6 | \+\dagit& |exp| \altt|lbrace| |int_like| |decl| 7 | @z 8 | 9 | @x 10 | \+& |decl_head| \altt|int_like| |lbrace| |decl| & |fn_decl| 11 | @y 12 | \+\dagit& |decl_head| \altt|int_like| |lbrace| |decl| & |fn_decl| 13 | @z 14 | 15 | @x 16 | \+& |decl| \alt|stmt| |function| & \alt|stmt| |function| 17 | @y 18 | \+\dagit& |decl| \alt|stmt| |function| & \alt|stmt| |function| 19 | @z 20 | 21 | @x 22 | \+& |fn_decl| |stmt| & |function| \hfill $F\,|out|\,|out|\,|force|\,S$ 23 | @y 24 | \+\dagit& |fn_decl| |stmt| & |function| \hfill $F\,|out|\,|out|\,|force|\,S$ 25 | @z 26 | 27 | @x 28 | \+& |catch_like| \alt|cast| |exp| & |fn_decl| \hfill 29 | @y 30 | \+\dagit& |catch_like| \alt|cast| |exp| & |fn_decl| \hfill 31 | @z 32 | 33 | @x 34 | \parindent=0pt 35 | @y 36 | \parindent=0pt 37 | \everypar={\hangindent=2em} 38 | @z 39 | 40 | @x 41 | Rules 35, 117: The |exp| must not be immediately followed by |lpar|, |lbrack|, 42 | @y 43 | Rules 1, 38, 52, and 73: The \\{din}s and \\{out}s are suppressed if 44 | \.{CWEAVE} has been invoked with the \.{-i} option. 45 | 46 | Rules 35, 117: The |exp| must not be immediately followed by |lpar|, |lbrack|, 47 | @z 48 | 49 | @x 50 | Rule 48: The |exp| or |int_like| must not be immediately followed by |base|. 51 | @y 52 | Rule 41: The |big_force| becomes |force| if \.{CWEAVE} has been invoked with the 53 | \.{-o} option. 54 | 55 | Rule 48: The |exp| or |int_like| must not be immediately followed by |base|. 56 | @z 57 | 58 | @x 59 | been invoked with the \.{-f} option. 60 | @y 61 | been invoked with the \.{-f} option, and the |big_force| in the |decl| and 62 | |function| lines becomes |force| if \.{CWEAVE} has been invoked with the 63 | \.{-o} option. 64 | @z 65 | -------------------------------------------------------------------------------- /tests/gb_graph.hux: -------------------------------------------------------------------------------- 1 | @$util {GB\_\,GRAPH}8 =\&{union}@> 2 | @$V {GB\_\,GRAPH}8 \&{Vertex} ${}{*}{}$@> 3 | @$A {GB\_\,GRAPH}8 \&{Arc} ${}{*}{}$@> 4 | @$G {GB\_\,GRAPH}8 \&{Graph} ${}{*}{}$@> 5 | @$S {GB\_\,GRAPH}8 \&{char} ${}{*}{}$@> 6 | @$I {GB\_\,GRAPH}8 \&{long}@> 7 | 8 | @$Vertex {GB\_\,GRAPH}9 =\&{struct}@> 9 | @$arcs {GB\_\,GRAPH}9 \&{Arc} ${}{*}{}$@> 10 | @$name {GB\_\,GRAPH}9 \&{char} ${}{*}{}$@> 11 | @$u {GB\_\,GRAPH}9 \&{util}@> 12 | @$v {GB\_\,GRAPH}9 \&{util}@> 13 | @$w {GB\_\,GRAPH}9 \&{util}@> 14 | @$x {GB\_\,GRAPH}9 \&{util}@> 15 | @$y {GB\_\,GRAPH}9 \&{util}@> 16 | @$z {GB\_\,GRAPH}9 \&{util}@> 17 | 18 | @$Arc {GB\_\,GRAPH}10 =\&{struct}@> 19 | @$tip {GB\_\,GRAPH}10 \&{Vertex} ${}{*}{}$@> 20 | @$next {GB\_\,GRAPH}10 \&{Arc} ${}{*}{}$@> 21 | @$len {GB\_\,GRAPH}10 \&{long}@> 22 | @$a {GB\_\,GRAPH}10 \&{util}@> 23 | @$b {GB\_\,GRAPH}10 \&{util}@> 24 | 25 | @$gb_typed_alloc {GB\_\,GRAPH}11 =macro (\,)@> 26 | 27 | @$Graph {GB\_\,GRAPH}20 =\&{struct}@> 28 | @$vertices {GB\_\,GRAPH}20 \&{Vertex} ${}{*}{}$@> 29 | @$n {GB\_\,GRAPH}20 \&{long}@> 30 | @$m {GB\_\,GRAPH}20 \&{long}@> 31 | @$uu {GB\_\,GRAPH}20 \&{util}@> 32 | @$vv {GB\_\,GRAPH}20 \&{util}@> 33 | @$ww {GB\_\,GRAPH}20 \&{util}@> 34 | @$xx {GB\_\,GRAPH}20 \&{util}@> 35 | @$yy {GB\_\,GRAPH}20 \&{util}@> 36 | @$zz {GB\_\,GRAPH}20 \&{util}@> 37 | 38 | @$n_1 {GB\_\,GRAPH}22 =\\{uu}.\|I@> 39 | 40 | @$arcs_per_block {GB\_\,GRAPH}29 =\T{102}@> 41 | 42 | @$gb_new_graph {GB\_\,GRAPH}31 =macro@> 43 | @$gb_new_arc {GB\_\,GRAPH}31 =macro@> 44 | @$gb_new_edge {GB\_\,GRAPH}31 =macro@> 45 | 46 | @$siz_t {GB\_\,GRAPH}34 =\&{unsigned} \&{long}@> 47 | 48 | @$string_block_size {GB\_\,GRAPH}35 =\T{1016}@> 49 | 50 | @$hash_link {GB\_\,GRAPH}43 =\|u.\|V@> 51 | @$hash_head {GB\_\,GRAPH}43 =\|v.\|V@> 52 | 53 | @$HASH_MULT {GB\_\,GRAPH}45 =\T{314159}@> 54 | @$HASH_PRIME {GB\_\,GRAPH}45 =\T{516595003}@> 55 | -------------------------------------------------------------------------------- /tests/index.tex: -------------------------------------------------------------------------------- 1 | \input cttwinxmac 2 | \I\|{a}\unskip, {\sc HAM}~\[1]. 3 | \I\\{aa}\unskip, {\sc HAM}~\[1], 5, 6, 7. 4 | \I\\{advance}\unskip, {\sc HAM}~\[4], 5, 7. 5 | \I\&{Arc}\unskip, {\sc HAM}~1. 6 | \I\\{arcs}\unskip, {\sc HAM}~1, 3, 5, 6. 7 | \I\\{argc}\unskip, {\sc HAM}~\[1], 2. 8 | \I\\{argv}\unskip, {\sc HAM}~\[1], 2. 9 | \I\\{ark}\unskip, {\sc HAM}~\[4], 5, 7, 8. 10 | \I\|{b}\unskip, {\sc HAM}~\[1]. 11 | \I\\{backtrack}\unskip, {\sc HAM}~\[4], 5. 12 | \I\\{bb}\unskip, {\sc HAM}~\[1]. 13 | \I\\{count}\unskip, {\sc HAM}~\[1], 9. 14 | \I\|{d}\unskip, {\sc HAM}~\[1]. 15 | \I\\{deg}\unskip, {\sc HAM}~\[1], 3, 5, 6. 16 | \I\\{dmin}\unskip, {\sc HAM}~\[1], 3. 17 | \I\\{done}\unskip, {\sc HAM}~\[4], 8. 18 | \I\\{exit}\unskip, {\sc HAM}~2. 19 | \I\\{fprintf}\unskip, {\sc HAM}~2. 20 | \I\|{g}\unskip, {\sc HAM}~\[1]. 21 | \I\&{Graph}\unskip, {\sc HAM}~1. 22 | \I\\{main}\unskip, {\sc HAM}~\[1]. 23 | \I\\{modulus}\unskip, {\sc HAM}~\[1], 2, 9. 24 | \I\\{name}\unskip, {\sc HAM}~1, 9. 25 | \I\\{next}\unskip, {\sc HAM}~1, 3, 5, 6, 7, 8. 26 | \I\\{printf}\unskip, {\sc HAM}~1, 9. 27 | \I\\{restore}\unskip, {\sc HAM}~\[4], 5, 7. 28 | \I\\{restore\_all}\unskip, {\sc HAM}~\[7], 8. 29 | \I\\{restore\_graph}\unskip, {\sc HAM}~1, 2. 30 | \I\\{sscanf}\unskip, {\sc HAM}~2. 31 | \I\\{stderr}\unskip, {\sc HAM}~2. 32 | \I\|{t}\unskip, {\sc HAM}~\[1]. 33 | \I\\{taken}\unskip, {\sc HAM}~\[3], 4, 5, 7, 8. 34 | \I\\{tip}\unskip, {\sc HAM}~1, 5, 6, 7. 35 | \I\\{tmax}\unskip, {\sc HAM}~\[1], 4, 5, 9. 36 | \I\\{try\_next}\unskip, {\sc HAM}~\[4], 8. 37 | \I\|{u}\unskip, {\sc HAM}~\[1]. 38 | \I\|{v}\unskip, {\sc HAM}~\[1]. 39 | \I\\{vert}\unskip, {\sc HAM}~\[4], 5, 6, 8, 9. 40 | \I\&{Vertex}\unskip, {\sc HAM}~1. 41 | \I\\{vertices}\unskip, {\sc HAM}~1, 3, 4, 8, 9. 42 | \I\|{x}\unskip, {\sc HAM}~\[1]. 43 | \I\|{y}\unskip, {\sc HAM}~\[1]. 44 | \I\|{z}\unskip, {\sc HAM}~\[1]. 45 | \fin 46 | -------------------------------------------------------------------------------- /tests/ham.sref: -------------------------------------------------------------------------------- 1 | \]{GB\_\,GRAPH}10 \&{Arc} =\&{struct} 2 | \]{GB\_\,GRAPH}9 \\{arcs} \&{Arc} ${}{*}{}$ 3 | \]"" \\{exit} \zip 4 | \]"" \\{fprintf} \zip 5 | \]{GB\_\,GRAPH}20 \&{Graph} =\&{struct} 6 | \]{GB\_\,GRAPH}8 \|{I} \&{long} 7 | \]{GB\_\,GRAPH}20 \|{n} \&{long} 8 | \]{GB\_\,GRAPH}9 \\{name} \&{char} ${}{*}{}$ 9 | \]{GB\_\,GRAPH}10 \\{next} \&{Arc} ${}{*}{}$ 10 | \]"" \\{printf} \zip 11 | \]{GB\_\,SAVE}4 \\{restore\_graph} \&{Graph} ${}{*}(\,){}$ 12 | \]"" \\{sscanf} \zip 13 | \]"" \\{stderr} \zip 14 | \]{GB\_\,GRAPH}10 \\{tip} \&{Vertex} ${}{*}{}$ 15 | \]{GB\_\,GRAPH}9 \|{u} \&{util} 16 | \]{GB\_\,GRAPH}9 \|{v} \&{util} 17 | \]{GB\_\,GRAPH}9 \&{Vertex} =\&{struct} 18 | \]{GB\_\,GRAPH}20 \\{vertices} \&{Vertex} ${}{*}{}$ 19 | \donewithpage2 20 | \[1 \|{a} \&{register} \&{Arc} ${}{*}{}$ 21 | \]{GB\_\,GRAPH}8 \|{A} \&{Arc} ${}{*}{}$ 22 | \[1 \\{aa} \&{register} \&{Arc} ${}{*}{}$ 23 | \]{GB\_\,GRAPH}9 \\{arcs} \&{Arc} ${}{*}{}$ 24 | \[1 \\{count} \&{int} 25 | \[1 \|{d} \&{register} \&{int} 26 | \[1 \\{deg} =\|u.\|I 27 | \[1 \|{g} \&{Graph} ${}{*}{}$ 28 | \[1 \\{modulus} \&{int} 29 | \]{GB\_\,GRAPH}20 \|{n} \&{long} 30 | \]{GB\_\,GRAPH}9 \\{name} \&{char} ${}{*}{}$ 31 | \]{GB\_\,GRAPH}10 \\{next} \&{Arc} ${}{*}{}$ 32 | \]"" \\{printf} \zip 33 | \[1 \|{t} \&{register} \&{Vertex} ${}{*}{}$ 34 | \[3 \\{taken} =\|v.\|I 35 | \]{GB\_\,GRAPH}10 \\{tip} \&{Vertex} ${}{*}{}$ 36 | \[1 \\{tmax} \&{Vertex} ${}{*}{}$ 37 | \[1 \|{u} \&{register} \&{Vertex} ${}{*}{}$ 38 | \[1 \|{v} \&{register} \&{Vertex} ${}{*}{}$ 39 | \]{GB\_\,GRAPH}8 \|{V} \&{Vertex} ${}{*}{}$ 40 | \]{GB\_\,GRAPH}20 \\{vertices} \&{Vertex} ${}{*}{}$ 41 | \]{GB\_\,GRAPH}9 \|{w} \&{util} 42 | \[1 \|{x} \&{register} \&{Vertex} ${}{*}{}$ 43 | \]{GB\_\,GRAPH}9 \|{x} \&{util} 44 | \[1 \|{y} \&{Vertex} ${}{*}{}$ 45 | \[1 \|{z} \&{Vertex} ${}{*}{}$ 46 | \donewithpage4 47 | -------------------------------------------------------------------------------- /examples/wmerg-borlandc.ch: -------------------------------------------------------------------------------- 1 | Changes for WMERGE.W by Andreas Scherer, May 10, 1995. 2 | 3 | This set of changes provides support for installing CWEB on MS/DOS systems 4 | with Borland C++ 3.1. A mysterious bug in a multiple `return' situation is 5 | fixed. Care has been taken to avoid conflicts with other operating 6 | systems. For other MS/DOS compilers than Borland C++ 3.1 you may not need 7 | to apply this change file. 8 | 9 | This change file requires WMERG-PATCH.CH, WMERG-ANSI.CH, 10 | WMERG-EXTENSIONS.CH, WMERG-MEMORY.CH to be applied as well. 11 | 12 | For a complete history of the changes made to WMERGE.W see WMERG-PATCH.CH. 13 | 14 | @x l.119 lf WMERG-EXTENSIONS.CH 15 | made sensitive to these conditions. 16 | @y 17 | made sensitive to these conditions. 18 | 19 | |__TURBOC__| has another shitty ``feature'' that has to be fixed. 20 | |return|ing from several |case|s crashes the system. Either always the 21 | first case is used, or the system is crashed completely. Really funny. 22 | @z 23 | 24 | @x l.132 of WMERG-EXTENSIONS.CH 25 | switch(history) { 26 | case harmless_message: return(RETURN_WARN); break; 27 | case error_message: return(RETURN_ERROR); break; 28 | case fatal_message: return(RETURN_FAIL); break; 29 | default: return(RETURN_OK); 30 | } 31 | @y 32 | #ifdef __TURBOC__ 33 | { 34 | int return_val; 35 | 36 | switch(history) { 37 | case harmless_message: return_val=RETURN_WARN; break; 38 | case error_message: return_val=RETURN_ERROR; break; 39 | case fatal_message: return_val=RETURN_FAIL; break; 40 | default: return_val=RETURN_OK; 41 | } 42 | return(return_val); 43 | } 44 | #else 45 | switch(history) { 46 | case harmless_message: return(RETURN_WARN); break; 47 | case error_message: return(RETURN_ERROR); break; 48 | case fatal_message: return(RETURN_FAIL); break; 49 | default: return(RETURN_OK); 50 | } 51 | #endif 52 | @z 53 | -------------------------------------------------------------------------------- /cwebinputs/cweb_ecma94.w: -------------------------------------------------------------------------------- 1 | % 2 | % CWEB/INCLUDE $VER: CWEB_ECMA94.W 1.6 (13.01.2019) 3 | % 4 | % SYNOPSIS: 5 | % Transliteration table for umlauts and special characters 6 | % according to the ISO 8859-1/ECMA-94/Latin-1 codepage. 7 | % @@include this file in limbo. 8 | % Note that not all equivalents to the TeX macros are present. 9 | % 10 | % DATE: 28.03.94: Derived from ECMA94.TEX (V1.0) 11 | % 12 | % AUTHOR: 13 | % Andreas Scherer 14 | % 15 | % Please send suggestions (pull requests) and bug reports (issues) 16 | % to https://github.com/ascherer/cwebbin 17 | % 18 | % COPYRIGHT: There is no restriction to the usage of this file. 19 | % 20 | % CHANGES: 21 | % March 25, 1996: New postal address. (V1.2) 22 | % August 13, 1998: New e-mail address. (V1.3) 23 | % June 11, 2000: Include matching TeX macros. (V1.4) 24 | % July 10, 2017: Complete overhaul. (V1.5) 25 | % January 13, 2019: Non-generic names. (V1.6) 26 | 27 | \input cweb_ecma94.sty 28 | \noatl 29 | 30 | @q b0 @> @q b1 @> @q b2 @> @q b3 @> @q b4 @> @l b5 mu 31 | @q b6 @> @q b7 @> @q b8 @> @q b9 @> @q ba @> @q bb @> 32 | @q bc @> @q bd @> @q be @> @q bf @> 33 | @l c0 A @l c1 A @l c2 A @l c3 A @l c4 Ae @l c5 AA 34 | @l c6 AE @l c7 C @l c8 E @l c9 E @l ca E @l cb Ee 35 | @l cc I @l cd I @l ce I @l cf Ie 36 | @q d0 @> @l d1 N @l d2 O @l d3 O @l d4 O @l d5 O 37 | @l d6 Oe @q d7 @> @l d8 O @l d9 U @l da U @l db U 38 | @l dc Ue @l dd Y @q de @> @l df ss 39 | @l e0 a @l e1 a @l e2 a @l e3 a @l e4 ae @l e5 aa 40 | @l e6 ae @l e7 c @l e8 e @l e9 e @l ea e @l eb ee 41 | @l ec i @l ed i @l ee i @l ef ie 42 | @q f0 @> @l f1 n @l f2 o @l f3 o @l f4 o @l f5 o 43 | @l f6 oe @q f7 @> @l f8 o @l f9 u @l fa u @l fb u 44 | @l fc ue @l fd y @q fe @> @l ff ye 45 | -------------------------------------------------------------------------------- /texinputs/dcwebstrings.tex: -------------------------------------------------------------------------------- 1 | % In case `german.sty' has been loaded, we have to redefine the `\3' 2 | % macro for an optional break within a statement. This should be the 3 | % first command after `\input german.sty' in your CWEB source. 4 | \def\originalthree{\def\3##1{\hfil\penalty##10\hfilneg}} 5 | 6 | \def\ATH{{\acrohintfalse\X\kern-.5em:Pr\"aprozessor Definitionen\X}} 7 | 8 | \def\A{\note{Siehe auch Abschnitt}} % xref for doubly defined section name 9 | \def\As{\note{Siehe auch die Abschnitte}} 10 | % xref for multiply defined section name 11 | 12 | \def\ET{ und~} % conjunction between two section numbers 13 | \def\ETs{ und~} % conjunction between the last two of several section numbers 14 | 15 | \def\Q{\note{Dieser Programmteil wird zitiert in Abschnitt}} 16 | % xref for mention of a section 17 | \def\Qs{\note{Dieser Programmteil wird zitiert in den Abschnitten}} 18 | % xref for mentions of a section 19 | 20 | \def\U{\note{Dieser Programmteil wird verwendet in Abschnitt}} 21 | % xref for use of a section 22 | \def\Us{\note{Dieser Programmteil wird verwendet in den Abschnitten}} 23 | % xref for uses of a section 24 | 25 | \def\ch{\note{Die folgenden Abschnitte sind vom Change-File ver\"andert worden:} 26 | \let\*=\relax} 27 | 28 | \def\redeffin{\message{Abschnittsnamen:} 29 | \def\grouptitle{ABSCHNITTSNAMEN} 30 | \def\outsecname{Abschnittsnamen} 31 | \def\Q{\note{Zitiert in Abschnitt}} % crossref for mention of a section 32 | \def\Qs{\note{Zitiert in den Abschnitten}} % crossref for mentions of a section 33 | \def\U{\note{Verwendet in Abschnitt}} % crossref for use of a section 34 | \def\Us{\note{Verwendet in den Abschnitten}} % crossref for uses of a section 35 | } 36 | 37 | \def\redefcon{\message{Inhaltsverzeichnis:} 38 | \def\grouptitle{INHALTSVERZEICHNIS:} 39 | \def\headerline{\hfil Abschnitt\ifhint\else\hbox to3em{\hss Seite}\fi} 40 | % No Page in HINT 41 | } 42 | -------------------------------------------------------------------------------- /tests/ham.ref: -------------------------------------------------------------------------------- 1 | !2 2 | + \]{GB\_\,GRAPH}9 \|{u} \&{util} 3 | + \]{GB\_\,GRAPH}10 \\{tip} \&{Vertex} ${}{*}{}$ 4 | + \]{GB\_\,GRAPH}10 \\{next} \&{Arc} ${}{*}{}$ 5 | + \]{GB\_\,GRAPH}9 \\{arcs} \&{Arc} ${}{*}{}$ 6 | + \]{GB\_\,GRAPH}9 \\{name} \&{char} ${}{*}{}$ 7 | + \]"" \\{printf} \zip 8 | + \]{GB\_\,GRAPH}20 \|{n} \&{long} 9 | + \]{GB\_\,GRAPH}20 \\{vertices} \&{Vertex} ${}{*}{}$ 10 | + \]{GB\_\,GRAPH}10 \&{Arc} =\&{struct} 11 | + \]{GB\_\,GRAPH}9 \&{Vertex} =\&{struct} 12 | + \]{GB\_\,GRAPH}20 \&{Graph} =\&{struct} 13 | + \]{GB\_\,SAVE}4 \\{restore\_graph} \&{Graph} ${}{*}(\,){}$ 14 | + \]{GB\_\,GRAPH}8 \|{I} \&{long} 15 | + \]"" \\{exit} \zip 16 | + \]"" \\{stderr} \zip 17 | + \]"" \\{fprintf} \zip 18 | + \]"" \\{sscanf} \zip 19 | + \]{GB\_\,GRAPH}9 \|{v} \&{util} 20 | !4 21 | + \[1 \|{x} \&{register} \&{Vertex} ${}{*}{}$ 22 | + \[1 \|{a} \&{register} \&{Arc} ${}{*}{}$ 23 | + \[1 \|{z} \&{Vertex} ${}{*}{}$ 24 | + \[1 \|{v} \&{register} \&{Vertex} ${}{*}{}$ 25 | + \[3 \\{taken} =\|v.\|I 26 | + \[1 \\{tmax} \&{Vertex} ${}{*}{}$ 27 | + \[1 \|{t} \&{register} \&{Vertex} ${}{*}{}$ 28 | + \[1 \|{g} \&{Graph} ${}{*}{}$ 29 | + \[1 \\{deg} =\|u.\|I 30 | + \[1 \|{d} \&{register} \&{int} 31 | + \[1 \|{u} \&{register} \&{Vertex} ${}{*}{}$ 32 | + \[1 \|{y} \&{Vertex} ${}{*}{}$ 33 | + \[1 \\{aa} \&{register} \&{Arc} ${}{*}{}$ 34 | + \[1 \\{modulus} \&{int} 35 | + \[1 \\{count} \&{int} 36 | + \]{GB\_\,GRAPH}9 \|{x} \&{util} 37 | + \]{GB\_\,GRAPH}9 \|{w} \&{util} 38 | + \]{GB\_\,GRAPH}20 \|{n} \&{long} 39 | + \]{GB\_\,GRAPH}20 \\{vertices} \&{Vertex} ${}{*}{}$ 40 | + \]{GB\_\,GRAPH}8 \|{A} \&{Arc} ${}{*}{}$ 41 | + \]{GB\_\,GRAPH}8 \|{V} \&{Vertex} ${}{*}{}$ 42 | + \]{GB\_\,GRAPH}10 \\{tip} \&{Vertex} ${}{*}{}$ 43 | + \]{GB\_\,GRAPH}10 \\{next} \&{Arc} ${}{*}{}$ 44 | + \]{GB\_\,GRAPH}9 \\{arcs} \&{Arc} ${}{*}{}$ 45 | + \]{GB\_\,GRAPH}9 \\{name} \&{char} ${}{*}{}$ 46 | + \]"" \\{printf} \zip 47 | -------------------------------------------------------------------------------- /refsort.ch: -------------------------------------------------------------------------------- 1 | Changes for the REFSORT utility from the CTWILL tarball. 2 | 3 | This minimal set of changes tries to satisfy the GCC compiler. 4 | 5 | This file is not copyrighted and can be used freely. 6 | 7 | @x [0] l.2 8 | \datethis 9 | @y 10 | \datethis 11 | \let\maybe=\iffalse % print only sections that change 12 | @z 13 | 14 | @x [1] l.35 extend index entries for HiTeX and Inverse Adding-Doubling 15 | @d max_key 30 /* greater than the length of the longest identifier */ 16 | @d max_size 100 /* greater than the length of the longest mini-index entry */ 17 | @y 18 | @d max_key 50 /* greater than the length of the longest identifier */ 19 | @d max_size 120 /* greater than the length of the longest mini-index entry */ 20 | @z 21 | 22 | @x [2] l.43 standard C library interface 23 | #include "stdio.h" 24 | #include "strings.h" 25 | #include "ctype.h" 26 | @y 27 | #include 28 | #include 29 | #include 30 | @z 31 | 32 | @x [2] l.57 declare return type 33 | main() 34 | @y 35 | int main() 36 | @z 37 | 38 | @x [2] l.59 'register' removed in C++17. 39 | register char *p,*q; 40 | register int n; /* current number of items */ 41 | register item *x, **y; 42 | @y 43 | char *p,*q; 44 | int n; /* current number of items */ 45 | item *x, **y; 46 | @z 47 | 48 | @x [4] l.83 49 | @; 50 | @y 51 | @; 52 | @z 53 | 54 | @x [5] l.89 variable not used 55 | { register int k; 56 | @y 57 | { 58 | @z 59 | 60 | @x [6] l.99 61 | @= 62 | @y 63 | @= 64 | @z 65 | 66 | @x [9] l.149 'register' removed in C++17 67 | { register int toggle=0; 68 | @y 69 | { int toggle=0; 70 | @z 71 | 72 | @x [10] l.157 'register' removed in C++17 73 | { register int toggle=0; 74 | @y 75 | { int toggle=0; 76 | @z 77 | 78 | @x [10] l.162 add 'Index.' section 79 | for (;*p;p++) *q++=*p; 80 | } 81 | 82 | @y 83 | for (;*p;p++) *q++=*p; 84 | } 85 | 86 | @* Index. 87 | @z 88 | -------------------------------------------------------------------------------- /texinputs/Xcwebmac.tex: -------------------------------------------------------------------------------- 1 | % standard macros for CWEB listings (in addition to plain.tex) 2 | % Version 2.4 --- Don Knuth, June 1992 3 | % Version 2.4 [p5] --- Hans-Hermann Bode, July 1992 4 | % Version 2.7 --- Don Knuth, July 1992 5 | % Version 2.7 [p6] --- Hans-Hermann Bode, September 1992 6 | % Version 2.8 --- Don Knuth, September 1992 7 | % Version 2.8 [p7] --- Andreas Scherer, October 1993 8 | % Version 3.0 --- Don Knuth, June 1993 9 | % Version 3.0 [p8c] --- Hans-Hermann Bode, June 1993 10 | % Version 3.0 [p8d] --- Andreas Scherer, October 1993 11 | % Version 3.0 [p8e] --- Andreas Scherer, November 1993 12 | % Version 3.1 [p9b] --- Andreas Scherer, January 1994 13 | % Version 3.1 [p9c] --- Andreas Scherer, June 1994 14 | % Version 3.2 [p10] --- Andreas Scherer, September 1994 15 | % Version 3.3 [p11] --- Andreas Scherer, December 1994 16 | % Version 3.3 [p11a] --- Andreas Scherer, January 1995 17 | % Version 3.3 [p11b] --- Andreas Scherer, March 1995 18 | % Version 3.4 [p13] --- Andreas Scherer, May 1996 19 | % Version 3.4 [p14] --- Andreas Scherer, March 1997 20 | % Version 3.42 [p15] --- Andreas Scherer, August 1998 21 | % Version 3.43 [p16] --- Andreas Scherer, October 1998 22 | % Version 3.5 [p17] --- Andreas Scherer, December 1999 23 | % Version 3.61 [p18] --- Andreas Scherer, July 2000 24 | % Version 3.63 [p19] --- Andreas Scherer, January 2001 25 | % Version 3.64 [p20] --- Andreas Scherer, March 2002 26 | % Version 3.64 [p21] --- Andreas Scherer, Octobre 2005 27 | % Version 3.64 [2018] --- Andreas Scherer, Octobre 2018 28 | % Version 3.64 [2020] --- Andreas Scherer, May 2020 29 | % Version 4.3 [2021] --- Andreas Scherer, April 2021 30 | 31 | \ifx\undefined\botofcontents\input cwebmac.tex\fi 32 | 33 | \xdef\fmtversion{\fmtversion[2021]} 34 | 35 | \font\tenss=cmss10 \let\cmntfont\tenss % comment font 36 | 37 | \def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$} 38 | \def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}} 39 | 40 | \let\K=\leftarrow % "honest" alternative to standard assignment operator 41 | -------------------------------------------------------------------------------- /cwebinputs/cweb_hp8.w: -------------------------------------------------------------------------------- 1 | % 2 | % CWEB/INCLUDE $VER: CWEB_HP8.W 1.6 (13.01.2019) 3 | % 4 | % SYNOPSIS: 5 | % Transliteration table for umlauts and special characters 6 | % according to the Hewlett-Packard Roman 8 codepage. 7 | % @@include this file in limbo. 8 | % Note that not all equivalents to the TeX macros are present. 9 | % 10 | % DATE: 28.03.94: Derived from HP8.TEX (V1.0) 11 | % 12 | % AUTHOR: 13 | % Andreas Scherer 14 | % 15 | % Please send suggestions (pull requests) and bug reports (issues) 16 | % to https://github.com/ascherer/cwebbin 17 | % 18 | % COPYRIGHT: There is no restriction to the usage of this file. 19 | % 20 | % CHANGES: 21 | % March 25, 1996: New postal address. (V1.2) 22 | % August 13, 1998: New e-mail address. (V1.3) 23 | % June 11, 2000: Include matching TeX macros. (V1.4) 24 | % July 10, 2017: Complete overhaul. (V1.5) 25 | % January 13, 2019: Non-generic names. (V1.6) 26 | 27 | \input cweb_hp8.sty 28 | \noatl 29 | 30 | @q a0 @> @l a1 A @l a2 A @l a3 E @l a4 E @l a5 Ee 31 | @l a6 I @l a7 Ie @q a8 @> @q a9 @> @q aa @> @q ab @> 32 | @q ac @> @l ad U @l ae U @q af @> 33 | @q b0 @> @l b1 Y @l b2 y @q b3 @> @l b4 C @l b5 c 34 | @l b6 N @l b7 n @q b8 @> @q b9 @> @q ba @> @q bb @> 35 | @q bc @> @q bd @> @q be @> @q bf @> 36 | @l c0 a @l c1 e @l c2 o @l c3 u @l c4 a @l c5 e 37 | @l c6 o @l c7 u @l c8 a @l c9 e @l ca o @l cb u 38 | @l cc ae @l cd ee @l ce oe @l cf ue 39 | @l d0 AA @l d1 i @l d2 O @l d3 AE @l d4 aa @l d5 i 40 | @l d6 o @l d7 ae @l d8 Ae @l d9 i @l da Oe @l db Ue 41 | @l dc E @l dd ie @l de ss @l df O 42 | @l e0 A @l e1 A @l e2 a @q e3 @> @q e4 @> @l e5 I 43 | @l e6 I @l e7 O @l e8 O @l e9 O @l ea o @q eb @> 44 | @q ec @> @l ed U @l ee Ye @l ef ye 45 | @q f0 @> @q f1 @> @q f2 @> @l f3 mu @q f4 @> @q f5 @> 46 | @q f6 @> @q f7 @> @q f8 @> @q f9 @> @q fa @> @q fb @> 47 | @q fc @> @q fd @> @q fe @> @q ff @> 48 | -------------------------------------------------------------------------------- /cwtw-texlive.ch: -------------------------------------------------------------------------------- 1 | % Kpathsea changes for CWEAVE and CTWILL by Andreas Scherer 2 | % This file is in the Public Domain. 3 | 4 | % These changes apply to both CWEAVE and CTWILL when preparing their 5 | % incantations for TeX Live. They were factored out of cweav-texlive.ch 6 | % and ctwill-texlive.ch to avoid redundancy and discrepancy. 7 | 8 | Material in limbo. 9 | 10 | @x l.39 and CWEAV-PATCH.CH 11 | \centerline{(@VERSION@)} 12 | @y 13 | \centerline{(Version 4.12.2 [\TeX~Live])} 14 | @z 15 | 16 | @x l.41 17 | \def\botofcontents{\vfill 18 | @y 19 | \def\covernote{\vbox{% 20 | @z 21 | 22 | @x l.54 23 | } 24 | @y 25 | }} 26 | @z 27 | 28 | Section 2. 29 | 30 | @x l.98 - Add Web2c version to banner. 31 | if (show_banner) puts(banner); /* print a ``banner line'' */ 32 | @y 33 | if (show_banner) cb_show_banner(); /* print a ``banner line'' */ 34 | @z 35 | 36 | Sections 3--18. 37 | 38 | @x l.112 and CWEAV-PATCH.CH 39 | @i comm-foo.h 40 | @y 41 | @i comm-w2c.h 42 | @z 43 | 44 | Section 23. 45 | 46 | @x l.217 47 | @ @d max_refs 30000 /* number of cross-references; must be less than 65536 */ 48 | @y 49 | @ @d max_refs 65535 /* number of cross-references; must be less than 65536 */ 50 | @z 51 | 52 | Section 30. 53 | 54 | @x l.337 55 | @d max_toks 30000 /* number of symbols in \CEE/ texts being parsed; 56 | must be less than 65536 */ 57 | @d max_texts 8000 /* number of phrases in \CEE/ texts being parsed; 58 | must be less than 10240 */ 59 | @y 60 | @d max_toks 65535 /* number of symbols in \CEE/ texts being parsed; 61 | must be less than 65536 */ 62 | @d max_texts 10239 /* number of phrases in \CEE/ texts being parsed; 63 | must be less than 10240 */ 64 | @z 65 | 66 | Appendix. 67 | 68 | @x l.4892 69 | @** Index. 70 | @y 71 | @* Print ``version'' information. 72 | Don't do this at home, kids! Push our local macro to the variable in \.{COMMON} 73 | for printing the |banner| and the |versionstring| from there. 74 | 75 | @d max_banner 50 76 | 77 | @= 78 | extern char cb_banner[]; 79 | 80 | @ @= 81 | strncpy(cb_banner,banner,max_banner-1); 82 | 83 | @** Index. 84 | @z 85 | -------------------------------------------------------------------------------- /system.bux: -------------------------------------------------------------------------------- 1 | @$memcmp "" \zip@> 2 | @$memcpy "" \zip@> 3 | @$strcat "" \zip@> 4 | @$strchr "" \zip@> 5 | @$strcmp "" \zip@> 6 | @$strcpy "" \zip@> 7 | @$strlen "" \zip@> 8 | @$strncmp "" \zip@> 9 | @$strncpy "" \zip@> 10 | @$strrchr "" \zip@> 11 | 12 | @$BUFSIZ "" \zip@> 13 | @$EOF "" \zip@> 14 | @$fclose "" \zip@> 15 | @$feof "" \zip@> 16 | @$fflush "" \zip@> 17 | @$fopen "" \zip@> 18 | @$fprintf "" \zip@> 19 | @$fputc "" \zip@> 20 | @$fputs "" \zip@> 21 | @$fread "" \zip@> 22 | @$fwrite "" \zip@> 23 | @$getc "" \zip@> 24 | @$printf "" \zip@> 25 | @$putc "" \zip@> 26 | @$putchar "" \zip@> 27 | @$puts "" \zip@> 28 | @$rename "" \zip@> 29 | @$remove "" \zip@> 30 | @$snprintf "" \zip@> 31 | @$sprintf "" \zip@> 32 | @$sscanf "" \zip@> 33 | @$stderr "" \zip@> 34 | @$stdin "" \zip@> 35 | @$stdout "" \zip@> 36 | @$ungetc "" \zip@> 37 | 38 | @$calloc "" \zip@> 39 | @$exit "" \zip@> 40 | @$free "" \zip@> 41 | @$getenv "" \zip@> 42 | 43 | @$isalpha "" \zip@> 44 | @$isdigit "" \zip@> 45 | @$islower "" \zip@> 46 | @$isspace "" \zip@> 47 | @$isupper "" \zip@> 48 | @$isxdigit "" \zip@> 49 | @$tolower "" \zip@> 50 | @$toupper "" \zip@> 51 | 52 | @$gettext "" \zip@> 53 | @$textdomain "" \zip@> 54 | 55 | @$INT_MAX "" \zip@> 56 | 57 | @$bindtextdomain "" \zip@> 58 | @$setlocale "" \zip@> 59 | @$LC_CTYPE "" \zip@> 60 | @$LC_MESSAGES "" \zip@> 61 | 62 | @$bool "" \zip@> 63 | @$false "" \zip@> 64 | @$true "" \zip@> 65 | 66 | @$ptrdiff_t "" \zip@> 67 | @$size_t "" \zip@> 68 | 69 | @$uint8_t "" \zip@> 70 | @$uint16_t "" \zip@> 71 | 72 | @$asctime "" \zip@> 73 | @$localtime "" \zip@> 74 | -------------------------------------------------------------------------------- /prod-twill.ch: -------------------------------------------------------------------------------- 1 | @x 2 | % This file is part of CWEB. 3 | @y 4 | % This file is part of CTWILL, a modification of CWEB. 5 | @z 6 | 7 | @x 8 | \advance\midcol-8pt 9 | \+& |typedef_like| \alt|int_like| |cast| \alt|comma| |semi| & 10 | |typedef_like| |exp| \alt|comma| |semi| & \&{typedef} \&{int} \&I,\cr 11 | \advance\midcol+8pt 12 | \+& |typedef_like| |int_like| & |typedef_like| \hfill $T\.\ I$ & 13 | \&{typedef} \&{char}\cr 14 | \+\dagit& |typedef_like| |exp| & |typedef_like| \hfill $T\.\ E^{**}$ & 15 | \&{typedef} \&I \.{@@[@@]} (|*|\&P)\cr 16 | \+& |typedef_like| |comma| & |typedef_like| \hfill $TC$ & 17 | \&{typedef} \&{int} \&x,\cr 18 | \+& |typedef_like| |semi| & |decl| & \&{typedef} \&{int} $\&x,{}$ $\&y$;\cr 19 | \+& |typedef_like| |ubinop| \alt |cast| |ubinop| & 20 | |typedef_like| \alt |cast| |ubinop| \hfill 21 | \alt $C=\.\{U\.\}C$ $U_2=\.\{U_1\.\}U_2$ \unskip & 22 | \&{typedef} |*|{}|*|(\&{CPtr})\cr 23 | @y 24 | \advance\midcol-3pt 25 | \+\dag200\enspace& |typedef_like| |decl_head| \alt|exp| |int_like| & 26 | |typedef_like| |decl_head| \hfill $D=D$\alt $E^{**}$ $I^{**}$ \unskip & 27 | \&{typedef} \&{char} \&{ch};\cr 28 | \advance\midcol+3pt 29 | \+201\enspace& |typedef_like| |decl_head| |semi| & |decl| \hfill $T\.\ D$ & 30 | \&{typedef} \&{int} $\&x,\&y$;\cr 31 | \+\dag202\enspace& |typedef_like| |int_like| |raw_int| & |typedef_like| |int_like| |exp| & 32 | \&{typedef} \&{int} \&{foo}\cr 33 | \global\prodno=121 34 | @z 35 | 36 | @x 37 | Rules 35, 117: The |exp| must not be immediately followed by |lpar|, |lbrack|, 38 | |exp|, or~|cast|. 39 | @y 40 | Rule 35: The |exp| must not be immediately followed by |lpar|, |lbrack|, 41 | |exp|, or~|cast|. 42 | @z 43 | 44 | @x 45 | Rules 153, 154: |make_reserved| is called only if \.{CWEAVE} has been invoked 46 | with the \.{+t} option. 47 | @y 48 | Rules 153, 154: |make_reserved| is called only if \.{CWEAVE} has been invoked 49 | with the \.{+t} option. 50 | 51 | Rule 200: The |exp| must not be immediately followed by |lpar| or~|exp|. 52 | 53 | Rule 202: The |raw_int| must be immediately followed by |semi| or |comma|. 54 | @z 55 | -------------------------------------------------------------------------------- /comm-i18n.hch: -------------------------------------------------------------------------------- 1 | Changes for COMMON.H by Andreas Scherer, January 2021. 2 | 3 | This set of changes translates all string values written by the CWEB module 4 | COMMON.H in case of errors or information requests with the help of 'gettext' 5 | and the 'libintl' library. 6 | 7 | For a complete history of the changes made to COMMON.H see COMM-PATCH.CH. 8 | 9 | Section 4. 10 | 11 | @x l.45 12 | @ Interface to the standard \CEE/ library: 13 | 14 | @= 15 | #include /* definition of |@!isalpha|, |@!isdigit| and so on */ 16 | #include /* definition of |@!bool|, |@!true| and |@!false| */ 17 | #include /* definition of |@!ptrdiff_t| */ 18 | #include /* definition of |@!uint8_t| and |@!uint16_t| */ 19 | #include /* definition of |@!printf| and friends */ 20 | #include /* definition of |@!getenv| and |@!exit| */ 21 | #include /* definition of |@!strlen|, |@!strcmp| and so on */ 22 | @y 23 | @ You may have noticed that almost all \.{"strings"} in the \.{CWEB} sources 24 | are placed in the context of the `|_|'~macro. This is just a shortcut for the 25 | `|@!gettext|' function from the ``GNU~gettext utilities.'' For systems that do 26 | not have this library installed, we wrap things for neutral behavior without 27 | internationalization. 28 | 29 | @d _(s) gettext(s) 30 | 31 | @= 32 | #include /* definition of |@!isalpha|, |@!isdigit| and so on */ 33 | #include /* definition of |@!bool|, |@!true| and |@!false| */ 34 | #include /* definition of |@!ptrdiff_t| */ 35 | #include /* definition of |@!uint8_t| and |@!uint16_t| */ 36 | #include /* definition of |@!printf| and friends */ 37 | #include /* definition of |@!getenv| and |@!exit| */ 38 | #include /* definition of |@!strlen|, |@!strcmp| and so on */ 39 | @# 40 | #ifndef HAVE_GETTEXT 41 | #define HAVE_GETTEXT 0 42 | #endif 43 | @# 44 | #if HAVE_GETTEXT 45 | #include 46 | #else 47 | #define gettext(a) a 48 | #endif 49 | @z 50 | 51 | Section 12. 52 | 53 | @x l.204 54 | @d confusion(s) fatal("! This can't happen: ",s) 55 | @y 56 | @d confusion(s) fatal(_("! This can't happen: "),s) 57 | @z 58 | -------------------------------------------------------------------------------- /cwebinputs/amiga_types.w: -------------------------------------------------------------------------------- 1 | % 2 | % CWEB/INCLUDE $VER: AMIGA_TYPES.W 1.3 (13.8.1998) 3 | % 4 | % SYNOPSIS: 5 | % This file tells CWEAVE to treat AMIGA specific keywords as 6 | % reserved words. Some of these are introduced by Commodore's 7 | % operating system, others by the SAS/C compiler. 8 | % 9 | % CREATION DATE: unknown 10 | % 11 | % AUTHOR: Andreas Scherer 12 | % 13 | % COPYRIGHT: There is no restriction to the usage of this file. 14 | 15 | @q Keywords specific to SAS/C@> 16 | 17 | @s __aligned int 18 | @s __asm int 19 | @s __chip int 20 | @s __far int 21 | @s __inline int 22 | @s __interrupt int 23 | @s __near int 24 | @s __regargs int 25 | @s __saveds int 26 | @s __stackext int 27 | @s __stdargs int 28 | 29 | @q Registers of the AMIGA@> 30 | 31 | @s __d0 int 32 | @s __d1 int 33 | @s __d2 int 34 | @s __d3 int 35 | @s __d4 int 36 | @s __d5 int 37 | @s __d6 int 38 | @s __d7 int 39 | @s __a0 int 40 | @s __a1 int 41 | @s __a2 int 42 | @s __a3 int 43 | @s __a4 int 44 | @s __a5 int 45 | @s __a6 int 46 | @s __a7 int 47 | @s __fp0 int 48 | @s __fp1 int 49 | @s __fp2 int 50 | @s __fp3 int 51 | @s __fp4 int 52 | @s __fp5 int 53 | @s __fp6 int 54 | @s __fp7 int 55 | 56 | @q Keywords by Commodore@> 57 | 58 | @s GLOBAL int 59 | @s IMPORT int 60 | @s STATIC int 61 | @s REGISTER int 62 | @s VOID int 63 | @s APTR int 64 | @s LONG int 65 | @s ULONG int 66 | @s LONGBITS int 67 | @s WORD int 68 | @s UWORD int 69 | @s WORDBITS int 70 | @s BYTE int 71 | @s UBYTE int 72 | @s BYTEBITS int 73 | @s RPTR int 74 | @s STRPTR int 75 | @s SHORT int 76 | @s USHORT int 77 | @s COUNT int 78 | @s UCOUNT int 79 | @s CPTR int 80 | @s FLOAT int 81 | @s DOUBLE int 82 | @s BOOL int 83 | @s TEXT int 84 | @s BPTR int 85 | @s BSTR int 86 | 87 | @s byte int 88 | @s Class int 89 | @s ClassID int 90 | @s CxMsg int 91 | @s CxObj int 92 | @s dev_t int 93 | @s DIR int 94 | @s DisplayInfoHandle int 95 | @s ino_t int 96 | @s IX int 97 | @s Msg int 98 | @s Object int 99 | @s off_t int 100 | @s PFL int 101 | @s PLANEPTR int 102 | @s Tag int 103 | @s tPoint int 104 | @s ushort int 105 | @s u_char int 106 | @s u_int int 107 | @s u_long int 108 | @s u_short int 109 | @s WINDOW int 110 | -------------------------------------------------------------------------------- /cwebinputs/cweb_pc850.w: -------------------------------------------------------------------------------- 1 | % 2 | % CWEB/INCLUDE $VER: CWEB_PC850.W 1.6 (13.01.2019) 3 | % 4 | % SYNOPSIS: 5 | % Transliteration table for umlauts and special characters 6 | % according to the IBM PC International Codepage 850. 7 | % @@include this file in limbo. 8 | % Note that not all equivalents to the TeX macros are present. 9 | % 10 | % DATE: 28.03.94: Derived from PC850.TEX (V1.0) 11 | % 12 | % AUTHOR: 13 | % Andreas Scherer 14 | % 15 | % Please send suggestions (pull requests) and bug reports (issues) 16 | % to https://github.com/ascherer/cwebbin 17 | % 18 | % COPYRIGHT: There is no restriction to the usage of this file. 19 | % 20 | % CHANGES: 21 | % March 25, 1996: New postal address. (V1.2) 22 | % August 13, 1998: New e-mail address. (V1.3) 23 | % June 11, 2000: Include matching TeX macros. (V1.4) 24 | % July 10, 2017: Complete overhaul. (V1.5) 25 | % January 13, 2019: Non-generic names. (V1.6) 26 | 27 | \input cweb_pc850.sty 28 | \noatl 29 | 30 | @l 80 C @l 81 ue @l 82 e @l 83 a @l 84 ae @l 85 a 31 | @l 86 aa @l 87 c @l 88 e @l 89 ee @l 8a e @l 8b ie 32 | @l 8c i @l 8d i @l 8e Ae @l 8f AA 33 | @l 90 E @l 91 ae @l 92 AE @l 93 o @l 94 oe @l 95 o 34 | @l 96 u @l 97 u @l 98 ye @l 99 Oe @l 9a Ue @l 9b o 35 | @q 9c @> @l 9d O @q 9e @> @q 9f @> 36 | @l a0 a @l a1 i @l a2 o @l a3 u @l a4 n @l a5 N 37 | @q a6 @> @q a7 @> @q a8 @> @q a9 @> @q aa @> @q ab @> 38 | @q ac @> @q ad @> @q ae @> @q af @> 39 | @q b0 @> @q b1 @> @q b2 @> @q b3 @> @q b4 @> @l b5 A 40 | @l b6 A @l b7 A @q b8 @> @q b9 @> @q ba @> @q bb @> 41 | @q bc @> @q bd @> @q be @> @q bf @> 42 | @q c0 @> @q c1 @> @q c2 @> @q c3 @> @q c4 @> @q c5 @> 43 | @l c6 a @l c7 A @q c8 @> @q c9 @> @q ca @> @q cb @> 44 | @q cc @> @q cd @> @q ce @> @q cf @> 45 | @q d0 @> @q d1 @> @l d2 E @l d3 Ee @l d4 E @q d5 @> 46 | @l d6 I @l d7 I @l d8 Ie @q d9 @> @q da @> @q db @> 47 | @q dc @> @q dd @> @l de I @q df @> 48 | @l e0 O @l e1 ss @l e2 O @l e3 O @l e4 o @l e5 O 49 | @l e6 mu @q e7 @> @q e8 @> @l e9 U @l ea U @l eb U 50 | @l ec y @l ed Y @q ee @> @q ef @> 51 | -------------------------------------------------------------------------------- /comm-texlive.hch: -------------------------------------------------------------------------------- 1 | % Original Kpathsea changes for CWEB by Wlodek Bzyl and Olaf Weber 2 | % This file is in the Public Domain. 3 | 4 | % Most of the original changes were merged with the set of change files 5 | % of the CWEBbin project. This stripped change file is last in line of 6 | % comm-extensions.hch, comm-output.hch, comm-i18n.hch, and comm-texlive.hch 7 | % that get tie'd into comm-w2c.h that is used in CWEB for TeX Live. 8 | 9 | Section 7. 10 | 11 | @x l.120 12 | @d max_file_name_length 60 13 | @y 14 | @d max_file_name_length 1024 15 | @z 16 | 17 | @x l.134 18 | extern int line[]; /* number of current line in the stacked files */ 19 | @y 20 | extern char *found_filename; /* filename found by |kpse_find_file| */ 21 | extern int line[]; /* number of current line in the stacked files */ 22 | @z 23 | 24 | Section 13. 25 | 26 | @x l.216 27 | extern void print_stats(void); /* defined in \.{ctangle.w} and \.{cweave.w} */ 28 | @y 29 | extern void cb_show_banner(void); /* copy |banner| back to \.{common.w} */ 30 | @# 31 | extern void print_stats(void); /* defined in \.{ctangle.w} and \.{cweave.w} */ 32 | @z 33 | 34 | Section 16. 35 | 36 | @x l.249 37 | @d buf_size 200 /* maximum length of input line, plus one */ 38 | @d longest_name 10000 /* file names, section names, and section texts 39 | shouldn't be longer than this */ 40 | @d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ 41 | @d max_bytes 100000 /* the number of bytes in identifiers, 42 | index entries, and section names; must be less than $2^{24}$ */ 43 | @d max_names 5000 /* number of identifiers, strings, section names; 44 | must be less than 10240 */ 45 | @d max_sections 2000 /* greater than the total number of sections */ 46 | @y 47 | @d buf_size 1000 /* maximum length of input line, plus one */ 48 | @d longest_name 10000 /* file names, section names, and section texts 49 | shouldn't be longer than this */ 50 | @d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */ 51 | @d max_bytes 1000000 /* the number of bytes in identifiers, 52 | index entries, and section names; must be less than $2^{24}$ */ 53 | @d max_names 10239 /* number of identifiers, strings, section names; 54 | must be less than 10240 */ 55 | @d max_sections 4000 /* greater than the total number of sections */ 56 | @z 57 | -------------------------------------------------------------------------------- /ctang-texlive.ch: -------------------------------------------------------------------------------- 1 | % Original Kpathsea changes for CWEB by Wlodek Bzyl and Olaf Weber 2 | % This file is in the Public Domain. 3 | 4 | % Most of the original changes were merged with the set of change files 5 | % of the CWEBbin project. This stripped change file is last in line of 6 | % ctang-patch.ch, ctang-output.ch, ctang-i18n.ch, and ctang-texlive.ch 7 | % that get tie'd into ctang-w2c.ch that is used as a monolithic changefile 8 | % for ctangle.w in TeX Live. 9 | 10 | Material in limbo. 11 | 12 | @x l.30 and CTANG-PATCH.CH 13 | \def\title{CTANGLE (@VERSION@)} 14 | @y 15 | \def\title{CTANGLE (Version 4.12.2 [\TeX~Live])} 16 | @z 17 | 18 | @x l.34 and CTANG-PATCH.CH 19 | \centerline{(@VERSION@)} 20 | @y 21 | \centerline{(Version 4.12.2 [\TeX~Live])} 22 | @z 23 | 24 | @x l.36 25 | \def\botofcontents{\vfill 26 | @y 27 | \def\covernote{\vbox{% 28 | @z 29 | 30 | @x l.49 31 | } 32 | @y 33 | }}\datecontentspage 34 | @z 35 | 36 | Section 1. 37 | 38 | @x l.64 and CTANG-PATCH.CH and CTANG-I18N.CH 39 | @d banner _("This is CTANGLE (@VERSION@)") 40 | @y 41 | @d banner "This is CTANGLE, Version 4.12.2" 42 | /* will be extended by the \TeX~Live |versionstring| */ 43 | @z 44 | 45 | Section 2. 46 | 47 | @x l.90 - Add Web2c version to banner. 48 | if (show_banner) puts(banner); /* print a ``banner line'' */ 49 | @y 50 | if (show_banner) cb_show_banner(); /* print a ``banner line'' */ 51 | @z 52 | 53 | Sections 2--18. 54 | 55 | @x l.101 and CTANG-PATCH.CH 56 | @i comm-foo.h 57 | @y 58 | @i comm-w2c.h 59 | @z 60 | 61 | Section 20. 62 | 63 | @x l.129 64 | @ @d max_texts 4000 /* number of replacement texts, must be less than 10240 */ 65 | @d max_toks 270000 /* number of bytes in compressed \CEE/ code */ 66 | @y 67 | @ @d max_texts 10239 /* number of replacement texts, must be less than 10240 */ 68 | @d max_toks 1000000 /* number of bytes in compressed \CEE/ code */ 69 | @z 70 | 71 | Appendix. 72 | 73 | @x l.1547 74 | @** Index. 75 | @y 76 | @* Print ``version'' information. 77 | Don't do this at home, kids! Push our local macro to the variable in \.{COMMON} 78 | for printing the |banner| and the |versionstring| from there. 79 | 80 | @d max_banner 50 81 | 82 | @= 83 | extern char cb_banner[]; 84 | 85 | @ @= 86 | strncpy(cb_banner,banner,max_banner-1); 87 | 88 | @** Index. 89 | @z 90 | -------------------------------------------------------------------------------- /vault/comm-translation.hch: -------------------------------------------------------------------------------- 1 | Changes for COMMON.H by Andreas Scherer, November 1, 2018. 2 | 3 | This set of changes translates all string values written by the CWEB module 4 | COMMON.H in case of errors or information requests. Some system-dependent 5 | code for the Amiga operating system is introduced to make use of the 6 | `locale.library' mechanism for user-definable language support. Care has 7 | been taken to avoid conflicts with non-Amiga systems. By editing the 8 | external header file `cweb.h' and applying this change file, you can set up 9 | the CWEB programs for a different language than English. 10 | 11 | This change file requires COMM-ANSI.HCH, COMM-EXTENSIONS.HCH, and 12 | COMM-OUTPUT.HCH to be applied as well. 13 | 14 | For a complete history of the changes made to COMMON.H see COMM-PATCH.CH. 15 | 16 | @x l.38 17 | @ Code related to the character set: 18 | @y 19 | @ Version~2.1 of the {\mc AMIGA} operating system introduced localization 20 | of programs and applications by means of ``language catalogs'' that contain 21 | replacement strings for terminal texts produced by suitably prepared programs. 22 | The complete \.{CWEB} system has been modified to accommodate this great idea 23 | and so the \.{cweb.h} header file with the original English strings is 24 | included in this section. Other systems than the {\mc AMIGA} will have to do 25 | the language conversion by different means, so a little bit of care is to be 26 | taken with what follows. 27 | 28 | @c 29 | #ifndef _AMIGA /* non-{\mc AMIGA} systems don't know about \.{} */ 30 | typedef long int LONG; /* excerpt from \.{} */ 31 | typedef const char * STRPTR; /* ditto, but \UNIX/ says it's signed. */ 32 | #define EXEC_TYPES_H 1 /* don't include \.{} in \.{"cweb.h"} */ 33 | #endif 34 | @# 35 | #ifdef STRINGARRAY 36 | #undef STRINGARRAY /* don't include the string array |AppStrings| again */ 37 | #endif 38 | #define get_string(n) AppStrings[n].as_Str 39 | @# 40 | #include "catalogs/cweb.h" /* This header file contains all translated strings */ 41 | @# 42 | struct AppString 43 | { 44 | LONG as_ID; 45 | STRPTR as_Str; 46 | }; 47 | @# 48 | extern struct AppString AppStrings[]; 49 | 50 | @ Code related to the character set: 51 | @z 52 | 53 | @x l.120 54 | @d confusion(s) fatal("! This can't happen: ",s) 55 | @y 56 | @d confusion(s) fatal(get_string(MSG_FATAL_CO66),s) 57 | @z 58 | -------------------------------------------------------------------------------- /cwebinputs/cweb_mac8.w: -------------------------------------------------------------------------------- 1 | % 2 | % CWEB/INCLUDE $VER: CWEB_MAC8.W 1.6 (13.01.2019) 3 | % 4 | % SYNOPSIS: 5 | % Transliteration table for umlauts and special characters 6 | % according to the Macintosh 8-bit codepage. 7 | % @@include this file in limbo. 8 | % Note that not all equivalents to the TeX macros are present. 9 | % 10 | % DATE: 23.06.94: Derived from MAC8.TEX (V1.0) 11 | % 12 | % AUTHOR: 13 | % Andreas Scherer 14 | % 15 | % Please send suggestions (pull requests) and bug reports (issues) 16 | % to https://github.com/ascherer/cwebbin 17 | % 18 | % COPYRIGHT: There is no restriction to the usage of this file. 19 | % 20 | % CHANGES: 21 | % March 25, 1996: New postal address. (V1.2) 22 | % August 13, 1998: New e-mail address. (V1.3) 23 | % June 11, 2000: Include matching TeX macros. (V1.4) 24 | % July 10, 2017: Complete overhaul. (V1.5) 25 | % January 13, 2019: Non-generic names. (V1.6) 26 | 27 | \input cweb_mac8.sty 28 | \noatl 29 | 30 | @l 80 Ae @l 81 A @l 82 C @l 83 E @l 84 N @l 85 Oe 31 | @l 86 Ue @l 87 a @l 88 a @l 89 a @l 8a ae @l 8b a 32 | @l 8c a @l 8d c @l 8e e @l 8f e 33 | @l 90 e @l 91 ee @l 92 i @l 93 i @l 94 i @l 95 ie 34 | @l 96 n @l 97 o @l 98 o @l 99 o @l 9a oe @l 9b o 35 | @l 9c u @l 9d u @l 9e u @l 9f ue 36 | @q a0 @> @q a1 @> @q a2 @> @q a3 @> @q a4 @> @q a5 @> 37 | @q a6 @> @l a7 ss @q a8 @> @q a9 @> @q aa @> @q ab @> 38 | @q ac @> @q ad @> @l ae AE @l af O 39 | @q b0 @> @q b1 @> @q b2 @> @q b3 @> @q b4 @> @l b5 mu 40 | @q b6 @> @q b7 @> @q b8 @> @q b9 @> @q ba @> @q bb @> 41 | @q bc @> @q bd @> @l be ae @l bf o 42 | @q c0 @> @q c1 @> @q c2 @> @q c3 @> @q c4 @> @q c5 @> 43 | @q c6 @> @q c7 @> @q c8 @> @q c9 @> @q ca @> @l cb A 44 | @l cc A @l cd O @q ce @> @q cf @> 45 | @q d0 @> @q d1 @> @q d2 @> @q d3 @> @q d4 @> @q d5 @> 46 | @q d6 @> @q d7 @> @l d8 ye @l d9 Ye @q da @> @q db @> 47 | @q dc @> @q dd @> @q de @> @q df @> 48 | @q e0 @> @q e1 @> @q e2 @> @q e3 @> @q e4 @> @l e5 A 49 | @l e6 E @l e7 A @l e8 Ee @l e9 E @l ea I @l eb I 50 | @l ec Ie @l ed I @l ee O @l ef O 51 | @q f0 @> @l f1 O @l f2 U @l f3 U @l f4 U @q f5 @> 52 | @q f6 @> @q f7 @> @q f8 @> @q f9 @> @q fa @> @q fb @> 53 | @q fc @> @q fd @> @q fe @> @q ff @> 54 | -------------------------------------------------------------------------------- /ctang+u.ch: -------------------------------------------------------------------------------- 1 | Changes for CTANGLE.W by Andreas Scherer. 2 | 3 | This set of changes extends CTANGLE's transliteration mechanism to ``poor man's 4 | UTF-8'' by stripping all but the last of a sequence of high-bit bytes 5 | representing a multi-byte character. 6 | 7 | Section 59. 8 | 9 | @x l.703 10 | @ @=@t\1\quad@> 11 | @y 12 | @ Nowadays, most computer files are encoded in some form of ``Unicode''. A very 13 | convenient special case is ``UTF-8'', a variable-length multi-byte encoding. In 14 | order to avoid major surgery for the transliteration feature---as tempting as 15 | the extended notation \.{@@l c3bc ue} might be---, \.{CTANGLE} 16 | accepts the \.{+u} option to activate a ``poor man's UTF-8'' mechanism. The 17 | first in a sequence of up to four high-bit bytes (amounting to more than 18 | $2^{20}$~possible character representations) determines the number of bytes 19 | used to represent the next character. Instead of extending the |translit| table 20 | to this multi-byte scenario, we simply strip all but the last byte and use this 21 | as the transliteration index. 22 | 23 | % Exercise 11.6 from the TeXbook: 24 | \def\frac#1/#2{\leavevmode\kern.1em\raise.5ex\hbox{\the\scriptfont0 #1} 25 | \kern-.1em/\kern-.15em\lower.25ex\hbox{\the\scriptfont0 #2}} 26 | 27 | \&{Example:} While in ``classic ASCII'' the German word {\it gr\"un\/} could be 28 | treated with transliteration \.{@@l fc ue} (from codepage ISO/IEC~8859-1) to 29 | get \.{gruen} as suggested above, in UTF-8 you'd be advised to use \.{@@l bc 30 | ue} instead, because character {\it \"u\/} (latin small letter u with 31 | diaeresis) is encoded as the two-byte sequence \.{c3 bc}, indicated by the 32 | initial three bits of byte \.{c3} (\.{1100 0011}). Note that this simple 33 | approach leads to the collision with character $\frac1/4$ (vulgar fraction one 34 | quarter) with its two-byte encoding \.{c2 bc}. 35 | 36 | @d transliterate_utf_eight flags['u'] 37 | 38 | @=@t\1\quad@> 39 | @z 40 | 41 | @x l.708 42 | if (ishigh(*j)) C_printf("%s",translit[(eight_bits)(*j)-0200]); 43 | @^high-bit character handling@> 44 | @y 45 | if (ishigh(*j)) { 46 | @^high-bit character handling@> 47 | if (transliterate_utf_eight) { 48 | if ((eight_bits)(*j)>=0360) j+=3; 49 | else if ((eight_bits)(*j)>=0340) j+=2; 50 | else if ((eight_bits)(*j)>=0300) j+=1; 51 | } 52 | C_printf("%s",translit[(eight_bits)(*j)-0200]); 53 | } 54 | @z 55 | -------------------------------------------------------------------------------- /tests/ham.ch: -------------------------------------------------------------------------------- 1 | Limbo. 2 | 3 | @x l.1 4 | \datethis 5 | @s try x 6 | @y 7 | \datethis 8 | \def\title{HAM} 9 | @z 10 | 11 | Section 1. 12 | 13 | @x l.11 14 | is a modulus |m|, which causes every $m$th solution to be printed. 15 | @y 16 | is a modulus~$m$, which causes every $m$th solution to be printed. 17 | @z 18 | 19 | @x l.15 20 | @d deg u.I 21 | @y 22 | @d deg u.I 23 | @-deg@> 24 | @$deg {HAM}1 =\|u.\|I@> 25 | @% 26 | @$u {GB\_\,GRAPH}9 \&{util}@> 27 | @z 28 | 29 | @x l.21 30 | main(int argc,char *argv[]) 31 | @y 32 | @# 33 | int main(int argc,char *argv[]) 34 | @z 35 | 36 | @x l.33 37 | for (v=g->vertices;vvertices+g->n;v++) printf(" %d",v->deg); 38 | @y 39 | for (v=g->vertices;vvertices+g->n;v++) printf(" %ld",v->deg); 40 | @z 41 | 42 | @x l.36 43 | printf("The minimum degree is %d (vertex %s)!\n",x->deg,x->name); 44 | @y 45 | printf("The minimum degree is %ld (vertex %s)!\n",x->deg,x->name); 46 | @z 47 | 48 | @x l.46 49 | for (v=g->vertices;vvertices+g->n;v++) printf(" %d",v->deg); 50 | @y 51 | for (v=g->vertices;vvertices+g->n;v++) printf(" %ld",v->deg); 52 | @z 53 | 54 | Section 2. 55 | 56 | @x l.50 57 | @ @= 58 | @y 59 | @r @ @= 60 | @z 61 | 62 | Section 3. 63 | 64 | @x l.58 65 | @ Vertices that have already appeared in the path are ``taken,'' and 66 | @y 67 | @ Vertices that have already appeared in the path are ``taken,'' and 68 | @-taken@> 69 | @$taken {HAM}3 =\|v.\|I@> 70 | @% 71 | @$v {HAM}1 \&{register} \&{Vertex} ${}{*}{}$@> 72 | @$v {GB\_\,GRAPH}9 \&{util}@> 73 | @$I {GB\_\,GRAPH}8 \&{long}@> 74 | @z 75 | 76 | Section 4. 77 | 78 | @x l.85 79 | I may learn my lesson. 80 | @y 81 | I may learn my lesson. 82 | @-k@> 83 | @-vert@> 84 | @-ark@> 85 | @$vert {HAM}4 =\|w.\|V@> 86 | @$ark {HAM}4 =\|x.\|A@> 87 | @% 88 | @$w {GB\_\,GRAPH}9 \&{util}@> 89 | @$x {GB\_\,GRAPH}9 \&{util}@> 90 | @$x {HAM}1 \&{register} \&{Vertex} ${}{*}{}$@> 91 | @z 92 | 93 | @x l.92 94 | x->taken=1;@+t->vert=x; 95 | @y 96 | x->taken=1;@+t->vert=x;@+ 97 | @z 98 | 99 | @x l.97 100 | try: @; 101 | @y 102 | try_next: @; 103 | @z 104 | 105 | Section 8. 106 | 107 | @x l.148 108 | goto try; 109 | @y 110 | goto try_next; 111 | @z 112 | 113 | Section 10. 114 | 115 | @x l.163 116 | @*Index. 117 | @y 118 | @z 119 | -------------------------------------------------------------------------------- /vault/ctang-borlandc.ch: -------------------------------------------------------------------------------- 1 | Changes for CTANGLE.W by Andreas Scherer, December 4, 2018. 2 | 3 | This set of changes provides support for installing CWEB on MS/DOS systems 4 | with Borland C++ 3.1. Arrays larger than 64 KB are allocated with a 5 | system-dependent routine `farcalloc'. For this, several pointer variables 6 | have to be declared as `huge'. Care has been taken to avoid conflicts with 7 | other operating systems which are not restricted to the limitations of DOS. 8 | (DOS isn't restricted to the 64 KB limit either, or else this full sized 9 | patch would not be possible. But instead of `farcalloc' a `non-ANSI' sized 10 | `malloc' would be much more convenient.) For other MS/DOS compilers than 11 | Borland C++ 3.1 you'll have to replace this file by other changes. 12 | 13 | This change file requires CTANG-PATCH.CH, CTANG-ANSI.CH, CTANG-EXTENSIONS.CH, 14 | CTANG-OUTPUT.CH, CTANG-MEMORY.CH, CTANG-TRANSLATIONS.CH to be applied as well. 15 | 16 | For a complete history of the changes made to CTANGLE.W see CTANG-PATCH.CH. 17 | 18 | @x l.154 19 | eight_bits *tok_start; /* pointer into |tok_mem| */ 20 | @y 21 | eight_bits HUGE *tok_start; /* pointer into |tok_mem| */ 22 | @z 23 | 24 | @x l.33 of CTANG-MEMORY.CH 25 | eight_bits *tok_mem; 26 | eight_bits *tok_mem_end; 27 | eight_bits *tok_ptr; /* first unused position in |tok_mem| */ 28 | @y 29 | eight_bits HUGE *tok_mem; 30 | eight_bits HUGE *tok_mem_end; 31 | eight_bits HUGE *tok_ptr; /* first unused position in |tok_mem| */ 32 | @z 33 | 34 | @x l.44 of CTANG-MEMORY.CH 35 | alloc_object(tok_mem,max_toks,eight_bits); 36 | @y 37 | #ifdef __TURBOC__ 38 | #undef max_toks 39 | #define max_toks 170000 40 | tok_mem=(eight_bits HUGE *)allocsafe(max_toks,sizeof(*tok_mem)); 41 | #else 42 | alloc_object(tok_mem,max_toks,eight_bits); 43 | #endif 44 | @z 45 | 46 | @x l.97 of CTANG-ANSI.CH 47 | node->equiv=(void *)text_info; 48 | @y 49 | node->equiv=(void HUGE *)text_info; 50 | @z 51 | 52 | @x l.298 53 | eight_bits *end_field; /* ending location of replacement text */ 54 | eight_bits *byte_field; /* present location within replacement text */ 55 | @y 56 | eight_bits HUGE *end_field; /* ending location of replacement text */ 57 | eight_bits HUGE *byte_field; /* present location within replacement text */ 58 | @z 59 | 60 | @x l.147 of CTANG-ANSI.CH 61 | if ((a+name_dir)->equiv!=(void *)text_info) push_level(a+name_dir); 62 | @y 63 | if ((a+name_dir)->equiv!=(void HUGE *)text_info) push_level(a+name_dir); 64 | @z 65 | 66 | @x l.656 67 | char *j, *k; /* pointer into |byte_mem| */ 68 | @y 69 | char HUGE *j; 70 | char HUGE *k; /* pointer into |byte_mem| */ 71 | @z 72 | 73 | @x l.295 of CTANG-ANSI.CH 74 | else if (p->equiv==(void *)text_info) p->equiv=(void *)cur_text; 75 | @y 76 | else if (p->equiv==(void HUGE *)text_info) p->equiv=(void HUGE *)cur_text; 77 | @z 78 | -------------------------------------------------------------------------------- /0002-Purge-redundant-TeX-macro.patch: -------------------------------------------------------------------------------- 1 | From e915d4e570ec3d56765317862eb3b664dbf764c1 Mon Sep 17 00:00:00 2001 2 | From: Andreas Scherer 3 | Date: Thu, 8 Apr 2021 14:44:11 +0200 4 | Subject: [PATCH 2/6] Purge redundant '\TeX' macro. 5 | 6 | --- 7 | ctwimac.tex | 5 +---- 8 | proofmac.tex | 4 +--- 9 | twinxmac.tex | 2 -- 10 | 3 files changed, 2 insertions(+), 9 deletions(-) 11 | 12 | diff --git a/ctwimac.tex b/ctwimac.tex 13 | index 1fbb0ac..8596b27 100644 14 | --- a/ctwimac.tex 15 | +++ b/ctwimac.tex 16 | @@ -218,6 +218,7 @@ 17 | \newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections 18 | \let\yskip=\smallskip 19 | \def\?{\mathrel?} 20 | +\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} 21 | \def\note#1#2.{\par\penalty5000 22 | \Y\noindent{\hangindent2\em\baselineskip10pt\eightrm#1~#2.\par}} 23 | \def\lapstar{\rlap{*}} 24 | @@ -303,10 +304,6 @@ 25 | \hbox{\strut\kern2pt\.{#1}\kern2pt}} 26 | \hrule}\vrule\kern2pt}} % verbatim string 27 | 28 | -\def\TeX{{\ifmmode\it\fi 29 | - \leavevmode\hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} 30 | -\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} 31 | - 32 | % now here's the mini-index formatting control 33 | \newcount\nrefs % total number of references in partial page 34 | \newcount\baseno % smallest section number in partial page 35 | diff --git a/proofmac.tex b/proofmac.tex 36 | index dbcf312..ccfd36b 100644 37 | --- a/proofmac.tex 38 | +++ b/proofmac.tex 39 | @@ -107,6 +107,7 @@ 40 | \newskip\intersecskip \intersecskip=12pt minus 3pt % space between sections 41 | \let\yskip=\smallskip 42 | \def\?{\mathrel?} 43 | +\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} 44 | \def\note#1#2.{\Y\noindent{\hangindent2em\baselineskip10pt\eightrm#1~#2.\par}} 45 | \def\lapstar{\rlap{*}} 46 | \def\stsec{\rightskip=0pt % get out of C mode (cf. \B) 47 | @@ -344,9 +345,6 @@ 48 | \def\printtwodigits{\advance\twodigits100 49 | \expandafter\gobbleone\number\twodigits 50 | \advance\twodigits-100 } 51 | -\def\TeX{{\ifmmode\it\fi 52 | - \leavevmode\hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} 53 | -\def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} 54 | \def\datethis{\def\startsection{\leftline{\sc\today\ at \hours}\bigskip 55 | \let\startsection=\stsec\stsec}} 56 | % say `\datethis' in limbo, to get your listing timestamped before section 1 57 | diff --git a/twinxmac.tex b/twinxmac.tex 58 | index 99ae604..89e3b68 100644 59 | --- a/twinxmac.tex 60 | +++ b/twinxmac.tex 61 | @@ -2,8 +2,6 @@ 62 | 63 | \let\:=\. % preserve a way to get the dot accent 64 | % (all other accents will still work as usual) 65 | -\def\TeX{{\ifmmode\it\fi 66 | - \hbox{T\kern-.1667em\lower.424ex\hbox{E}\hskip-.125em X}}} 67 | \def\,{\relax\ifmmode\mskip\thinmuskip\else\thinspace\fi} 68 | \let\mc=\ninerm % medium caps 69 | \def\CEE/{{\mc C\spacefactor1000}} 70 | -- 71 | 2.47.1 72 | 73 | -------------------------------------------------------------------------------- /cweav-output.ch: -------------------------------------------------------------------------------- 1 | Changes for CWEAVE.W by Andreas Scherer, October 2021. 2 | 3 | This set of changes modifies the output behaviour of the CWEB system. 4 | Instead of writing directly to the C or TeX file as described in the 5 | manual, the current run is documented in a temporary output file which is 6 | copied to the expected file in the last moment. In case of an user abort, 7 | previous results are not destroyed. 8 | 9 | This change file requires CWEAV-PATCH.CH and CWEAV-EXTENSIONS.CH to be 10 | applied as well. 11 | 12 | For a complete history of the changes made to CWEAVE.W see CWEAV-PATCH.CH. 13 | 14 | Section 247. 15 | 16 | @x l.4572 17 | fclose(active_file); 18 | @y 19 | fclose(active_file); active_file=tex_file=NULL; 20 | if (check_for_change) @@; 21 | @z 22 | 23 | Additional material. 24 | 25 | @x l.4886 26 | @** Index. 27 | @y 28 | @* Output file update. Most \CEE/ projects are controlled by a \.{Makefile} 29 | that automatically takes care of the temporal dependencies between the different 30 | source modules. It may be convenient that \.{CWEB} doesn't create new output 31 | for all existing files, when there are only changes to some of them. Thus the 32 | \.{make} process will only recompile those modules where necessary. You can 33 | activate this feature with the `\.{+c}' command-line option. The idea and basic 34 | implementation of this mechanism can be found in the program \.{NUWEB} by 35 | Preston Briggs, to whom credit is due. 36 | 37 | @= { 38 | if((tex_file=fopen(tex_file_name,"r"))!=NULL) { 39 | bool comparison=false; 40 | 41 | if((check_file=fopen(check_file_name,"r"))==NULL) 42 | fatal("! Cannot open output file ",check_file_name); 43 | @.Cannot open output file@> 44 | 45 | @@; 46 | 47 | fclose(tex_file); tex_file=NULL; 48 | fclose(check_file); check_file=NULL; 49 | 50 | @@; 51 | } else 52 | rename(check_file_name,tex_file_name); /* This was the first run */ 53 | 54 | strcpy(check_file_name,""); /* We want to get rid of the temporary file */ 55 | } 56 | 57 | @ We hope that this runs fast on most systems. 58 | 59 | @= 60 | do { 61 | char x[BUFSIZ],y[BUFSIZ]; 62 | int x_size = fread(x,sizeof(char),BUFSIZ,tex_file); 63 | int y_size = fread(y,sizeof(char),BUFSIZ,check_file); 64 | comparison = (x_size == y_size) && !memcmp(x,y,x_size); 65 | } while(comparison && !feof(tex_file) && !feof(check_file)); 66 | 67 | @ Note the superfluous call to |remove| before |rename|. We're using it to 68 | get around a bug in some implementations of |rename|.@^system dependencies@> 69 | 70 | @= 71 | if(comparison) 72 | remove(check_file_name); /* The output remains untouched */ 73 | else { 74 | remove(tex_file_name); 75 | rename(check_file_name,tex_file_name); 76 | } 77 | 78 | @** Index. 79 | @z 80 | -------------------------------------------------------------------------------- /vault/comm-memory.hch: -------------------------------------------------------------------------------- 1 | Changes for COMMON.H by Andreas Scherer, December 3, 2018. 2 | 3 | This set of changes provides dynamic memory allocation for the internal 4 | fields of the CWEB system. There is no external memory configuration file 5 | as for TeX (yet), but there's already the advantage that the CWEB programs 6 | can be compiled in the `NEAR' data section and be made `resident'. 7 | 8 | This change file requires COMM-ANSI.HCH, COMM-EXTENSIONS.HCH to be applied. 9 | 10 | For a complete history of the changes made to COMMON.H see COMM-PATCH.CH. 11 | 12 | @x l.35 13 | @ @= 14 | @y 15 | @ @f type int /* \.{type} becomes the pseudotype \&{type} */ 16 | @# 17 | @d alloc_object(object,size,@!type) 18 | if(!(object = (type *)malloc((size)*sizeof(type)))) 19 | fatal("","! Memory allocation failure"); 20 | 21 | @d free_object(object) 22 | if(object) { 23 | free(object); 24 | object=NULL; 25 | } 26 | 27 | @= 28 | @z 29 | 30 | @x l.58 31 | char section_text[longest_name+1]; /* name being sought for */ 32 | char *section_text_end = section_text+longest_name; /* end of |section_text| */ 33 | @y 34 | char *section_text; /* name being sought for */ 35 | char *section_text_end; /* end of |section_text| */ 36 | @z 37 | 38 | @x l.73 39 | extern char buffer[]; /* where each line of input goes */ 40 | @y 41 | extern char *buffer; /* where each line of input goes */ 42 | @z 43 | 44 | @x l.100 45 | extern char byte_mem[]; /* characters of names */ 46 | @y 47 | extern char *byte_mem; /* characters of names */ 48 | @z 49 | 50 | @x l.102 51 | extern name_info name_dir[]; /* information about names */ 52 | @y 53 | extern name_pointer name_dir; /* information about names */ 54 | @z 55 | 56 | @x l.106 57 | extern name_pointer hash[]; /* heads of hash lists */ 58 | @y 59 | extern name_pointer *hash; /* heads of hash lists */ 60 | @z 61 | 62 | @x l.139 and l.15 of COMM-OUTPUT.HCH 63 | extern FILE *file[]; /* stack of non-change files */ 64 | extern FILE *change_file; /* change file */ 65 | extern char C_file_name[]; /* name of |C_file| */ 66 | extern char tex_file_name[]; /* name of |tex_file| */ 67 | extern char idx_file_name[]; /* name of |idx_file| */ 68 | extern char scn_file_name[]; /* name of |scn_file| */ 69 | extern char check_file_name[]; /* name of |check_file| */ 70 | extern char file_name[][max_file_name_length]; 71 | /* stack of non-change file names */ 72 | extern char change_file_name[]; /* name of change file */ 73 | extern int line[]; /* number of current line in the stacked files */ 74 | @y 75 | extern FILE **file; /* stack of non-change files */ 76 | extern FILE *change_file; /* change file */ 77 | extern char *C_file_name; /* name of |C_file| */ 78 | extern char *tex_file_name; /* name of |tex_file| */ 79 | extern char *idx_file_name; /* name of |idx_file| */ 80 | extern char *scn_file_name; /* name of |scn_file| */ 81 | extern char *check_file_name; /* name of |check_file| */ 82 | extern char **file_name; /* stack of non-change file names */ 83 | extern char *change_file_name; /* name of change file */ 84 | extern int *line; /* number of current line in the stacked files */ 85 | @z 86 | 87 | @x l.162 88 | extern boolean changed_section[]; /* is the section changed? */ 89 | @y 90 | extern boolean *changed_section; /* is the section changed? */ 91 | @z 92 | -------------------------------------------------------------------------------- /ctwill.bux: -------------------------------------------------------------------------------- 1 | @$program {COMMON.W}18 \&{cweb}@> 2 | @$phase {COMMON.W}19 \&{int}@> 3 | @$common_init {COMMON.W}20 \&{void} (\,)@> 4 | @$section_text {COMMON.W}21 \&{char} [\,][\,]@> 5 | @$section_text_end {COMMON.W}21 \&{char} ${*}$@> 6 | @$id_first {COMMON.W}21 \&{char} ${*}$@> 7 | @$id_loc {COMMON.W}21 \&{char} ${*}$@> 8 | @$buffer {COMMON.W}22 \&{char} [\,]@> 9 | @$buffer_end {COMMON.W}22 \&{char} ${*}$@> 10 | @$loc {COMMON.W}22 \&{char} ${*}$@> 11 | @$limit {COMMON.W}22 \&{char} ${*}$@> 12 | 13 | @$include_depth {COMMON.W}25 \&{int}@> 14 | @$file {COMMON.W}25 \&{FILE} ${*}$ [\,]@> 15 | @$change_file {COMMON.W}25 \&{FILE} ${*}$@> 16 | @$file_name {COMMON.W}25 \&{char} [\,][\,]@> 17 | @$change_file_name {COMMON.W}25 \&{char} [\,]@> 18 | @$found_filename {COMMON.W}25 \&{char} ${*}$@> 19 | @$line {COMMON.W}25 \&{int} [\,]@> 20 | @$change_line {COMMON.W}25 \&{int}@> 21 | @$change_depth {COMMON.W}25 \&{int}@> 22 | @$input_has_ended {COMMON.W}25 \&{bool}@> 23 | @$changing {COMMON.W}25 \&{bool}@> 24 | @$web_file_open {COMMON.W}25 \&{bool}@> 25 | 26 | @$get_line {COMMON.W}35 \&{bool} (\,)@> 27 | 28 | @$check_complete {COMMON.W}39 \&{void} (\,)@> 29 | 30 | @$reset_input {COMMON.W}40 \&{void} (\,)@> 31 | 32 | @$section_count {COMMON.W}42 \&{sixteen\_bits}@> 33 | @$changed_section {COMMON.W}42 \&{bool} [\,]@> 34 | @$change_pending {COMMON.W}42 \&{bool}@> 35 | @$print_where {COMMON.W}42 \&{bool}@> 36 | 37 | @$byte_mem {COMMON.W}43 \&{char} [\,]@> 38 | @$byte_mem_end {COMMON.W}43 \&{char} ${*}$@> 39 | @$name_dir {COMMON.W}43 \&{name\_info} [\,]@> 40 | @$name_dir_end {COMMON.W}43 \&{name\_pointer}@> 41 | 42 | @$byte_ptr {COMMON.W}44 \&{char} ${*}$@> 43 | @$name_ptr {COMMON.W}44 \&{name\_pointer}@> 44 | 45 | @$hash {COMMON.W}46 \&{name\_pointer} [\,]@> 46 | @$hash_end {COMMON.W}46 \&{hash\_pointer}@> 47 | @$hash_ptr {COMMON.W}46 \&{hash\_pointer}@> 48 | 49 | @$id_lookup {COMMON.W}48 \&{name\_pointer} (\,)@> 50 | 51 | @$print_section_name {COMMON.W}52 \&{void} (\,)@> 52 | @$sprint_section_name {COMMON.W}53 \&{void} (\,)@> 53 | @$print_prefix_name {COMMON.W}54 \&{void} (\,)@> 54 | 55 | @$section_lookup {COMMON.W}59 \&{name\_pointer} (\,)@> 56 | 57 | @$history {COMMON.W}65 \&{int}@> 58 | 59 | @$err_print {COMMON.W}66 \&{void} (\,)@> 60 | 61 | @$wrap_up {COMMON.W}68 \&{int} (\,)@> 62 | 63 | @$fatal {COMMON.W}70 \&{void} (\,)@> 64 | @$overflow {COMMON.W}71 \&{void} (\,)@> 65 | 66 | @$argc {COMMON.W}73 \&{int}@> 67 | @$argv {COMMON.W}73 \&{char} ${**}$@> 68 | @$C_file_name {COMMON.W}73 \&{char} [\,]@> 69 | @$tex_file_name {COMMON.W}73 \&{char} [\,]@> 70 | @$idx_file_name {COMMON.W}73 \&{char} [\,]@> 71 | @$scn_file_name {COMMON.W}73 \&{char} [\,]@> 72 | @$check_file_name {COMMON.W}73 \&{char} [\,]@> 73 | @$flags {COMMON.W}73 \&{bool} [\,]@> 74 | 75 | @$C_file {COMMON.W}83 \&{FILE} ${*}$@> 76 | @$tex_file {COMMON.W}83 \&{FILE} ${*}$@> 77 | @$idx_file {COMMON.W}83 \&{FILE} ${*}$@> 78 | @$scn_file {COMMON.W}83 \&{FILE} ${*}$@> 79 | @$check_file {COMMON.W}83 \&{FILE} ${*}$@> 80 | @$active_file {COMMON.W}83 \&{FILE} ${*}$@> 81 | 82 | @$use_language {COMMON.W}86 \&{const char} ${*}$@> 83 | 84 | @$cb_banner {COMMON.W}87 \&{char} [\,]@> 85 | 86 | @$cb_show_banner {COMMON.W}101 \&{void} (\,)@> 87 | 88 | @$kpse_cweb_format "" \zip@> 89 | @$kpse_find_file "" \zip@> 90 | @$versionstring "" \zip@> 91 | -------------------------------------------------------------------------------- /vault/comm-borlandc.hch: -------------------------------------------------------------------------------- 1 | Changes for COMMON.H by Andreas Scherer, May 10, 1995. 2 | 3 | This set of changes provides support for installing CWEB on MS/DOS systems 4 | with Borland C++ 3.1. Arrays larger than 64 KB are allocated with a 5 | system-dependent routine `farcalloc'. For this, several pointer variables 6 | have to be declared as `huge'. Care has been taken to avoid conflicts with 7 | other operating systems which are not restricted to the limitations of DOS. 8 | (DOS isn't restricted to the 64 KB limit either, or else this full sized 9 | patch would not be possible. But instead of `farcalloc' a `non-ANSI' sized 10 | `malloc' would be much more convenient.) For other MS/DOS compilers than 11 | Borland C++ 3.1 you'll have to replace this file by other changes. 12 | 13 | This change file requires COMM-ANSI.HCH, COMM-EXTENSIONS.HCH, 14 | COMM-MEMORY.HCH, COMM-TRANSLATION.HCH to be applied as well. 15 | 16 | For a complete history of the changes made to COMMON.H see COMM-PATCH.CH. 17 | 18 | @x l.24 19 | First comes general stuff: 20 | @y 21 | First comes general stuff. 22 | 23 | In {\mc TURBO} \CEE/, we use |huge| pointers instead of large arrays. 24 | @^system dependencies@> 25 | 26 | @f far int 27 | @f huge int 28 | @f HUGE int 29 | @# 30 | @z 31 | 32 | @x l.33 33 | extern int phase; /* which phase are we in? */ 34 | @y 35 | extern int phase; /* which phase are we in? */ 36 | @# 37 | #ifdef __TURBOC__ 38 | #define HUGE huge 39 | #else 40 | #define HUGE 41 | #endif 42 | @^system dependencies@> 43 | @z 44 | 45 | @x l.36 46 | #include 47 | @y 48 | #include 49 | @# 50 | #ifdef __TURBOC__ 51 | #include 52 | #endif 53 | @z 54 | 55 | @x l.88 56 | typedef struct name_info { 57 | char *byte_start; /* beginning of the name in |byte_mem| */ 58 | struct name_info *link; 59 | union { 60 | struct name_info *Rlink; /* right link in binary search tree for section 61 | names */ 62 | char Ilk; /* used by identifiers in \.{CWEAVE} only */ 63 | } dummy; 64 | void *equiv_or_xref; /* info corresponding to names */ 65 | } name_info; /* contains information about an identifier or section name */ 66 | @y 67 | typedef struct name_info { 68 | char HUGE *byte_start; /* beginning of the name in |byte_mem| */ 69 | struct name_info HUGE *link; 70 | union { 71 | struct name_info HUGE *Rlink; /* right link in binary search tree for section 72 | names */ 73 | char Ilk; /* used by identifiers in \.{WEAVE} only */ 74 | } dummy; 75 | void HUGE *equiv_or_xref; /* info corresponding to names */ 76 | } name_info; /* contains information about an identifier or section name */ 77 | @z 78 | 79 | @x l.98 80 | typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */ 81 | @y 82 | typedef name_info HUGE *name_pointer; /* pointer into array of |name_info|s */ 83 | @z 84 | 85 | @x l.49 of COMM-MEMORY.HCH 86 | extern char *byte_mem; /* characters of names */ 87 | extern char *byte_mem_end; /* end of |byte_mem| */ 88 | @y 89 | extern char HUGE *byte_mem; /* characters of names */ 90 | extern char HUGE *byte_mem_end; /* end of |byte_mem| */ 91 | @z 92 | 93 | @x l.105 94 | extern char *byte_ptr; /* first unused position in |byte_mem| */ 95 | @y 96 | extern char HUGE *byte_ptr; /* first unused position in |byte_mem| */ 97 | #ifdef __TURBOC__ 98 | extern void far *allocsafe(unsigned long,unsigned long); 99 | #endif 100 | @^system dependencies@> 101 | @z 102 | -------------------------------------------------------------------------------- /0006-Rename-page-dimensions-to-match-cwebmac.patch: -------------------------------------------------------------------------------- 1 | From 88a5e5237f615d94a3ea3f6c8e8d7391969198e5 Mon Sep 17 00:00:00 2001 2 | From: debbuild 3 | Date: Fri, 27 Dec 2024 11:35:30 +0100 4 | Subject: [PATCH 6/6] Rename page dimensions to match cwebmac. 5 | 6 | --- 7 | ctwimac.tex | 26 +++++++++++++------------- 8 | 1 file changed, 13 insertions(+), 13 deletions(-) 9 | 10 | diff --git a/ctwimac.tex b/ctwimac.tex 11 | index d65f5bf..a7978d8 100644 12 | --- a/ctwimac.tex 13 | +++ b/ctwimac.tex 14 | @@ -259,16 +259,16 @@ 15 | % \L is Polish letter suppressed-L 16 | \outer\def\M#1{\def\secno{#1}\startsection\ignorespaces} 17 | \outer\def\N{\ifvoid\partialpage\lefttrue 18 | - \else\ifdim\ht\partialpage<\pageht \leftfalse\else\lefttrue\fi\fi\NNN} 19 | + \else\ifdim\ht\partialpage<\pageheight \leftfalse\else\lefttrue\fi\fi\NNN} 20 | \outer\def\NN{\ifvoid\partialpage\leftfalse 21 | - \else\ifdim\ht\partialpage<\pageht \lefttrue\else\leftfalse\fi\fi\NNN} 22 | + \else\ifdim\ht\partialpage<\pageheight \lefttrue\else\leftfalse\fi\fi\NNN} 23 | \outer\def\NNN#1#2#3.{% beginning of starred section 24 | \gdepth=#1\gtitle={#3}\def\secno{#2} 25 | \ifleft \flushout 26 | \gdef\rlhead{\let\i=I\uppercase{\ignorespaces#3}} % running left headline 27 | \global\let\rrhead=\rlhead % running right headline 28 | \else\global\setbox\partialpage=\vbox{ 29 | - \vbox to\pageht{\unvbox\partialpage\vfill}\break} 30 | + \vbox to\pageheight{\unvbox\partialpage\vfill}\break} 31 | \gdef\rrhead{\let\i=I\uppercase{\ignorespaces#3}} 32 | \fi 33 | \message{*\secno} % progress report 34 | @@ -315,12 +315,12 @@ 35 | % \count and \toks registers 200--219 are also used to keep track of refs 36 | \catcode`\@=11 37 | \newcount\@n \newcount\@m \newcount\@p 38 | -\newdimen\pageht \pageht=19cm 39 | -\newdimen\pagewd \pagewd=13cm 40 | -\newdimen\colwd \colwd=\pagewd 41 | +\newdimen\pageheight \pageheight=19cm 42 | +\newdimen\pagewidth \pagewidth=13cm 43 | +\newdimen\colwd \colwd=\pagewidth 44 | \advance\colwd by -2pc \divide\colwd by 3 % for three columns 45 | -\newdimen\fullpageht \fullpageht=\pageht \advance\fullpageht by 4pc 46 | -\newdimen\pagethresh \pagethresh=2\pageht 47 | +\newdimen\fullpageheight \fullpageheight=\pageheight \advance\fullpageheight by 4pc 48 | +\newdimen\pagethresh \pagethresh=2\pageheight 49 | \newdimen\nsize \newdimen\msize 50 | \newskip\intersecskip \intersecskip=8pt plus 2pt minus 3pt 51 | \newbox\partialpage 52 | @@ -331,7 +331,7 @@ 53 | \newif\iftitle \newif\ifleft 54 | 55 | \def\flushout{\ifvoid\partialpage\else 56 | - \setbox0=\vsplit\partialpage to \pageht 57 | + \setbox0=\vsplit\partialpage to \pageheight 58 | \shipout\vbox{ 59 | \vbox to 3pc{\leftheadline\vfill} 60 | \nointerlineskip\box0} 61 | @@ -345,7 +345,7 @@ 62 | \hyphenpenalty 10000 \exhyphenpenalty 10000 63 | \noindent\vbox to1pt{}\par % 1pt = \topskip - \ninept 64 | \readin} 65 | - \shipout\vbox to\fullpageht{ 66 | + \shipout\vbox to\fullpageheight{ 67 | \vbox to 3pc{\rightheadline\vfill} 68 | \unvbox\partialpage 69 | \vfill 70 | @@ -364,10 +364,10 @@ 71 | \@n=199 \loop \ifnum\@n<222 \toks\@n={} \count\@n=0 \advance\@n 1 \repeat 72 | \nrefs=0 73 | \baseno=\secno}} 74 | -\def\leftheadline{\hbox to\pagewd{\vbox to10pt{}% 75 | +\def\leftheadline{\hbox to\pagewidth{\vbox to10pt{}% 76 | \iftitle\global\titlefalse\else\ninerm\title:\enspace \eightsl\rlhead\fi 77 | \hfil\eightrm\folio}} 78 | -\def\rightheadline{\hbox to\pagewd{\vbox to10pt{}% 79 | +\def\rightheadline{\hbox to\pagewidth{\vbox to10pt{}% 80 | \eightrm\folio\hfil\ninerm\title:\enspace \eightsl\rrhead\/}} 81 | 82 | \def\mini{\begingroup \obeylines \globaldefs=1 \newrefs=\bgroup} 83 | @@ -448,7 +448,7 @@ 84 | \def\donewithpage#1 {\let\readin=\relax} 85 | \catcode`\@=12 86 | 87 | -\hsize=\pagewd \vsize=\maxdimen \output={\twillout} 88 | +\hsize=\pagewidth \vsize=\maxdimen \output={\twillout} 89 | 90 | \def\inx{\flushout\end} 91 | \def\fin{\parfillskip 0pt plus 1fil 92 | -- 93 | 2.47.1 94 | 95 | -------------------------------------------------------------------------------- /cwebman-patch.ch: -------------------------------------------------------------------------------- 1 | -*-Web-*- 2 | This file, CWEBMAN-FOO.CH, is part of CWEBBIN (@VERSION@). It is a 3 | changefile written by Andreas Scherer for CWEBMAN.TEX, Version 4.12.2, that 4 | provides changes appropriate for extensions by Carsten Steger, Andreas 5 | Scherer (deutsch), Giuseppe Ghibò (italiano), and Denis Roegel (français). 6 | 7 | Technically, CWEBMAN-FOO.CH is constructed from a multitude of separate change 8 | files by applying Klaus Guntermann's TIE processor. Any comments (like this 9 | introduction) are removed from the final output, so this CWEBMAN-PATCH.CH is 10 | the place to look up the development history. 11 | 12 | This program is distributed WITHOUT ANY WARRANTY, express or implied. 13 | 14 | The following copyright notice extends to this changefile only, not to 15 | the masterfile CWEBMAN.TEX. 16 | 17 | Copyright (C) 1993-1995,1998-2000,2005,2011,2018-2025 Andreas Scherer 18 | 19 | Permission is granted to make and distribute verbatim copies of this 20 | document provided that the copyright notice and this permission notice 21 | are preserved on all copies. 22 | 23 | Permission is granted to copy and distribute modified versions of this 24 | document under the conditions for verbatim copying, provided that the 25 | entire resulting derived work is distributed under the terms of a 26 | permission notice identical to this one. 27 | 28 | Version history: 29 | 30 | Version Date Author Comment 31 | a1 15 Mar 1993 AS Setup of changefile. 32 | a2 05 Sep 1993 AS Minor changes and corrections. 33 | a3 09 Oct 1993 AS Updated for cwebman.tex 2.8. 34 | a4 12 Oct 1993 AS Contents page for the complete manual. 35 | a5 25 Oct 1993 AS Updated for cwebman.tex 3.0. 36 | a6 18 Nov 1993 AS Updated for cwebman.tex 3.1. 37 | a7 30 Nov 1993 AS Minor changes and corrections. 38 | a8 12 Jan 1994 AS New gcwebmac.tex installed. 39 | a9 18 Jan 1994 AS New patch level. 40 | a10 24 Jun 1994 AS New option `m' for ARexx communication. 41 | a11 12 Aug 1994 AS Updated for cwebman.tex 3.2. 42 | a12 24 Aug 1994 AS Support for Italian users by GG. 43 | New option flag list. 44 | a13 19 Sep 1994 AS Support for French users by DBR. 45 | a14 03 Dec 1994 AS Updated for CWEB 3.3. 46 | a15 18 Apr 1995 AS Updated for CWEB 3.4. 47 | a16 12 May 1995 AS Updated for private patch level. 48 | a17 13 Aug 1998 AS Updated for CWEB 3.42. 49 | a18 31 Dec 1999 AS Updated for CWEB 3.5. 50 | a19 25 Jul 2000 AS Updated for CWEB 3.61. 51 | a20 02 Jan 2001 AS Updated for CWEB 3.63. 52 | a21 09 Mar 2002 AS Updated for CWEB 3.64. 53 | a22 18 Aug 2011 AS Updated for CWEB 3.64ad. 54 | 2018 24 Nov 2018 AS Update for CWEBbin 2018. 55 | 2019 01 Jan 2019 AS Update for CWEBbin 2019. 56 | 2020 30 Mar 2020 AS New option '-t' re temporary output. 57 | 2020 13 Apr 2020 AS New Appendix G (CTWILL source). 58 | 2020 24 May 2020 AS Remove macro translations. 59 | 2020 11 Jun 2020 AS Split into multiple changefiles. 60 | ------------------------------------------------------------------------------ 61 | @x l.6 See comment in cwebmac.tex 62 | \def\page{\box255 } \normalbottom 63 | @y 64 | \let\page=\pagebody \raggedbottom 65 | \newcount\footnotecount \footnotecount 1\relax 66 | \def\cwebfootnote#1{\footnote{${}^{\the\footnotecount}$}{#1}% 67 | \advance\footnotecount by 1\relax} 68 | @z 69 | ------------------------------------------------------------------------------ 70 | @x l.34 71 | \def\runninghead{{\ninett CWEB} USER MANUAL (VERSION 4.12.2)} 72 | @y 73 | \def\runninghead{{\ninett CWEB} USER MANUAL (@VERSION@)} 74 | @z 75 | ------------------------------------------------------------------------------ 76 | @x l.48 77 | \vskip 18pt\centerline{(Version 4.12.2 --- July 2025)} 78 | @y 79 | \vskip 18pt\centerline{(Version 4.12.2 --- July 2025)% 80 | \footnote*{This document describes the extended \.{CWEB} (@VERSION@).}} 81 | @z 82 | ------------------------------------------------------------------------------ 83 | @x l.1613 84 | \.{ { }\\vskip 15pt \\centerline\{(Version 4.12.2)\}{ }\\vfill\}}\cr}$$ 85 | @y 86 | \.{ { }\\vskip 15pt \\centerline\{(@VERSION@)\}{ }\\vfill\}}\cr}$$ 87 | @z 88 | ------------------------------------------------------------------------------ 89 | -------------------------------------------------------------------------------- /vault/ctangle.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="ctangle" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103 6 | 7 | CFG=ctangle - Win32 Release 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "ctangle.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "ctangle.mak" CFG="ctangle - Win32 Release" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "ctangle - Win32 Release" (based on "Win32 (x86) Console Application") 21 | !MESSAGE "ctangle - Win32 Debug" (based on "Win32 (x86) Console Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "ctangle - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir ".\Release" 36 | # PROP BASE Intermediate_Dir ".\Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir ".\Release" 41 | # PROP Intermediate_Dir ".\Release" 42 | # PROP Ignore_Export_Lib 0 43 | # PROP Target_Dir "" 44 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c 45 | # ADD CPP /nologo /MD /W3 /GX /O2 /I "catalogs" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D _DEV_NULL=\"NUL\" /D SEPARATORS=\":\\/\" /FD /c 46 | # SUBTRACT CPP /YX 47 | # ADD BASE RSC /l 0x407 /d "NDEBUG" 48 | # ADD RSC /l 0x407 /d "NDEBUG" 49 | BSC32=bscmake.exe 50 | # ADD BASE BSC32 /nologo 51 | # ADD BSC32 /nologo 52 | LINK32=link.exe 53 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 54 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 55 | 56 | !ELSEIF "$(CFG)" == "ctangle - Win32 Debug" 57 | 58 | # PROP BASE Use_MFC 0 59 | # PROP BASE Use_Debug_Libraries 1 60 | # PROP BASE Output_Dir ".\Debug" 61 | # PROP BASE Intermediate_Dir ".\Debug" 62 | # PROP BASE Target_Dir "" 63 | # PROP Use_MFC 0 64 | # PROP Use_Debug_Libraries 1 65 | # PROP Output_Dir ".\Debug" 66 | # PROP Intermediate_Dir ".\Debug" 67 | # PROP Ignore_Export_Lib 0 68 | # PROP Target_Dir "" 69 | # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c 70 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "catalogs" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D _DEV_NULL=\"NUL\" /D SEPARATORS=\":\\/\" /FD /c 71 | # SUBTRACT CPP /YX 72 | # ADD BASE RSC /l 0x407 /d "_DEBUG" 73 | # ADD RSC /l 0x407 /d "_DEBUG" 74 | BSC32=bscmake.exe 75 | # ADD BASE BSC32 /nologo 76 | # ADD BSC32 /nologo 77 | LINK32=link.exe 78 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 79 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 80 | 81 | !ENDIF 82 | 83 | # Begin Target 84 | 85 | # Name "ctangle - Win32 Release" 86 | # Name "ctangle - Win32 Debug" 87 | # Begin Group "Source Files" 88 | 89 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" 90 | # Begin Source File 91 | 92 | SOURCE=common.cxx 93 | # End Source File 94 | # Begin Source File 95 | 96 | SOURCE=ctangle.cxx 97 | # End Source File 98 | # End Group 99 | # End Target 100 | # End Project 101 | -------------------------------------------------------------------------------- /ctwill-texlive.ch: -------------------------------------------------------------------------------- 1 | % Kpathsea changes for CTWILL by Andreas Scherer 2 | % This file is in the Public Domain. 3 | 4 | % Most of the original changes were merged with the set of change files 5 | % of the CWEBbin project. This stripped change file is last in line of 6 | % cweav-patch.ch, cweav-extensions.ch, cweav-output.ch, cweav-i18n.ch, 7 | % cweav-twill.ch, ctwt-texlive.ch, and ctwill-texlive.ch that get tie'd 8 | % into ctwill.w in TeX Live. 9 | 10 | Material in limbo. 11 | 12 | @x l.40 of CWEAV-TWILL.CH 13 | \def\title{CTWILL (@VERSION@)} 14 | @y 15 | \def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} \ifacro\sanitizecommand\Kpathsea{KPATHSEA}\fi 16 | \def\title{CTWILL (Version 4.12.2 [\TeX~Live])} 17 | @z 18 | 19 | Section 1. 20 | 21 | @x l.69 of CWEAV-TWILL.CH 22 | @d banner _("This is CTWILL (@VERSION@)") 23 | @y 24 | @d banner "This is CTWILL, Version 4.12.2" 25 | /* will be extended by the \TeX~Live |versionstring| */ 26 | @z 27 | 28 | Section 89. 29 | 30 | @x l.1395 and l.323 of CWEAV-TWILL.CH 31 | saying \.{+P} on the command line, it's `\.{\\input proofmac}' (resp.\ 32 | \.{\\input Xproofmac} with option \.{+lX}), a set of macros used when 33 | @y 34 | saying \.{+P} on the command line, it's `\.{\\input ctproofmac}' (resp.\ 35 | \.{\\input Xctproofmac} with option \.{+lX}), a set of macros used when 36 | @z 37 | 38 | @x l.333 of CWEAV-TWILL.CH 39 | tex_puts(proofing?"proofma":"ctwima"); 40 | @y 41 | tex_puts(proofing?"ctproofma":"ctwima"); 42 | @z 43 | 44 | Section 272. 45 | 46 | @x l.907 of CWEAV-TWILL.CH 47 | must have fewer than 50 characters. If the \TeX\ part starts 48 | @y 49 | must have fewer than 80 characters. If the \TeX\ part starts 50 | @z 51 | 52 | @x l.949 of CWEAV-TWILL.CH 53 | @d max_tex_chars 50 /* limit on the \TeX\ part of a meaning */ 54 | @y 55 | @d max_tex_chars 80 /* limit on the \TeX\ part of a meaning */ 56 | @z 57 | 58 | Section 292. 59 | 60 | @x l.1238 of CWEAV-TWILL.CH 61 | if ((cur_file=fopen(cur_file_name,"r"))) { cur_line=0; include_depth++; } 62 | @y 63 | if ( (found_filename = kpse_find_cweb(cur_file_name)) @| 64 | && (cur_file=fopen(found_filename,"r")) ) { 65 | @@; 66 | cur_line=0; include_depth++; 67 | } 68 | @z 69 | 70 | @x l.1241 of CWEAV-TWILL.CH 71 | if ((cur_file=fopen(cur_file_name,"r"))) cur_line=0; 72 | @y 73 | if ( (found_filename = kpse_find_cweb(cur_file_name)) @| 74 | && (cur_file=fopen(found_filename,"r")) ) { 75 | @@; 76 | cur_line=0; 77 | } 78 | @z 79 | 80 | @x l.4892 81 | @** Index. 82 | @y 83 | @* File lookup with \Kpathsea/. The \.{CTANGLE} and \.{CWEAVE} programs from 84 | the original \.{CWEB} package use the compile-time default directory or the 85 | value of the environment variable \.{CWEBINPUTS} as an alternative place to be 86 | searched for files, if they could not be found in the current directory. 87 | 88 | This version uses the \Kpathsea/ mechanism for searching files. 89 | The directories to be searched for come from three sources: 90 | \smallskip 91 | {\parindent1em 92 | \item{(a)} a user-set environment variable \.{CWEBINPUTS} 93 | (overridden by \.{CWEBINPUTS\_cweb}); 94 | \item{(b)} a line in \Kpathsea/ configuration file \.{texmf.cnf},\hfil\break 95 | e.g., \.{CWEBINPUTS=\$TEXMFDOTDIR:\$TEXMF/texmf/cweb//}\hfil\break 96 | or \.{CWEBINPUTS.cweb=\$TEXMFDOTDIR:\$TEXMF/texmf/cweb//}; 97 | \item{(c)} compile-time default directories (specified in 98 | \.{texmf.in}),\hfil\break 99 | i.e., \.{\$TEXMFDOTDIR:\$TEXMF/texmf/cweb//}.\par} 100 | @.CWEBINPUTS@> 101 | 102 | @d kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) 103 | 104 | @= 105 | #include /* |@!kpse_find_file| */ 106 | 107 | @ @= 108 | if (strlen(found_filename) < max_file_name_length) { 109 | if (strcmp(cur_file_name,found_filename)) { 110 | strcpy(cur_file_name,found_filename + @| 111 | ((strncmp(found_filename,"./",2)==0) ? 2 : 0)); /* Strip path prefix */ 112 | } 113 | free(found_filename); 114 | }@+else fatal(_("! Filename too long\n"), found_filename); 115 | 116 | @** Index. 117 | @z 118 | -------------------------------------------------------------------------------- /examples/wmerg-output.ch: -------------------------------------------------------------------------------- 1 | Changes for WMERGE.W by Andreas Scherer, October 30, 2018. 2 | 3 | This set of changes modifies the output behaviour of the CWEB system. 4 | Instead of writing directly to the file as described in the manual, the 5 | current run is documented in a temporary output file which is copied to the 6 | expected file in the last moment. In case of an user abort, previous 7 | results are not destroyed. 8 | 9 | This change file somewhat requires WMERG-PATCH.CH, WMERG-ANSI.CH, and 10 | WMERG-EXTENSIONS.CH to be applied as well. 11 | 12 | For a complete history of the changes made to WMERGE.W see WMERG-PATCH.CH. 13 | 14 | @x l.34 15 | return wrap_up(); 16 | @y 17 | if(out_file!=stdout) { 18 | fclose(out_file); out_file=NULL; 19 | @@; 20 | } 21 | return wrap_up(); 22 | @z 23 | 24 | @x l.557 25 | @; 26 | @y 27 | @@; 28 | @@; 29 | @z 30 | 31 | @x l.587 32 | char out_file_name[max_file_name_length]; /* name of |out_file| */ 33 | @y 34 | char out_file_name[max_file_name_length]; /* name of |out_file| */ 35 | char check_file_name[max_file_name_length]; /* name of |check_file| */ 36 | @z 37 | 38 | @x l.701 39 | FILE *out_file; /* where output goes */ 40 | @y 41 | FILE *out_file; /* where output goes */ 42 | FILE *check_file; /* where the temporary output goes */ 43 | @z 44 | 45 | @x l.705 46 | if (out_file_name[0]=='\0') out_file=stdout; 47 | else if ((out_file=fopen(out_file_name,"w"))==NULL) 48 | fatal("! Cannot open output file ", out_file_name); 49 | @y 50 | strcpy(check_file_name,out_file_name); 51 | if(check_file_name[0]!='\0') { 52 | char *dot_pos=strrchr(check_file_name,'.'); 53 | if(dot_pos==NULL) strcat(check_file_name,".mtp"); 54 | else strcpy(dot_pos,".mtp"); 55 | } 56 | if (out_file_name[0]=='\0') out_file=stdout; 57 | else if ((out_file=fopen(check_file_name,"w"))==NULL) 58 | fatal("! Cannot open output file ", check_file_name); 59 | @z 60 | 61 | @x l.717 62 | @* Index. 63 | @y 64 | @* Output file update. Most \CEE/ projects are controlled by a 65 | \.{makefile} which automatically takes care of the temporal dependencies 66 | between the different source modules. It is suitable that \.{CWEB} doesn't 67 | create new output for all existing files, when there are only changes to 68 | some of them. Thus the \.{make} process will only recompile those modules 69 | where necessary. The idea and basic implementation of this mechanism can 70 | be found in the program \.{NUWEB} by Preston Briggs, to whom credit is due. 71 | 72 | @= 73 | if((out_file=fopen(out_file_name,"r"))!=NULL) { 74 | char x[BUFSIZ],y[BUFSIZ]; 75 | int x_size,y_size,comparison; 76 | 77 | if((check_file=fopen(check_file_name,"r"))==NULL) 78 | fatal("! Cannot open output file ",check_file_name); 79 | 80 | @@; 81 | 82 | fclose(out_file); out_file=NULL; 83 | fclose(check_file); check_file=NULL; 84 | 85 | @@; 86 | } else 87 | rename(check_file_name,out_file_name); /* This was the first run */ 88 | 89 | strcpy(check_file_name,""); /* We want to get rid of the temporary file */ 90 | 91 | @ We hope that this runs fast on most systems. 92 | 93 | @= 94 | do { 95 | x_size = fread(x,1,BUFSIZ,out_file); 96 | y_size = fread(y,1,BUFSIZ,check_file); 97 | comparison = (x_size == y_size); /* Do not merge these statements! */ 98 | if(comparison) comparison = !memcmp(x,y,x_size); 99 | } while(comparison && !feof(out_file) && !feof(check_file)); 100 | 101 | @ Note the superfluous call to |remove| before |rename|. We're using it to 102 | get around a bug in some implementations of |rename|. 103 | 104 | @= 105 | if(comparison) 106 | remove(check_file_name); /* The output remains untouched */ 107 | else { 108 | remove(out_file_name); 109 | rename(check_file_name,out_file_name); 110 | } 111 | 112 | @ @= 113 | if(out_file) 114 | fclose(out_file); 115 | if(check_file) 116 | fclose(check_file); 117 | if(strlen(check_file_name)) 118 | remove(check_file_name); 119 | 120 | @* Index. 121 | @z 122 | -------------------------------------------------------------------------------- /proofsort: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env perl 2 | # Public domain. Originally written by Andreas Scherer, 2023. 3 | 4 | use strict; 5 | use warnings; 6 | 7 | use File::Basename; 8 | use Getopt::Long qw(:config no_ignore_case bundling); 9 | use Pod::Usage; 10 | 11 | my $progname; 12 | my $collator; 13 | 14 | BEGIN { 15 | $progname = basename $0; 16 | # Unicode::Collate has been around a long time, 17 | # but it's not part of core Perl. 18 | eval { 19 | require Unicode::Collate; 20 | $collator = Unicode::Collate->new(); 21 | }; 22 | } 23 | 24 | my $usage = "Usage: $progname < input_file > output_file\n"; 25 | 26 | # Standard options for TeX Live. 27 | Getopt::Long::GetOptions( 28 | 'help|?' => \&help_handler, 29 | 'version' => sub { print version(); exit 0; } 30 | ) or die $usage; 31 | ## help_handler() 32 | sub help_handler { 33 | open(my $pipe, '|-', $ENV{PAGER} || 'less -e') or exit 1; 34 | pod2usage(-message => version(), -output => $pipe, 35 | -verbose => 99, -sections => "SHORT DESCRIPTION|EXAMPLE|COPYRIGHT"); 36 | close $pipe; 37 | exit 0; 38 | } 39 | ## version() 40 | sub version { 41 | return "This is $progname (2023).\n"; 42 | } 43 | 44 | # Read input from the console and look for blocks like 45 | # \mini 46 | # [LOCATION KEY TEXPART]* 47 | # }\FI 48 | # and sort them alphabetically by the KEYs. 49 | # 50 | # Every KEY contains a single C identifier (variable, type, function, etc.), 51 | # either as a single brace-enclosed argument of a TeX control sequence, 52 | # or as a single identifier in $math_mode$; the latter come from '@f'ormat 53 | # definitions. All internal backslashes are removed from the KEY before it 54 | # is used in the storage. 55 | my %mini_index; # storage for index entries of a section 56 | my $print_index = 0; # do we collect and print a mini-index? 57 | foreach my $line () 58 | { 59 | if ("\\mini\n" eq $line) { # start of mini-index 60 | $print_index = 1; 61 | %mini_index = (); # reset mini-index storage 62 | } elsif ("}\\FI\n" eq $line) { # end of mini-index 63 | foreach my $key ($collator ? # (I) sort by second column 64 | $collator->sort(keys %mini_index) : 65 | sort {"\L$a" cmp "\L$b"} keys %mini_index) { 66 | print sort { # (II) sort by third and first column 67 | my ($a_loc,undef,$a_id) = split / /, $a, 3; 68 | my ($b_loc,undef,$b_id) = split / /, $b, 3; 69 | $a_id cmp $b_id || $a_loc cmp $b_loc } 70 | @{ $mini_index{$key} }; 71 | } 72 | $print_index = 0; 73 | } elsif ($print_index) { # mini-index entry 74 | my (undef,$key) = split / /, $line; # 2nd column is the key 75 | $key =~ s/\\//g; # strip internal TeX escape(s) 76 | $key =~ m/\w*\{(\w+)\}/; # extract plain key from control seq. 77 | $key =~ m/\$(\w+)\$/ unless defined $1; # extract @f TeX key 78 | push @{ $mini_index{$1} }, $line; # store index entry 79 | next; # print later 80 | } 81 | 82 | print $line; 83 | } 84 | 85 | exit 0; 86 | 87 | =pod 88 | 89 | =encoding utf8 90 | 91 | =head1 NAME 92 | 93 | proofsort - Sort mini-indexes alphabetically 94 | 95 | =head1 SHORT DESCRIPTION 96 | 97 | This small Perl script 'proofsort' sorts the mini-indexes for each 98 | section in the TeX file created by 'ctwill +P', i.e., prior to 99 | formatting with the 'proofmac.tex' macros. 100 | It reads its input from and writes its output to . 101 | 102 | =over 103 | 104 | =item Run CTWILL twice on your 'input_file'.w, creating 'input_file'.tex 105 | 106 | =item Invoke "( proofsort < 'input_file'.tex ) 1<> 'input_file'.tex" 107 | 108 | =item Run TeX on 'input_file'.tex once 109 | 110 | =back 111 | 112 | See also "man ctwill" for more information on how to use the CTWILL system, 113 | both with or without the '+P' option. 114 | 115 | =head1 EXAMPLE 116 | 117 | Example from MMIX (https://github.com/ascherer/mmix, 'local' branch): 118 | 119 | =over 120 | 121 | =item $ tie -c mmotype-twill.ch mmotype.{w,ch} mmotype-mini.ch 122 | 123 | =item $ ctwill +P -x mmotype mmotype-twill (run this two times) 124 | 125 | =item $ ( proofsort < mmotype.tex ) 1<> mmotype.tex 126 | 127 | =item $ tex mmotype 128 | 129 | =back 130 | 131 | =head1 COPYRIGHT 132 | 133 | Public domain. Originally written by Andreas Scherer, 2023. 134 | 135 | Contemporary development on https://github.com/ascherer/cwebbin. 136 | 137 | =cut 138 | -------------------------------------------------------------------------------- /0001-Support-extended-syntax-for-numeric-literals.patch: -------------------------------------------------------------------------------- 1 | From 07e8fcc3d675a01043c97d1ae01df3eff2745399 Mon Sep 17 00:00:00 2001 2 | From: Andreas Scherer 3 | Date: Mon, 29 Mar 2021 13:14:34 +0200 4 | Subject: [PATCH 1/6] Support extended syntax for numeric literals. 5 | 6 | --- 7 | ctwimac.tex | 15 ++++++++++----- 8 | proofmac.tex | 15 ++++++++++----- 9 | 2 files changed, 20 insertions(+), 10 deletions(-) 10 | 11 | diff --git a/ctwimac.tex b/ctwimac.tex 12 | index eddd6af..1fbb0ac 100644 13 | --- a/ctwimac.tex 14 | +++ b/ctwimac.tex 15 | @@ -1,9 +1,9 @@ 16 | % standard macros for CWEB listings (in addition to plain.tex) 17 | -% Version 3.6 --- May 2000 18 | +% Version 4.3 --- April 2021 19 | % modified for pages produced by CTWILL 20 | % further modified for page size of the MMIXware book 21 | \ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros 22 | -\xdef\fmtversion{\fmtversion+CTWILL3.6+LNCS} 23 | +\xdef\fmtversion{\fmtversion+CTWILL4.3+LNCS} 24 | 25 | \let\:=\. % preserve a way to get the dot accent 26 | % (all other accents will still work as usual) 27 | @@ -278,7 +278,8 @@ 28 | \hbox{$\def\?{\kern.2em}% 29 | \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant 30 | \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick) 31 | - \let\~=\oct \let\^=\hex {#1}$}} 32 | + \def\%{\cdot 16^{\aftergroup}}% power of sixteen (via dirty trick) 33 | + \let\~=\oct \let\^=\hex \let\\=\bin{#1}$}}%$% 34 | \def\U{\note{This code is used in section}} % xref for use of a section 35 | \def\Us{\note{This code is used in sections}} % xref for uses of a section 36 | \let\V=\lor % logical or 37 | @@ -292,8 +293,12 @@ 38 | 39 | %\def\oct{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}} % WEB style 40 | %\def\hex{\hbox{\rm\char"7D\tt\aftergroup}} % WEB style 41 | -\def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}% CWEB style 42 | -\def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style 43 | +\def\oct{\hbox{$^\circ$\kern-.1em}\Od}% CWEB style 44 | +\def\hex{\hbox{$^{\scriptscriptstyle\#}$}\Hd} % CWEB style 45 | +\def\bin{\hbox{$^{\scriptscriptstyle b}$}\Bd} 46 | +\def\Od#1/{{\it#1}} % octal digit 47 | +\def\Hd#1/{{\tt#1}} % hexadecimal digit 48 | +\def\Bd#1/{{\tt#1}} % binary digit 49 | \def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule 50 | \hbox{\strut\kern2pt\.{#1}\kern2pt}} 51 | \hrule}\vrule\kern2pt}} % verbatim string 52 | diff --git a/proofmac.tex b/proofmac.tex 53 | index 29533b8..dbcf312 100644 54 | --- a/proofmac.tex 55 | +++ b/proofmac.tex 56 | @@ -1,8 +1,8 @@ 57 | % standard macros for CWEB listings (in addition to plain.tex) 58 | -% Version 3.6 --- May 2000 59 | +% Version 4.3 --- April 2021 60 | % Modified for proofs in CTWILL 61 | \ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros 62 | -\xdef\fmtversion{\fmtversion+CWEB3.6+PROOFS} 63 | +\xdef\fmtversion{\fmtversion+CWEB4.3+PROOFS} 64 | 65 | \let\:=\. % preserve a way to get the dot accent 66 | % (all other accents will still work as usual) 67 | @@ -162,7 +162,8 @@ 68 | \hbox{$\def\?{\kern.2em}% 69 | \def\$##1{\egroup_{\,\rm##1}\bgroup}% suffix to constant 70 | \def\_{\cdot 10^{\aftergroup}}% power of ten (via dirty trick) 71 | - \let\~=\oct \let\^=\hex {#1}$}} 72 | + \def\%{\cdot 16^{\aftergroup}}% power of sixteen (via dirty trick) 73 | + \let\~=\oct \let\^=\hex \let\\=\bin{#1}$}}%$% 74 | \def\U{\note{This code is used in section}} % xref for use of a section 75 | \def\Us{\note{This code is used in sections}} % xref for uses of a section 76 | \let\V=\lor % logical or 77 | @@ -176,8 +177,12 @@ 78 | 79 | %\def\oct{\hbox{\rm\char'23\kern-.2em\it\aftergroup\?\aftergroup}} % WEB style 80 | %\def\hex{\hbox{\rm\char"7D\tt\aftergroup}} % WEB style 81 | -\def\oct{\hbox{$^\circ$\kern-.1em\it\aftergroup\?\aftergroup}}% CWEB style 82 | -\def\hex{\hbox{$^{\scriptscriptstyle\#}$\tt\aftergroup}} % CWEB style 83 | +\def\oct{\hbox{$^\circ$\kern-.1em}\Od}% CWEB style 84 | +\def\hex{\hbox{$^{\scriptscriptstyle\#}$}\Hd} % CWEB style 85 | +\def\bin{\hbox{$^{\scriptscriptstyle b}$}\Bd} 86 | +\def\Od#1/{{\it#1}} % octal digit 87 | +\def\Hd#1/{{\tt#1}} % hexadecimal digit 88 | +\def\Bd#1/{{\tt#1}} % binary digit 89 | \def\vb#1{\leavevmode\hbox{\kern2pt\vrule\vtop{\vbox{\hrule 90 | \hbox{\strut\kern2pt\.{#1}\kern2pt}} 91 | \hrule}\vrule\kern2pt}} % verbatim string 92 | -- 93 | 2.47.1 94 | 95 | -------------------------------------------------------------------------------- /examples/README.p11: -------------------------------------------------------------------------------- 1 | This directory contains several files for programs that are tutorial 2 | and/or useful. If you are new to CWEB, read "wc.w" first; it's a 3 | typical example of CWEB applied to system programming. 4 | 5 | The MAKEFILE in this directory is a complete example makefile for the 6 | SAS/C compiler on the Commodore Amiga. Say, for example, "smake all" 7 | to get all the executable programs from their sources. Say "smake docs" 8 | to get a printable listing of their documentations. 9 | 10 | The WC program is a slight improvement over UNIX's standard word-count 11 | utility. To use it, say "make wc" to get an executable program "wc" 12 | from wc.w. Say "make wc.dvi" to get a printable listing of its documentation. 13 | 14 | The TREEPRINT program, by Norman Ramsey, generates tree-structured 15 | representations of file hierarchies. To use it, say "make treeprint" 16 | and then 17 | find dir -type p -print | sort | treeprint 18 | (on a UNIX system), where dir is a directory with interesting subdirectories. 19 | 20 | The files XVIEW_TYPES.W and XLIB_TYPES.W are examples of @i (include) files 21 | that can be used when writing XView programs. They are based on the header 22 | files in OpenWindows Version 3.0. 23 | 24 | An examples XVIEW application appears in Knuth's program OEMACS.W, which 25 | he uses for heavy emacsing. It's not very portable, but if you have 26 | OpenWindows3 and a Sun Type-4 keyboard you may like it as much as he does. 27 | (It replaces "emacstool".) The file OEMACS.EL goes with it. 28 | 29 | The EXTEX and WORDTEST programs, by Don Knuth, are useful spellcheckers. 30 | After "make extex" say also "ln extex excweb"; this gives 31 | you two filter programs, extex and excweb, that remove extraneous 32 | material from TeX and CWEB source files, respectively. To use them, 33 | you can say for example 34 | cat foo.w | excweb | spell 35 | (or replace "cat foo.w" with "wmerge foo.w bar.ch"). A similar pipeline 36 | for TeX files would be 37 | cat foo.tex | extex | spell 38 | Even better is to replace "spell" by "wordtest /usr/local/lib/dict/words", 39 | if you have a suitable dictionary. One such dictionary in the public domain 40 | can be found in directory ~ftp/pub/dict at labrea.stanford.edu, available 41 | via anonymous ftp. To make your own dictionary from given ones, 42 | cat dict1 dict2 dict3 dict4 | wordtest > words 43 | is quick and effective. See the documentation of wordtest for more info. 44 | 45 | A file KSPELL.EL that provides an emacs user interface to extex+excweb+wordtest 46 | also appears in this directory. (Somebody should write ELWEB...) 47 | 48 | All the CWEB example programs listed above are provided with change files 49 | for full ANSI-C compliance (prototypes, #include files, etc.), so they 50 | should be compilable with any decent C compiler, although they may not be 51 | operational on every machine. 52 | 53 | The COMMONWORDS program, by Andreas Scherer, is based on the WEB program of 54 | the same name by Don Knuth. It counts the frequencies of the most common 55 | words in a given text file. To use it, say "make commonwords" and then 56 | "commonwords < commonwords.w". 57 | 58 | The PRIMES program, by Andreas Scherer, is based on the WEB program of the 59 | same name by Don Knuth. It generates the first thousand prime numbers. 60 | To use it, say "make primes" and then simply "primes". 61 | 62 | The SAMPLE program, by Andreas Scherer, is based on the WEB program of the 63 | same name by Don Knuth. It generates samples of random numbers. To use 64 | it, say "make sample" and then simply "sample". Answer the input questions 65 | with positive integers and see the results. 66 | 67 | The MATRIX program, by Andreas Scherer, is an example for C++ programming 68 | with CWEB 3. Also it is an example for German users; the complete source 69 | is written with umlauts and quotes as defined in `gcwebmac.tex'. Its 70 | purpose is to invert 4x4 matrices with elements from the complex set. 71 | 72 | The CCT program, by Andreas Scherer, copies `text files' between different 73 | systems and translates the character codes according to external tables. 74 | It is also capable of transforming a file with extended ASCII characters 75 | into a portable 7-bit representation, by replacing most of the codes higher 76 | than 127 by suitable TeX macros. In the same source file CCT.W is a second 77 | program, CCTSETUP, which generates external transformation files needed by 78 | CCT itself. 79 | -------------------------------------------------------------------------------- /vault/cweav-borlandc.ch: -------------------------------------------------------------------------------- 1 | Changes for CWEAVE.W by Andreas Scherer, December 4, 2018. 2 | 3 | This set of changes provides support for installing CWEB on MS/DOS systems 4 | with Borland C++ 3.1. Arrays larger than 64 KB are allocated with a 5 | system-dependent routine `farcalloc'. For this, several pointer variables 6 | have to be declared as `huge'. Care has been taken to avoid conflicts with 7 | other operating systems which are not restricted to the limitations of DOS. 8 | (DOS isn't restricted to the 64 KB limit either, or else this full sized 9 | patch would not be possible. But instead of `farcalloc' a `non-ANSI' sized 10 | `malloc' would be much more convenient.) For other MS/DOS compilers than 11 | Borland C++ 3.1 you'll have to replace this file by other changes. 12 | 13 | This change file requires CWEAV-PATCH.CH, CWEAV-ANSI.CH, CWEAV-EXTENSIONS.CH, 14 | CWEAV-OUTPUT.CH, CWEAV-MEMORY.CH, CWEAV-TRANSLATIONS.CH to be applied as well. 15 | 16 | For a complete history of the changes made to CWEAVE.W see CWEAV-PATCH.CH. 17 | 18 | @x l.223 19 | typedef struct xref_info { 20 | sixteen_bits num; /* section number plus zero or |def_flag| */ 21 | struct xref_info *xlink; /* pointer to the previous cross-reference */ 22 | } xref_info; 23 | typedef xref_info *xref_pointer; 24 | @y 25 | typedef struct xref_info { 26 | sixteen_bits num; /* section number plus zero or |def_flag| */ 27 | struct xref_info HUGE *xlink; /* pointer to the previous cross-reference */ 28 | } xref_info; 29 | typedef xref_info HUGE *xref_pointer; 30 | @z 31 | 32 | @x l.26 of CWEAV-MEMORY.CH 33 | alloc_object(xmem,max_refs,xref_info); 34 | @y 35 | #ifdef __TURBOC__ 36 | xmem=(xref_pointer)allocsafe(max_refs,sizeof(*xmem)); 37 | #else 38 | alloc_object(xmem,max_refs,xref_info); 39 | #endif 40 | @z 41 | 42 | @x l.334 43 | typedef token *token_pointer; 44 | typedef token_pointer *text_pointer; 45 | @y 46 | typedef token HUGE *token_pointer; 47 | typedef token_pointer HUGE *text_pointer; 48 | @z 49 | 50 | @x l.51 of CWEAV-MEMORY.CH 51 | alloc_object(tok_mem,max_toks,token); 52 | @y 53 | #ifdef __TURBOC__ 54 | tok_mem=(token_pointer)allocsafe(max_toks,sizeof(*tok_mem)); 55 | #else 56 | alloc_object(tok_mem,max_toks,token); 57 | #endif 58 | @^system dependencies@> 59 | @z 60 | 61 | @x l.134 of CWEAV-ANSI.CH 62 | p->xref=(void *)xmem; 63 | @y 64 | p->xref=(void HUGE*)xmem; 65 | @z 66 | 67 | @x l.239 of CWEAV-ANSI.CH 68 | else lhs->xref=(void *)q->xlink; 69 | @y 70 | else lhs->xref=(void HUGE*)q->xlink; 71 | @z 72 | 73 | @x l.1419 74 | char *k, *k_end=(p+1)->byte_start; /* pointers into |byte_mem| */ 75 | @y 76 | char HUGE *k; 77 | char HUGE *k_end=(p+1)->byte_start; /* pointers into |byte_mem| */ 78 | @z 79 | 80 | @x l.3554 81 | char *k, *k_limit; /* indices into |scratch| */ 82 | @y 83 | char HUGE *k; 84 | char HUGE *k_limit; /* indices into |scratch| */ 85 | @z 86 | 87 | We need a huge pointer here instead of j; k seems a good choice, since it is 88 | declared as index into byte_mem anyhow. 89 | 90 | @x l.3600 91 | for (p=cur_name->byte_start;p<(cur_name+1)->byte_start;p++) 92 | out(*p=='_'? 'x': *p=='$'? 'X': *p); 93 | @y 94 | #ifdef __TURBOC__ 95 | for (k=cur_name->byte_start;k<(cur_name+1)->byte_start;k++) 96 | out(*k=='_'? 'x': *k=='$'? 'X': *k); 97 | #else 98 | for (p=cur_name->byte_start;p<(cur_name+1)->byte_start;p++) 99 | out(*p=='_'? 'x': *p=='$'? 'X': *p); 100 | #endif 101 | @^system dependencies@> 102 | @z 103 | 104 | @x l.3606 105 | for (p=cur_name->byte_start;p<(cur_name+1)->byte_start;p++) 106 | if (xislower(*p)) { /* not entirely uppercase */ 107 | @y 108 | #ifdef __TURBOC__ 109 | for (k=cur_name->byte_start;k<(cur_name+1)->byte_start;k++) 110 | if (xislower(*k)) { /* not entirely uppercase */ 111 | #else 112 | for (p=cur_name->byte_start;p<(cur_name+1)->byte_start;p++) 113 | if (xislower(*p)) { /* not entirely uppercase */ 114 | #endif 115 | @^system dependencies@> 116 | @z 117 | 118 | @x l.606 of CWEAV-ANSI.CH 119 | if (cur_name->xref!=(void *)xmem) { 120 | @y 121 | if (cur_name->xref!=(void HUGE*)xmem) { 122 | @z 123 | 124 | @x l.4268 125 | char *cur_byte; /* index into |byte_mem| */ 126 | @y 127 | char HUGE *cur_byte; /* index into |byte_mem| */ 128 | @z 129 | 130 | @x l.4387 131 | else {char *j; 132 | @y 133 | else {char HUGE *j; 134 | @z 135 | 136 | @x l.4550 137 | case custom: {char *j; out_str("$\\"); 138 | @y 139 | case custom: {char HUGE *j; out_str("$\\"); 140 | @z 141 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # literate programming in ansi-c/c++ 2 | 3 | *cwebbin* is an extension of silvio levy's and donald e. knuth's 4 | [cweb system](http://www-cs-faculty.stanford.edu/~uno/cweb.html) 5 | and donald e. knuth's [ctwill program](http://ftp.cs.stanford.edu/pub/ctwill). 6 | it requires the contents of [the original *cweb* source 7 | drop](https://github.com/ascherer/cweb/releases/download/cweb-4.12.2/cweb-4.12.2.tar.gz) 8 | and [the secondary *ctwill* source 9 | drop](http://ftp.cs.stanford.edu/pub/ctwill/ctwill.tar.gz), to which it applies 10 | a set of change files to introduce advanced features. see the extensive 11 | [readme](README.txt) for the full story. 12 | 13 | ## feature list 14 | 15 | * includes **ctwill** and its utilities; 16 | * **internationalization** with the “GNU `gettext` utilities”; 17 | * **temporary file output**: check output for differences from former run with 18 | new option `+c`; 19 | * [only `cweave` and `ctwill`] option `-l` to change the first line in the tex 20 | output; options `-i` and `-o` for slightly customizable code layout; 21 | * [only `ctangle`] output can be redirected to `@(/dev/{stdout,stderr,null}@>`; 22 | * [only in “tex live”] file lookup with the **kpathsea** library. 23 | 24 | ## manual compilation 25 | 26 | extract `ctwill.tar.gz` and add the contents of `cweb-4.12.2.tar.gz` (overwriting 27 | outdated source files `Makefile`, `common.h`, `common.w`, and `prod.w`) and 28 | `cwebbin-2025.1.tar.gz` for the full set of source files. 29 | replace `@@VERSION@@` in line 129 of the `Makefile.unix` with something like 30 | `Version 4.12.2 [CWEBbin 2025.1]`. 31 | `touch *.cxx`. 32 | unix/linux users should work with [`make -f Makefile.unix`](Makefile.unix) 33 | exclusively (targets `boot`, `cautiously`, and `all`). 34 | macos/bsd users will have to adapt `Makefile.unix` in several spots to make 35 | things work. 36 | 37 | ## advanced packaging 38 | 39 | alternatively, you may want to use 40 | [rpmbuild](https://github.com/rpm-software-management/rpm) or 41 | [debbuild](https://github.com/debbuild/debbuild) for compiling the sources and 42 | for creating installable packages in *rpm* and *deb* format. 43 | set up your *build arena* with `mkdir BUILD BUILDROOT RPMS SOURCES SPECS SRPMS` 44 | for *rpmbuild* (plus `mkdir DEBS SDEBS` for *debbuild*). 45 | 46 | clone 47 | [cweb](https://github.com/ascherer/cweb) and 48 | [cwebbin](https://github.com/ascherer/cwebbin), create the source drops with 49 | ``` 50 | git archive -o cweb-4.12.2.tar.gz cweb-4.12.2 51 | git archive -o cwebbin-2025.1.tar.gz cwebbin-2025.1 52 | ``` 53 | respectively, put these two tarballs and the original `ctwill.tar.gz` in the 54 | *SOURCES* directory, add the patch files 55 | * `0001-Support-extended-syntax-for-numeric-literals.patch` 56 | * `0002-Purge-redundant-TeX-macro.patch` 57 | * `0003-Adapt-to-CWEB-4.5.patch` 58 | * `0004-Add-silent-datecontentspage-macro.patch` 59 | * `0005-Update-CTWILL-macros-for-CWEB-4.9.patch` 60 | 61 | to *SOURCES* also, and place `cwebbin.spec` in the *SPECS* directory of your 62 | build arena. 63 | 64 | the five patch files upgrade the *ctwill* macros for modern cweb. originally, 65 | they come from branch 66 | [update-macros-for-cweb-4](https://github.com/ascherer/ctwill/tree/update-macros-for-cweb-4) 67 | and can be recreated by `git format-patch master` in the archived 68 | [ctwill project](https://github.com/ascherer/ctwill). 69 | 70 | depending on your preferences run the magic incantation 71 | ``` 72 | {deb|rpm}build -ba SPECS/cwebbin.spec 73 | ``` 74 | 75 | ## cweb for texlive 76 | 77 | the extended sources and the build system were modified to smoothly integrate 78 | with the [texlive build system](https://github.com/TeX-Live/texlive-source). 79 | by invoking 80 | ``` 81 | {deb|rpm}build -bi SPECS/cwebbin.spec --with texlive 82 | ``` 83 | you receive a small tarball `cweb-texlive.tar.gz`, which should be extracted in 84 | texlive's source directory 85 | [`texlive-source`](https://github.com/TeX-Live/texlive-source) (or the 86 | [subversion equivalent](https://tug.org/svn/texlive/trunk/Build/source)) with 87 | ``` 88 | cd /path/to/texlive-source 89 | pax -rzf /path/to/cweb-texlive.tar.gz 90 | ``` 91 | 92 | this tarball contains `*-w2c.ch` files that modify the original cweb sources 93 | for the texlive ecosystem. additionally, it contains language catalogs, tex 94 | macros, and cweb include files. 95 | 96 | updated versions of **cweb** are added to the texlive source tree with 97 | ``` 98 | cd /path/to/texlive-source/texk/web2c/cwebdir 99 | pax -rzf /path/to/cweb-4.12.2.tar.gz 100 | ``` 101 | -------------------------------------------------------------------------------- /examples/Makefile.sas: -------------------------------------------------------------------------------- 1 | # 2 | # Makefile for the example programs EXTEX, OEMACS, TREEPRINT, WC and 3 | # WORDTEST from the original CWEB package. 4 | # Additionally there are the three example programs COMMONWORDS, PRIMES, 5 | # and SAMPLE. These are originally WEB programs by Donald E. Knuth and 6 | # were translated into CWEB for eductational purposes. 7 | # And there is the example program MATRIX. This is the first attempt of 8 | # C++ programming in connection with the features of CWEB 3 for German 9 | # users. The program CCT translates text files between different 10 | # character code tables. 11 | # The routines below are suitable for the SAS/C Amiga compiler 6.x by 12 | # SAS Institute Inc., Cary NC. 13 | # 14 | # March 16, 1995, Andreas Scherer. 15 | # 16 | 17 | CFLAGS = cpu=ANY math=STANDARD optimize nostackcheck define=_STRICT_ANSI 18 | 19 | .SUFFIXES: .tex .dvi .w 20 | 21 | .w.tex: 22 | cweave -f $* 23 | .tex.dvi: 24 | virtex &plain "\\language=\\USenglish \\input " $* 25 | .w.c: 26 | ctangle $* 27 | .c.o: 28 | sc $(CFLAGS) $*.c 29 | 30 | PRG = cct cctsetup commonwords extex matrix primes bigprimes \ 31 | sample treeprint wc wordtest 32 | 33 | all: $(PRG) 34 | 35 | docs: cct.dvi commonwords.dvi extex.dvi oemacs.dvi primes.dvi bigprimes.dvi\ 36 | sample.dvi treeprint.dvi wc.dvi wordtest.dvi 37 | 38 | cct: cct.o 39 | slink FROM lib:c.o cct.o TO cct LIB lib:sc.lib NOICONS 40 | cct.o: cct.c 41 | cct.c: cct.w 42 | cct.dvi: cct.tex 43 | cct.tex: cct.w 44 | 45 | cctsetup: cctsetup.o 46 | slink FROM lib:c.o cctsetup.o TO cctsetup LIB lib:sc.lib NOICONS 47 | cctsetup.o: cct.c 48 | sc $(CFLAGS) cctsetup.c 49 | 50 | commonwords: commonwords.o 51 | slink FROM lib:c.o commonwords.o TO commonwords LIB lib:sc.lib NOICONS 52 | commonwords.o: commonwords.c 53 | sc $(CFLAGS) data=FAR commonwords.c 54 | commonwords.c: commonwords.w 55 | commonwords.dvi: commonwords.tex 56 | commonwords.tex: commonwords.w 57 | 58 | extex: extex.o 59 | slink FROM lib:c.o extex.o TO extex LIB lib:sc.lib NOICONS 60 | extex.o: extex.c 61 | extex.c: extex.w extex-ansi.ch 62 | ctangle extex.w extex-ansi.ch 63 | extex.dvi: extex.tex 64 | extex.tex: extex.w extex-ansi.ch 65 | cweave -f extex.w extex-ansi.ch 66 | 67 | matrix: matrix.o 68 | slink FROM lib:c.o matrix.o TO matrix LIB lib:scm.lib lib:sc.lib NOICONS 69 | matrix.o: matrix.cxx 70 | matrix.cxx: matrix.wxx 71 | ctangle matrix.wxx - matrix.cxx 72 | matrix.dvi: matrix.tex 73 | matrix.tex: matrix.wxx 74 | cweave -f +ld matrix.wxx 75 | 76 | oemacs: oemacs.o 77 | slink FROM lib:c.o oemacs.o TO oemacs LIB lib:sc.lib NOICONS 78 | oemacs.o: oemacs.c 79 | oemacs.c: oemacs.w 80 | oemacs.dvi: oemacs.tex 81 | oemacs.tex: oemacs.w 82 | 83 | primes: primes.o 84 | slink FROM lib:c.o primes.o TO primes LIB lib:sc.lib NOICONS 85 | primes.o: primes.c 86 | primes.c: primes.w 87 | primes.dvi: primes.tex 88 | primes.tex: primes.w 89 | 90 | bigprimes: bigprimes.o 91 | slink FROM lib:c.o bigprimes.o TO bigprimes LIB lib:sc.lib NOICONS 92 | bigprimes.o: bigprimes.c 93 | bigprimes.c: primes.w primes-ansi.ch 94 | ctangle primes primes bigprimes 95 | bigprimes.dvi: bigprimes.tex 96 | bigprimes.tex: primes.w primes-ansi.ch 97 | cweave -f primes primes bigprimes 98 | 99 | primereader: bigprimes bigprimes.c 100 | sc link noicons optimize primereader.c 101 | 102 | sample: sample.o 103 | slink FROM lib:c.o sample.o TO sample LIB lib:sc.lib lib:scm.lib NOICONS 104 | sample.o: sample.c 105 | sample.c: sample.w 106 | sample.dvi: sample.tex 107 | sample.tex: sample.w 108 | 109 | treeprint: treeprint.o 110 | slink FROM lib:c.o treeprint.o TO treeprint LIB lib:sc.lib NOICONS 111 | treeprint.o: treeprint.c 112 | treeprint.c: treeprint.w treeprint-ansi.ch 113 | ctangle treeprint.w treeprint-ansi.ch 114 | treeprint.dvi: treeprint.tex 115 | treeprint.tex: treeprint.w treeprint-ansi.ch 116 | cweave -f treeprint.w treeprint-ansi.ch 117 | 118 | wc: wc.o 119 | slink FROM lib:c.o wc.o TO wc LIB lib:sc.lib NOICONS 120 | wc.o: wc.c 121 | wc.c: wc.w wc-ansi.ch 122 | ctangle wc.w wc-ansi.ch 123 | wc.dvi: wc.tex 124 | wc.tex: wc.w wc-ansi.ch 125 | cweave -f wc.w wc-ansi.ch 126 | 127 | wordtest: wordtest.o 128 | slink FROM lib:c.o wordtest.o TO wordtest LIB lib:sc.lib NOICONS 129 | wordtest.o: wordtest.c 130 | wordtest.c: wordtest.w wordtest-ansi.ch 131 | ctangle wordtest.w wordtest-ansi.ch 132 | wordtest.dvi: wordtest.tex 133 | wordtest.tex: wordtest.w wordtest-ansi.ch 134 | cweave -f wordtest.w wordtest-ansi.ch 135 | 136 | clean: 137 | - delete \#?.(o|lnk|bak|dvi|tex|toc|log|c|cxx|idx|scn) 138 | 139 | veryclean: clean 140 | - delete $(PRG) primereader \#?.(cct|out) 141 | -------------------------------------------------------------------------------- /vault/ctang-memory.ch: -------------------------------------------------------------------------------- 1 | Changes for CTANGLE.W by Andreas Scherer, May 9, 1995. 2 | 3 | This set of changes provides dynamic memory allocation for the internal 4 | fields of the CWEB system. There is no external memory configuration file 5 | as for TeX (yet), but there's already the advantage that the CWEB programs 6 | can be compiled in the `NEAR' data section and be made `resident'. 7 | 8 | This change file requires CTANG-PATCH.CH, CTANG-ANSI.CH, 9 | CTANG-EXTENSIONS.CH to be applied as well. 10 | 11 | For a complete history of the changes made to CTANGLE.W see CTANG-PATCH.CH. 12 | 13 | @x l.95 14 | @; 15 | common_init(); 16 | @y 17 | common_init(); 18 | @; 19 | @z 20 | 21 | @x l.157 22 | text text_info[max_texts]; 23 | text_pointer text_info_end=text_info+max_texts-1; 24 | @y 25 | text_pointer text_info; 26 | text_pointer text_info_end; 27 | @z 28 | 29 | @x l.160 30 | eight_bits tok_mem[max_toks]; 31 | eight_bits *tok_mem_end=tok_mem+max_toks-1; 32 | @y 33 | eight_bits *tok_mem; 34 | eight_bits *tok_mem_end; 35 | @z 36 | 37 | @x l.165 38 | text_info->tok_start=tok_ptr=tok_mem; 39 | @y 40 | alloc_object(section_text,longest_name+1,char); 41 | section_text_end = section_text + longest_name; 42 | alloc_object(text_info,max_texts,text); 43 | text_info_end = text_info + max_texts - 1; 44 | alloc_object(tok_mem,max_toks,eight_bits); 45 | tok_mem_end = tok_mem + max_toks - 1; 46 | text_info->tok_start=tok_ptr=tok_mem; 47 | alloc_object(stack,stack_size+1,output_state); 48 | stack_end = stack + stack_size; 49 | @z 50 | 51 | @x l.312 52 | output_state stack[stack_size+1]; /* info for non-current levels */ 53 | stack_pointer stack_ptr; /* first unused location in the output state stack */ 54 | stack_pointer stack_end=stack+stack_size; /* end of |stack| */ 55 | @y 56 | stack_pointer stack; /* info for non-current levels */ 57 | stack_pointer stack_end; /* end of |stack| */ 58 | stack_pointer stack_ptr; /* first unused location in the output state stack */ 59 | @z 60 | 61 | @x l.500 62 | name_pointer output_files[max_files]; 63 | name_pointer *cur_out_file, *end_output_files, *an_output_file; 64 | char cur_section_name_char; /* is it |'<'| or |'('| */ 65 | char output_file_name[longest_name]; /* name of the file */ 66 | 67 | @ We make |end_output_files| point just beyond the end of 68 | |output_files|. The stack pointer 69 | |cur_out_file| starts out there. Every time we see a new file, we 70 | decrement |cur_out_file| and then write it in. 71 | @= 72 | cur_out_file=end_output_files=output_files+max_files; 73 | @y 74 | name_pointer *output_files; 75 | name_pointer *cur_out_file, *end_output_files, *an_output_file; 76 | char cur_section_name_char; /* is it |'<'| or |'('| */ 77 | char *output_file_name; /* name of the file */ 78 | 79 | @ We make |end_output_files| point just beyond the end of 80 | |output_files|. The stack pointer 81 | |cur_out_file| starts out there. Every time we see a new file, we 82 | decrement |cur_out_file| and then write it in. 83 | 84 | @= 85 | alloc_object(output_files,max_files,name_pointer); 86 | alloc_object(output_file_name,longest_name,char); 87 | cur_out_file=end_output_files=output_files+max_files; 88 | @z 89 | 90 | @x l.707 91 | char translit[128][translit_length]; 92 | 93 | @ @= 94 | { 95 | int i; 96 | for (i=0;i<128;i++) sprintf(translit[i],"X%02X",(unsigned)(128+i)); 97 | } 98 | @y 99 | char **translit; 100 | 101 | @ @= 102 | { 103 | int i; 104 | alloc_object(translit,128,char *); 105 | for(i=0; i<128; i++) 106 | alloc_object(translit[i],translit_length,char); 107 | for (i=0;i<128;i++) 108 | sprintf(translit[i],"X%02X",(unsigned)(128+i)); 109 | } 110 | @z 111 | 112 | @x l.783 113 | eight_bits ccode[256]; /* meaning of a char following \.{@@} */ 114 | 115 | @ @= { 116 | int c; /* must be |int| so the |for| loop will end */ 117 | @y 118 | eight_bits *ccode; /* meaning of a char following \.{@@} */ 119 | 120 | @ @= { 121 | int c; /* must be |int| so the |for| loop will end */ 122 | alloc_object(ccode,256,eight_bits); 123 | @z 124 | 125 | @x l.1546 126 | @** Index. 127 | @y 128 | @* Version information. The {\mc AMIGA} operating system provides the 129 | `\.{version}' command and good programs answer with some informations about 130 | their creation date and their current version. This might be useful for 131 | other operating systems as well. 132 | 133 | @= 134 | const char Version[] = "$VER: CTANGLE @VERSION@ ("@| 135 | __DATE__@= @>", "@= @>__TIME__@= @>")\n"; 136 | 137 | @** Index. 138 | @z 139 | -------------------------------------------------------------------------------- /po/web2c-help.pot: -------------------------------------------------------------------------------- 1 | # International version of CWEB (CWEBbin, TeXLive). 2 | # Copyright (C) 2021 Andreas Scherer et al. 3 | # This file is distributed under the same license as the CWEB package. 4 | # Andreas Scherer , 2021. 5 | # 6 | #, fuzzy 7 | msgid "" 8 | msgstr "" 9 | "Project-Id-Version: CWEBbin 2025\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2025-04-30 10:05+0200\n" 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 13 | "Last-Translator: FULL NAME \n" 14 | "Language-Team: LANGUAGE \n" 15 | "Language: \n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | 20 | #: help.h:52 21 | msgid "" 22 | "Usage: ctangle [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.c]]]" 23 | msgstr "" 24 | 25 | #: help.h:53 26 | msgid " Tangle WEBFILE with CHANGEFILE into a C/C++ program." 27 | msgstr "" 28 | 29 | #: help.h:54 help.h:77 help.h:106 30 | msgid " Default CHANGEFILE is /dev/null;" 31 | msgstr "" 32 | 33 | #: help.h:55 34 | msgid " C output goes to the basename of WEBFILE extended with `.c'" 35 | msgstr "" 36 | 37 | #: help.h:56 help.h:79 help.h:108 38 | msgid " unless otherwise specified by OUTFILE; in this case, '-' specifies" 39 | msgstr "" 40 | 41 | #: help.h:57 help.h:80 help.h:109 42 | msgid " a null CHANGEFILE." 43 | msgstr "" 44 | 45 | #: help.h:59 help.h:82 help.h:111 46 | msgid "+b print banner line on terminal" 47 | msgstr "" 48 | 49 | #: help.h:60 help.h:83 help.h:112 50 | msgid "+h print success message on completion" 51 | msgstr "" 52 | 53 | #: help.h:61 help.h:84 help.h:113 54 | msgid "+p print progress report messages" 55 | msgstr "" 56 | 57 | #: help.h:62 help.h:85 help.h:114 58 | msgid "+/-q shortcut for '-bhp'; also '--quiet'" 59 | msgstr "" 60 | 61 | #: help.h:63 help.h:86 help.h:115 62 | msgid "+/-v shortcut for '+bhp'; also '--verbose' (default)" 63 | msgstr "" 64 | 65 | #: help.h:64 help.h:87 help.h:116 66 | msgid "+c check temporary output for changes" 67 | msgstr "" 68 | 69 | #: help.h:65 help.h:88 help.h:117 70 | msgid "-dN set 'kpathsea_debug' to N (0..127)" 71 | msgstr "" 72 | 73 | #: help.h:66 74 | msgid "+k keep separators in numeric literals in the output" 75 | msgstr "" 76 | 77 | #: help.h:67 help.h:96 help.h:126 78 | msgid "+s print usage statistics" 79 | msgstr "" 80 | 81 | #: help.h:68 82 | msgid "+u transliterate UTF-8 characters in C code" 83 | msgstr "" 84 | 85 | #: help.h:69 help.h:98 help.h:128 86 | msgid "--help display this help and exit" 87 | msgstr "" 88 | 89 | #: help.h:70 help.h:99 help.h:129 90 | msgid "--version output version information and exit" 91 | msgstr "" 92 | 93 | #: help.h:75 94 | msgid "" 95 | "Usage: cweave [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]" 96 | msgstr "" 97 | 98 | #: help.h:76 help.h:638 99 | msgid " Weave WEBFILE with CHANGEFILE into a TeX document." 100 | msgstr "" 101 | 102 | #: help.h:78 help.h:107 103 | msgid " TeX output goes to the basename of WEBFILE extended with `.tex'" 104 | msgstr "" 105 | 106 | #: help.h:89 help.h:118 107 | msgid "-e do not enclose C material in \\PB{...}" 108 | msgstr "" 109 | 110 | #: help.h:90 help.h:119 111 | msgid "-f do not force a newline after every C statement in output" 112 | msgstr "" 113 | 114 | #: help.h:91 help.h:120 115 | msgid "-F do not force a compound statement to start on a new line" 116 | msgstr "" 117 | 118 | #: help.h:92 help.h:121 119 | msgid "-i suppress indentation of parameter declarations" 120 | msgstr "" 121 | 122 | #: help.h:93 help.h:122 123 | msgid "-o suppress separation of declarations and statements" 124 | msgstr "" 125 | 126 | #: help.h:94 help.h:123 127 | msgid "-x omit indices, section names, table of contents" 128 | msgstr "" 129 | 130 | #: help.h:95 131 | msgid "+lX use macros for language X as of Xcwebmac.tex" 132 | msgstr "" 133 | 134 | #: help.h:97 help.h:127 135 | msgid "+t treat 'typename' in a template like 'typedef'" 136 | msgstr "" 137 | 138 | #: help.h:104 139 | msgid "" 140 | "Usage: ctwill [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]" 141 | msgstr "" 142 | 143 | #: help.h:105 help.h:655 144 | msgid " Weave WEBFILE with CHANGEFILE into a TeX document with mini-indexes." 145 | msgstr "" 146 | 147 | #: help.h:124 148 | msgid "+P \\input ctproofmac.tex instead of ctwimac.tex" 149 | msgstr "" 150 | 151 | #: help.h:125 152 | msgid "+/-lX use macros for language X as of Xct{wi|proof}mac.tex" 153 | msgstr "" 154 | -------------------------------------------------------------------------------- /comm-output.ch: -------------------------------------------------------------------------------- 1 | Changes for COMMON.W by Andreas Scherer, October 2021. 2 | 3 | This set of changes modifies the output behaviour of the CWEB system. 4 | Instead of writing directly to the C or TeX file as described in the 5 | manual, the current run is documented in a temporary output file which 6 | is copied to the expected file in the last moment. In case of an user 7 | abort, previous results are not destroyed. This feature is activated 8 | with commandline option '+c'. 9 | 10 | This change file requires COMM-PATCH.CH and COMM-EXTENSIONS.CH to be 11 | applied as well. 12 | 13 | For a complete history of the changes made to COMMON.W see COMM-PATCH.CH. 14 | 15 | Section 68. 16 | 17 | @x l.1068 18 | @@; 19 | @y 20 | @@; 21 | @@; 22 | @z 23 | 24 | Section 73. 25 | 26 | @x l.1130 27 | char scn_file_name[max_file_name_length]; /* name of |scn_file| */ 28 | @y 29 | char scn_file_name[max_file_name_length]; /* name of |scn_file| */ 30 | char check_file_name[max_file_name_length]; /* name of |check_file| */ 31 | @z 32 | 33 | Section 83. 34 | 35 | @x l.1272 36 | FILE *active_file; /* currently active file for \.{CWEAVE} output */ 37 | @y 38 | FILE *active_file; /* currently active file for \.{CWEAVE} output */ 39 | FILE *check_file; /* temporary output file */ 40 | @z 41 | 42 | Section 84. 43 | 44 | @x l.1274 45 | @ @= 46 | scan_args(); 47 | if (program==ctangle) { 48 | if ((C_file=fopen(C_file_name,"wb"))==NULL) 49 | fatal("! Cannot open output file ", C_file_name); 50 | @.Cannot open output file@> 51 | } 52 | else { 53 | if ((tex_file=fopen(tex_file_name,"wb"))==NULL) 54 | fatal("! Cannot open output file ", tex_file_name); 55 | } 56 | @y 57 | @ @= 58 | scan_args(); 59 | if (program==ctangle) { 60 | if (check_for_change) @@; 61 | else if ((C_file=fopen(C_file_name,"wb"))==NULL) 62 | fatal("! Cannot open output file ", C_file_name); 63 | @.Cannot open output file@> 64 | } 65 | else { 66 | if (check_for_change) @@; 67 | else if ((tex_file=fopen(tex_file_name,"wb"))==NULL) 68 | fatal("! Cannot open output file ", tex_file_name); 69 | } 70 | @z 71 | 72 | New material after section 85. 73 | 74 | @x l.1286 75 | @* Index. 76 | @y 77 | @*1 Temporary file output. Most \CEE/ projects are controlled by a \.{Makefile} 78 | that automatically takes care of the temporal dependencies between the different 79 | source modules. It may be convenient that \.{CWEB} doesn't create new output 80 | for all existing files, when there are only changes to some of them. Thus the 81 | \.{make} process will only recompile those modules where necessary. You can 82 | activate this feature with the `\.{+c}' command-line option. The idea and basic 83 | implementation of this mechanism can be found in the program \.{NUWEB} by 84 | Preston Briggs, to whom credit is due. 85 | 86 | @= { 87 | if ((C_file=fopen(C_file_name,"a"))==NULL) 88 | fatal("! Cannot open output file ", C_file_name); 89 | @.Cannot open output file@> 90 | else fclose(C_file); /* Test accessability */ 91 | strcpy(check_file_name,C_file_name); 92 | if(check_file_name[0]!='\0') { 93 | char *dot_pos=strrchr(check_file_name,'.'); 94 | if(dot_pos==NULL) strcat(check_file_name,".ttp"); 95 | else strcpy(dot_pos,".ttp"); 96 | } 97 | if ((C_file=fopen(check_file_name,"wb"))==NULL) 98 | fatal("! Cannot open output file ", check_file_name); 99 | } 100 | 101 | @ @= { 102 | if ((tex_file=fopen(tex_file_name,"a"))==NULL) 103 | fatal("! Cannot open output file ", tex_file_name); 104 | @.Cannot open output file@> 105 | else fclose(tex_file); /* Test accessability */ 106 | strcpy(check_file_name,tex_file_name); 107 | if(check_file_name[0]!='\0') { 108 | char *dot_pos=strrchr(check_file_name,'.'); 109 | if(dot_pos==NULL) strcat(check_file_name,".wtp"); 110 | else strcpy(dot_pos,".wtp"); 111 | } 112 | if ((tex_file=fopen(check_file_name,"wb"))==NULL) 113 | fatal("! Cannot open output file ", check_file_name); 114 | } 115 | 116 | @ Before we leave the program we have to make 117 | sure that the output files are correctly written. 118 | 119 | @= 120 | if(C_file) fclose(C_file); 121 | if(tex_file) fclose(tex_file); 122 | if(check_file) fclose(check_file); 123 | if(strlen(check_file_name)) /* Delete the temporary file in case of a break */ 124 | remove(check_file_name); 125 | 126 | @* Index. 127 | @z 128 | -------------------------------------------------------------------------------- /examples/wmerg-ansi.ch: -------------------------------------------------------------------------------- 1 | Changes for WMERGE.W by Andreas Scherer, November 6, 2018. 2 | 3 | This set of changes converts the WMERGE.W module into ANSI-C and C++ code. 4 | All functions are both declared and defined in prototypical form, while 5 | several functions are declared `static' instead of `extern'. Additional 6 | casts are introduced. 7 | 8 | This change file requires that WMERG-PATCH.CH is applied as well. 9 | 10 | For a complete history of the changes made to WMERGE.W see WMERG-PATCH.CH. 11 | 12 | @x l.3 13 | \def\9#1{} % this hack is explained in CWEB manual Appendix F11 14 | @y 15 | \def\9#1{} % this hack is explained in CWEB manual Appendix F11 16 | 17 | @i iso_types.w 18 | @z 19 | 20 | @x l.16 21 | #include 22 | @y 23 | #include 24 | #include 25 | #include 26 | #include 27 | @z 28 | 29 | @x l.22 30 | main (ac,av) 31 | int ac; char **av; 32 | @y 33 | int main ( 34 | int ac, char **av) 35 | @z 36 | 37 | @x l.38 38 | typedef short boolean; 39 | typedef unsigned char eight_bits; 40 | @y 41 | typedef bool boolean; 42 | typedef uint8_t eight_bits; 43 | @z 44 | 45 | @x l.42 46 | @ We predeclare some standard string-handling functions here instead of 47 | including their system header files, because the names of the header files 48 | are not as standard as the names of the functions. (There's confusion 49 | between \.{} and \.{}.) 50 | 51 | @= 52 | extern size_t strlen(); /* length of string */ 53 | extern char* strcpy(); /* copy one string to another */ 54 | extern int strncmp(); /* compare up to $n$ string characters */ 55 | extern char* strncpy(); /* copy up to $n$ string characters */ 56 | @y 57 | @ For string handling we include the {\mc ANSI C} system header file 58 | instead of predeclaring the standard system functions |strlen|, |strcmp|, 59 | |strcpy|, and |strncpy|. This is done in the main section. 60 | @^system dependencies@> 61 | 62 | @= 63 | @z 64 | 65 | @x l.96 66 | input_ln(fp) /* copies a line into |buffer| or returns 0 */ 67 | FILE *fp; /* what file to read from */ 68 | @y 69 | int input_ln(@t\1\1@> /* copies a line into |buffer| or returns 0 */ 70 | FILE *fp@t\2\2@>) /* what file to read from */ 71 | @z 72 | 73 | @x l.159 74 | @d lines_dont_match (change_limit-change_buffer != limit-buffer || 75 | strncmp(buffer, change_buffer, limit-buffer)) 76 | @y 77 | @d lines_dont_match (change_limit-change_buffer != limit-buffer || 78 | strncmp(buffer, change_buffer, (size_t)(limit-buffer))) 79 | @z 80 | 81 | @x l.174 82 | void 83 | prime_the_change_buffer() 84 | @y 85 | void 86 | prime_the_change_buffer(void) 87 | @z 88 | 89 | @x l.217 90 | strncpy(change_buffer,buffer,limit-buffer+1); 91 | @y 92 | strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); 93 | @z 94 | 95 | @x l.233 96 | void 97 | check_change() /* switches to |change_file| if the buffers match */ 98 | @y 99 | void 100 | check_change(void) /* switches to |change_file| if the buffers match */ 101 | @z 102 | 103 | @x l.285 104 | void 105 | reset_input() 106 | @y 107 | void 108 | reset_input(void) 109 | @z 110 | 111 | @x l.318 112 | int get_line() /* inputs the next line */ 113 | @y 114 | int get_line(void) /* inputs the next line */ 115 | @z 116 | 117 | @x l.348 118 | void put_line() 119 | @y 120 | void put_line(void) 121 | @z 122 | 123 | @x l.458 124 | void 125 | check_complete(){ 126 | @y 127 | void 128 | check_complete(void) { 129 | @z 130 | 131 | @x l.461 132 | strncpy(buffer,change_buffer,change_limit-change_buffer+1); 133 | @y 134 | strncpy(buffer,change_buffer,(size_t)(change_limit-change_buffer+1)); 135 | @z 136 | 137 | @x l.499 138 | void err_print(); 139 | @y 140 | void err_print(const char *); 141 | @z 142 | 143 | @x l.503 144 | void 145 | err_print(s) /* prints `\..' and location of error message */ 146 | char *s; 147 | @y 148 | void 149 | err_print(@t\1\1@> /* prints `\..' and location of error message */ 150 | const char *s@t\2\2@>) 151 | @z 152 | 153 | @x l.556 154 | wrap_up() { 155 | @y 156 | int wrap_up(void) { 157 | @z 158 | 159 | @x l.609 160 | void scan_args(); 161 | @y 162 | void scan_args(void); 163 | @z 164 | 165 | @x l.613 166 | void 167 | scan_args() 168 | @y 169 | void 170 | scan_args(void) 171 | @z 172 | 173 | @x l.687 174 | flags[*dot_pos]=flag_change; 175 | @y 176 | flags[0+*dot_pos]=flag_change; 177 | @z 178 | 179 | @x l.717 180 | @* Index. 181 | @y 182 | @* Function declarations. To satisfy all the {\mc ANSI} compilers out 183 | there, here are the prototypes of all internal functions. 184 | 185 | @= 186 | int get_line(void);@/ 187 | int input_ln(FILE *);@/ 188 | int main(int,char **);@/ 189 | int wrap_up(void);@/ 190 | void check_change(void);@/ 191 | void check_complete(void);@/ 192 | void prime_the_change_buffer(void);@/ 193 | void put_line(void);@/ 194 | void reset_input(void); 195 | 196 | @* Index. 197 | @z 198 | -------------------------------------------------------------------------------- /texinputs/pdfwebtocfront.tex: -------------------------------------------------------------------------------- 1 | % pdfwebtocfront.tex 2 | % Code from knuth.drv in https://github.com/oberdiek/latex-tds 3 | % 2024/05/25 v3.1 by Andreas Scherer. 4 | % 5 | % This file is part of project https://github.com/ascherer/cwebbin 6 | % and may be distributed under the MIT License or the LaTeX Project 7 | % Public License. 8 | % 9 | % Move table-of-contents page to the front in PDF output. 10 | % Works with pdftex/xetex/luatex and plain tex/dvipdf in connection 11 | % with either 'pwebmac.tex' for Pascal/WEB programs or 'cwebmac.tex' 12 | % for C/CWEB programs. 13 | % 14 | \ifx\detokenize\undefined\endinput\fi 15 | \ifx\twodigits\undefined\endinput\fi 16 | \def\contentsfile{\jobname.toc} % file that gets table of contents info 17 | \newif\iftexmf\texmffalse % special toc treatment for TeX, Metafont, etc. 18 | \newread\testread 19 | \openin\testread=\contentsfile\relax 20 | \ifeof\testread % First run 21 | \else\closein\testread % Second run 22 | % Fix page numbers in the PDF bootmarks with 'Page Labels' 23 | \def\tocpages{1} % Most programs have one-page Table-of-Contents 24 | \def\tocstart{2} % so we start with (fake) page 2 for the rest 25 | \def\pagemode{/PageMode /UseOutlines} 26 | \def\pagelabels{/PageLabels << /Nums [ 27 | \ifnum\contentspagenumber=0 0 << /P(Contents) >> \tocpages << /S/D/St 1 >> 28 | \else 0 << /S/D/St \contentspagenumber >> \fi ] >> } 29 | \def\startpdf{\ifpdflua\pdfcatalog{\pagemode\space\pagelabels} 30 | \else {\special{pdf: docview << \pagemode\space\pagelabels >>}}\fi} 31 | % Redefine '\con' to be invoked before the first '\N' (starred section). 32 | \let\ORGcon\con 33 | \def\con{% 34 | % reduce size of PDF pages for more screen space 35 | \pdfpagewidth=\pagewidth \advance\pdfpagewidth by 1in 36 | \pdfpageheight=\fullpageheight \advance\pdfpageheight by 1in 37 | \iftexmf \advance\pdfpageheight by 0.5in 38 | \gtitle={Table of Contents} % overwrite default 'WEB output' 39 | \mark{\noexpand\nullsec{\the\gtitle}} \fi 40 | \ifpdflua \pdfhorigin=0.5in \pdfvorigin=0.5in 41 | \else \global\pageshift=-0.5in 42 | \global\hoffset=-0.5in \global\voffset=-0.5in \fi 43 | \begingroup 44 | \let\end\relax 45 | \ORGcon 46 | \endgroup 47 | \let\con\end 48 | }% 49 | % Special variant for 'mf.web' and 'tex.web' (et al.). 50 | % They all define a peculiar version of '\N' in their preamble. 51 | % And they put their tables-of-contents on sparse 'Contents' page(s) 52 | % and start the main body on page '3'. 53 | \edef\x{\jobname}% 54 | \edef\y{\detokenize{tex}}% 55 | \ifx\x\y \texmftrue\else 56 | \edef\y{\detokenize{mf}}% 57 | \ifx\x\y \texmftrue\else 58 | \edef\y{\detokenize{pdftex}}% 59 | \ifx\x\y \texmftrue \def\tocpages{2}\else 60 | \edef\y{\detokenize{xetex}}% 61 | \ifx\x\y \texmftrue\fi\fi\fi\fi 62 | \iftexmf 63 | % These main programs start on page '3' (after any number of ToC pages) 64 | \def\pagelabels{/PageLabels << /Nums [ 65 | 0 << /P(Contents) >> \tocpages << /S/D/St 3 >> ] >> } 66 | \expandafter\let\csname ORGN\expandafter\endcsname 67 | \csname N\endcsname 68 | \expandafter\outer\expandafter\def\csname N\endcsname{% 69 | \titletrue \con \pageno=\tocstart 70 | \expandafter\let\csname N\expandafter\endcsname 71 | \csname ORGN\endcsname 72 | \csname N\endcsname 73 | }% 74 | \else % Much more general approach for WEB and CWEB programs. 75 | \edef\y{\detokenize{mp}}% 76 | % This main program starts on page '3' (after any number of ToC pages) 77 | \ifx\x\y \def\pagelabels{/PageLabels << /Nums [ 78 | 0 << /P(Contents) >> \tocpages << /S/D/St 3 >> ] >> } \fi 79 | % In fact, '\con' will be invoked _inside_ the first '\N' right _after_ 80 | % '\MN', but _before_ '\eject'. And '\topofcontents' gets in the twist 81 | % as well. 82 | \let\ORGtopofcontents\topofcontents \let\ORGrheader\rheader 83 | \def\topofcontents{% 84 | \def\:{\par\hangindent 2em} % Fix for 'bibtex.web'; from '\def\fin'. 85 | \ORGtopofcontents 86 | \let\topofcontents\relax 87 | }% 88 | % Squeeze '\con' between '\MN' and '\eject' in the very first '\N'. 89 | \expandafter\let\csname ORGvfil\expandafter\endcsname 90 | \csname vfil\endcsname 91 | \expandafter\let\csname ORGeject\expandafter\endcsname 92 | \csname eject\endcsname 93 | \expandafter\outer\expandafter\def\csname vfil\endcsname{% 94 | \let\eject\relax 95 | \titletrue % prepare to output the table of contents 96 | \topofcontents \con 97 | \advance\pageno by -1\relax 98 | \expandafter\let\csname vfil\expandafter\endcsname 99 | \csname ORGvfil\endcsname 100 | \expandafter\let\csname eject\expandafter\endcsname 101 | \csname ORGeject\endcsname 102 | \vfil\eject 103 | \let\rheader\ORGrheader 104 | }% 105 | \fi 106 | \fi 107 | -------------------------------------------------------------------------------- /0005-Update-CTWILL-macros-for-CWEB-4.9.patch: -------------------------------------------------------------------------------- 1 | From 9352f2538be0025a86ecee2f3fac4222d756483a Mon Sep 17 00:00:00 2001 2 | From: Andreas Scherer 3 | Date: Wed, 14 Jun 2023 10:00:33 +0200 4 | Subject: [PATCH 5/6] Update CTWILL macros for CWEB 4.9. 5 | 6 | --- 7 | ctwimac.tex | 10 ++++++---- 8 | proofmac.tex | 12 ++++++------ 9 | twinxmac.tex | 2 +- 10 | 3 files changed, 13 insertions(+), 11 deletions(-) 11 | 12 | diff --git a/ctwimac.tex b/ctwimac.tex 13 | index 014168b..d65f5bf 100644 14 | --- a/ctwimac.tex 15 | +++ b/ctwimac.tex 16 | @@ -1,9 +1,9 @@ 17 | % standard macros for CWEB listings (in addition to plain.tex) 18 | -% Version 4.5 --- October 2021 19 | +% Version 4.9 --- June 2023 20 | % modified for pages produced by CTWILL 21 | % further modified for page size of the MMIXware book 22 | \ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros 23 | -\xdef\fmtversion{\fmtversion+CTWILL4.5+LNCS} 24 | +\xdef\fmtversion{\fmtversion+CTWILL4.9+LNCS} 25 | 26 | \let\:=\. % preserve a way to get the dot accent 27 | % (all other accents will still work as usual) 28 | @@ -31,6 +31,8 @@ 29 | \def\Cee{\CEE/} % for backward compatibility 30 | \def\Cpp{\CPLUSPLUS/} % for backward compatibility 31 | \def\9#1{} 32 | + % with this definition of \9 you can say @:sort key}{TeX code@> 33 | + % to alphabetize an index entry by the sort key but format with the TeX code 34 | \font\eightrm=cmr8 35 | \font\sixrm=cmr6 36 | \font\ninei=cmmi9 37 | @@ -251,7 +253,7 @@ 38 | \let\G=\ge % greater than or equal sign 39 | % \H is long Hungarian umlaut accent 40 | \let\I=\ne % unequal sign 41 | -\def\J{\.{@\&}} % TANGLE's join operation 42 | +\def\J{\.{@\&}} % CTANGLE's join operation 43 | \let\K== % assignment operator 44 | %\let\K=\leftarrow % "honest" alternative to standard assignment operator 45 | % \L is Polish letter suppressed-L 46 | @@ -459,7 +461,7 @@ 47 | \def\Us{\note{Used in sections}} % crossref for uses of a section 48 | \def\I{\par\hangindent 2em}\let\*=* 49 | \readsections} 50 | -\def\readsections{\input \jobname.sscn} 51 | +\def\readsections{\input \jobname.scn} 52 | \def\datethis{} \def\datecontentspage{} 53 | 54 | % To produce only a subset of pages, put the page numbers on separate 55 | diff --git a/proofmac.tex b/proofmac.tex 56 | index c0b4fa6..8cfe398 100644 57 | --- a/proofmac.tex 58 | +++ b/proofmac.tex 59 | @@ -1,8 +1,8 @@ 60 | % standard macros for CWEB listings (in addition to plain.tex) 61 | -% Version 4.5 --- October 2021 62 | +% Version 4.9 --- June 2023 63 | % Modified for proofs in CTWILL 64 | -\ifx\documentstyle\undefined\else\endinput\fi % LaTeX will use other macros 65 | -\xdef\fmtversion{\fmtversion+CWEB4.5+PROOFS} 66 | +\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros 67 | +\xdef\fmtversion{\fmtversion+CTWILL4.9+PROOFS} 68 | 69 | \let\:=\. % preserve a way to get the dot accent 70 | % (all other accents will still work as usual) 71 | @@ -115,7 +115,7 @@ 72 | \sfcode`;=1500 \pretolerance 200 \hyphenpenalty 50 \exhyphenpenalty 50 73 | \noindent{\let\*=\lapstar\bf\secstar.\quad}} 74 | \let\startsection=\stsec 75 | -\def\defin#1{\global\advance\ind by 2 \1\&{#1 } } % begin `define' or `format' 76 | +\def\defin#1{\global\advance\ind by 2 \1\&{#1 }} % begin `define' or `format' 77 | \def\A{\note{See also section}} % xref for doubly defined section name 78 | \def\As{\note{See also sections}} % xref for multiply defined section name 79 | \def\B{\rightskip=0pt plus 100pt minus 10pt % go into C mode 80 | @@ -128,7 +128,7 @@ 81 | \let\SHC\C % "// short comments" treated like "/* ordinary comments */" 82 | %\def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$} 83 | %\def\SHC#1{\5\5\quad$\diamond\,${\cmntfont#1}} 84 | -\def\D{\defin{\#define}} % macro definition 85 | +\def\D{\defin{{\rm\#}define}} % macro definition 86 | \let\E=\equiv % equivalence sign 87 | \def\ET{ and~} % conjunction between two section numbers 88 | \def\ETs{, and~} % conjunction between the last two of several section numbers 89 | @@ -136,7 +136,7 @@ 90 | \let\G=\ge % greater than or equal sign 91 | % \H is long Hungarian umlaut accent 92 | \let\I=\ne % unequal sign 93 | -\def\J{\.{@\&}} % TANGLE's join operation 94 | +\def\J{\.{@\&}} % CTANGLE's join operation 95 | \let\K== % assignment operator 96 | %\let\K=\leftarrow % "honest" alternative to standard assignment operator 97 | % \L is Polish letter suppressed-L 98 | diff --git a/twinxmac.tex b/twinxmac.tex 99 | index 6d9ac2f..6865478 100644 100 | --- a/twinxmac.tex 101 | +++ b/twinxmac.tex 102 | @@ -213,7 +213,7 @@ 103 | \let\G=\ge % greater than or equal sign 104 | % \H is long Hungarian umlaut accent 105 | \let\I=\ne % unequal sign 106 | -\def\J{\.{@\&}} % TANGLE's join operation 107 | +\def\J{\.{@\&}} % CTANGLE's join operation 108 | \let\K== % can be changed to left arrow, if desired 109 | % \L is Polish letter suppressed-L; we have no shorthand for \le 110 | % \O is Scandinavian letter O-with-slash 111 | -- 112 | 2.47.1 113 | 114 | -------------------------------------------------------------------------------- /texinputs/dcwebmac.tex: -------------------------------------------------------------------------------- 1 | % standard macros for CWEB listings (in addition to plain.tex) 2 | % modified for use with "tex2pdf" --- March 1997 3 | % Version 2.0 --- Don Knuth, July 1990 4 | % Version 2.0 [german] --- Carsten Steger, October 1991 5 | % Version 2.0 [german] --- Andreas Scherer, February 1993 6 | % Version 2.7 --- Don Knuth, July 1992 7 | % Version 2.7 [p6c] --- Andreas Scherer, September 1993 8 | % Version 2.8 --- Don Knuth, September 1992 9 | % Version 2.8 [german] --- Carsten Steger, 1993 10 | % Version 2.8 [p7] --- Andreas Scherer, October 1993 11 | % Version 3.0 --- Don Knuth, June 1993 12 | % Version 3.0 [p8e] --- Andreas Scherer, November 1993 13 | % Version 3.1 [p9b] --- Andreas Scherer, January 1994 14 | % Version 3.1 [p9c] --- Andreas Scherer, March 1994 15 | % Version 3.1 [p9d] --- Andreas Scherer, July 1994 16 | % Version 3.2 [p10] --- Andreas Scherer, August 1994 17 | % Version 3.2 [p10b] --- Andreas Scherer, October 1994 18 | % Version 3.3 [p11a] --- Andreas Scherer, December 1994 19 | % Version 3.3 [p11b] --- Andreas Scherer, March 1995 20 | % Version 3.4 [p13] --- Andreas Scherer, August 1995 21 | % Version 3.4 [p14] --- Andreas Scherer, March 1997 22 | % Version 3.42 [p15] --- Andreas Scherer, August 1998 23 | % Version 3.43 [p16] --- Andreas Scherer, October 1998 24 | % Version 3.5 [p17] --- Andreas Scherer, December 1999 25 | % Version 3.61 [p18] --- Andreas Scherer, July 2000 26 | % Version 3.63 [p19] --- Andreas Scherer, January 2001 27 | % Version 3.64 [p20] --- Andreas Scherer, March 2002 28 | % Version 3.64 [p21] --- Andreas Scherer, Octobre 2005 29 | % Version 3.64 [p22] --- Andreas Scherer, March 2016 30 | % Version 4.9 --- Andreas Scherer, June 2022 31 | % Version 4.12 --- Andreas Scherer, August 2024 32 | 33 | \ifx\undefined\botofcontents\input cwebmac.tex\fi 34 | 35 | \input dcwebstrings.tex % German translations for some tags and strings 36 | 37 | \def\.#1{\leavevmode\hbox{\tentex % typewriter type for strings 38 | \ifx\Cstringchars\undefined\else\Cstringchars\fi % special string characters 39 | \let\\=\BS % backslash in a string 40 | \let\{=\LB % left brace in a string 41 | \let\}=\RB % right brace in a string 42 | \let\~=\TL % tilde in a string 43 | \let\ =\SP % space in a string 44 | \let\_=\UL % underline in a string 45 | \let\&=\AM % ampersand in a string 46 | \let\^=\CF % circumflex in a string 47 | \ifx\originalTeX\undefined\else\originalTeX\fi#1\kern.05em}} 48 | 49 | \def\postATL#1 #2 {\bf Buchstabe \\{\uppercase{\char"#1}} 50 | wird getangled als \tentex "#2"\egroup\par} 51 | 52 | \gtitle={\.{CWEB} Ausgabe} % this running head is reset by starred sections 53 | \mark{\noexpand\nullsec0{\the\gtitle}} 54 | 55 | \def\fin{\par\vfill\eject % this is done when we are ending the index 56 | \ifpagesaved\null\vfill\eject\fi % output a null index column 57 | \if L\lr\else\null\vfill\eject\fi % finish the current page 58 | \ifpdf \ifpdflua \makebookmarks % added in Version 3.68 59 | \countsections \fi\fi % and in Version 4.9 60 | \parfillskip 0pt plus 1fil 61 | \let\topsecno=\nullsec 62 | \redeffin 63 | \output={\normaloutput\page\lheader\rheader} 64 | \setpage 65 | \def\note##1##2.{\quad{\eightrm##1~\ifacrohint{\pdfnote##2.}\else{##2}\fi.}} 66 | \def\I{\par\hangindent 2em}\let\*=* 67 | \ifacro \let\Xpdf\X 68 | \ifpdflua \pdfdest name {NOS} fith 69 | \pdfoutline goto name {NOS} count -\the\countD {\outsecname} 70 | \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% 71 | {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% 72 | \pdfoutline goto num \the\toksA \expandafter{\the\toksE}} 73 | \else \special{pdf: outline -1 << /Title (\outsecname) 74 | /Dest [ @thispage /FitH @ypos ] >>} 75 | \def\X##1:##2\X{\Xpdf##1:##2\X \firstsecno##1.% 76 | {\toksF={}\makeoutlinetoks##2\outlinedone\outlinedone}% 77 | \special{pdf: outline 0 << /Title (\the\toksE) 78 | /A << /S /GoTo /D (\romannumeral\the\toksA) >> >>}} 79 | \fi\fi 80 | \readsections} 81 | \def\con{\par\vfill\eject % finish the section names 82 | % \ifodd\pageno\else\titletrue\null\vfill\eject\fi % for duplex printers 83 | \rightskip 0pt \hyphenpenalty 50 \tolerance 200 84 | \setpage \output={\normaloutput\page\lheader\rheader} 85 | \ifpdf\startpdf\fi \titletrue % prepare to output the table of contents 86 | \pageno=\contentspagenumber 87 | \redefcon 88 | \ifhint\HINThome\fi% Mark the Table of contents as home page 89 | \topofcontents 90 | \line{\headerline} 91 | \let\ZZ=\contentsline 92 | \readcontents\relax % read the contents info 93 | \botofcontents \end} % print the contents page(s) and terminate 94 | \def\today{\number\day.~\ifcase\month\or 95 | Januar\or Februar\or M\"arz\or April\or Mai\or Juni\or 96 | Juli\or August\or September\or Oktober\or November\or Dezember\fi 97 | \space\number\year} 98 | \def\hours{\twodigits=\time \divide\twodigits by60 \printtwodigits 99 | \null\space\sc Uhr\space % distinguish between time and year 100 | \multiply\twodigits by-60 \advance\twodigits by\time \printtwodigits} 101 | \def\datethis{\def\startsection{\leftline{\sc\today\ um \hours}\bigskip 102 | \let\startsection=\stsec\stsec}} 103 | % say `\datethis' in limbo, to get your listing timestamped before section 1 104 | \def\datecontentspage{% changed in version 3.66 105 | \def\botofcontents{\vfill 106 | \centerline{\covernote} 107 | \bigskip 108 | \leftline{\sc\today\ um \hours}}} % timestamps the contents page 109 | -------------------------------------------------------------------------------- /tests/ham.w: -------------------------------------------------------------------------------- 1 | \datethis 2 | @s try x 3 | @i gb_types.w 4 | 5 | @*Hamiltonian cycles. This program finds all Hamiltonian cycles of 6 | an undirected graph. [It's a slight revision of the program published 7 | in my paper ``Mini-indexes for literate programs,'' {\sl Software---Concepts 8 | and Tools\/ \bf15} (1994), 2--11.] The input graph should be in 9 | Stanford GraphBase format, and should be named on the command line 10 | as, for example, \.{foo.gb}. An optional second command-line parameter 11 | is a modulus |m|, which causes every $m$th solution to be printed. 12 | 13 | We use a utility field to record the vertex degrees. 14 | 15 | @d deg u.I 16 | 17 | @c 18 | #include "gb_graph.h" /* the GraphBase data structures */ 19 | #include "gb_save.h" /* |restore_graph| */ 20 | 21 | main(int argc,char *argv[]) 22 | { 23 | Graph *g; 24 | Vertex *x,*y,*z, *tmax; 25 | register Vertex *t,*u,*v; 26 | register Arc *a,*aa; 27 | register int d; 28 | Arc *b,*bb; 29 | int count=0; 30 | int dmin,modulus; 31 | @; 32 | @; 33 | for (v=g->vertices;vvertices+g->n;v++) printf(" %d",v->deg); 34 | printf("\n"); /* TEMPORARY CHECK */ 35 | if (x->deg<2) { 36 | printf("The minimum degree is %d (vertex %s)!\n",x->deg,x->name); 37 | return -1; 38 | } 39 | for (b=x->arcs;b->next;b=b->next) for (bb=b->next;bb;bb=bb->next) { 40 | v=b->tip; 41 | z=bb->tip; 42 | @n-2| from |v| to |z|, 43 | avoiding |x|@>; 44 | } 45 | printf("Altogether %d solutions.\n",count); 46 | for (v=g->vertices;vvertices+g->n;v++) printf(" %d",v->deg); 47 | printf("\n"); /* TEMPORARY CHECK, SHOULD AGREE WITH FORMER VALUES */ 48 | } 49 | 50 | @ @= 51 | if (argc>1) g=restore_graph(argv[1]);@+ else g=NULL; 52 | if (argc<3 || sscanf(argv[2],"%d",&modulus)!=1) modulus=1000000000; 53 | if (!g || modulus<=0) { 54 | fprintf(stderr,"Usage: %s foo.gb [modulus]\n",argv[0]); 55 | exit(-1); 56 | } 57 | 58 | @ Vertices that have already appeared in the path are ``taken,'' and 59 | their |taken| field is nonzero. Initially we make all those fields zero. 60 | 61 | @d taken v.I 62 | 63 | @= 64 | dmin=g->n; 65 | for (v=g->vertices;vvertices+g->n;v++) { 66 | v->taken=0; 67 | d=0; 68 | for (a=v->arcs;a;a=a->next) d++; 69 | v->deg=d; 70 | if (dvert| when |t| is the |k|th vertex of 79 | the graph. If the move was not forced, |t->ark| will point to the Arc 80 | record representing the edge from |t->vert| to |(t+1)->vert|; otherwise 81 | |t->ark| will be |NULL|. 82 | 83 | This program is a typical backtrack program. I am more comfortable doing 84 | it with labels and goto statements than with while loops, but some day 85 | I may learn my lesson. 86 | 87 | @d vert w.V 88 | @d ark x.A 89 | 90 | @n-2|...@>= 91 | t=g->vertices;@+tmax=t+g->n-1; 92 | x->taken=1;@+t->vert=x; 93 | t->ark=NULL; 94 | advance: @; 97 | try: @; 98 | restore: @; 100 | backtrack: @; 102 | done: 103 | 104 | @ @= 105 | t++; 106 | t->vert=v; 107 | v->taken=1; 108 | if (v==z) { 109 | if (t==tmax) @; 110 | goto backtrack; 111 | } 112 | for (aa=v->arcs,y=NULL;aa;aa=aa->next) { 113 | u=aa->tip; 114 | d=u->deg-1; 115 | if (d==1 && u->taken==0) { 116 | if (y) goto restore; /* restoration will stop at |aa| */ 117 | y=u; 118 | } 119 | u->deg=d; 120 | } 121 | if (y) { 122 | t->ark=NULL; 123 | v=y; 124 | goto advance; 125 | } 126 | a=v->arcs; 127 | 128 | @ @= 130 | for (a=t->vert->arcs;a!=aa;a=a->next) a->tip->deg++; 131 | 132 | @ @= 133 | while (a) { 134 | v=a->tip; 135 | if (v->taken==0) { 136 | t->ark=a; 137 | goto advance; 138 | } 139 | a=a->next; 140 | } 141 | restore_all: aa=NULL; /* all moves tried; we fall through to |restore| */ 142 | 143 | @ @= 144 | t->vert->taken=0; 145 | t--; 146 | if (t->ark) { 147 | a=t->ark->next; 148 | goto try; 149 | } 150 | if (t==g->vertices) goto done; 151 | goto restore_all; /* the move was forced */ 152 | 153 | @ @= 154 | { 155 | count++; 156 | if (count%modulus==0) { 157 | printf("%d: ",count); 158 | for (u=g->vertices;u<=tmax;u++) printf("%s ",u->vert->name); 159 | printf("\n"); 160 | } 161 | } 162 | 163 | @*Index. 164 | -------------------------------------------------------------------------------- /examples/wmerge.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="wmerge" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103 6 | 7 | CFG=wmerge - Win32 Release 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "wmerge.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "wmerge.mak" CFG="wmerge - Win32 Release" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "wmerge - Win32 Release" (based on "Win32 (x86) Console Application") 21 | !MESSAGE "wmerge - Win32 Debug" (based on "Win32 (x86) Console Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "wmerge - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir ".\Release" 36 | # PROP BASE Intermediate_Dir ".\Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir ".\Release" 41 | # PROP Intermediate_Dir ".\Release" 42 | # PROP Ignore_Export_Lib 0 43 | # PROP Target_Dir "" 44 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c 45 | # ADD CPP /nologo /MD /W3 /GX /O2 /I "catalogs" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D _DEV_NULL=\"NUL\" /FD /D SEPARATORS=\":\\/\" /c 46 | # SUBTRACT CPP /YX 47 | # ADD BASE RSC /l 0x407 /d "NDEBUG" 48 | # ADD RSC /l 0x407 /d "NDEBUG" 49 | BSC32=bscmake.exe 50 | # ADD BASE BSC32 /nologo 51 | # ADD BSC32 /nologo 52 | LINK32=link.exe 53 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 54 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 55 | 56 | !ELSEIF "$(CFG)" == "wmerge - Win32 Debug" 57 | 58 | # PROP BASE Use_MFC 0 59 | # PROP BASE Use_Debug_Libraries 1 60 | # PROP BASE Output_Dir ".\Debug" 61 | # PROP BASE Intermediate_Dir ".\Debug" 62 | # PROP BASE Target_Dir "" 63 | # PROP Use_MFC 0 64 | # PROP Use_Debug_Libraries 1 65 | # PROP Output_Dir ".\Debug" 66 | # PROP Intermediate_Dir ".\Debug" 67 | # PROP Ignore_Export_Lib 0 68 | # PROP Target_Dir "" 69 | # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c 70 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "catalogs" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D _DEV_NULL=\"NUL\" /FD /D SEPARATORS=\":\\/\" /c 71 | # SUBTRACT CPP /YX 72 | # ADD BASE RSC /l 0x407 /d "_DEBUG" 73 | # ADD RSC /l 0x407 /d "_DEBUG" 74 | BSC32=bscmake.exe 75 | # ADD BASE BSC32 /nologo 76 | # ADD BSC32 /nologo 77 | LINK32=link.exe 78 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 79 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 80 | 81 | !ENDIF 82 | 83 | # Begin Target 84 | 85 | # Name "wmerge - Win32 Release" 86 | # Name "wmerge - Win32 Debug" 87 | # Begin Group "Source Files" 88 | 89 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" 90 | # Begin Source File 91 | 92 | SOURCE=wmerge.cxx 93 | # End Source File 94 | # End Group 95 | # Begin Group "Change Files" 96 | 97 | # PROP Default_Filter "ch" 98 | # Begin Source File 99 | 100 | SOURCE=".\wmerg-ansi.ch" 101 | # End Source File 102 | # Begin Source File 103 | 104 | SOURCE=".\wmerg-extensions.ch" 105 | # End Source File 106 | # Begin Source File 107 | 108 | SOURCE=".\wmerg-memory.ch" 109 | # End Source File 110 | # Begin Source File 111 | 112 | SOURCE=".\wmerg-output.ch" 113 | # End Source File 114 | # Begin Source File 115 | 116 | SOURCE=".\wmerg-patch.ch" 117 | # End Source File 118 | # End Group 119 | # Begin Group "CWEB Files" 120 | 121 | # PROP Default_Filter "w" 122 | # Begin Source File 123 | 124 | SOURCE=.\examples\wmerge.w 125 | 126 | !IF "$(CFG)" == "wmerge - Win32 Release" 127 | 128 | # Begin Custom Build 129 | InputPath=.\examples\wmerge.w 130 | 131 | "wmerge.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 132 | tie -c wmerg-p21.ch examples/wmerge.w wmerg-patch.ch wmerg-ansi.ch wmerg-extensions.ch wmerg-memory.ch wmerg-output.ch 133 | ctangle examples/wmerge.w wmerg-p21.ch wmerge.cxx 134 | 135 | # End Custom Build 136 | 137 | !ELSEIF "$(CFG)" == "wmerge - Win32 Debug" 138 | 139 | # Begin Custom Build 140 | InputPath=.\examples\wmerge.w 141 | 142 | "wmerge.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 143 | tie -c wmerg-p21.ch examples/wmerge.w wmerg-patch.ch wmerg-ansi.ch wmerg-extensions.ch wmerg-memory.ch wmerg-output.ch 144 | ctangle examples/wmerge.w wmerg-p21.ch wmerge.cxx 145 | 146 | # End Custom Build 147 | 148 | !ENDIF 149 | 150 | # End Source File 151 | # End Group 152 | # End Target 153 | # End Project 154 | -------------------------------------------------------------------------------- /twinx.ch: -------------------------------------------------------------------------------- 1 | Changes for the TWINX utility from the CTWILL tarball. 2 | 3 | This minimal set of changes tries to satisfy the GCC compiler 4 | and it fixes a few minor issues. See the comments after '@x'. 5 | 6 | This file is not copyrighted and can be used freely. 7 | 8 | Limbo. 9 | 10 | @x l.1 11 | \datethis 12 | @y 13 | \datethis 14 | \let\maybe=\iffalse % print only sections that change 15 | @z 16 | 17 | Section 1. 18 | 19 | @x l.10 Standard C interface. 20 | #include 21 | @y 22 | #include 23 | #include 24 | #include 25 | #include 26 | @z 27 | 28 | @x l.15 29 | main(argc,argv) 30 | int argc; 31 | char *argv[]; 32 | @y 33 | int main( 34 | int argc, 35 | char *argv[]) 36 | @z 37 | 38 | @x l.21 39 | f=fopen(*++argv,"r"); 40 | if (!f) 41 | @y 42 | if((f=fopen(*++argv,"r"))==NULL) 43 | @z 44 | 45 | @x l.27 46 | strncpy(*argv+strlen(*argv)-3,"idx",3); 47 | f=fopen(*argv,"r"); 48 | if (!f) 49 | @y 50 | memcpy(*argv+strlen(*argv)-3,"idx",3); 51 | if((f=fopen(*argv,"r"))==NULL) 52 | @z 53 | 54 | Section 3. 55 | 56 | @x l.49 Document minor change in behavior. 57 | @ @= 58 | @y 59 | @ For your convenience, \.{TWINX} grabs the first ``word'' in \.{\\title} and 60 | turns it into uppercase form. 61 | 62 | @= 63 | @z 64 | 65 | @x l.56 C++17 removed 'register' storage class. 66 | if (strncmp(buf,"\\def\\title\{",11)==0) {@+register char *p,*q; 67 | @y 68 | if (strncmp(buf,"\\def\\title\{",11)==0) {@+char *p,*q; 69 | @z 70 | 71 | @x l.57 FIX: Fetch only the first word from the '\title'. 72 | for (p=buf+11,q=title;*p && *p!='}';p++) *q++=*p; 73 | @y 74 | for (p=buf+11,q=title;*p&&*p!=' '&&*p!='}';p++) *q++=toupper(*p); 75 | @z 76 | 77 | Section 4. 78 | 79 | @x l.96 80 | @= 81 | @y 82 | @s node_struct int 83 | 84 | @= 85 | @z 86 | 87 | @x l.102 Compiler warning. 88 | char *id; 89 | @y 90 | const char *id; 91 | @z 92 | 93 | Section 5. 94 | 95 | @x l.115 96 | char *save_string(s) 97 | char *s; 98 | @y 99 | char *save_string( 100 | char *s) 101 | @z 102 | 103 | @x l.118 C++17 removed 'register' storage class. 104 | register char *p,*q; register int l; 105 | @y 106 | char *p,*q; int l; 107 | @z 108 | 109 | Section 6. 110 | 111 | @x l.145 112 | node *new_node() 113 | @y 114 | node *new_node(void) 115 | @z 116 | 117 | @x l.181 C++17 removed 'register' storage class. 118 | register node* main_node; /* current end of main list */ 119 | @y 120 | node* main_node; /* current end of main list */ 121 | @z 122 | 123 | @x l.195 C++17 removed 'register' storage class. 124 | while (1) {@+register node *cur_node; 125 | @y 126 | while (1) {@+node *cur_node; 127 | @z 128 | 129 | @x l.213 C++17 removed 'register' storage class. 130 | {@+register char *p,*q;@+register int bal=1; 131 | @y 132 | {@+char *p,*q;@+int bal=1; 133 | @z 134 | 135 | Section 11. 136 | 137 | @x l.216 FIX: Don't count masked braces. 138 | if (*p=='{') bal++; 139 | else if (*p=='}') bal--; 140 | @y 141 | switch (*p) { 142 | case '\\': *q++=*p++; break; 143 | case '{': bal++; break; 144 | case '}': bal--; break; 145 | } 146 | @z 147 | 148 | Section 12. 149 | 150 | @x l.246 151 | do@+{ 152 | @y 153 | do { 154 | @z 155 | 156 | @x l.256 157 | }@+while(fgets(buf,buf_size,f)); 158 | @y 159 | } while(fgets(buf,buf_size,f)); 160 | @z 161 | 162 | Section 14. 163 | 164 | @x l.289 C++17 removed 'register' storage class. 165 | while (1) {@+register node *p,*q,*r,*s,*t; 166 | @y 167 | while (1) {@+node *p,*q,*r,*s,*t; 168 | @z 169 | 170 | Section 15. 171 | 172 | @x l.308 C++17 removed 'register' storage class. 173 | do@+{@+register int d; 174 | @y 175 | do {@+int d; 176 | @z 177 | 178 | @x l.316 179 | }@+while(1); 180 | @y 181 | } while(1); 182 | @z 183 | 184 | Section 16. 185 | 186 | @x l.323 C++17 removed 'register' storage class. 187 | do@+{@+register int d; 188 | @y 189 | do {@+int d; 190 | @z 191 | 192 | @x l.338 193 | }@+while(1); 194 | @y 195 | } while(1); 196 | @z 197 | 198 | Section 17. 199 | 200 | @x l.347 201 | int compare(p,q) 202 | node *p,*q; 203 | @y 204 | int compare( 205 | node *p, node *q) 206 | @z 207 | 208 | 209 | @x l.349 C++17 removed 'register' storage class. 210 | {@+register unsigned char *pp,*qq; 211 | @y 212 | {@+unsigned char *pp,*qq; 213 | @z 214 | 215 | Section 19. 216 | 217 | @x l.378 C++17 removed 'register' storage class. 218 | {@+register int j; 219 | @y 220 | {@+int j; 221 | @z 222 | 223 | @x l.379 Compiler warning. 224 | for (j=1;collate[j];j++) ord[collate[j]]=j; 225 | @y 226 | for (j=1;collate[j];j++) ord[(int)collate[j]]=j; 227 | @z 228 | 229 | Section 20. 230 | 231 | @x l.390 232 | collapse(p,q) 233 | node *p,*q; 234 | @y 235 | void collapse( 236 | node *p, node *q) 237 | @z 238 | 239 | @x l.392 C++17 removed 'register' storage class. 240 | {@+register node *x; 241 | @y 242 | {@+node *x; 243 | @z 244 | 245 | Section 21. 246 | 247 | @x l.403 C++17 removed 'register' storage class. 248 | {@+register node *x; 249 | @y 250 | {@+node *x; 251 | @z 252 | 253 | Section 22. 254 | 255 | @x l.414 Compiler warning. 256 | {@+register char *p=x->id; 257 | @y 258 | {@+const char *p=x->id; 259 | @z 260 | 261 | @x l.434 FIX: Don't mask already masked underscore. 262 | if (*p=='_') putchar('\\'); 263 | @y 264 | if (*p=='_'&&*(p-1)!='\\') putchar('\\'); 265 | @z 266 | 267 | @x l.441 C++17 removed 'register' storage class. 268 | {@+register node *y=x->data.n,*z=NULL; 269 | while (y) {@+register node *w; 270 | @y 271 | {@+node *y=x->data.n,*z=NULL; 272 | while (y) {@+node *w; 273 | @z 274 | -------------------------------------------------------------------------------- /vault/cweave.dsp: -------------------------------------------------------------------------------- 1 | # Microsoft Developer Studio Project File - Name="cweave" - Package Owner=<4> 2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00 3 | # ** DO NOT EDIT ** 4 | 5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103 6 | 7 | CFG=cweave - Win32 Release 8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE, 9 | !MESSAGE use the Export Makefile command and run 10 | !MESSAGE 11 | !MESSAGE NMAKE /f "cweave.mak". 12 | !MESSAGE 13 | !MESSAGE You can specify a configuration when running NMAKE 14 | !MESSAGE by defining the macro CFG on the command line. For example: 15 | !MESSAGE 16 | !MESSAGE NMAKE /f "cweave.mak" CFG="cweave - Win32 Release" 17 | !MESSAGE 18 | !MESSAGE Possible choices for configuration are: 19 | !MESSAGE 20 | !MESSAGE "cweave - Win32 Release" (based on "Win32 (x86) Console Application") 21 | !MESSAGE "cweave - Win32 Debug" (based on "Win32 (x86) Console Application") 22 | !MESSAGE 23 | 24 | # Begin Project 25 | # PROP AllowPerConfigDependencies 0 26 | # PROP Scc_ProjName "" 27 | # PROP Scc_LocalPath "" 28 | CPP=cl.exe 29 | RSC=rc.exe 30 | 31 | !IF "$(CFG)" == "cweave - Win32 Release" 32 | 33 | # PROP BASE Use_MFC 0 34 | # PROP BASE Use_Debug_Libraries 0 35 | # PROP BASE Output_Dir ".\Release" 36 | # PROP BASE Intermediate_Dir ".\Release" 37 | # PROP BASE Target_Dir "" 38 | # PROP Use_MFC 0 39 | # PROP Use_Debug_Libraries 0 40 | # PROP Output_Dir ".\Release" 41 | # PROP Intermediate_Dir ".\Release" 42 | # PROP Ignore_Export_Lib 0 43 | # PROP Target_Dir "" 44 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c 45 | # ADD CPP /nologo /MD /W3 /GX /Od /I "catalogs" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D _DEV_NULL=\"NUL\" /FD /D SEPARATORS=\":\\/\" /c 46 | # SUBTRACT CPP /YX 47 | # ADD BASE RSC /l 0x407 /d "NDEBUG" 48 | # ADD RSC /l 0x407 /d "NDEBUG" 49 | BSC32=bscmake.exe 50 | # ADD BASE BSC32 /nologo 51 | # ADD BSC32 /nologo 52 | LINK32=link.exe 53 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 54 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 55 | 56 | !ELSEIF "$(CFG)" == "cweave - Win32 Debug" 57 | 58 | # PROP BASE Use_MFC 0 59 | # PROP BASE Use_Debug_Libraries 1 60 | # PROP BASE Output_Dir ".\Debug" 61 | # PROP BASE Intermediate_Dir ".\Debug" 62 | # PROP BASE Target_Dir "" 63 | # PROP Use_MFC 0 64 | # PROP Use_Debug_Libraries 1 65 | # PROP Output_Dir ".\Debug" 66 | # PROP Intermediate_Dir ".\Debug" 67 | # PROP Ignore_Export_Lib 0 68 | # PROP Target_Dir "" 69 | # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c 70 | # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "catalogs" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D _DEV_NULL=\"NUL\" /FD /D SEPARATORS=\":\\/\" /c 71 | # SUBTRACT CPP /YX 72 | # ADD BASE RSC /l 0x407 /d "_DEBUG" 73 | # ADD RSC /l 0x407 /d "_DEBUG" 74 | BSC32=bscmake.exe 75 | # ADD BASE BSC32 /nologo 76 | # ADD BSC32 /nologo 77 | LINK32=link.exe 78 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 79 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 80 | 81 | !ENDIF 82 | 83 | # Begin Target 84 | 85 | # Name "cweave - Win32 Release" 86 | # Name "cweave - Win32 Debug" 87 | # Begin Group "Source Files" 88 | 89 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" 90 | # Begin Source File 91 | 92 | SOURCE=common.cxx 93 | # End Source File 94 | # Begin Source File 95 | 96 | SOURCE=cweave.cxx 97 | # End Source File 98 | # End Group 99 | # Begin Group "Change Files" 100 | 101 | # PROP Default_Filter "ch" 102 | # Begin Source File 103 | 104 | SOURCE="cweav-ansi.ch" 105 | # End Source File 106 | # Begin Source File 107 | 108 | SOURCE="cweav-extensions.ch" 109 | # End Source File 110 | # Begin Source File 111 | 112 | SOURCE="cweav-memory.ch" 113 | # End Source File 114 | # Begin Source File 115 | 116 | SOURCE="cweav-output.ch" 117 | # End Source File 118 | # Begin Source File 119 | 120 | SOURCE="cweav-patch.ch" 121 | # End Source File 122 | # Begin Source File 123 | 124 | SOURCE="cweav-translation.ch" 125 | # End Source File 126 | # End Group 127 | # Begin Group "CWEB Files" 128 | 129 | # PROP Default_Filter "w" 130 | # Begin Source File 131 | 132 | SOURCE=cweave.w 133 | 134 | !IF "$(CFG)" == "cweave - Win32 Release" 135 | 136 | # Begin Custom Build 137 | InputPath=cweave.w 138 | 139 | "cweave.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 140 | tie -c comm-p21.hch common.h comm-ansi.hch comm-extensions.hch comm-memory.hch comm-translation.hch comm-output.hch 141 | tie -m comm-p21.h common.h comm-p21.hch 142 | tie -c cweav-p21.ch cweave.w cweav-patch.ch cweav-ansi.ch cweav-extensions.ch cweav-memory.ch cweav-translation.ch cweav-output.ch 143 | ctangle cweave.w cweav-p21.ch cweave.cxx 144 | 145 | # End Custom Build 146 | 147 | !ELSEIF "$(CFG)" == "cweave - Win32 Debug" 148 | 149 | # Begin Custom Build 150 | InputPath=cweave.w 151 | 152 | "cweave.cxx" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" 153 | tie -c comm-p21.hch common.h comm-ansi.hch comm-extensions.hch comm-memory.hch comm-translation.hch comm-output.hch 154 | tie -m comm-p21.h common.h comm-p21.hch 155 | tie -c cweav-p21.ch cweave.w cweav-patch.ch cweav-ansi.ch cweav-extensions.ch cweav-memory.ch cweav-translation.ch cweav-output.ch 156 | ctangle cweave.w cweav-p21.ch cweave.cxx 157 | 158 | # End Custom Build 159 | 160 | !ENDIF 161 | 162 | # End Source File 163 | # End Group 164 | # End Target 165 | # End Project 166 | -------------------------------------------------------------------------------- /examples/wmerg-patch.ch: -------------------------------------------------------------------------------- 1 | -*-Web-*- 2 | This file, WMERG-FOO.CH, is part of CWEBBIN (Version 3.64 [2018]). 3 | It is a changefile for WMERGE.W, Version 3.64. 4 | 5 | Technically, WMERG-FOO.CH is constructed from a multitude of separate 6 | change files by applying Klaus Guntermann's TIE processor. Any comments 7 | (like this introduction) are removed from the final output, so 8 | WMERG-PATCH.CH is the place to look up the development history. 9 | 10 | Authors and Contributors: 11 | (H2B) Hans-Hermann Bode, Universität Osnabrück, 12 | (hhbode@@dosuni1.rz.uni-osnabrueck.de or HHBODE@@DOSUNI1.BITNET). 13 | 14 | (KG) Klaus Guntermann, TH Darmstadt, 15 | (guntermann@@iti.informatik.th-darmstadt.de). 16 | 17 | (AS) Andreas Scherer, RWTH Aachen, 18 | (andreas.scherer@@pobox.com). 19 | 20 | (BS) Barry Schwartz 21 | (trashman@@crud.mn.org). 22 | 23 | (GG) Giuseppe Ghibò 24 | (ghibo@@galileo.polito.it). 25 | 26 | This program is distributed WITHOUT ANY WARRANTY, express or implied. 27 | 28 | The following copyright notice extends to this changefile only, not to 29 | the masterfile WMERGE.W. 30 | 31 | Copyright (C) 1991-1993 Hans-Hermann Bode 32 | Copyright (C) 1993-1999,2005 Andreas Scherer 33 | Copyright (C) 1994 Barry Schwartz 34 | 35 | Permission is granted to make and distribute verbatim copies of this 36 | document provided that the copyright notice and this permission notice 37 | are preserved on all copies. 38 | 39 | Permission is granted to copy and distribute modified versions of this 40 | document under the conditions for verbatim copying, provided that the 41 | entire resulting derived work is distributed under the terms of a 42 | permission notice identical to this one. 43 | 44 | Version history: 45 | 46 | Version Date Author Comment 47 | p2 13 Feb 1992 H2B First hack. 48 | p3 16 Apr 1992 H2B Change of |@@i| allowed, /dev/null in case 49 | replaced by nul. 50 | p4 21 Jun 1992 H2B Nothing changed. 51 | p5 21 Jul 1992 H2B Nothing changed. 52 | p5a 30 Jul 1992 KG remove one #include , 53 | use strchr instead of index and 54 | include for |strchr| declaration 55 | p5b 06 Aug 1992 KG fixed a typo 56 | p6 06 Sep 1992 H2B Nothing changed. 57 | p6a 15 Mar 1993 AS SAS/C 6.0 support 58 | p6b 28 Jul 1993 AS make some functions return `void' 59 | p6c 04 Sep 1993 AS path searching with CWEBINCLUDE 60 | p7 09 Oct 1993 AS Updated to CWEB 2.8 61 | p8a 11 Mar 1993 H2B Converted to master change file. 62 | [Not released.] 63 | p8b 15 Apr 1993 H2B Updated for wmerge.w 3.0beta (?). 64 | [Not released.] 65 | p8c 22 Jun 1993 H2B Updated for final wmerge.w 3.0 (?). 66 | p8d 26 Oct 1993 AS Incorporated with Amiga version 2.8 [p7]. 67 | p8e 04 Nov 1993 AS New patch level in accordance with CWEB. 68 | p9 18 Nov 1993 AS Update for wmerge.w 3.1. 69 | 26 Nov 1993 AS Minor casting problems fixed. 70 | p9c 18 Jan 1994 AS Version information included. 71 | p9d 09 Aug 1994 AS Extend buf_size. 72 | p10 12 Aug 1994 AS Updated for wmerge.w 3.2. 73 | p10a 24 Aug 1994 AS New patch level. 74 | p10b 11 Oct 1994 AS Write to check_file and compare results. 75 | 13 Oct 1994 AS WMerge residentable. 76 | 18 Oct 1994 AS Some refinements for C++ compilation. 77 | 21 Oct 1994 AS Use _DEV_NULL instead of the multi-way 78 | selection for the NULL path/device. 79 | 12 Nov 1994 AS Use SEPARATORS instead of the multi-way 80 | selection for '/', ':', '\', etc. 81 | p11 03 Dec 1994 AS Updated for wmerge.w 3.3. 82 | 13 Dec 1994 AS Slight correction in `wrap_up()'. 83 | 24 Jan 1995 AS Yet another improvement in `wrap_up()'. 84 | 12 Feb 1995 AS Use `memcmp' only once. 85 | p13 10 May 1995 AS Separate change files for the various 86 | elements of this patch to facilitate 87 | maintenance. Aggregated with Guntermann's 88 | TIE processor. 89 | 13 Jun 1995 AS Updated for wmerge.w 3.4c. 90 | 15 Jun 1995 AS Bug in temporary output mechanism fixed. 91 | 28 Sep 1995 GG Minor corrections. 92 | 15 Nov 1995 AS Updated for wmerge.w 3.4e. 93 | 07 Jun 1996 AS Updated for wmerge.w 3.4g. 94 | p14 11 March 1997 AS Updated for patch level [p14]. 95 | 96 | Version 3.42 --- Don Knuth, Silvio Levy, August 1998 97 | 98 | p15 13 August 1998 AS Updated for patch level [p15]. 99 | 100 | Version 3.43 --- Don Knuth, Silvio Levy, September 1998 101 | 102 | p16 14 October 1998 AS Updated for patch level [p16]. 103 | 104 | Version 3.5 --- Don Knuth, Silvio Levy, December 1999 105 | 106 | p17 31 December 1999 AS Updated for patch level [p17]. 107 | 108 | Version 3.6 --- Don Knuth, Silvio Levy, May 2000 109 | Version 3.61 --- Don Knuth, Silvio Levy, July 2000 110 | 111 | p18 25 July 2000 AS Updated for patch level [p18]. 112 | p19 02 January 2001 AS Updated for patch level [p19]. 113 | 114 | Version 3.64 --- Don Knuth, Silvio Levy, February 2002 115 | 116 | p20 09 March 2002 AS Update for patch level [p20]. 117 | p21 29 October 2005 AS ANSI C++ patches for patch level [p21]. 118 | 22p 18 August 2011 AS ANSI C++ patches for patch level [22p]. 119 | 120 | 2018 17 October 2018 AS Updated version number [2018]. 121 | ------------------------------------------------------------------------------ 122 | Two of the last long-standing bugs in CWEB; reported to DEK long ago. 123 | 124 | @x l.8 125 | file and and optional \.{.ch} file and sends the corresponding 126 | @y 127 | file and an optional \.{.ch} file and sends the corresponding 128 | @z 129 | 130 | @x l.88 131 | @:caddr_t}{\bf caddr_t@> 132 | @y 133 | @:caddr_t}{\bf caddr\_t@> 134 | @z 135 | 136 | @x l.709 137 | @* Index. 138 | @y 139 | @* Version information. The {\mc AMIGA} operating system provides the 140 | `version' command and good programs answer with some informations about 141 | their creation date and their current version. This might be useful for 142 | other operating systems as well. 143 | 144 | @= 145 | const char Version[] = "$VER: WMerge 3.64 [CWEBbin 2018] ("@| 146 | __DATE__@= @>", "@= @>__TIME__@= @>")\n"; 147 | 148 | @* Index. 149 | @z 150 | -------------------------------------------------------------------------------- /examples/wmerg-memory.ch: -------------------------------------------------------------------------------- 1 | Changes for WMERGE.W by Andreas Scherer, December 4, 2018. 2 | 3 | This set of changes provides dynamic memory allocation for the internal 4 | fields of the CWEB system. There is no external memory configuration file 5 | as for TeX (yet), but there's already the advantage that the CWEB programs 6 | can be compiled in the `NEAR' data section and be made `resident'. 7 | 8 | This change file requires WMERG-PATCH.CH, WMERG-ANSI.CH, WMERG-EXTENSIONS.CH, 9 | and WMERG-OUTPUT.CH to be applied as well. 10 | 11 | For a complete history of the changes made to WMERGE.W see WMERG-PATCH.CH. 12 | 13 | @x l.16 14 | #include 15 | @y 16 | #include 17 | #include 18 | @z 19 | 20 | @x l.26 21 | @; 22 | @; 23 | @y 24 | @@; 25 | @@; 26 | @@; 27 | @@; 28 | @z 29 | 30 | @x l.71 31 | ASCII buffer[buf_size]; /* where each line of input goes */ 32 | ASCII *buffer_end=buffer+buf_size-2; /* end of |buffer| */ 33 | @y 34 | ASCII *buffer; /* where each line of input goes */ 35 | ASCII *buffer_end; /* end of |buffer| */ 36 | @z 37 | 38 | @x l.138 39 | FILE *file[max_include_depth]; /* stack of non-change files */ 40 | FILE *change_file; /* change file */ 41 | char file_name[max_include_depth][max_file_name_length]; 42 | /* stack of non-change file names */ 43 | char change_file_name[max_file_name_length]; /* name of change file */ 44 | char alt_web_file_name[max_file_name_length]; /* alternate name to try */ 45 | int line[max_include_depth]; /* number of current line in the stacked files */ 46 | @y 47 | FILE **file; /* stack of non-change files */ 48 | FILE *change_file; /* change file */ 49 | char **file_name; /* stack of non-change file names */ 50 | char *change_file_name; /* name of change file */ 51 | char *alt_web_file_name; /* alternate name to try */ 52 | int *line; /* number of current line in the stacked files */ 53 | @z 54 | 55 | @x l.163 56 | char change_buffer[buf_size]; /* next line of |change_file| */ 57 | @y 58 | char *change_buffer; /* next line of |change_file| */ 59 | @z 60 | 61 | @x l.370 62 | char temp_file_name[max_file_name_length]; 63 | @y 64 | static char *temp_file_name; 65 | @z 66 | 67 | @x l.375 68 | if (*loc=='"') { 69 | @y 70 | alloc_object(temp_file_name,max_file_name_length,char); 71 | if (*loc=='"') { 72 | @z 73 | 74 | @x l.587 and l.35 of WMERG-OUTPUT.CH 75 | char out_file_name[max_file_name_length]; /* name of |out_file| */ 76 | char check_file_name[max_file_name_length]; /* name of |check_file| */ 77 | boolean flags[256]; /* an option for each 8-bit code */ 78 | @y 79 | char *out_file_name; /* name of |out_file| */ 80 | char *check_file_name; /* name of |check_file| */ 81 | boolean *flags; /* an option for each 8-bit code */ 82 | @z 83 | 84 | @x l.196 of WMERG-EXTENSIONS.CH 85 | char string[max_path_length+2]; 86 | @y 87 | char *string; 88 | alloc_object(string,max_path_length+2,char); 89 | @z 90 | 91 | @x l.204 of WMERG-EXTENSIONS.CH 92 | err_print("! Include path too long"); return(0); 93 | @y 94 | err_print("! Include path too long"); 95 | free_object(string); return(0); 96 | @z 97 | 98 | @x l.211 of WMERG-EXTENSIONS.CH 99 | return(1); 100 | @y 101 | free_object(string); return(1); 102 | @z 103 | 104 | @x l.220 of WMERG-EXTENSIONS.CH 105 | char include_path[max_path_length+2];@/ 106 | @y 107 | char *include_path;@/ 108 | @z 109 | 110 | @x l.717 111 | @* Index. 112 | @y 113 | @* Dynamic memory allocation. Just as \.{CTANGLE} and \.{CWEAVE} before, 114 | \.{WMERGE} allocates all its internal arrays dynamically, so the resulting 115 | program can be compiled in the \.{NEAR} data segment and made resident on 116 | the Amiga. We do all the global allocations here. 117 | 118 | @f type int /* \.{type} becomes the pseudotype \&{type} */ 119 | @# 120 | @d alloc_object(object,size,@!type) 121 | if(!(object = (type *)malloc((size)*sizeof(type)))) 122 | fatal("! Memory allocation failure",""); 123 | @d free_object(object) 124 | if(object) { 125 | free(object); 126 | object=NULL; 127 | } 128 | 129 | @= 130 | alloc_object(buffer,buf_size,ASCII); 131 | buffer_end=buffer+buf_size-2; 132 | alloc_object(file,max_include_depth,FILE*); 133 | alloc_object(file_name,max_include_depth,char *); 134 | for(i=0; i= 147 | int i; /* index variable for initializing matrices */ 148 | 149 | @ In case of an user break we must take care of the dynamically allocated 150 | and opened resources like memory segments. There is no warranty that in 151 | such cases the exit code automatically frees these resources. |exit| is 152 | not necessarily called after a break. {\mc ANSI-C} provides ``interrupt 153 | handlers'' for this purpose. |catch_break| simply calls |wrap_up| before 154 | |exit|ing the aborted program. 155 | @^system dependencies@> 156 | 157 | @= 158 | if(signal(SIGINT,&catch_break) == SIG_ERR) 159 | exit(1); /* Interrupt handler could not be set up. */ 160 | 161 | @ The only purpose of the interrupt handler |catch_break| in case of an 162 | user abort is to call the cleanup routine that takes care of any opened 163 | system resources. 164 | 165 | @c 166 | void catch_break(int) 167 | { 168 | history=fatal_message; 169 | exit(wrap_up()); 170 | } 171 | 172 | @ @= 173 | void catch_break(int); 174 | 175 | @* Index. 176 | @z 177 | -------------------------------------------------------------------------------- /comm-mini.ch: -------------------------------------------------------------------------------- 1 | Limbo. 2 | 3 | @x 4 | \def\title{Common code for CTANGLE and CWEAVE (4.12.2 [\TeX~Live])} 5 | @y 6 | \def\title{COMMON (4.12.2 [\TeX~Live])} 7 | \def\contentspagenumber{0} 8 | @z 9 | 10 | Section 4. 11 | 12 | @x 13 | internationalization. 14 | @y 15 | internationalization. 16 | @-a@> 17 | @-s@> 18 | @-HAVE_GETTEXT@> 19 | @z 20 | 21 | Section 5. 22 | 23 | @x 24 | @ Code related to the character set: 25 | @y 26 | @ Code related to the character set: 27 | @-c@> 28 | @z 29 | 30 | Section 6. 31 | 32 | @x 33 | @ Code related to input routines: 34 | @y 35 | @ Code related to input routines: 36 | @-c@> 37 | @z 38 | 39 | Section 10. 40 | 41 | @x 42 | @ Code related to identifier and section name storage: 43 | @y 44 | @ Code related to identifier and section name storage: 45 | @-c@> 46 | @z 47 | 48 | Section 15. 49 | 50 | @x 51 | @ Code related to output: 52 | @y 53 | @r @ Code related to output: 54 | @-a@> 55 | @-b@> 56 | @z 57 | 58 | Section 24. 59 | 60 | @x 61 | @ @=@+static bool input_ln(FILE *); 62 | @y 63 | @ @=@+static bool input_ln(FILE *); 64 | @-input_ln@> 65 | @$input_ln {COMMON}23 \&{static} \&{bool} (\,)@> 66 | @z 67 | 68 | ẞection 28. 69 | 70 | @x 71 | @ @=@+static void prime_the_change_buffer(void); 72 | @y 73 | @ @=@+static void prime_the_change_buffer(void); 74 | @-prime_the_change_buffer@> 75 | @$prime_the_change_buffer {COMMON}27 \&{static} \&{void} (\,)@> 76 | @z 77 | 78 | Section 32. 79 | 80 | @x 81 | current line is nonempty. 82 | @y 83 | current line is nonempty. 84 | @-b@> 85 | @z 86 | 87 | Section 33. 88 | 89 | @x 90 | @ @=@+static void check_change(void); 91 | @y 92 | @ @=@+static void check_change(void); 93 | @-check_change@> 94 | @$check_change {COMMON}32 \&{static} \&{void} (\,)@> 95 | @z 96 | 97 | Section 36. 98 | 99 | @x 100 | @ When an \.{@@i} line is found in the |cur_file|, we must temporarily 101 | @y 102 | @r @ When an \.{@@i} line is found in the |cur_file|, we must temporarily 103 | @z 104 | 105 | Section 48. 106 | 107 | @x 108 | id_lookup( /* looks up a string in the identifier table */ 109 | @y 110 | id_lookup( /* looks up a string in the identifier table */ 111 | @-h@> 112 | @-id_lookup@> 113 | @$id_lookup {COMMON}48 \&{name\_pointer} (\,)@> 114 | @z 115 | 116 | Section 49. 117 | 118 | @x 119 | h=(int)((eight_bits)*i); 120 | @y 121 | h=(int)((eight_bits)*i); 122 | @% 123 | @$h {COMMON}48 \&{int}@> 124 | @z 125 | 126 | Section 52. 127 | 128 | @x 129 | @d first_chunk(p) ((p)->byte_start+2) 130 | @y 131 | @-m@> 132 | @d first_chunk(p) ((p)->byte_start+2) 133 | @z 134 | 135 | Section 53. 136 | 137 | @x 138 | *dest='\0'; 139 | } 140 | 141 | @ @c 142 | @y 143 | *dest='\0'; 144 | } 145 | 146 | @r @ @c 147 | @z 148 | 149 | Section 56. 150 | 151 | @x 152 | static int web_strcmp( /* fuller comparison than |strcmp| */ 153 | @y 154 | static int web_strcmp( /* fuller comparison than |strcmp| */ 155 | @-web_strcmp@> 156 | @$web_strcmp {COMMON}56 \&{static} \&{int} ${}(\,){}$@> 157 | @z 158 | 159 | Section 57. 160 | 161 | @x 162 | add_section_name( /* install a new node in the tree */ 163 | @y 164 | add_section_name( /* install a new node in the tree */ 165 | @-add_section_name@> 166 | @$add_section_name {COMMON}57 \&{static} \&{name\_pointer} ${}(\,){}$@> 167 | @z 168 | 169 | Section 59. 170 | 171 | @x 172 | @ The |section_lookup| procedure is supposed to find a 173 | @y 174 | @r @ The |section_lookup| procedure is supposed to find a 175 | @z 176 | 177 | @x 178 | section_lookup( /* find or install section name in tree */ 179 | @y 180 | section_lookup( /* find or install section name in tree */ 181 | @-section_lookup@> 182 | @$section_lookup {COMMON}59 \&{name\_pointer} (\,)@> 183 | @z 184 | 185 | Section 62. 186 | 187 | @x 188 | @ Although error messages are given in anomalous cases, we do return the 189 | @y 190 | @r @ Although error messages are given in anomalous cases, we do return the 191 | @z 192 | 193 | Section 64. 194 | 195 | @x 196 | @ @=@+static int section_name_cmp(char **,size_t,name_pointer); 197 | @y 198 | @ @=@+static int section_name_cmp(char **,size_t,name_pointer); 199 | @-section_name_cmp@> 200 | @$section_name_cmp {COMMON}63 \&{static} \&{int} (\,)@> 201 | @z 202 | 203 | Section 66. 204 | 205 | @x 206 | err_print( /* prints `\..' and location of error message */ 207 | @y 208 | err_print( /* prints `\..' and location of error message */ 209 | @-err_print@> 210 | @$err_print {COMMON}66 \&{void} (\,)@> 211 | @z 212 | 213 | Section 75. 214 | 215 | @x 216 | systems the contents of the compile-time variable |DEV_NULL| (\TeX~Live) or 217 | @y 218 | systems the contents of the compile-time variable |DEV_NULL| (\TeX~Live) or 219 | @-DEV_NULL@> 220 | @-_DEV_NULL@> 221 | @z 222 | 223 | Section 76. 224 | 225 | @x 226 | @ @=@+static void scan_args(void); 227 | @y 228 | @ @=@+static void scan_args(void); 229 | @-scan_args@> 230 | @$scan_args {COMMON}75 \&{static} \&{void} (\,)@> 231 | @z 232 | 233 | Section 77. 234 | 235 | @x 236 | @ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it, 237 | @y 238 | @r @ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it, 239 | @z 240 | 241 | Section 87. 242 | 243 | @x 244 | |bindtextdomain| argument string need a few extra variables. 245 | @y 246 | |bindtextdomain| argument string need a few extra variables. 247 | @-SEPARATORS@> 248 | @z 249 | 250 | Section 91. 251 | 252 | @x 253 | @.cweb.mo@> 254 | @y 255 | @.cweb.mo@> 256 | @-HAVE_GETTEXT@> 257 | @-TEXMFLOCALEDIR@> 258 | @-a@> 259 | @-b@> 260 | @z 261 | 262 | Section 93. 263 | 264 | @x 265 | @d kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) 266 | @y 267 | @d kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) 268 | @-name@> 269 | @z 270 | 271 | Section 96. 272 | 273 | @x 274 | #include "help.h" /* |@!CTANGLEHELP|, |@!CWEAVEHELP|, |@!CTWILLHELP| */ 275 | @y 276 | #include "help.h" /* |@!CTANGLEHELP|, |@!CWEAVEHELP|, |@!CTWILLHELP| */ 277 | @$CTANGLEHELP "help.h" \zip@> 278 | @$CTWILLHELP "help.h" \zip@> 279 | @$CWEAVEHELP "help.h" \zip@> 280 | @-CWEB@> 281 | @z 282 | 283 | Section 85/102. 284 | 285 | @x 286 | @* Index. 287 | @y 288 | @z 289 | -------------------------------------------------------------------------------- /vault/cweav-memory.ch: -------------------------------------------------------------------------------- 1 | Changes for CWEAVE.W by Andreas Scherer, December 4, 2018. 2 | 3 | This set of changes provides dynamic memory allocation for the internal 4 | fields of the CWEB system. There is no external memory configuration file 5 | as for TeX (yet), but there's already the advantage that the CWEB programs 6 | can be compiled in the `NEAR' data section and be made `resident'. 7 | 8 | This change file requires CWEAV-PATCH.CH, CWEAV-ANSI.CH, CWEAV-EXTENSIONS.CH, 9 | and CWEAV-OUTPUT.CH to be applied as well. 10 | 11 | For a complete history of the changes made to CWEAVE.W see CWEAV-PATCH.CH. 12 | 13 | @x l.241 14 | xref_info xmem[max_refs]; /* contains cross-reference information */ 15 | xref_pointer xmem_end = xmem+max_refs-1; 16 | @y 17 | xref_pointer xmem; /* contains cross-reference information */ 18 | xref_pointer xmem_end; 19 | @z 20 | 21 | @x l.255 and l.88 of CWEAV-ANSI.CH 22 | xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0; 23 | @y 24 | alloc_object(section_text,longest_name+1,char); 25 | section_text_end = section_text + longest_name; 26 | alloc_object(xmem,max_refs,xref_info); 27 | xmem_end = xmem + max_refs - 1; 28 | xref_ptr=xmem; init_node(name_dir); 29 | xref_switch=0; section_xref_switch=0; 30 | @z 31 | 32 | @x l.356 33 | token tok_mem[max_toks]; /* tokens */ 34 | token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */ 35 | token_pointer tok_start[max_texts]; /* directory into |tok_mem| */ 36 | token_pointer tok_ptr; /* first unused position in |tok_mem| */ 37 | text_pointer text_ptr; /* first unused position in |tok_start| */ 38 | text_pointer tok_start_end = tok_start+max_texts-1; /* end of |tok_start| */ 39 | @y 40 | token_pointer tok_mem; /* tokens */ 41 | token_pointer tok_mem_end; /* end of |tok_mem| */ 42 | token_pointer tok_ptr; /* first unused position in |tok_mem| */ 43 | text_pointer tok_start; /* directory into |tok_mem| */ 44 | text_pointer tok_start_end; /* end of |tok_start| */ 45 | text_pointer text_ptr; /* first unused position in |tok_start| */ 46 | @z 47 | 48 | @x l.366 49 | tok_ptr=max_tok_ptr=tok_mem+1;@/ 50 | tok_start[0]=tok_start[1]=tok_mem+1;@/ 51 | text_ptr=max_text_ptr=tok_start+1; 52 | @y 53 | alloc_object(tok_mem,max_toks,token); 54 | tok_mem_end = tok_mem + max_toks - 1; 55 | alloc_object(tok_start,max_texts,token_pointer); 56 | tok_start_end = tok_start + max_texts - 1; 57 | tok_ptr=max_tok_ptr=tok_mem+1;@/ 58 | tok_start[0]=tok_start[1]=tok_mem+1;@/ 59 | text_ptr=max_text_ptr=tok_start+1; 60 | @z 61 | 62 | @x l.560 63 | eight_bits ccode[256]; /* meaning of a char following \.{@@} */ 64 | 65 | @ @= 66 | {int c; for (c=0; c<256; c++) ccode[c]=0;} 67 | @y 68 | eight_bits *ccode; /* meaning of a char following \.{@@} */ 69 | 70 | @ @= 71 | {int c; 72 | alloc_object(ccode,256,eight_bits); 73 | for (c=0; c<256; c++) ccode[c]=0;} 74 | @z 75 | 76 | @x l.1301 77 | char out_buf[line_length+1]; /* assembled characters */ 78 | char *out_ptr; /* last character in |out_buf| */ 79 | char *out_buf_end = out_buf+line_length; /* end of |out_buf| */ 80 | @y 81 | char *out_buf; /* assembled characters */ 82 | char *out_buf_end; /* end of |out_buf| */ 83 | char *out_ptr; /* last character in |out_buf| */ 84 | @z 85 | 86 | @x l.1370 and l.99 of CWEAV-EXTENSIONS.CH 87 | out_ptr=out_buf+1; out_line=1; active_file=tex_file; *out_ptr='c'; 88 | @y 89 | alloc_object(out_buf,line_length+1,char); 90 | out_buf_end = out_buf + line_length; 91 | out_ptr=out_buf+1; out_line=1; active_file=tex_file; *out_ptr='c'; 92 | @z 93 | 94 | @x l.1715 95 | char cat_name[256][12]; 96 | 97 | @ @= 98 | {int c; for (c=0;c<256;c++) strcpy(cat_name[c],"UNKNOWN");} 99 | @y 100 | char **cat_name; 101 | 102 | @ @= 103 | alloc_object(cat_name,256,char *); 104 | {int c; for (c=0;c<256;c++) { 105 | alloc_object(cat_name[c],12,char); strcpy(cat_name[c],"UNKNOWN");}} 106 | @z 107 | 108 | @x l.2102 109 | scrap scrap_info[max_scraps]; /* memory array for scraps */ 110 | scrap_pointer scrap_info_end=scrap_info+max_scraps -1; /* end of |scrap_info| */ 111 | @y 112 | scrap_pointer scrap_info; /* memory array for scraps */ 113 | scrap_pointer scrap_info_end; /* end of |scrap_info| */ 114 | @z 115 | 116 | @x l.2112 117 | scrap_base=scrap_info+1; 118 | max_scr_ptr=scrap_ptr=scrap_info; 119 | @y 120 | alloc_object(scrap_info,max_scraps,scrap); 121 | scrap_info_end = scrap_info + max_scraps - 1; 122 | scrap_base=scrap_info+1; 123 | max_scr_ptr=scrap_ptr=scrap_info; 124 | @z 125 | 126 | @x l.3573 127 | output_state stack[stack_size]; /* info for non-current levels */ 128 | stack_pointer stack_ptr; /* first unused location in the output state stack */ 129 | stack_pointer stack_end=stack+stack_size-1; /* end of |stack| */ 130 | @y 131 | stack_pointer stack; /* info for non-current levels */ 132 | stack_pointer stack_end; /* end of |stack| */ 133 | stack_pointer stack_ptr; /* first unused location in the output state stack */ 134 | @z 135 | 136 | @x l.3579 137 | max_stack_ptr=stack; 138 | @y 139 | alloc_object(stack,stack_size,output_state); 140 | stack_end = stack + stack_size - 1; 141 | max_stack_ptr=stack; 142 | @z 143 | 144 | @x l.4372 145 | name_pointer bucket[256]; 146 | name_pointer next_name; /* successor of |cur_name| when sorting */ 147 | name_pointer blink[max_names]; /* links in the buckets */ 148 | @y 149 | name_pointer *bucket; 150 | name_pointer next_name; /* successor of |cur_name| when sorting */ 151 | name_pointer *blink; /* links in the buckets */ 152 | @z 153 | 154 | @x l.4421 155 | max_sort_ptr=scrap_info; 156 | @y 157 | alloc_object(bucket,256,name_pointer); 158 | alloc_object(blink,max_names,name_pointer); 159 | max_sort_ptr=scrap_info; 160 | @z 161 | 162 | @x l.4427 163 | eight_bits collate[102+128]; /* collation order */ 164 | @y 165 | eight_bits *collate; /* collation order */ 166 | @z 167 | 168 | @x l.4440 169 | collate[0]=0; 170 | @y 171 | alloc_object(collate,102+128,eight_bits); 172 | collate[0]=0; 173 | @z 174 | 175 | @x l.4644 176 | @** Index. 177 | @y 178 | @* Version information. The {\mc AMIGA} operating system provides the 179 | `\.{version}' command and good programs answer with some informations about 180 | their creation date and their current version. This might be useful for 181 | other operating systems as well. 182 | 183 | @= 184 | const char Version[] = "$VER: CWEAVE @VERSION@ ("@| 185 | __DATE__@= @>", "@= @>__TIME__@= @>")\n"; 186 | 187 | @** Index. 188 | @z 189 | --------------------------------------------------------------------------------