summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2021-02-07 11:02:17 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2021-02-07 11:02:17 +0000
commit3063cfbe5a32a13420a310bad225be72bcde4982 (patch)
tree01cdd5b69339785bc339eeaa5ec8e5e0dc7e29d0 /Build
parent1842aa2477fe04aa641c9332262e21b78c4e50ed (diff)
CWEB – release 4.0, 2021-02-07.
In the course of the "2021 TeX tuneup", Don Knuth kindly transferred the responsibility for CWEB to me; see the original CWEB home page (https://www-cs-faculty.stanford.edu/~knuth/cweb.html), section "CWEB 4.0" and the updated CWEB development project (https://github.com/ascherer/cweb). This first new release draws heavily on the multi-decade work collected in my "CWEBbin" project (https://github.com/ascherer/cwebbin). I moved (almost) all stuff from the "*-patch.*" changefiles into the new CWEB sources and applied all of the "*-ansi.*" changes as well. Moreover, I made "common.h" the full interface of "common.w" in order to avoid code redundancy. And I tried to fix as many of the bugs reported by email to DEK and/or tex-k@tug.org. In total, "make; make cautiously; make fullmanual" runs flawlessly with GCC on Linux and with LLVM on MacOS. After the release of "CWEB 4.0", also "CWEBbin 2021" has also been fully revised. Thousands of lines of changefiles could be purged. What's left are the clearcut extensions for CWEB and the additional stuff for integration in "TeX Live 2021". git-svn-id: svn://tug.org/texlive/trunk@57658 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/ChangeLog8
-rw-r--r--Build/source/texk/web2c/ctangleboot.cin1078
-rw-r--r--Build/source/texk/web2c/cwebboot.cin1183
-rw-r--r--Build/source/texk/web2c/cwebdir/ChangeLog32
-rw-r--r--Build/source/texk/web2c/cwebdir/Makefile2
-rw-r--r--Build/source/texk/web2c/cwebdir/README21
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-amiga.ch8
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-bs.ch210
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-mac.ch52
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-os2.ch16
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-pc.ch22
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-ql.ch251
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-vms.ch39
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-w2c.ch788
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-w2c.h73
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-w32.ch50
-rw-r--r--Build/source/texk/web2c/cwebdir/common.c978
-rw-r--r--Build/source/texk/web2c/cwebdir/common.h145
-rw-r--r--Build/source/texk/web2c/cwebdir/common.w583
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-bs.ch106
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-man.ch2
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-pc.ch12
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-ql.ch8
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-vms.ch34
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-w2c.ch514
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-w32.ch62
-rw-r--r--Build/source/texk/web2c/cwebdir/ctangle.c908
-rw-r--r--Build/source/texk/web2c/cwebdir/ctangle.w372
-rw-r--r--Build/source/texk/web2c/cwebdir/ctwill-mini.ch483
-rw-r--r--Build/source/texk/web2c/cwebdir/ctwill-w2c.ch1467
-rw-r--r--Build/source/texk/web2c/cwebdir/ctwill.bux174
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-bs.ch132
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-man.ch2
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-pc.ch19
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-ql.ch8
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-vms.ch35
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-w2c.ch1453
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-w32.ch54
-rw-r--r--Build/source/texk/web2c/cwebdir/cweave.w1064
-rw-r--r--Build/source/texk/web2c/cwebdir/cweb.122
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebmac.tex7
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebman-w2c.ch131
-rw-r--r--Build/source/texk/web2c/cwebdir/cwebman.tex204
-rw-r--r--Build/source/texk/web2c/cwebdir/examples/wmerge.w2
-rw-r--r--Build/source/texk/web2c/cwebdir/po/cweb-tl.pot38
-rw-r--r--Build/source/texk/web2c/cwebdir/po/cweb.pot210
-rw-r--r--Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po50
-rw-r--r--Build/source/texk/web2c/cwebdir/po/de/cweb.po238
-rw-r--r--Build/source/texk/web2c/cwebdir/po/de/web2c-help.po32
-rw-r--r--Build/source/texk/web2c/cwebdir/po/it/cweb.po22
-rw-r--r--Build/source/texk/web2c/cwebdir/po/web2c-help.pot8
-rw-r--r--Build/source/texk/web2c/cwebdir/system.bux2
-rw-r--r--Build/source/texk/web2c/cwebdir/texinputs/p+cwebmac.tex5
-rw-r--r--Build/source/texk/web2c/man/ctwill.man6
-rw-r--r--Build/source/texk/web2c/man/cweb.man2
55 files changed, 4902 insertions, 8525 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 9106d881c52..4bfd62c8745 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,11 @@
+2021-02-07 Andreas Scherer <https://ascherer.github.io>
+
+ * ctangleboot.cin,
+ * cwebboot.cin,
+ * cwebdir/*,
+ * man/ctwill.man,
+ * man/cweb.man: New CWEB 4.0 amd CWEBbin 2021.
+
2021-02-05 Karl Berry <karl@freefriends.org>
* mf.ch: adjust for latest fixes.
diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin
index afd215a5b09..d29a6ad3944 100644
--- a/Build/source/texk/web2c/ctangleboot.cin
+++ b/Build/source/texk/web2c/ctangleboot.cin
@@ -1,14 +1,8 @@
/*1:*/
-#line 64 "cwebdir/ctangle.w"
-
-/*2:*/
-#line 73 "cwebdir/ctang-w2c.ch"
-
-#include <string.h>
-#line 83 "cwebdir/ctangle.w"
+#line 66 "cwebdir/ctangle.w"
-/*:2*//*6:*/
-#line 52 "cwebdir/comm-w2c.h"
+/*4:*/
+#line 53 "cwebdir/comm-w2c.h"
#ifndef HAVE_GETTEXT
#define HAVE_GETTEXT 0
@@ -20,33 +14,20 @@
#define gettext(A) A
#endif
+#include <ctype.h>
#include <stdbool.h>
+#include <stddef.h>
#include <stdint.h>
-#include <stdio.h>
-
-/*:6*//*62:*/
-#line 888 "cwebdir/ctangle.w"
-
-#include <ctype.h>
#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
-/*:62*/
-#line 65 "cwebdir/ctangle.w"
+/*:4*/
+#line 67 "cwebdir/ctangle.w"
-#define banner "This is CTANGLE, Version 3.64" \
+#define banner "This is CTANGLE, Version 4.0" \
\
-#define max_bytes 1000000 \
-
-#define max_toks 1000000
-#define max_names 10239 \
-
-#define max_texts 10239
-#define hash_size 8501
-#define longest_name 10000
-#define stack_size 50
-#define buf_size 1000 \
-
#define _(S) gettext(S) \
#define and_and 04
@@ -87,15 +68,20 @@
#define mark_harmless {if(history==spotless) history= harmless_message;}
#define mark_error history= error_message
#define confusion(s) fatal(_("! This can't happen: ") ,s) \
+ \
+
+#define max_include_depth 10 \
#define max_file_name_length 1024
#define cur_file file[include_depth]
#define cur_file_name file_name[include_depth]
-#define web_file_name file_name[0]
-#define cur_line line[include_depth] \
+#define cur_line line[include_depth]
+#define web_file file[0]
+#define web_file_name file_name[0] \
#define show_banner flags['b']
#define show_progress flags['p']
+#define show_stats flags['s']
#define show_happiness flags['h']
#define temporary_output flags['t']
#define make_xrefs flags['x'] \
@@ -107,6 +93,18 @@
#define C_printf(c,a) fprintf(C_file,c,a)
#define C_putc(c) putc(c,C_file) \
+#define max_bytes 1000000 \
+
+#define max_toks 1000000
+#define max_names 10239 \
+
+#define max_sections 4000
+#define max_texts 10239
+#define longest_name 10000
+#define stack_size 500
+#define buf_size 1000
+#define long_buf_size (buf_size+longest_name) \
+
#define equiv equiv_or_xref \
#define section_flag max_texts \
@@ -148,7 +146,7 @@
#define isxalpha(c) ((c) =='_'||(c) =='$') \
-#define ishigh(c) ((unsigned char) (c) > 0177) \
+#define ishigh(c) ((eight_bits) (c) > 0177) \
\
#define compress(c) if(loc++<=limit) return(c) \
@@ -159,10 +157,10 @@
#define max_banner 50 \
-#line 66 "cwebdir/ctangle.w"
+#line 68 "cwebdir/ctangle.w"
-/*5:*/
-#line 34 "cwebdir/comm-w2c.h"
+/*3:*/
+#line 35 "cwebdir/comm-w2c.h"
typedef bool boolean;
typedef uint8_t eight_bits;
@@ -173,24 +171,24 @@ ctangle,cweave,ctwill
extern cweb program;
extern int phase;
-/*:5*//*7:*/
-#line 86 "cwebdir/comm-w2c.h"
+/*:3*//*5:*/
+#line 91 "cwebdir/comm-w2c.h"
extern char section_text[];
extern char*section_text_end;
extern char*id_first;
extern char*id_loc;
-/*:7*//*8:*/
-#line 101 "cwebdir/comm-w2c.h"
+/*:5*//*6:*/
+#line 105 "cwebdir/comm-w2c.h"
extern char buffer[];
extern char*buffer_end;
extern char*loc;
extern char*limit;
-/*:8*//*9:*/
-#line 116 "cwebdir/comm-w2c.h"
+/*:6*//*7:*/
+#line 120 "cwebdir/comm-w2c.h"
typedef struct name_info{
char*byte_start;
@@ -213,27 +211,14 @@ extern char*byte_ptr;
extern name_pointer hash[];
extern hash_pointer hash_end;
extern hash_pointer h;
-extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
-extern name_pointer id_lookup(const char*,const char*,char);
-extern name_pointer section_lookup(char*,char*,int);
-extern void init_node(name_pointer);
-extern void init_p(name_pointer,eight_bits);
-extern void print_prefix_name(name_pointer);
-extern void print_section_name(name_pointer);
-extern void sprint_section_name(char*,name_pointer);
-
-/*:9*//*10:*/
-#line 157 "cwebdir/comm-w2c.h"
+/*:7*//*9:*/
+#line 164 "cwebdir/comm-w2c.h"
extern int history;
-extern int wrap_up(void);
-extern void err_print(const char*);
-extern void fatal(const char*,const char*);
-extern void overflow(const char*);
-/*:10*//*11:*/
-#line 172 "cwebdir/comm-w2c.h"
+/*:9*//*11:*/
+#line 184 "cwebdir/comm-w2c.h"
extern int include_depth;
extern FILE*file[];
@@ -242,63 +227,53 @@ extern char C_file_name[];
extern char tex_file_name[];
extern char idx_file_name[];
extern char scn_file_name[];
-extern char check_file_name[];
extern char file_name[][max_file_name_length];
extern char change_file_name[];
+extern char check_file_name[];
extern int line[];
extern int change_line;
extern int change_depth;
extern boolean input_has_ended;
extern boolean changing;
extern boolean web_file_open;
-extern boolean get_line(void);
-extern void check_complete(void);
-extern void reset_input(void);
-/*:11*//*12:*/
-#line 195 "cwebdir/comm-w2c.h"
+/*:11*//*13:*/
+#line 209 "cwebdir/comm-w2c.h"
extern sixteen_bits section_count;
extern boolean changed_section[];
extern boolean change_pending;
extern boolean print_where;
-/*:12*//*13:*/
-#line 208 "cwebdir/comm-w2c.h"
+/*:13*//*14:*/
+#line 223 "cwebdir/comm-w2c.h"
extern int argc;
extern char**argv;
extern boolean flags[];
+extern const char*use_language;
-/*:13*//*14:*/
-#line 220 "cwebdir/comm-w2c.h"
+/*:14*//*15:*/
+#line 236 "cwebdir/comm-w2c.h"
extern FILE*C_file;
extern FILE*tex_file;
extern FILE*idx_file;
extern FILE*scn_file;
-extern FILE*check_file;
extern FILE*active_file;
+extern FILE*check_file;
-/*:14*//*15:*/
-#line 230 "cwebdir/comm-w2c.h"
-
-extern void common_init(void);
-extern void print_stats(void);
-extern void cb_show_banner(void);
-#line 128 "cwebdir/ctangle.w"
-
-/*:15*//*108:*/
-#line 903 "cwebdir/ctang-w2c.ch"
+/*:15*//*116:*/
+#line 473 "cwebdir/ctang-w2c.ch"
extern char cb_banner[];
-/*:108*/
-#line 67 "cwebdir/ctangle.w"
+/*:116*/
+#line 69 "cwebdir/ctangle.w"
-/*16:*/
-#line 152 "cwebdir/ctangle.w"
+/*19:*/
+#line 124 "cwebdir/ctangle.w"
typedef struct{
eight_bits*tok_start;
@@ -306,8 +281,8 @@ sixteen_bits text_link;
}text;
typedef text*text_pointer;
-/*:16*//*27:*/
-#line 296 "cwebdir/ctangle.w"
+/*:19*//*31:*/
+#line 272 "cwebdir/ctangle.w"
typedef struct{
eight_bits*end_field;
@@ -318,11 +293,11 @@ sixteen_bits section_field;
}output_state;
typedef output_state*stack_pointer;
-/*:27*/
-#line 68 "cwebdir/ctangle.w"
+/*:31*/
+#line 70 "cwebdir/ctangle.w"
-/*17:*/
-#line 159 "cwebdir/ctangle.w"
+/*20:*/
+#line 131 "cwebdir/ctangle.w"
text text_info[max_texts];
text_pointer text_info_end= text_info+max_texts-1;
@@ -331,13 +306,13 @@ eight_bits tok_mem[max_toks];
eight_bits*tok_mem_end= tok_mem+max_toks-1;
eight_bits*tok_ptr;
-/*:17*//*23:*/
-#line 227 "cwebdir/ctangle.w"
+/*:20*//*26:*/
+#line 200 "cwebdir/ctangle.w"
text_pointer last_unnamed;
-/*:23*//*28:*/
-#line 312 "cwebdir/ctangle.w"
+/*:26*//*32:*/
+#line 288 "cwebdir/ctangle.w"
output_state cur_state;
@@ -345,163 +320,207 @@ output_state stack[stack_size+1];
stack_pointer stack_ptr;
stack_pointer stack_end= stack+stack_size;
-/*:28*//*32:*/
-#line 384 "cwebdir/ctangle.w"
+/*:32*//*37:*/
+#line 364 "cwebdir/ctangle.w"
int cur_val;
-/*:32*//*36:*/
-#line 473 "cwebdir/ctangle.w"
+/*:37*//*42:*/
+#line 456 "cwebdir/ctangle.w"
eight_bits out_state;
boolean protect;
-/*:36*//*38:*/
-#line 502 "cwebdir/ctangle.w"
+/*:42*//*45:*/
+#line 488 "cwebdir/ctangle.w"
name_pointer output_files[max_files];
name_pointer*cur_out_file,*end_output_files,*an_output_file;
char cur_section_name_char;
-char output_file_name[longest_name];
+char output_file_name[longest_name+1];
-/*:38*//*45:*/
-#line 599 "cwebdir/ctangle.w"
+/*:45*//*52:*/
+#line 588 "cwebdir/ctangle.w"
boolean output_defs_seen= 0;
-/*:45*//*51:*/
-#line 710 "cwebdir/ctangle.w"
+/*:52*//*57:*/
+#line 697 "cwebdir/ctangle.w"
char translit[128][translit_length];
-/*:51*//*56:*/
-#line 789 "cwebdir/ctangle.w"
+/*:57*//*62:*/
+#line 776 "cwebdir/ctangle.w"
eight_bits ccode[256];
-/*:56*//*59:*/
-#line 845 "cwebdir/ctangle.w"
+/*:62*//*66:*/
+#line 836 "cwebdir/ctangle.w"
boolean comment_continues= 0;
-/*:59*//*61:*/
-#line 884 "cwebdir/ctangle.w"
+/*:66*//*68:*/
+#line 875 "cwebdir/ctangle.w"
name_pointer cur_section_name;
int no_where;
-/*:61*//*75:*/
-#line 1195 "cwebdir/ctangle.w"
+/*:68*//*82:*/
+#line 1189 "cwebdir/ctangle.w"
text_pointer cur_text;
eight_bits next_control;
-/*:75*//*82:*/
-#line 1353 "cwebdir/ctangle.w"
+/*:82*//*90:*/
+#line 1350 "cwebdir/ctangle.w"
extern sixteen_bits section_count;
-/*:82*/
-#line 69 "cwebdir/ctangle.w"
+/*:90*/
+#line 71 "cwebdir/ctangle.w"
-/*41:*/
-#line 533 "cwebdir/ctangle.w"
+/*8:*/
+#line 143 "cwebdir/comm-w2c.h"
-#line 264 "cwebdir/ctang-w2c.ch"
-static void phase_two(void);
-#line 535 "cwebdir/ctangle.w"
+extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
+extern name_pointer id_lookup(const char*,const char*,char);
-/*:41*//*46:*/
-#line 602 "cwebdir/ctangle.w"
+extern name_pointer section_lookup(char*,char*,int);
+extern void init_node(name_pointer);
+extern void init_p(name_pointer,eight_bits);
+extern void print_prefix_name(name_pointer);
+extern void print_section_name(name_pointer);
+extern void sprint_section_name(char*,name_pointer);
-#line 351 "cwebdir/ctang-w2c.ch"
-static void output_defs(void);
-#line 604 "cwebdir/ctangle.w"
+/*:8*//*10:*/
+#line 167 "cwebdir/comm-w2c.h"
-/*:46*//*48:*/
-#line 648 "cwebdir/ctangle.w"
+extern int wrap_up(void);
+extern void err_print(const char*);
+extern void fatal(const char*,const char*);
+extern void overflow(const char*);
-#line 371 "cwebdir/ctang-w2c.ch"
-static void out_char(eight_bits);
-#line 650 "cwebdir/ctangle.w"
+/*:10*//*12:*/
+#line 203 "cwebdir/comm-w2c.h"
-/*:48*//*90:*/
-#line 1460 "cwebdir/ctangle.w"
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
-#line 667 "cwebdir/ctang-w2c.ch"
-static void phase_one(void);
-#line 1462 "cwebdir/ctangle.w"
+/*:12*//*16:*/
+#line 245 "cwebdir/comm-w2c.h"
-/*:90*//*92:*/
-#line 1478 "cwebdir/ctangle.w"
+extern void common_init(void);
+extern void print_stats(void);
+extern void cb_show_banner(void);
-#line 681 "cwebdir/ctang-w2c.ch"
-static void skip_limbo(void);
-#line 1480 "cwebdir/ctangle.w"
+/*:16*//*29:*/
+#line 233 "cwebdir/ctangle.w"
+
+static void store_two_bytes(sixteen_bits);
-/*:92*//*97:*/
-#line 766 "cwebdir/ctang-w2c.ch"
+/*:29*//*34:*/
+#line 312 "cwebdir/ctangle.w"
+
+static void push_level(name_pointer);
+static void pop_level(int);
+
+/*:34*//*38:*/
+#line 371 "cwebdir/ctangle.w"
+
+static void get_output(void);
+
+/*:38*//*43:*/
+#line 464 "cwebdir/ctangle.w"
+
+static void flush_buffer(void);
+
+/*:43*//*48:*/
+#line 519 "cwebdir/ctangle.w"
+
+static void phase_two(void);
+
+/*:48*//*53:*/
+#line 591 "cwebdir/ctangle.w"
+
+static void output_defs(void);
+static void out_char(eight_bits);
+
+/*:53*//*64:*/
+#line 800 "cwebdir/ctangle.w"
-static eight_bits get_next(void);
static eight_bits skip_ahead(void);
static boolean skip_comment(boolean);
-static void flush_buffer(void);
-static void get_output(void);
-static void pop_level(int);
-static void push_level(name_pointer);
+
+/*:64*//*69:*/
+#line 887 "cwebdir/ctangle.w"
+
+static eight_bits get_next(void);
+
+/*:69*//*83:*/
+#line 1193 "cwebdir/ctangle.w"
+
static void scan_repl(eight_bits);
+
+/*:83*//*91:*/
+#line 1357 "cwebdir/ctangle.w"
+
static void scan_section(void);
-static void store_two_bytes(sixteen_bits);
-/*:97*/
-#line 70 "cwebdir/ctangle.w"
+/*:91*//*99:*/
+#line 1460 "cwebdir/ctangle.w"
+static void phase_one(void);
-#line 68 "cwebdir/ctang-w2c.ch"
-/*:1*//*3:*/
-#line 91 "cwebdir/ctangle.w"
+/*:99*//*101:*/
+#line 1478 "cwebdir/ctangle.w"
+
+static void skip_limbo(void);
+
+/*:101*/
+#line 72 "cwebdir/ctangle.w"
+
+
+/*:1*//*2:*/
+#line 81 "cwebdir/ctangle.w"
-#line 82 "cwebdir/ctang-w2c.ch"
int main(
int ac,
char**av)
-#line 95 "cwebdir/ctangle.w"
{
argc= ac;argv= av;
program= ctangle;
-/*18:*/
-#line 167 "cwebdir/ctangle.w"
+/*21:*/
+#line 139 "cwebdir/ctangle.w"
text_info->tok_start= tok_ptr= tok_mem;
text_ptr= text_info+1;text_ptr->tok_start= tok_mem;
-/*:18*//*20:*/
-#line 177 "cwebdir/ctangle.w"
+/*:21*//*23:*/
+#line 149 "cwebdir/ctangle.w"
-#line 143 "cwebdir/ctang-w2c.ch"
init_node(name_dir);
-#line 179 "cwebdir/ctangle.w"
-/*:20*//*24:*/
-#line 230 "cwebdir/ctangle.w"
+/*:23*//*27:*/
+#line 203 "cwebdir/ctangle.w"
last_unnamed= text_info;text_info->text_link= 0;
-/*:24*//*39:*/
-#line 512 "cwebdir/ctangle.w"
+/*:27*//*46:*/
+#line 498 "cwebdir/ctangle.w"
cur_out_file= end_output_files= output_files+max_files;
-/*:39*//*52:*/
-#line 713 "cwebdir/ctangle.w"
+/*:46*//*58:*/
+#line 700 "cwebdir/ctangle.w"
{
int i;
-for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned)(128+i));
+for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i));
}
-/*:52*//*57:*/
-#line 792 "cwebdir/ctangle.w"
+/*:58*//*63:*/
+#line 779 "cwebdir/ctangle.w"
{
int c;
for(c= 0;c<256;c++)ccode[c]= ignore;
@@ -520,88 +539,76 @@ ccode['<']= ccode['(']= section_name;
ccode['\'']= ord;
}
-/*:57*//*71:*/
-#line 1116 "cwebdir/ctangle.w"
+/*:63*//*78:*/
+#line 1110 "cwebdir/ctangle.w"
section_text[0]= ' ';
-/*:71*//*109:*/
-#line 906 "cwebdir/ctang-w2c.ch"
+/*:78*//*117:*/
+#line 476 "cwebdir/ctang-w2c.ch"
strncpy(cb_banner,banner,max_banner-1);
-/*:109*/
-#line 98 "cwebdir/ctangle.w"
-;
+/*:117*/
+#line 88 "cwebdir/ctangle.w"
+
common_init();
-#line 90 "cwebdir/ctang-w2c.ch"
+#line 53 "cwebdir/ctang-w2c.ch"
if(show_banner)cb_show_banner();
-#line 101 "cwebdir/ctangle.w"
+#line 91 "cwebdir/ctangle.w"
phase_one();
phase_two();
return wrap_up();
}
-/*:3*//*21:*/
-#line 183 "cwebdir/ctangle.w"
+/*:2*//*24:*/
+#line 155 "cwebdir/ctangle.w"
-#line 153 "cwebdir/ctang-w2c.ch"
boolean names_match(
name_pointer p,
const char*first,
size_t l,
eight_bits t)
{(void)t;
-#line 189 "cwebdir/ctangle.w"
if(length(p)!=l)return 0;
return!strncmp(first,p->byte_start,l);
}
-/*:21*//*22:*/
-#line 198 "cwebdir/ctangle.w"
+/*:24*//*25:*/
+#line 171 "cwebdir/ctangle.w"
-#line 166 "cwebdir/ctang-w2c.ch"
void
init_node(
name_pointer node)
-#line 202 "cwebdir/ctangle.w"
{
-#line 174 "cwebdir/ctang-w2c.ch"
node->equiv= (void*)text_info;
-#line 204 "cwebdir/ctangle.w"
}
-#line 181 "cwebdir/ctang-w2c.ch"
void
init_p(name_pointer p,eight_bits t){(void)p;(void)t;}
-#line 207 "cwebdir/ctangle.w"
-/*:22*//*26:*/
-#line 260 "cwebdir/ctangle.w"
+/*:25*//*30:*/
+#line 236 "cwebdir/ctangle.w"
-#line 190 "cwebdir/ctang-w2c.ch"
-static void
+void
store_two_bytes(
sixteen_bits x)
-#line 264 "cwebdir/ctangle.w"
{
-#line 198 "cwebdir/ctang-w2c.ch"
+#line 65 "cwebdir/ctang-w2c.ch"
if(tok_ptr+2> tok_mem_end)overflow(_("token"));
-#line 266 "cwebdir/ctangle.w"
+#line 242 "cwebdir/ctangle.w"
*tok_ptr++= x>>8;
*tok_ptr++= x&0377;
}
-/*:26*//*30:*/
-#line 336 "cwebdir/ctangle.w"
+/*:30*//*35:*/
+#line 316 "cwebdir/ctangle.w"
-#line 206 "cwebdir/ctang-w2c.ch"
static void
push_level(
name_pointer p)
-#line 340 "cwebdir/ctangle.w"
{
-#line 214 "cwebdir/ctang-w2c.ch"
+#line 71 "cwebdir/ctang-w2c.ch"
if(stack_ptr==stack_end)overflow(_("stack"));
-#line 342 "cwebdir/ctangle.w"
+#line 322 "cwebdir/ctangle.w"
*stack_ptr= cur_state;
stack_ptr++;
if(p!=NULL){
@@ -611,14 +618,12 @@ cur_section= 0;
}
}
-/*:30*//*31:*/
-#line 355 "cwebdir/ctangle.w"
+/*:35*//*36:*/
+#line 335 "cwebdir/ctangle.w"
-#line 222 "cwebdir/ctang-w2c.ch"
static void
pop_level(
int flag)
-#line 359 "cwebdir/ctangle.w"
{
if(flag&&cur_repl->text_link<section_flag){
cur_repl= cur_repl->text_link+text_info;
@@ -629,13 +634,11 @@ stack_ptr--;
if(stack_ptr> stack)cur_state= *stack_ptr;
}
-/*:31*//*33:*/
-#line 391 "cwebdir/ctangle.w"
+/*:36*//*39:*/
+#line 374 "cwebdir/ctangle.w"
-#line 231 "cwebdir/ctang-w2c.ch"
static void
get_output(void)
-#line 394 "cwebdir/ctangle.w"
{
sixteen_bits a;
restart:if(stack_ptr==stack)return;
@@ -654,27 +657,25 @@ a= (a-0200)*0400+*cur_byte++;
switch(a/024000){
case 0:cur_val= a;out_char(identifier);break;
case 1:if(a==output_defs_flag)output_defs();
-else/*34:*/
-#line 423 "cwebdir/ctangle.w"
+else/*40:*/
+#line 406 "cwebdir/ctangle.w"
{
a-= 024000;
-#line 238 "cwebdir/ctang-w2c.ch"
if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir);
-#line 427 "cwebdir/ctangle.w"
else if(a!=0){
-#line 244 "cwebdir/ctang-w2c.ch"
+#line 77 "cwebdir/ctang-w2c.ch"
fputs(_("\n! Not present: <"),stdout);
-#line 429 "cwebdir/ctangle.w"
+#line 412 "cwebdir/ctangle.w"
print_section_name(a+name_dir);err_print(">");
}
goto restart;
}
-/*:34*/
-#line 412 "cwebdir/ctangle.w"
-;
+/*:40*/
+#line 395 "cwebdir/ctangle.w"
+
break;
default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val;
out_char(section_number);
@@ -682,13 +683,11 @@ out_char(section_number);
}
}
-/*:33*//*37:*/
-#line 481 "cwebdir/ctangle.w"
+/*:39*//*44:*/
+#line 467 "cwebdir/ctangle.w"
-#line 251 "cwebdir/ctang-w2c.ch"
static void
flush_buffer(void)
-#line 484 "cwebdir/ctangle.w"
{
C_putc('\n');
if(cur_line%100==0&&show_progress){
@@ -699,51 +698,49 @@ update_terminal;
cur_line++;
}
-/*:37*//*42:*/
-#line 536 "cwebdir/ctangle.w"
+/*:44*//*49:*/
+#line 522 "cwebdir/ctangle.w"
-#line 271 "cwebdir/ctang-w2c.ch"
static void
phase_two(void){
-#line 539 "cwebdir/ctangle.w"
web_file_open= 0;
cur_line= 1;
-/*29:*/
-#line 325 "cwebdir/ctangle.w"
+/*33:*/
+#line 301 "cwebdir/ctangle.w"
stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info;
cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0;
-/*:29*/
-#line 541 "cwebdir/ctangle.w"
-;
-/*44:*/
-#line 595 "cwebdir/ctangle.w"
+/*:33*/
+#line 527 "cwebdir/ctangle.w"
+
+/*51:*/
+#line 584 "cwebdir/ctangle.w"
if(!output_defs_seen)
output_defs();
-/*:44*/
-#line 542 "cwebdir/ctangle.w"
-;
+/*:51*/
+#line 528 "cwebdir/ctangle.w"
+
if(text_info->text_link==0&&cur_out_file==end_output_files){
-#line 278 "cwebdir/ctang-w2c.ch"
+#line 89 "cwebdir/ctang-w2c.ch"
fputs(_("\n! No program text was specified."),stdout);mark_harmless;
-#line 545 "cwebdir/ctangle.w"
+#line 531 "cwebdir/ctangle.w"
}
else{
if(cur_out_file==end_output_files){
if(show_progress)
-#line 284 "cwebdir/ctang-w2c.ch"
+#line 95 "cwebdir/ctang-w2c.ch"
printf(_("\nWriting the output file (%s):"),C_file_name);
-#line 551 "cwebdir/ctangle.w"
+#line 537 "cwebdir/ctangle.w"
}
else{
if(show_progress){
-#line 290 "cwebdir/ctang-w2c.ch"
+#line 101 "cwebdir/ctang-w2c.ch"
fputs(_("\nWriting the output files:"),stdout);
-#line 555 "cwebdir/ctangle.w"
+#line 541 "cwebdir/ctangle.w"
printf(" (%s)",C_file_name);
update_terminal;
@@ -752,16 +749,16 @@ if(text_info->text_link==0)goto writeloop;
}
while(stack_ptr> stack)get_output();
flush_buffer();
-writeloop:/*43:*/
-#line 322 "cwebdir/ctang-w2c.ch"
+writeloop:/*50:*/
+#line 130 "cwebdir/ctang-w2c.ch"
fclose(C_file);C_file= NULL;
-/*98:*/
-#line 786 "cwebdir/ctang-w2c.ch"
+/*106:*/
+#line 356 "cwebdir/ctang-w2c.ch"
if((C_file= fopen(C_file_name,"r"))!=NULL){
-/*99:*/
-#line 793 "cwebdir/ctang-w2c.ch"
+/*107:*/
+#line 363 "cwebdir/ctang-w2c.ch"
char x[BUFSIZ],y[BUFSIZ];
int x_size,y_size,comparison= false;
@@ -770,8 +767,8 @@ if((check_file= fopen(check_file_name,"r"))==NULL)
fatal(_("! Cannot open output file "),check_file_name);
-if(temporary_output)/*100:*/
-#line 808 "cwebdir/ctang-w2c.ch"
+if(temporary_output)/*108:*/
+#line 378 "cwebdir/ctang-w2c.ch"
do{
x_size= fread(x,1,BUFSIZ,C_file);
@@ -780,18 +777,18 @@ comparison= (x_size==y_size);
if(comparison)comparison= !memcmp(x,y,x_size);
}while(comparison&&!feof(C_file)&&!feof(check_file));
-/*:100*/
-#line 801 "cwebdir/ctang-w2c.ch"
+/*:108*/
+#line 371 "cwebdir/ctang-w2c.ch"
fclose(C_file);C_file= NULL;
fclose(check_file);check_file= NULL;
-/*:99*/
-#line 788 "cwebdir/ctang-w2c.ch"
+/*:107*/
+#line 358 "cwebdir/ctang-w2c.ch"
-/*101:*/
-#line 819 "cwebdir/ctang-w2c.ch"
+/*109:*/
+#line 389 "cwebdir/ctang-w2c.ch"
if(comparison)
remove(check_file_name);
@@ -800,14 +797,14 @@ remove(C_file_name);
rename(check_file_name,C_file_name);
}
-/*:101*/
-#line 789 "cwebdir/ctang-w2c.ch"
+/*:109*/
+#line 359 "cwebdir/ctang-w2c.ch"
}else
rename(check_file_name,C_file_name);
-/*:98*/
-#line 324 "cwebdir/ctang-w2c.ch"
+/*:106*/
+#line 132 "cwebdir/ctang-w2c.ch"
for(an_output_file= end_output_files;an_output_file> cur_out_file;){
an_output_file--;
@@ -827,15 +824,15 @@ cur_byte= cur_repl->tok_start;
cur_end= (cur_repl+1)->tok_start;
while(stack_ptr> stack)get_output();
flush_buffer();fclose(C_file);C_file= NULL;
-/*102:*/
-#line 832 "cwebdir/ctang-w2c.ch"
+/*110:*/
+#line 402 "cwebdir/ctang-w2c.ch"
if(0==strcmp("/dev/stdout",output_file_name))
-/*104:*/
-#line 859 "cwebdir/ctang-w2c.ch"
+/*112:*/
+#line 429 "cwebdir/ctang-w2c.ch"
{
-/*107:*/
-#line 890 "cwebdir/ctang-w2c.ch"
+/*115:*/
+#line 460 "cwebdir/ctang-w2c.ch"
char in_buf[BUFSIZ+1];
int in_size,comparison= true;
@@ -843,8 +840,8 @@ if((check_file= fopen(check_file_name,"r"))==NULL)
fatal(_("! Cannot open output file "),check_file_name);
-/*:107*/
-#line 860 "cwebdir/ctang-w2c.ch"
+/*:115*/
+#line 430 "cwebdir/ctang-w2c.ch"
do{
in_size= fread(in_buf,1,BUFSIZ,check_file);
@@ -852,8 +849,8 @@ in_buf[in_size]= '\0';
fprintf(stdout,"%s",in_buf);
}while(!feof(check_file));
fclose(check_file);check_file= NULL;
-/*103:*/
-#line 849 "cwebdir/ctang-w2c.ch"
+/*111:*/
+#line 419 "cwebdir/ctang-w2c.ch"
if(comparison)
remove(check_file_name);
@@ -862,20 +859,20 @@ remove(output_file_name);
rename(check_file_name,output_file_name);
}
-/*:103*/
-#line 867 "cwebdir/ctang-w2c.ch"
+/*:111*/
+#line 437 "cwebdir/ctang-w2c.ch"
}
-/*:104*/
-#line 834 "cwebdir/ctang-w2c.ch"
+/*:112*/
+#line 404 "cwebdir/ctang-w2c.ch"
else if(0==strcmp("/dev/stderr",output_file_name))
-/*105:*/
-#line 872 "cwebdir/ctang-w2c.ch"
+/*113:*/
+#line 442 "cwebdir/ctang-w2c.ch"
{
-/*107:*/
-#line 890 "cwebdir/ctang-w2c.ch"
+/*115:*/
+#line 460 "cwebdir/ctang-w2c.ch"
char in_buf[BUFSIZ+1];
int in_size,comparison= true;
@@ -883,8 +880,8 @@ if((check_file= fopen(check_file_name,"r"))==NULL)
fatal(_("! Cannot open output file "),check_file_name);
-/*:107*/
-#line 873 "cwebdir/ctang-w2c.ch"
+/*:115*/
+#line 443 "cwebdir/ctang-w2c.ch"
do{
in_size= fread(in_buf,1,BUFSIZ,check_file);
@@ -892,8 +889,8 @@ in_buf[in_size]= '\0';
fprintf(stderr,"%s",in_buf);
}while(!feof(check_file));
fclose(check_file);check_file= NULL;
-/*103:*/
-#line 849 "cwebdir/ctang-w2c.ch"
+/*111:*/
+#line 419 "cwebdir/ctang-w2c.ch"
if(comparison)
remove(check_file_name);
@@ -902,21 +899,21 @@ remove(output_file_name);
rename(check_file_name,output_file_name);
}
-/*:103*/
-#line 880 "cwebdir/ctang-w2c.ch"
+/*:111*/
+#line 450 "cwebdir/ctang-w2c.ch"
}
-/*:105*/
-#line 836 "cwebdir/ctang-w2c.ch"
+/*:113*/
+#line 406 "cwebdir/ctang-w2c.ch"
else if(0==strcmp("/dev/null",output_file_name))
-/*106:*/
-#line 885 "cwebdir/ctang-w2c.ch"
+/*114:*/
+#line 455 "cwebdir/ctang-w2c.ch"
{
int comparison= true;
-/*103:*/
-#line 849 "cwebdir/ctang-w2c.ch"
+/*111:*/
+#line 419 "cwebdir/ctang-w2c.ch"
if(comparison)
remove(check_file_name);
@@ -925,18 +922,18 @@ remove(output_file_name);
rename(check_file_name,output_file_name);
}
-/*:103*/
-#line 887 "cwebdir/ctang-w2c.ch"
+/*:111*/
+#line 457 "cwebdir/ctang-w2c.ch"
}
-/*:106*/
-#line 838 "cwebdir/ctang-w2c.ch"
+/*:114*/
+#line 408 "cwebdir/ctang-w2c.ch"
else{
if((C_file= fopen(output_file_name,"r"))!=NULL){
-/*99:*/
-#line 793 "cwebdir/ctang-w2c.ch"
+/*107:*/
+#line 363 "cwebdir/ctang-w2c.ch"
char x[BUFSIZ],y[BUFSIZ];
int x_size,y_size,comparison= false;
@@ -945,8 +942,8 @@ if((check_file= fopen(check_file_name,"r"))==NULL)
fatal(_("! Cannot open output file "),check_file_name);
-if(temporary_output)/*100:*/
-#line 808 "cwebdir/ctang-w2c.ch"
+if(temporary_output)/*108:*/
+#line 378 "cwebdir/ctang-w2c.ch"
do{
x_size= fread(x,1,BUFSIZ,C_file);
@@ -955,18 +952,18 @@ comparison= (x_size==y_size);
if(comparison)comparison= !memcmp(x,y,x_size);
}while(comparison&&!feof(C_file)&&!feof(check_file));
-/*:100*/
-#line 801 "cwebdir/ctang-w2c.ch"
+/*:108*/
+#line 371 "cwebdir/ctang-w2c.ch"
fclose(C_file);C_file= NULL;
fclose(check_file);check_file= NULL;
-/*:99*/
-#line 841 "cwebdir/ctang-w2c.ch"
+/*:107*/
+#line 411 "cwebdir/ctang-w2c.ch"
-/*103:*/
-#line 849 "cwebdir/ctang-w2c.ch"
+/*111:*/
+#line 419 "cwebdir/ctang-w2c.ch"
if(comparison)
remove(check_file_name);
@@ -975,39 +972,37 @@ remove(output_file_name);
rename(check_file_name,output_file_name);
}
-/*:103*/
-#line 842 "cwebdir/ctang-w2c.ch"
+/*:111*/
+#line 412 "cwebdir/ctang-w2c.ch"
}else
rename(check_file_name,output_file_name);
}
-/*:102*/
-#line 343 "cwebdir/ctang-w2c.ch"
+/*:110*/
+#line 151 "cwebdir/ctang-w2c.ch"
}
strcpy(check_file_name,"");
-#line 590 "cwebdir/ctangle.w"
+#line 579 "cwebdir/ctangle.w"
+
+/*:50*/
+#line 549 "cwebdir/ctangle.w"
-/*:43*/
-#line 563 "cwebdir/ctangle.w"
-;
-#line 296 "cwebdir/ctang-w2c.ch"
if(show_happiness){
if(show_progress)new_line;
+#line 107 "cwebdir/ctang-w2c.ch"
fputs(_("Done."),stdout);
+#line 553 "cwebdir/ctangle.w"
}
-#line 565 "cwebdir/ctangle.w"
}
}
-/*:42*//*47:*/
-#line 605 "cwebdir/ctangle.w"
+/*:49*//*54:*/
+#line 595 "cwebdir/ctangle.w"
-#line 358 "cwebdir/ctang-w2c.ch"
static void
output_defs(void)
-#line 608 "cwebdir/ctangle.w"
{
sixteen_bits a;
push_level(NULL);
@@ -1030,9 +1025,9 @@ a= (a-0200)*0400+*cur_byte++;
if(a<024000){
cur_val= a;out_char(identifier);
}
-#line 365 "cwebdir/ctang-w2c.ch"
+#line 159 "cwebdir/ctang-w2c.ch"
else if(a<050000){confusion(_("macro defs have strange char"));}
-#line 631 "cwebdir/ctangle.w"
+#line 621 "cwebdir/ctangle.w"
else{
cur_val= a-050000;cur_section= cur_val;out_char(section_number);
}
@@ -1045,14 +1040,12 @@ flush_buffer();
pop_level(0);
}
-/*:47*//*49:*/
-#line 651 "cwebdir/ctangle.w"
+/*:54*//*55:*/
+#line 638 "cwebdir/ctangle.w"
-#line 379 "cwebdir/ctang-w2c.ch"
static void
out_char(
eight_bits cur_char)
-#line 655 "cwebdir/ctangle.w"
{
char*j,*k;
restart:
@@ -1060,26 +1053,26 @@ switch(cur_char){
case'\n':if(protect&&out_state!=verbatim)C_putc(' ');
if(protect||out_state==verbatim)C_putc('\\');
flush_buffer();if(out_state!=verbatim)out_state= normal;break;
-/*53:*/
-#line 719 "cwebdir/ctangle.w"
+/*59:*/
+#line 706 "cwebdir/ctangle.w"
case identifier:
if(out_state==num_or_id)C_putc(' ');
j= (cur_val+name_dir)->byte_start;
k= (cur_val+name_dir+1)->byte_start;
while(j<k){
-if((unsigned char)(*j)<0200)C_putc(*j);
+if((eight_bits)(*j)<0200)C_putc(*j);
-else C_printf("%s",translit[(unsigned char)(*j)-0200]);
+else C_printf("%s",translit[(eight_bits)(*j)-0200]);
j++;
}
out_state= num_or_id;break;
-/*:53*/
-#line 662 "cwebdir/ctangle.w"
-;
-/*54:*/
-#line 732 "cwebdir/ctangle.w"
+/*:59*/
+#line 649 "cwebdir/ctangle.w"
+
+/*60:*/
+#line 719 "cwebdir/ctangle.w"
case section_number:
if(cur_val> 0)C_printf("/*%d:*/",cur_val);
@@ -1105,11 +1098,11 @@ C_printf("%s","\"\n");
}
break;
-/*:54*/
-#line 663 "cwebdir/ctangle.w"
-;
-/*50:*/
-#line 404 "cwebdir/ctang-w2c.ch"
+/*:60*/
+#line 650 "cwebdir/ctangle.w"
+
+/*56:*/
+#line 668 "cwebdir/ctangle.w"
case plus_plus:C_putc('+');C_putc('+');out_state= normal;break;
case minus_minus:C_putc('-');C_putc('-');out_state= normal;break;
@@ -1128,11 +1121,10 @@ case colon_colon:C_putc(':');C_putc(':');out_state= normal;break;
case period_ast:C_putc('.');C_putc('*');out_state= normal;break;
case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal;
break;
-#line 699 "cwebdir/ctangle.w"
-/*:50*/
-#line 664 "cwebdir/ctangle.w"
-;
+/*:56*/
+#line 651 "cwebdir/ctangle.w"
+
case'=':case'>':C_putc(cur_char);C_putc(' ');
out_state= normal;break;
case join:out_state= unbreakable;break;
@@ -1149,14 +1141,11 @@ default:C_putc(cur_char);out_state= normal;break;
}
}
-#line 404 "cwebdir/ctang-w2c.ch"
-/*:49*//*58:*/
-#line 813 "cwebdir/ctangle.w"
+/*:55*//*65:*/
+#line 804 "cwebdir/ctangle.w"
-#line 428 "cwebdir/ctang-w2c.ch"
static eight_bits
skip_ahead(void)
-#line 816 "cwebdir/ctangle.w"
{
eight_bits c;
while(1){
@@ -1170,13 +1159,11 @@ if(c!=ignore||*(loc-1)=='>')return(c);
}
}
-/*:58*//*60:*/
-#line 848 "cwebdir/ctangle.w"
+/*:65*//*67:*/
+#line 839 "cwebdir/ctangle.w"
-#line 436 "cwebdir/ctang-w2c.ch"
static boolean skip_comment(
boolean is_long_comment)
-#line 851 "cwebdir/ctangle.w"
{
char c;
while(1){
@@ -1184,9 +1171,9 @@ if(loc> limit){
if(is_long_comment){
if(get_line())return(comment_continues= 1);
else{
-#line 443 "cwebdir/ctang-w2c.ch"
+#line 165 "cwebdir/ctang-w2c.ch"
err_print(_("! Input ended in mid-comment"));
-#line 859 "cwebdir/ctangle.w"
+#line 850 "cwebdir/ctangle.w"
return(comment_continues= 0);
}
@@ -1199,9 +1186,9 @@ loc++;return(comment_continues= 0);
}
if(c=='@'){
if(ccode[(eight_bits)*loc]==new_section){
-#line 449 "cwebdir/ctang-w2c.ch"
+#line 171 "cwebdir/ctang-w2c.ch"
err_print(_("! Section name ended in mid-comment"));loc--;
-#line 872 "cwebdir/ctangle.w"
+#line 863 "cwebdir/ctangle.w"
return(comment_continues= 0);
}
@@ -1210,13 +1197,11 @@ else loc++;
}
}
-/*:60*//*63:*/
-#line 900 "cwebdir/ctangle.w"
+/*:67*//*70:*/
+#line 890 "cwebdir/ctangle.w"
-#line 456 "cwebdir/ctang-w2c.ch"
static eight_bits
get_next(void)
-#line 903 "cwebdir/ctangle.w"
{
static int preprocessing= 0;
eight_bits c;
@@ -1226,8 +1211,8 @@ if(preprocessing&&*(limit-1)!='\\')preprocessing= 0;
if(get_line()==0)return(new_section);
else if(print_where&&!no_where){
print_where= 0;
-/*77:*/
-#line 1225 "cwebdir/ctangle.w"
+/*85:*/
+#line 1222 "cwebdir/ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1238,14 +1223,12 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-#line 598 "cwebdir/ctang-w2c.ch"
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
-#line 1237 "cwebdir/ctangle.w"
-/*:77*/
-#line 912 "cwebdir/ctangle.w"
-;
+/*:85*/
+#line 902 "cwebdir/ctangle.w"
+
}
else return('\n');
}
@@ -1257,8 +1240,8 @@ if(comment_continues)return('\n');
else continue;
}
loc++;
-if(xisdigit(c)||c=='.')/*66:*/
-#line 978 "cwebdir/ctangle.w"
+if(xisdigit(c)||c=='.')/*73:*/
+#line 971 "cwebdir/ctangle.w"
{
id_first= loc-1;
if(*id_first=='.'&&!xisdigit(*loc))goto mistake;
@@ -1282,38 +1265,34 @@ id_loc= loc;
return(constant);
}
-/*:66*/
-#line 924 "cwebdir/ctangle.w"
+/*:73*/
+#line 914 "cwebdir/ctangle.w"
-#line 463 "cwebdir/ctang-w2c.ch"
else if(c=='\''||c=='"'
||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"'))
||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"')))
-#line 926 "cwebdir/ctangle.w"
-/*67:*/
-#line 1006 "cwebdir/ctangle.w"
+/*74:*/
+#line 999 "cwebdir/ctangle.w"
{
char delim= c;
id_first= section_text+1;
id_loc= section_text;*++id_loc= delim;
-#line 494 "cwebdir/ctang-w2c.ch"
if(delim=='L'||delim=='u'||delim=='U'){
if(delim=='u'&&*loc=='8'){*++id_loc= *loc++;}
delim= *loc++;*++id_loc= delim;
}
-#line 1013 "cwebdir/ctangle.w"
while(1){
if(loc>=limit){
if(*(limit-1)!='\\'){
-#line 503 "cwebdir/ctang-w2c.ch"
+#line 177 "cwebdir/ctang-w2c.ch"
err_print(_("! String didn't end"));loc= limit;break;
-#line 1017 "cwebdir/ctangle.w"
+#line 1011 "cwebdir/ctangle.w"
}
if(get_line()==0){
-#line 509 "cwebdir/ctang-w2c.ch"
+#line 183 "cwebdir/ctang-w2c.ch"
err_print(_("! Input ended in middle of string"));loc= buffer;break;
-#line 1021 "cwebdir/ctangle.w"
+#line 1015 "cwebdir/ctangle.w"
}
else if(++id_loc<=section_text_end)*id_loc= '\n';
@@ -1331,9 +1310,9 @@ c= *loc++;
if(++id_loc<=section_text_end)*id_loc= c;
}
if(id_loc>=section_text_end){
-#line 515 "cwebdir/ctang-w2c.ch"
+#line 189 "cwebdir/ctang-w2c.ch"
fputs(_("\n! String too long: "),stdout);
-#line 1039 "cwebdir/ctangle.w"
+#line 1033 "cwebdir/ctangle.w"
term_write(section_text+1,25);
err_print("...");
@@ -1342,63 +1321,61 @@ id_loc++;
return(string);
}
-/*:67*/
-#line 926 "cwebdir/ctangle.w"
+/*:74*/
+#line 918 "cwebdir/ctangle.w"
else if(isalpha(c)||isxalpha(c)||ishigh(c))
-/*65:*/
-#line 972 "cwebdir/ctangle.w"
+/*72:*/
+#line 964 "cwebdir/ctangle.w"
{
id_first= --loc;
-#line 485 "cwebdir/ctang-w2c.ch"
while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc)
||isxalpha((eight_bits)*loc)||ishigh((eight_bits)*loc));
-#line 975 "cwebdir/ctangle.w"
id_loc= loc;return(identifier);
}
-/*:65*/
-#line 928 "cwebdir/ctangle.w"
+/*:72*/
+#line 920 "cwebdir/ctangle.w"
-else if(c=='@')/*68:*/
-#line 1050 "cwebdir/ctangle.w"
+else if(c=='@')/*75:*/
+#line 1044 "cwebdir/ctangle.w"
{
c= ccode[(eight_bits)*loc++];
switch(c){
case ignore:continue;
-#line 521 "cwebdir/ctang-w2c.ch"
+#line 195 "cwebdir/ctang-w2c.ch"
case translit_code:err_print(_("! Use @l in limbo only"));continue;
-#line 1055 "cwebdir/ctangle.w"
+#line 1049 "cwebdir/ctangle.w"
case control_text:while((c= skip_ahead())=='@');
if(*(loc-1)!='>')
-#line 527 "cwebdir/ctang-w2c.ch"
+#line 201 "cwebdir/ctang-w2c.ch"
err_print(_("! Double @ should be used in control text"));
-#line 1060 "cwebdir/ctangle.w"
+#line 1054 "cwebdir/ctangle.w"
continue;
case section_name:
cur_section_name_char= *(loc-1);
-/*70:*/
-#line 1098 "cwebdir/ctangle.w"
+/*77:*/
+#line 1092 "cwebdir/ctangle.w"
{
char*k;
-/*72:*/
-#line 1118 "cwebdir/ctangle.w"
+/*79:*/
+#line 1112 "cwebdir/ctangle.w"
k= section_text;
while(1){
if(loc> limit&&get_line()==0){
-#line 545 "cwebdir/ctang-w2c.ch"
+#line 219 "cwebdir/ctang-w2c.ch"
err_print(_("! Input ended in section name"));
-#line 1123 "cwebdir/ctangle.w"
+#line 1117 "cwebdir/ctangle.w"
loc= buffer+1;break;
}
c= *loc;
-/*73:*/
-#line 1142 "cwebdir/ctangle.w"
+/*80:*/
+#line 1136 "cwebdir/ctangle.w"
if(c=='@'){
c= *(loc+1);
@@ -1406,23 +1383,23 @@ if(c=='>'){
loc+= 2;break;
}
if(ccode[(eight_bits)c]==new_section){
-#line 557 "cwebdir/ctang-w2c.ch"
+#line 231 "cwebdir/ctang-w2c.ch"
err_print(_("! Section name didn't end"));break;
-#line 1150 "cwebdir/ctangle.w"
+#line 1144 "cwebdir/ctangle.w"
}
if(ccode[(eight_bits)c]==section_name){
-#line 563 "cwebdir/ctang-w2c.ch"
+#line 237 "cwebdir/ctang-w2c.ch"
err_print(_("! Nesting of section names not allowed"));break;
-#line 1154 "cwebdir/ctangle.w"
+#line 1148 "cwebdir/ctangle.w"
}
*(++k)= '@';loc++;
}
-/*:73*/
-#line 1127 "cwebdir/ctangle.w"
-;
+/*:80*/
+#line 1121 "cwebdir/ctangle.w"
+
loc++;if(k<section_text_end)k++;
if(xisspace(c)){
c= ' ';if(*(k-1)==' ')k--;
@@ -1430,24 +1407,24 @@ c= ' ';if(*(k-1)==' ')k--;
*k= c;
}
if(k>=section_text_end){
-#line 551 "cwebdir/ctang-w2c.ch"
+#line 225 "cwebdir/ctang-w2c.ch"
fputs(_("\n! Section name too long: "),stdout);
-#line 1136 "cwebdir/ctangle.w"
+#line 1130 "cwebdir/ctangle.w"
term_write(section_text+1,25);
printf("...");mark_harmless;
}
if(*k==' '&&k> section_text)k--;
-/*:72*/
-#line 1100 "cwebdir/ctangle.w"
-;
+/*:79*/
+#line 1094 "cwebdir/ctangle.w"
+
if(k-section_text> 3&&strncmp(k-2,"...",3)==0)
cur_section_name= section_lookup(section_text+1,k-3,1);
else cur_section_name= section_lookup(section_text+1,k,0);
if(cur_section_name_char=='(')
-/*40:*/
-#line 516 "cwebdir/ctangle.w"
+/*47:*/
+#line 502 "cwebdir/ctangle.w"
{
for(an_output_file= cur_out_file;
@@ -1457,40 +1434,40 @@ if(an_output_file==end_output_files){
if(cur_out_file> output_files)
*--cur_out_file= cur_section_name;
else{
-#line 258 "cwebdir/ctang-w2c.ch"
+#line 83 "cwebdir/ctang-w2c.ch"
overflow(_("output files"));
-#line 526 "cwebdir/ctangle.w"
+#line 512 "cwebdir/ctangle.w"
}
}
}
-/*:40*/
-#line 1106 "cwebdir/ctangle.w"
-;
+/*:47*/
+#line 1100 "cwebdir/ctangle.w"
+
return(section_name);
}
-/*:70*/
-#line 1064 "cwebdir/ctangle.w"
-;
-case string:/*74:*/
-#line 1164 "cwebdir/ctangle.w"
+/*:77*/
+#line 1058 "cwebdir/ctangle.w"
+
+case string:/*81:*/
+#line 1158 "cwebdir/ctangle.w"
{
id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';
while(*loc!='@'||*(loc+1)!='>')loc++;
-#line 569 "cwebdir/ctang-w2c.ch"
+#line 243 "cwebdir/ctang-w2c.ch"
if(loc>=limit)err_print(_("! Verbatim string didn't end"));
-#line 1168 "cwebdir/ctangle.w"
+#line 1162 "cwebdir/ctangle.w"
id_loc= loc;loc+= 2;
return(string);
}
-/*:74*/
-#line 1065 "cwebdir/ctangle.w"
-;
-case ord:/*69:*/
-#line 1077 "cwebdir/ctangle.w"
+/*:81*/
+#line 1059 "cwebdir/ctangle.w"
+
+case ord:/*76:*/
+#line 1071 "cwebdir/ctangle.w"
id_first= loc;
if(*loc=='\\'){
@@ -1499,32 +1476,32 @@ if(*++loc=='\'')loc++;
while(*loc!='\''){
if(*loc=='@'){
if(*(loc+1)!='@')
-#line 533 "cwebdir/ctang-w2c.ch"
+#line 207 "cwebdir/ctang-w2c.ch"
err_print(_("! Double @ should be used in ASCII constant"));
-#line 1086 "cwebdir/ctangle.w"
+#line 1080 "cwebdir/ctangle.w"
else loc++;
}
loc++;
if(loc> limit){
-#line 539 "cwebdir/ctang-w2c.ch"
+#line 213 "cwebdir/ctang-w2c.ch"
err_print(_("! String didn't end"));loc= limit-1;break;
-#line 1092 "cwebdir/ctangle.w"
+#line 1086 "cwebdir/ctangle.w"
}
}
loc++;
return(ord);
-/*:69*/
-#line 1066 "cwebdir/ctangle.w"
-;
+/*:76*/
+#line 1060 "cwebdir/ctangle.w"
+
default:return(c);
}
}
-/*:68*/
-#line 929 "cwebdir/ctangle.w"
+/*:75*/
+#line 921 "cwebdir/ctangle.w"
else if(xisspace(c)){
if(!preprocessing||loc> limit)continue;
@@ -1532,16 +1509,14 @@ if(!preprocessing||loc> limit)continue;
else return(' ');
}
else if(c=='#'&&loc==buffer+1)preprocessing= 1;
-mistake:/*64:*/
-#line 950 "cwebdir/ctangle.w"
+mistake:/*71:*/
+#line 942 "cwebdir/ctangle.w"
switch(c){
case'+':if(*loc=='+')compress(plus_plus);break;
case'-':if(*loc=='-'){compress(minus_minus);}
-#line 472 "cwebdir/ctang-w2c.ch"
else{if(*loc=='>'){if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);}
else compress(minus_gt);}}break;
-#line 956 "cwebdir/ctangle.w"
case'.':if(*loc=='*'){compress(period_ast);}
else if(*loc=='.'&&*(loc+1)=='.'){
loc++;compress(dot_dot_dot);
@@ -1555,30 +1530,26 @@ case'<':if(*loc=='='){compress(lt_eq);}
else if(*loc=='<')compress(lt_lt);break;
case'&':if(*loc=='&')compress(and_and);break;
case'|':if(*loc=='|')compress(or_or);break;
-#line 479 "cwebdir/ctang-w2c.ch"
case'!':if(*loc=='=')compress(non_eq);break;
-#line 970 "cwebdir/ctangle.w"
}
-/*:64*/
-#line 936 "cwebdir/ctangle.w"
+/*:71*/
+#line 928 "cwebdir/ctangle.w"
return(c);
}
}
-/*:63*//*76:*/
-#line 1199 "cwebdir/ctangle.w"
+/*:70*//*84:*/
+#line 1196 "cwebdir/ctangle.w"
-#line 583 "cwebdir/ctang-w2c.ch"
static void
scan_repl(
eight_bits t)
-#line 1203 "cwebdir/ctangle.w"
{
sixteen_bits a;
-if(t==section_name){/*77:*/
-#line 1225 "cwebdir/ctangle.w"
+if(t==section_name){/*85:*/
+#line 1222 "cwebdir/ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1589,46 +1560,44 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-#line 598 "cwebdir/ctang-w2c.ch"
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
-#line 1237 "cwebdir/ctangle.w"
-/*:77*/
-#line 1205 "cwebdir/ctangle.w"
-;}
+/*:85*/
+#line 1202 "cwebdir/ctangle.w"
+}
while(1)switch(a= get_next()){
-/*78:*/
-#line 1238 "cwebdir/ctangle.w"
+/*86:*/
+#line 1235 "cwebdir/ctangle.w"
case identifier:a= id_lookup(id_first,id_loc,0)-name_dir;
app_repl((a/0400)+0200);
app_repl(a%0400);break;
case section_name:if(t!=section_name)goto done;
else{
-/*79:*/
-#line 1271 "cwebdir/ctangle.w"
+/*87:*/
+#line 1268 "cwebdir/ctangle.w"
{
char*try_loc= loc;
while(*try_loc==' '&&try_loc<limit)try_loc++;
if(*try_loc=='+'&&try_loc<limit)try_loc++;
while(*try_loc==' '&&try_loc<limit)try_loc++;
-#line 617 "cwebdir/ctang-w2c.ch"
+#line 273 "cwebdir/ctang-w2c.ch"
if(*try_loc=='=')err_print(_("! Missing `@ ' before a named section"));
-#line 1277 "cwebdir/ctangle.w"
+#line 1274 "cwebdir/ctangle.w"
}
-/*:79*/
-#line 1244 "cwebdir/ctangle.w"
-;
+/*:87*/
+#line 1241 "cwebdir/ctangle.w"
+
a= cur_section_name-name_dir;
app_repl((a/0400)+0250);
app_repl(a%0400);
-/*77:*/
-#line 1225 "cwebdir/ctangle.w"
+/*85:*/
+#line 1222 "cwebdir/ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1639,26 +1608,24 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-#line 598 "cwebdir/ctang-w2c.ch"
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
-#line 1237 "cwebdir/ctangle.w"
-/*:77*/
-#line 1248 "cwebdir/ctangle.w"
-;break;
+/*:85*/
+#line 1245 "cwebdir/ctangle.w"
+break;
}
-#line 605 "cwebdir/ctang-w2c.ch"
+#line 261 "cwebdir/ctang-w2c.ch"
case output_defs_code:if(t!=section_name)err_print(_("! Misplaced @h"));
-#line 1251 "cwebdir/ctangle.w"
+#line 1248 "cwebdir/ctangle.w"
else{
output_defs_seen= 1;
a= output_defs_flag;
app_repl((a/0400)+0200);
app_repl(a%0400);
-/*77:*/
-#line 1225 "cwebdir/ctangle.w"
+/*85:*/
+#line 1222 "cwebdir/ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1669,39 +1636,37 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-#line 598 "cwebdir/ctang-w2c.ch"
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
-#line 1237 "cwebdir/ctangle.w"
-/*:77*/
-#line 1257 "cwebdir/ctangle.w"
-;
+/*:85*/
+#line 1254 "cwebdir/ctangle.w"
+
}
break;
case constant:case string:
-/*80:*/
-#line 1282 "cwebdir/ctangle.w"
+/*88:*/
+#line 1279 "cwebdir/ctangle.w"
app_repl(a);
while(id_first<id_loc){
if(*id_first=='@'){
if(*(id_first+1)=='@')id_first++;
-#line 623 "cwebdir/ctang-w2c.ch"
+#line 279 "cwebdir/ctang-w2c.ch"
else err_print(_("! Double @ should be used in string"));
-#line 1288 "cwebdir/ctangle.w"
+#line 1285 "cwebdir/ctangle.w"
}
app_repl(*id_first++);
}
app_repl(a);break;
-/*:80*/
-#line 1261 "cwebdir/ctangle.w"
-;
+/*:88*/
+#line 1258 "cwebdir/ctangle.w"
+
case ord:
-/*81:*/
-#line 1298 "cwebdir/ctangle.w"
+/*89:*/
+#line 1295 "cwebdir/ctangle.w"
{
int c= (eight_bits)*id_first;
if(c=='\\'){
@@ -1727,24 +1692,20 @@ case'x':
if(xisdigit(*(id_first+1)))c= *(++id_first)-'0';
else if(xisxdigit(*(id_first+1))){
++id_first;
-#line 629 "cwebdir/ctang-w2c.ch"
c= toupper((eight_bits)*id_first)-'A'+10;
-#line 1324 "cwebdir/ctangle.w"
}
if(xisdigit(*(id_first+1)))c= 16*c+*(++id_first)-'0';
else if(xisxdigit(*(id_first+1))){
++id_first;
-#line 635 "cwebdir/ctang-w2c.ch"
c= 16*c+toupper((eight_bits)*id_first)-'A'+10;
-#line 1329 "cwebdir/ctangle.w"
}
break;
case'\\':c= '\\';break;
case'\'':c= '\'';break;
case'\"':c= '\"';break;
-#line 641 "cwebdir/ctang-w2c.ch"
+#line 285 "cwebdir/ctang-w2c.ch"
default:err_print(_("! Unrecognized escape sequence"));
-#line 1335 "cwebdir/ctangle.w"
+#line 1332 "cwebdir/ctangle.w"
}
}
@@ -1757,20 +1718,20 @@ app_repl(constant);
}
break;
-/*:81*/
-#line 1263 "cwebdir/ctangle.w"
-;
+/*:89*/
+#line 1260 "cwebdir/ctangle.w"
+
case definition:case format_code:case begin_C:if(t!=section_name)goto done;
else{
-#line 611 "cwebdir/ctang-w2c.ch"
+#line 267 "cwebdir/ctang-w2c.ch"
err_print(_("! @d, @f and @c are ignored in C text"));continue;
-#line 1267 "cwebdir/ctangle.w"
+#line 1264 "cwebdir/ctangle.w"
}
case new_section:goto done;
-/*:78*/
-#line 1210 "cwebdir/ctangle.w"
+/*:86*/
+#line 1207 "cwebdir/ctangle.w"
case')':app_repl(a);
if(t==macro)app_repl(' ');
@@ -1778,19 +1739,17 @@ break;
default:app_repl(a);
}
done:next_control= (eight_bits)a;
-#line 591 "cwebdir/ctang-w2c.ch"
+#line 255 "cwebdir/ctang-w2c.ch"
if(text_ptr> text_info_end)overflow(_("text"));
-#line 1218 "cwebdir/ctangle.w"
+#line 1215 "cwebdir/ctangle.w"
cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr;
}
-/*:76*//*83:*/
+/*:84*//*92:*/
#line 1360 "cwebdir/ctangle.w"
-#line 648 "cwebdir/ctang-w2c.ch"
static void
scan_section(void)
-#line 1363 "cwebdir/ctangle.w"
{
name_pointer p;
text_pointer q;
@@ -1801,7 +1760,7 @@ printf("*%d",section_count);update_terminal;
}
next_control= 0;
while(1){
-/*84:*/
+/*93:*/
#line 1399 "cwebdir/ctangle.w"
while(next_control<definition)
@@ -1810,16 +1769,16 @@ if((next_control= skip_ahead())==section_name){
loc-= 2;next_control= get_next();
}
-/*:84*/
+/*:93*/
#line 1374 "cwebdir/ctangle.w"
-;
+
if(next_control==definition){
-/*85:*/
+/*94:*/
#line 1406 "cwebdir/ctangle.w"
{
while((next_control= get_next())=='\n');
if(next_control!=identifier){
-#line 655 "cwebdir/ctang-w2c.ch"
+#line 291 "cwebdir/ctang-w2c.ch"
err_print(_("! Definition flushed, must start with identifier"));
#line 1410 "cwebdir/ctangle.w"
@@ -1835,7 +1794,7 @@ scan_repl(macro);
cur_text->text_link= 0;
}
-/*:85*/
+/*:94*/
#line 1376 "cwebdir/ctangle.w"
continue;
@@ -1845,43 +1804,41 @@ p= name_dir;break;
}
if(next_control==section_name){
p= cur_section_name;
-/*86:*/
+/*95:*/
#line 1431 "cwebdir/ctangle.w"
while((next_control= get_next())=='+');
if(next_control!='='&&next_control!=eq_eq)
continue;
-/*:86*/
+/*:95*/
#line 1384 "cwebdir/ctangle.w"
-;
+
break;
}
return;
}
no_where= print_where= 0;
-/*87:*/
+/*96:*/
#line 1436 "cwebdir/ctangle.w"
-/*88:*/
+/*97:*/
#line 1441 "cwebdir/ctangle.w"
store_two_bytes((sixteen_bits)(0150000+section_count));
-/*:88*/
+/*:97*/
#line 1437 "cwebdir/ctangle.w"
-;
+
scan_repl(section_name);
-/*89:*/
+/*98:*/
#line 1445 "cwebdir/ctangle.w"
if(p==name_dir||p==0){
(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;
}
-#line 661 "cwebdir/ctang-w2c.ch"
else if(p->equiv==(void*)text_info)p->equiv= (void*)cur_text;
-#line 1450 "cwebdir/ctangle.w"
else{
q= (text_pointer)p->equiv;
@@ -1892,22 +1849,20 @@ q->text_link= cur_text-text_info;
cur_text->text_link= section_flag;
-/*:89*/
+/*:98*/
#line 1439 "cwebdir/ctangle.w"
-;
-/*:87*/
+
+/*:96*/
#line 1390 "cwebdir/ctangle.w"
-;
+
}
-/*:83*//*91:*/
+/*:92*//*100:*/
#line 1463 "cwebdir/ctangle.w"
-#line 674 "cwebdir/ctang-w2c.ch"
static void
phase_one(void){
-#line 1466 "cwebdir/ctangle.w"
phase= 1;
section_count= 0;
reset_input();
@@ -1917,13 +1872,11 @@ check_complete();
phase= 2;
}
-/*:91*//*93:*/
+/*:100*//*102:*/
#line 1481 "cwebdir/ctangle.w"
-#line 688 "cwebdir/ctang-w2c.ch"
static void
skip_limbo(void)
-#line 1484 "cwebdir/ctangle.w"
{
char c;
while(1){
@@ -1934,51 +1887,49 @@ if(loc++<=limit){
c= *loc++;
if(ccode[(eight_bits)c]==new_section)break;
switch(ccode[(eight_bits)c]){
-case translit_code:/*94:*/
+case translit_code:/*103:*/
#line 1510 "cwebdir/ctangle.w"
while(xisspace(*loc)&&loc<limit)loc++;
loc+= 3;
if(loc> limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2))
||(*(loc-3)>='0'&&*(loc-3)<='7')||!xisspace(*(loc-1)))
-#line 707 "cwebdir/ctang-w2c.ch"
+#line 309 "cwebdir/ctang-w2c.ch"
err_print(_("! Improper hex number following @l"));
#line 1516 "cwebdir/ctangle.w"
else{
-unsigned i;
+unsigned int i;
char*beg;
sscanf(loc-3,"%x",&i);
while(xisspace(*loc)&&loc<limit)loc++;
beg= loc;
while(loc<limit&&(xisalpha(*loc)||xisdigit(*loc)||*loc=='_'))loc++;
if(loc-beg>=translit_length)
-#line 713 "cwebdir/ctang-w2c.ch"
+#line 315 "cwebdir/ctang-w2c.ch"
err_print(_("! Replacement string in @l too long"));
#line 1526 "cwebdir/ctangle.w"
else{
-#line 719 "cwebdir/ctang-w2c.ch"
strncpy(translit[i-0200],beg,(size_t)(loc-beg));
-#line 1529 "cwebdir/ctangle.w"
translit[i-0200][loc-beg]= '\0';
}
}
-/*:94*/
+/*:103*/
#line 1494 "cwebdir/ctangle.w"
-;break;
+break;
case format_code:case'@':break;
case control_text:if(c=='q'||c=='Q'){
while((c= skip_ahead())=='@');
if(*(loc-1)!='>')
-#line 695 "cwebdir/ctang-w2c.ch"
+#line 297 "cwebdir/ctang-w2c.ch"
err_print(_("! Double @ should be used in control text"));
#line 1500 "cwebdir/ctangle.w"
break;
}
-#line 701 "cwebdir/ctang-w2c.ch"
+#line 303 "cwebdir/ctang-w2c.ch"
default:err_print(_("! Double @ should be used in limbo"));
#line 1504 "cwebdir/ctangle.w"
@@ -1987,24 +1938,23 @@ default:err_print(_("! Double @ should be used in limbo"));
}
}
-/*:93*//*95:*/
+/*:102*//*104:*/
#line 1536 "cwebdir/ctangle.w"
-#line 726 "cwebdir/ctang-w2c.ch"
void
print_stats(void){
-#line 740 "cwebdir/ctang-w2c.ch"
+#line 328 "cwebdir/ctang-w2c.ch"
puts(_("\nMemory usage statistics:"));
printf(_("%ld names (out of %ld)\n"),
-(long)(name_ptr-name_dir),(long)max_names);
+(ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf(_("%ld replacement texts (out of %ld)\n"),
-(long)(text_ptr-text_info),(long)max_texts);
+(ptrdiff_t)(text_ptr-text_info),(long)max_texts);
printf(_("%ld bytes (out of %ld)\n"),
-(long)(byte_ptr-byte_mem),(long)max_bytes);
+(ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
printf(_("%ld tokens (out of %ld)\n"),
#line 1547 "cwebdir/ctangle.w"
-(long)(tok_ptr-tok_mem),(long)max_toks);
+(ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks);
}
-#line 753 "cwebdir/ctang-w2c.ch"
-/*:95*/
+#line 341 "cwebdir/ctang-w2c.ch"
+/*:104*/
diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin
index 2854c14f822..d24ac351723 100644
--- a/Build/source/texk/web2c/cwebboot.cin
+++ b/Build/source/texk/web2c/cwebboot.cin
@@ -1,31 +1,40 @@
/*1:*/
-#line 58 "cwebdir/common.w"
+#line 66 "cwebdir/common.w"
-/*85:*/
-#line 1247 "cwebdir/comm-w2c.ch"
-
-#include <stdbool.h>
-#include <stddef.h>
-
-/*:85*//*88:*/
-#line 1286 "cwebdir/comm-w2c.ch"
+/*3:*/
+#line 53 "cwebdir/comm-w2c.h"
#ifndef HAVE_GETTEXT
#define HAVE_GETTEXT 0
#endif
#if HAVE_GETTEXT
-#include <locale.h>
#include <libintl.h>
#else
+#define gettext(A) A
+#endif
+
+#include <ctype.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+/*:3*//*89:*/
+#line 710 "cwebdir/comm-w2c.ch"
+
+#if HAVE_GETTEXT
+#include <locale.h>
+#else
#define setlocale(A,B) ""
#define bindtextdomain(A,B) ""
#define textdomain(A) ""
-#define gettext(A) A
#endif
-/*:88*//*90:*/
-#line 1380 "cwebdir/comm-w2c.ch"
+/*:89*//*91:*/
+#line 757 "cwebdir/comm-w2c.ch"
typedef bool boolean;
#define HAVE_BOOLEAN
@@ -34,14 +43,16 @@ typedef bool boolean;
#include <w2c/config.h>
#include <lib/lib.h>
-/*:90*//*93:*/
-#line 1419 "cwebdir/comm-w2c.ch"
+/*:91*//*94:*/
+#line 796 "cwebdir/comm-w2c.ch"
#define CWEB
#include "help.h"
-/*:93*/
-#line 59 "cwebdir/common.w"
+/*:94*/
+#line 67 "cwebdir/common.w"
+
+#define _(S) gettext(S) \
#define and_and 04
#define lt_lt 020
@@ -59,11 +70,29 @@ typedef bool boolean;
#define period_ast 026
#define minus_gt_ast 027 \
-#define buf_size 1000
-#define longest_name 10000
-#define long_buf_size (buf_size+longest_name)
+#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) )
#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) )
-#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) \
+#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
+
+#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
+#define print_id(c) term_write((c) ->byte_start,length((c) ) )
+#define llink link
+#define rlink dummy.Rlink
+#define root name_dir->rlink \
+
+#define chunk_marker 0 \
+
+#define spotless 0
+#define harmless_message 1
+#define error_message 2
+#define fatal_message 3
+#define mark_harmless {if(history==spotless) history= harmless_message;}
+#define mark_error history= error_message
+#define confusion(s) fatal(_("! This can't happen: ") ,s) \
+ \
#define max_include_depth 10 \
@@ -74,6 +103,32 @@ typedef bool boolean;
#define web_file file[0]
#define web_file_name file_name[0] \
+#define show_banner flags['b']
+#define show_progress flags['p']
+#define show_stats flags['s']
+#define show_happiness flags['h']
+#define temporary_output flags['t']
+#define make_xrefs flags['x'] \
+
+#define update_terminal fflush(stdout)
+#define new_line putchar('\n')
+#define putxchar putchar
+#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
+#define C_printf(c,a) fprintf(C_file,c,a)
+#define C_putc(c) putc(c,C_file) \
+
+#define max_bytes 1000000 \
+
+#define max_toks 1000000
+#define max_names 10239 \
+
+#define max_sections 4000
+#define max_texts 10239
+#define longest_name 10000
+#define stack_size 500
+#define buf_size 1000
+#define long_buf_size (buf_size+longest_name) \
+
#define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \
strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) ) \
@@ -83,31 +138,14 @@ for(loc= buffer;xisspace(*loc) ;loc++) ; \
if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b; \
} \
-#define max_sections 10239 \
- \
-
#define too_long() {include_depth--; \
err_print(_("! Include file name too long") ) ;goto restart;} \
- \
-
-#define max_bytes 1000000 \
-
-#define max_names 10239 \
- \
-
-#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
-#define print_id(c) term_write((c) ->byte_start,length((c) ) ) \
#define hash_size 8501 \
-#define llink link
-#define rlink dummy.Rlink
-#define root name_dir->rlink \
- \
-
#define first_chunk(p) ((p) ->byte_start+2)
-#define prefix_length(p) (int) ((unsigned char) *((p) ->byte_start) *256+ \
-(unsigned char) *((p) ->byte_start+1) )
+#define prefix_length(p) (int) ((eight_bits) *((p) ->byte_start) *256+ \
+(eight_bits) *((p) ->byte_start+1) )
#define set_prefix_length(p,m) (*((p) ->byte_start) = (m) /256, \
*((p) ->byte_start+1) = (m) %256) \
@@ -119,83 +157,160 @@ err_print(_("! Include file name too long") ) ;goto restart;} \
#define bad_extension 5 \
-#define spotless 0
-#define harmless_message 1
-#define error_message 2
-#define fatal_message 3
-#define mark_harmless {if(history==spotless) history= harmless_message;}
-#define mark_error history= error_message \
-
#define RETURN_OK 0
#define RETURN_WARN 5
#define RETURN_ERROR 10
#define RETURN_FAIL 20 \
-#define confusion(s) fatal(_("! This can't happen: ") ,s) \
- \
-
-#define show_banner flags['b']
-#define show_progress flags['p']
-#define show_stats flags['s']
-#define show_happiness flags['h']
-#define temporary_output flags['t']
-#define make_xrefs flags['x'] \
-
#define flag_change (**argv!='-')
-#define update_terminal fflush(stdout) \
-
-#define new_line putchar('\n')
-#define putxchar putchar
-#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
-#define C_printf(c,a) fprintf(C_file,c,a)
-#define C_putc(c) putc(c,C_file) \
-
#define max_banner 50 \
#define PATH_SEPARATOR separators[0]
#define DIR_SEPARATOR separators[1]
#define DEVICE_SEPARATOR separators[2] \
-#define _(S) gettext(S) \
-
#define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) \
-#line 60 "cwebdir/common.w"
+#line 68 "cwebdir/common.w"
/*2:*/
-#line 73 "cwebdir/common.w"
+#line 35 "cwebdir/comm-w2c.h"
-#line 77 "cwebdir/comm-w2c.ch"
+typedef bool boolean;
typedef uint8_t eight_bits;
typedef uint16_t sixteen_bits;
-#line 84 "cwebdir/comm-w2c.ch"
typedef enum{
ctangle,cweave,ctwill
}cweb;
+extern cweb program;
+extern int phase;
+
+/*:2*//*4:*/
+#line 91 "cwebdir/comm-w2c.h"
+
+extern char section_text[];
+extern char*section_text_end;
+extern char*id_first;
+extern char*id_loc;
+
+/*:4*//*5:*/
+#line 105 "cwebdir/comm-w2c.h"
+
+extern char buffer[];
+extern char*buffer_end;
+extern char*loc;
+extern char*limit;
+
+/*:5*//*6:*/
+#line 120 "cwebdir/comm-w2c.h"
+
+typedef struct name_info{
+char*byte_start;
+struct name_info*link;
+union{
+struct name_info*Rlink;
+
+char Ilk;
+}dummy;
+void*equiv_or_xref;
+}name_info;
+typedef name_info*name_pointer;
+typedef name_pointer*hash_pointer;
+extern char byte_mem[];
+extern char*byte_mem_end;
+extern name_info name_dir[];
+extern name_pointer name_dir_end;
+extern name_pointer name_ptr;
+extern char*byte_ptr;
+extern name_pointer hash[];
+extern hash_pointer hash_end;
+extern hash_pointer h;
+
+/*:6*//*8:*/
+#line 164 "cwebdir/comm-w2c.h"
+
+extern int history;
+
+/*:8*//*10:*/
+#line 184 "cwebdir/comm-w2c.h"
+
+extern int include_depth;
+extern FILE*file[];
+extern FILE*change_file;
+extern char C_file_name[];
+extern char tex_file_name[];
+extern char idx_file_name[];
+extern char scn_file_name[];
+extern char file_name[][max_file_name_length];
+
+extern char change_file_name[];
+extern char check_file_name[];
+extern int line[];
+extern int change_line;
+extern int change_depth;
+extern boolean input_has_ended;
+extern boolean changing;
+extern boolean web_file_open;
+
+/*:10*//*12:*/
+#line 209 "cwebdir/comm-w2c.h"
+
+extern sixteen_bits section_count;
+extern boolean changed_section[];
+extern boolean change_pending;
+extern boolean print_where;
+
+/*:12*//*13:*/
+#line 223 "cwebdir/comm-w2c.h"
+
+extern int argc;
+extern char**argv;
+extern boolean flags[];
+extern const char*use_language;
+
+/*:13*//*14:*/
+#line 236 "cwebdir/comm-w2c.h"
+
+extern FILE*C_file;
+extern FILE*tex_file;
+extern FILE*idx_file;
+extern FILE*scn_file;
+extern FILE*active_file;
+extern FILE*check_file;
+
+/*:14*/
+#line 69 "cwebdir/common.w"
+
+/*18:*/
+#line 85 "cwebdir/common.w"
+
+#line 72 "cwebdir/comm-w2c.ch"
cweb program;
-#line 76 "cwebdir/common.w"
+#line 87 "cwebdir/common.w"
-/*:2*//*6:*/
-#line 130 "cwebdir/comm-w2c.ch"
+/*:18*//*19:*/
+#line 94 "cwebdir/common.w"
+int phase;
+
+/*:19*//*21:*/
+#line 131 "cwebdir/common.w"
char section_text[longest_name+1];
char*section_text_end= section_text+longest_name;
char*id_first;
char*id_loc;
-#line 138 "cwebdir/common.w"
-/*:6*//*7:*/
-#line 159 "cwebdir/common.w"
+/*:21*//*22:*/
+#line 151 "cwebdir/common.w"
char buffer[long_buf_size];
char*buffer_end= buffer+buf_size-2;
char*limit= buffer;
char*loc= buffer;
-#line 155 "cwebdir/comm-w2c.ch"
-/*:7*//*10:*/
-#line 214 "cwebdir/common.w"
+/*:22*//*25:*/
+#line 196 "cwebdir/common.w"
int include_depth;
FILE*file[max_include_depth];
@@ -203,7 +318,7 @@ FILE*change_file;
char file_name[max_include_depth][max_file_name_length];
char change_file_name[max_file_name_length];
-#line 222 "cwebdir/common.w"
+#line 204 "cwebdir/common.w"
int line[max_include_depth];
int change_line;
int change_depth;
@@ -211,116 +326,84 @@ boolean input_has_ended;
boolean changing;
boolean web_file_open= 0;
-/*:10*//*20:*/
-#line 418 "cwebdir/common.w"
+/*:25*//*26:*/
+#line 222 "cwebdir/common.w"
+
+char change_buffer[buf_size];
+char*change_limit;
+
+/*:26*//*37:*/
+#line 403 "cwebdir/common.w"
-#line 420 "cwebdir/common.w"
sixteen_bits section_count;
boolean changed_section[max_sections];
boolean change_pending;
boolean print_where= 0;
-/*:20*//*27:*/
-#line 594 "cwebdir/common.w"
+/*:37*//*43:*/
+#line 600 "cwebdir/common.w"
-typedef struct name_info{
-char*byte_start;
-/*31:*/
-#line 631 "cwebdir/common.w"
-
-struct name_info*link;
-
-/*:31*//*40:*/
-#line 730 "cwebdir/common.w"
-
-union{
-struct name_info*Rlink;
-
-char Ilk;
-}dummy;
-
-/*:40*//*55:*/
-#line 773 "cwebdir/comm-w2c.ch"
-
-void*equiv_or_xref;
-#line 1064 "cwebdir/common.w"
-
-/*:55*/
-#line 597 "cwebdir/common.w"
-
-}name_info;
-typedef name_info*name_pointer;
char byte_mem[max_bytes];
char*byte_mem_end= byte_mem+max_bytes-1;
name_info name_dir[max_names];
name_pointer name_dir_end= name_dir+max_names-1;
-/*:27*//*29:*/
-#line 617 "cwebdir/common.w"
+/*:43*//*44:*/
+#line 611 "cwebdir/common.w"
name_pointer name_ptr;
char*byte_ptr;
-/*:29*//*32:*/
-#line 644 "cwebdir/common.w"
+/*:44*//*46:*/
+#line 631 "cwebdir/common.w"
-typedef name_pointer*hash_pointer;
name_pointer hash[hash_size];
hash_pointer hash_end= hash+hash_size-1;
hash_pointer h;
-/*:32*//*56:*/
-#line 1082 "cwebdir/common.w"
+/*:46*//*65:*/
+#line 1019 "cwebdir/common.w"
int history= spotless;
-/*:56*//*67:*/
-#line 1220 "cwebdir/common.w"
+/*:65*//*73:*/
+#line 1140 "cwebdir/common.w"
int argc;
char**argv;
char C_file_name[max_file_name_length];
char tex_file_name[max_file_name_length];
char idx_file_name[max_file_name_length];
-#line 934 "cwebdir/comm-w2c.ch"
+#line 431 "cwebdir/comm-w2c.ch"
char scn_file_name[max_file_name_length];
char check_file_name[max_file_name_length];
-#line 941 "cwebdir/comm-w2c.ch"
+#line 1147 "cwebdir/common.w"
boolean flags[128];
-const char*use_language= "";
-#line 1228 "cwebdir/common.w"
-/*:67*//*77:*/
-#line 1370 "cwebdir/common.w"
+/*:73*//*83:*/
+#line 1288 "cwebdir/common.w"
FILE*C_file;
FILE*tex_file;
FILE*idx_file;
-#line 1131 "cwebdir/comm-w2c.ch"
+#line 569 "cwebdir/comm-w2c.ch"
FILE*scn_file;
FILE*check_file;
-#line 1138 "cwebdir/comm-w2c.ch"
+#line 576 "cwebdir/comm-w2c.ch"
FILE*active_file;
char*found_filename;
-#line 1376 "cwebdir/common.w"
+#line 1294 "cwebdir/common.w"
-#line 1155 "cwebdir/comm-w2c.ch"
-/*:77*/
-#line 61 "cwebdir/common.w"
-
-/*3:*/
-#line 83 "cwebdir/common.w"
-int phase;
+#line 593 "cwebdir/comm-w2c.ch"
+/*:83*//*86:*/
+#line 638 "cwebdir/comm-w2c.ch"
-/*:3*//*11:*/
-#line 240 "cwebdir/common.w"
+const char*use_language= "";
-char change_buffer[buf_size];
-char*change_limit;
-/*:11*//*86:*/
-#line 1260 "cwebdir/comm-w2c.ch"
+/*:86*//*87:*/
+#line 651 "cwebdir/comm-w2c.ch"
char cb_banner[max_banner];
string texmf_locale;
@@ -329,141 +412,120 @@ string texmf_locale;
#endif
char separators[]= SEPARATORS;
-/*:86*/
-#line 62 "cwebdir/common.w"
+/*:87*/
+#line 70 "cwebdir/common.w"
-/*33:*/
-#line 650 "cwebdir/common.w"
+/*7:*/
+#line 143 "cwebdir/comm-w2c.h"
-#line 502 "cwebdir/comm-w2c.ch"
extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
-#line 652 "cwebdir/common.w"
+extern name_pointer id_lookup(const char*,const char*,char);
-/*:33*//*38:*/
-#line 703 "cwebdir/common.w"
-
-#line 532 "cwebdir/comm-w2c.ch"
-extern void init_p(name_pointer,eight_bits);
-#line 705 "cwebdir/common.w"
-
-/*:38*//*46:*/
-#line 852 "cwebdir/common.w"
-
-#line 612 "cwebdir/comm-w2c.ch"
+extern name_pointer section_lookup(char*,char*,int);
extern void init_node(name_pointer);
-#line 854 "cwebdir/common.w"
+extern void init_p(name_pointer,eight_bits);
+extern void print_prefix_name(name_pointer);
+extern void print_section_name(name_pointer);
+extern void sprint_section_name(char*,name_pointer);
-/*:46*//*53:*/
-#line 1017 "cwebdir/common.w"
+/*:7*//*9:*/
+#line 167 "cwebdir/comm-w2c.h"
-#line 738 "cwebdir/comm-w2c.ch"
-static int section_name_cmp(char**,int,name_pointer);
-#line 1019 "cwebdir/common.w"
+extern int wrap_up(void);
+extern void err_print(const char*);
+extern void fatal(const char*,const char*);
+extern void overflow(const char*);
-/*:53*//*57:*/
-#line 1092 "cwebdir/common.w"
+/*:9*//*11:*/
+#line 203 "cwebdir/comm-w2c.h"
-#line 780 "cwebdir/comm-w2c.ch"
-extern void err_print(const char*);
-#line 1094 "cwebdir/common.w"
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
-/*:57*//*60:*/
-#line 1140 "cwebdir/common.w"
+/*:11*//*15:*/
+#line 245 "cwebdir/comm-w2c.h"
-#line 807 "cwebdir/comm-w2c.ch"
-extern int wrap_up(void);
+extern void common_init(void);
extern void print_stats(void);
-#line 1143 "cwebdir/common.w"
+extern void cb_show_banner(void);
-#line 818 "cwebdir/comm-w2c.ch"
-/*:60*//*63:*/
-#line 1173 "cwebdir/common.w"
+/*:15*//*23:*/
+#line 161 "cwebdir/common.w"
-#line 881 "cwebdir/comm-w2c.ch"
-extern void fatal(const char*,const char*);
-extern void overflow(const char*);
-#line 1175 "cwebdir/common.w"
+static boolean input_ln(FILE*);
-/*:63*//*69:*/
-#line 1251 "cwebdir/common.w"
+/*:23*//*27:*/
+#line 233 "cwebdir/common.w"
-#line 971 "cwebdir/comm-w2c.ch"
-static void scan_args(void);
-#line 1253 "cwebdir/common.w"
+static void prime_the_change_buffer(void);
-/*:69*//*83:*/
-#line 1222 "cwebdir/comm-w2c.ch"
+/*:27*//*32:*/
+#line 305 "cwebdir/common.w"
-boolean get_line(void);
-name_pointer id_lookup(const char*,const char*,char);
-name_pointer section_lookup(char*,char*,int);
-void check_complete(void);
-void common_init(void);
-void print_prefix_name(name_pointer);
-void print_section_name(name_pointer);
-void reset_input(void);
-void sprint_section_name(char*,name_pointer);
+static void check_change(void);
-/*:83*//*84:*/
-#line 1235 "cwebdir/comm-w2c.ch"
+/*:32*//*55:*/
+#line 778 "cwebdir/common.w"
-static boolean input_ln(FILE*);
static int web_strcmp(char*,int,char*,int);
static name_pointer add_section_name(name_pointer,int,char*,char*,int);
static void extend_section_name(name_pointer,char*,char*,int);
-static void check_change(void);
-static void prime_the_change_buffer(void);
-/*:84*//*98:*/
-#line 1485 "cwebdir/comm-w2c.ch"
+/*:55*//*63:*/
+#line 974 "cwebdir/common.w"
+
+static int section_name_cmp(char**,int,name_pointer);
+
+/*:63*//*75:*/
+#line 1172 "cwebdir/common.w"
+
+static void scan_args(void);
+
+/*:75*//*96:*/
+#line 809 "cwebdir/comm-w2c.ch"
static void cb_usage(const_string str);
static void cb_usagehelp(const_string*message,const_string bug_email);
-void cb_show_banner(void);
-/*:98*/
-#line 63 "cwebdir/common.w"
+/*:96*/
+#line 71 "cwebdir/common.w"
-/*:1*//*4:*/
-#line 89 "cwebdir/common.w"
+/*:1*//*20:*/
+#line 100 "cwebdir/common.w"
-#line 94 "cwebdir/comm-w2c.ch"
void
common_init(void)
-#line 92 "cwebdir/common.w"
{
-#line 103 "cwebdir/comm-w2c.ch"
-/*30:*/
-#line 621 "cwebdir/common.w"
+#line 78 "cwebdir/comm-w2c.ch"
+/*45:*/
+#line 615 "cwebdir/common.w"
name_dir->byte_start= byte_ptr= byte_mem;
name_ptr= name_dir+1;
name_ptr->byte_start= byte_mem;
+root= NULL;
-/*:30*//*34:*/
-#line 655 "cwebdir/common.w"
+/*:45*//*47:*/
+#line 638 "cwebdir/common.w"
for(h= hash;h<=hash_end;*h++= NULL);
-/*:34*//*41:*/
-#line 737 "cwebdir/common.w"
+/*:47*/
+#line 78 "cwebdir/comm-w2c.ch"
-root= NULL;
-
-/*:41*/
-#line 103 "cwebdir/comm-w2c.ch"
-
-/*91:*/
-#line 1394 "cwebdir/comm-w2c.ch"
+/*92:*/
+#line 771 "cwebdir/comm-w2c.ch"
kpse_set_program_name(argv[0],"cweb");
-/*:91*/
-#line 104 "cwebdir/comm-w2c.ch"
+/*:92*/
+#line 79 "cwebdir/comm-w2c.ch"
-/*89:*/
-#line 1342 "cwebdir/comm-w2c.ch"
+#line 85 "cwebdir/comm-w2c.ch"
+/*90:*/
+#line 719 "cwebdir/comm-w2c.ch"
setlocale(LC_MESSAGES,setlocale(LC_CTYPE,""));
texmf_locale= kpse_var_expand("${TEXMFLOCALEDIR}");
@@ -478,21 +540,24 @@ free(texmf_locale);
textdomain("cweb");
-/*:89*/
-#line 105 "cwebdir/comm-w2c.ch"
+/*:90*/
+#line 85 "cwebdir/comm-w2c.ch"
-/*68:*/
-#line 1233 "cwebdir/common.w"
+/*74:*/
+#line 1153 "cwebdir/common.w"
-#line 948 "cwebdir/comm-w2c.ch"
-temporary_output= 1;
-#line 1235 "cwebdir/common.w"
+#line 438 "cwebdir/comm-w2c.ch"
+make_xrefs= true;
+temporary_output= true;
+#line 1155 "cwebdir/common.w"
+show_stats= false;
-/*:68*/
-#line 106 "cwebdir/comm-w2c.ch"
+/*:74*/
+#line 86 "cwebdir/comm-w2c.ch"
-/*78:*/
-#line 1155 "cwebdir/comm-w2c.ch"
+#line 106 "cwebdir/common.w"
+/*84:*/
+#line 593 "cwebdir/comm-w2c.ch"
scan_args();
if(program==ctangle){
@@ -523,35 +588,33 @@ else strcpy(dot_pos,".wtp");
if((tex_file= fopen(check_file_name,"wb"))==NULL)
fatal(_("! Cannot open output file "),check_file_name);
}
-#line 1388 "cwebdir/common.w"
+#line 1306 "cwebdir/common.w"
-/*:78*/
-#line 107 "cwebdir/comm-w2c.ch"
+#line 628 "cwebdir/comm-w2c.ch"
+/*:84*/
+#line 106 "cwebdir/common.w"
-#line 96 "cwebdir/common.w"
}
-/*:4*//*9:*/
-#line 172 "cwebdir/common.w"
+/*:20*//*24:*/
+#line 164 "cwebdir/common.w"
-#line 162 "cwebdir/comm-w2c.ch"
static boolean input_ln(
FILE*fp)
-#line 175 "cwebdir/common.w"
{
register int c= EOF;
register char*k;
if(feof(fp))return(0);
limit= k= buffer;
while(k<=buffer_end&&(c= getc(fp))!=EOF&&c!='\n')
-#line 169 "cwebdir/comm-w2c.ch"
+#line 92 "cwebdir/comm-w2c.ch"
if((*(k++)= c)!=' '&&c!='\r')limit= k;
-#line 182 "cwebdir/common.w"
+#line 174 "cwebdir/common.w"
if(k> buffer_end)
if((c= getc(fp))!=EOF&&c!='\n'){
-#line 175 "cwebdir/comm-w2c.ch"
+#line 98 "cwebdir/comm-w2c.ch"
ungetc(c,fp);loc= buffer;err_print(_("! Input line too long"));
-#line 185 "cwebdir/common.w"
+#line 177 "cwebdir/common.w"
}
if(c==EOF&&limit==buffer)return(0);
@@ -559,78 +622,70 @@ if(c==EOF&&limit==buffer)return(0);
return(1);
}
-/*:9*//*12:*/
-#line 251 "cwebdir/common.w"
+/*:24*//*28:*/
+#line 236 "cwebdir/common.w"
-#line 201 "cwebdir/comm-w2c.ch"
static void
prime_the_change_buffer(void)
-#line 254 "cwebdir/common.w"
{
change_limit= change_buffer;
-/*13:*/
-#line 265 "cwebdir/common.w"
+/*29:*/
+#line 250 "cwebdir/common.w"
while(1){
change_line++;
if(!input_ln(change_file))return;
if(limit<buffer+2)continue;
if(buffer[0]!='@')continue;
-#line 208 "cwebdir/comm-w2c.ch"
if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]);
-#line 272 "cwebdir/common.w"
if(buffer[1]=='x')break;
if(buffer[1]=='y'||buffer[1]=='z'||buffer[1]=='i'){
loc= buffer+2;
-#line 214 "cwebdir/comm-w2c.ch"
+#line 109 "cwebdir/comm-w2c.ch"
err_print(_("! Missing @x in change file"));
-#line 276 "cwebdir/common.w"
+#line 261 "cwebdir/common.w"
}
}
-/*:13*/
-#line 256 "cwebdir/common.w"
-;
-/*14:*/
-#line 282 "cwebdir/common.w"
+/*:29*/
+#line 241 "cwebdir/common.w"
+
+/*30:*/
+#line 267 "cwebdir/common.w"
do{
change_line++;
if(!input_ln(change_file)){
-#line 220 "cwebdir/comm-w2c.ch"
+#line 115 "cwebdir/comm-w2c.ch"
err_print(_("! Change file ended after @x"));
-#line 287 "cwebdir/common.w"
+#line 272 "cwebdir/common.w"
return;
}
}while(limit==buffer);
-/*:14*/
-#line 257 "cwebdir/common.w"
-;
-/*15:*/
-#line 292 "cwebdir/common.w"
+/*:30*/
+#line 242 "cwebdir/common.w"
+
+/*31:*/
+#line 277 "cwebdir/common.w"
{
-#line 227 "cwebdir/comm-w2c.ch"
change_limit= change_buffer+(ptrdiff_t)(limit-buffer);
strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
-#line 296 "cwebdir/common.w"
}
-/*:15*/
-#line 258 "cwebdir/common.w"
-;
+/*:31*/
+#line 243 "cwebdir/common.w"
+
}
-/*:12*//*16:*/
-#line 320 "cwebdir/common.w"
+/*:28*//*33:*/
+#line 308 "cwebdir/common.w"
-#line 235 "cwebdir/comm-w2c.ch"
static void
check_change(void)
-#line 323 "cwebdir/common.w"
{
int n= 0;
if(lines_dont_match)return;
@@ -642,62 +697,58 @@ if(!change_pending)changed_section[section_count]= 1;
while(1){
changing= 1;print_where= 1;change_line++;
if(!input_ln(change_file)){
-#line 242 "cwebdir/comm-w2c.ch"
+#line 121 "cwebdir/comm-w2c.ch"
err_print(_("! Change file ended before @y"));
-#line 335 "cwebdir/common.w"
+#line 323 "cwebdir/common.w"
change_limit= change_buffer;changing= 0;
return;
}
if(limit> buffer+1&&buffer[0]=='@'){
-#line 248 "cwebdir/comm-w2c.ch"
char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1];
-#line 341 "cwebdir/common.w"
-/*17:*/
-#line 358 "cwebdir/common.w"
+/*34:*/
+#line 346 "cwebdir/common.w"
if(xyz_code=='x'||xyz_code=='z'){
-#line 260 "cwebdir/comm-w2c.ch"
+#line 133 "cwebdir/comm-w2c.ch"
loc= buffer+2;err_print(_("! Where is the matching @y?"));
-#line 361 "cwebdir/common.w"
+#line 349 "cwebdir/common.w"
}
else if(xyz_code=='y'){
if(n> 0){
loc= buffer+2;
printf("\n! Hmm... %d ",n);
-#line 266 "cwebdir/comm-w2c.ch"
+#line 139 "cwebdir/comm-w2c.ch"
err_print(_("of the preceding lines failed to match"));
-#line 368 "cwebdir/common.w"
+#line 356 "cwebdir/common.w"
}
change_depth= include_depth;
return;
}
-/*:17*/
-#line 342 "cwebdir/common.w"
-;
+/*:34*/
+#line 330 "cwebdir/common.w"
+
}
-/*15:*/
-#line 292 "cwebdir/common.w"
+/*31:*/
+#line 277 "cwebdir/common.w"
{
-#line 227 "cwebdir/comm-w2c.ch"
change_limit= change_buffer+(ptrdiff_t)(limit-buffer);
strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
-#line 296 "cwebdir/common.w"
}
-/*:15*/
-#line 344 "cwebdir/common.w"
-;
+/*:31*/
+#line 332 "cwebdir/common.w"
+
changing= 0;cur_line++;
while(!input_ln(cur_file)){
if(include_depth==0){
-#line 254 "cwebdir/comm-w2c.ch"
+#line 127 "cwebdir/comm-w2c.ch"
err_print(_("! CWEB file ended during a change"));
-#line 349 "cwebdir/common.w"
+#line 337 "cwebdir/common.w"
input_has_ended= 1;return;
}
@@ -707,19 +758,17 @@ if(lines_dont_match)n++;
}
}
-/*:16*//*18:*/
-#line 378 "cwebdir/common.w"
+/*:33*//*35:*/
+#line 366 "cwebdir/common.w"
-#line 273 "cwebdir/comm-w2c.ch"
void
reset_input(void)
-#line 381 "cwebdir/common.w"
{
limit= buffer;loc= buffer+1;buffer[0]= ' ';
-/*19:*/
-#line 393 "cwebdir/common.w"
+/*36:*/
+#line 381 "cwebdir/common.w"
-#line 284 "cwebdir/comm-w2c.ch"
+#line 149 "cwebdir/comm-w2c.ch"
if((found_filename= kpse_find_cweb(web_file_name))==NULL||
(web_file= fopen(found_filename,"r"))==NULL){
fatal(_("! Cannot open input file "),web_file_name);
@@ -730,11 +779,11 @@ strcpy(web_file_name,found_filename+
((strncmp(found_filename,"./",2)==0)?2:0));
free(found_filename);
}else fatal(_("! Filename too long\n"),found_filename);
-#line 399 "cwebdir/common.w"
+#line 387 "cwebdir/common.w"
web_file_open= 1;
-#line 300 "cwebdir/comm-w2c.ch"
+#line 165 "cwebdir/comm-w2c.ch"
if((found_filename= kpse_find_cweb(change_file_name))==NULL||
(change_file= fopen(found_filename,"r"))==NULL){
fatal(_("! Cannot open change file "),change_file_name);
@@ -745,34 +794,32 @@ strcpy(change_file_name,found_filename+
((strncmp(found_filename,"./",2)==0)?2:0));
free(found_filename);
}else fatal(_("! Filename too long\n"),found_filename);
-#line 404 "cwebdir/common.w"
+#line 392 "cwebdir/common.w"
+
+/*:36*/
+#line 371 "cwebdir/common.w"
-/*:19*/
-#line 383 "cwebdir/common.w"
-;
include_depth= 0;cur_line= 0;change_line= 0;
change_depth= include_depth;
changing= 1;prime_the_change_buffer();changing= !changing;
limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= 0;
}
-/*:18*//*21:*/
-#line 426 "cwebdir/common.w"
+/*:35*//*38:*/
+#line 410 "cwebdir/common.w"
-#line 328 "cwebdir/comm-w2c.ch"
boolean get_line(void)
-#line 428 "cwebdir/common.w"
{
restart:
if(changing&&include_depth==change_depth)
-/*25:*/
-#line 537 "cwebdir/common.w"
+/*41:*/
+#line 518 "cwebdir/common.w"
{
change_line++;
if(!input_ln(change_file)){
-#line 440 "cwebdir/comm-w2c.ch"
+#line 274 "cwebdir/comm-w2c.ch"
err_print(_("! Change file ended without @z"));
-#line 541 "cwebdir/common.w"
+#line 522 "cwebdir/common.w"
buffer[0]= '@';buffer[1]= 'z';limit= buffer+2;
}
@@ -785,14 +832,12 @@ changed_section[section_count]= 1;change_pending= 0;
}
*limit= ' ';
if(buffer[0]=='@'){
-#line 446 "cwebdir/comm-w2c.ch"
if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]);
-#line 554 "cwebdir/common.w"
if(buffer[1]=='x'||buffer[1]=='y'){
loc= buffer+2;
-#line 452 "cwebdir/comm-w2c.ch"
+#line 280 "cwebdir/comm-w2c.ch"
err_print(_("! Where is the matching @z?"));
-#line 557 "cwebdir/common.w"
+#line 538 "cwebdir/common.w"
}
else if(buffer[1]=='z'){
@@ -802,12 +847,12 @@ prime_the_change_buffer();changing= !changing;print_where= 1;
}
}
-/*:25*/
-#line 431 "cwebdir/common.w"
-;
+/*:41*/
+#line 415 "cwebdir/common.w"
+
if(!changing||include_depth> change_depth){
-/*24:*/
-#line 520 "cwebdir/common.w"
+/*40:*/
+#line 501 "cwebdir/common.w"
{
cur_line++;
while(!input_ln(cur_file)){
@@ -825,9 +870,9 @@ if(buffer[0]==change_buffer[0])
if(change_limit> change_buffer)check_change();
}
-/*:24*/
-#line 433 "cwebdir/common.w"
-;
+/*:40*/
+#line 417 "cwebdir/common.w"
+
if(changing&&include_depth==change_depth)goto restart;
}
if(input_has_ended)return 0;
@@ -836,27 +881,27 @@ if(buffer[0]=='@'&&(buffer[1]=='i'||buffer[1]=='I')){
loc= buffer+2;*limit= '"';
while(*loc==' '||*loc=='\t')loc++;
if(loc>=limit){
-#line 334 "cwebdir/comm-w2c.ch"
+#line 180 "cwebdir/comm-w2c.ch"
err_print(_("! Include file name not given"));
-#line 443 "cwebdir/common.w"
+#line 427 "cwebdir/common.w"
goto restart;
}
if(include_depth>=max_include_depth-1){
-#line 340 "cwebdir/comm-w2c.ch"
+#line 186 "cwebdir/comm-w2c.ch"
err_print(_("! Too many nested includes"));
-#line 448 "cwebdir/common.w"
+#line 432 "cwebdir/common.w"
goto restart;
}
include_depth++;
-/*23:*/
-#line 380 "cwebdir/comm-w2c.ch"
+/*39:*/
+#line 455 "cwebdir/common.w"
{
-#line 389 "cwebdir/comm-w2c.ch"
+#line 223 "cwebdir/comm-w2c.ch"
char*cur_file_name_end= cur_file_name+max_file_name_length-1;
char*k= cur_file_name;
-#line 479 "cwebdir/common.w"
+#line 460 "cwebdir/common.w"
if(*loc=='"'){
loc++;
@@ -867,7 +912,7 @@ while(*loc!=' '&&*loc!='\t'&&*loc!='"'&&k<=cur_file_name_end)*k++= *loc++;
if(k> cur_file_name_end)too_long();
*k= '\0';
-#line 396 "cwebdir/comm-w2c.ch"
+#line 230 "cwebdir/comm-w2c.ch"
if((found_filename= kpse_find_cweb(cur_file_name))!=NULL&&
(cur_file= fopen(found_filename,"r"))!=NULL){
@@ -877,45 +922,42 @@ strcpy(cur_file_name,found_filename+
((strncmp(found_filename,"./",2)==0)?2:0));
free(found_filename);
}else fatal(_("! Filename too long\n"),found_filename);
-#line 490 "cwebdir/common.w"
+#line 471 "cwebdir/common.w"
cur_line= 0;print_where= 1;
goto restart;
}
-#line 434 "cwebdir/comm-w2c.ch"
+#line 268 "cwebdir/comm-w2c.ch"
include_depth--;err_print(_("! Cannot open include file"));goto restart;
-#line 518 "cwebdir/common.w"
+#line 499 "cwebdir/common.w"
}
-/*:23*/
-#line 452 "cwebdir/common.w"
-;
+/*:39*/
+#line 436 "cwebdir/common.w"
+
}
return 1;
}
-#line 355 "cwebdir/comm-w2c.ch"
-/*:21*//*26:*/
-#line 569 "cwebdir/common.w"
+#line 201 "cwebdir/comm-w2c.ch"
+/*:38*//*42:*/
+#line 550 "cwebdir/common.w"
-#line 462 "cwebdir/comm-w2c.ch"
void
check_complete(void){
if(change_limit!=change_buffer){
strncpy(buffer,change_buffer,(size_t)(change_limit-change_buffer+1));
limit= buffer+(ptrdiff_t)(change_limit-change_buffer);
-#line 575 "cwebdir/common.w"
changing= 1;change_depth= include_depth;loc= buffer;
-#line 472 "cwebdir/comm-w2c.ch"
+#line 286 "cwebdir/comm-w2c.ch"
err_print(_("! Change file entry did not match"));
-#line 577 "cwebdir/common.w"
+#line 558 "cwebdir/common.w"
}
}
-/*:26*//*35:*/
-#line 660 "cwebdir/common.w"
+/*:42*//*48:*/
+#line 643 "cwebdir/common.w"
-#line 514 "cwebdir/comm-w2c.ch"
name_pointer
id_lookup(
const char*first,
@@ -923,26 +965,23 @@ const char*last,
char t)
{
const char*i= first;
-#line 668 "cwebdir/common.w"
int h;
int l;
name_pointer p;
if(last==NULL)for(last= first;*last!='\0';last++);
-#line 526 "cwebdir/comm-w2c.ch"
l= (int)(last-first);
-#line 673 "cwebdir/common.w"
-/*36:*/
-#line 683 "cwebdir/common.w"
+/*49:*/
+#line 666 "cwebdir/common.w"
-h= (unsigned char)*i;
-while(++i<last)h= (h+h+(int)((unsigned char)*i))%hash_size;
+h= (eight_bits)*i;
+while(++i<last)h= (h+h+(int)((eight_bits)*i))%hash_size;
-/*:36*/
-#line 673 "cwebdir/common.w"
-;
-/*37:*/
-#line 691 "cwebdir/common.w"
+/*:49*/
+#line 656 "cwebdir/common.w"
+
+/*50:*/
+#line 674 "cwebdir/common.w"
p= hash[h];
while(p&&!names_match(p,first,l,t))p= p->link;
@@ -951,63 +990,55 @@ p= name_ptr;
p->link= hash[h];hash[h]= p;
}
-/*:37*/
-#line 674 "cwebdir/common.w"
-;
-if(p==name_ptr)/*39:*/
-#line 706 "cwebdir/common.w"
+/*:50*/
+#line 657 "cwebdir/common.w"
+
+if(p==name_ptr)/*51:*/
+#line 685 "cwebdir/common.w"
{
-#line 539 "cwebdir/comm-w2c.ch"
+#line 293 "cwebdir/comm-w2c.ch"
if(byte_ptr+l> byte_mem_end)overflow(_("byte memory"));
if(name_ptr>=name_dir_end)overflow(_("name"));
-#line 709 "cwebdir/common.w"
+#line 688 "cwebdir/common.w"
strncpy(byte_ptr,first,l);
(++name_ptr)->byte_start= byte_ptr+= l;
-#line 546 "cwebdir/comm-w2c.ch"
init_p(p,t);
-#line 712 "cwebdir/common.w"
}
-/*:39*/
-#line 675 "cwebdir/common.w"
-;
+/*:51*/
+#line 658 "cwebdir/common.w"
+
return(p);
}
-/*:35*//*42:*/
-#line 764 "cwebdir/common.w"
+/*:48*//*52:*/
+#line 717 "cwebdir/common.w"
-#line 554 "cwebdir/comm-w2c.ch"
void
print_section_name(
name_pointer p)
-#line 768 "cwebdir/common.w"
{
char*ss,*s= first_chunk(p);
name_pointer q= p+1;
while(p!=name_dir){
ss= (p+1)->byte_start-1;
if(*ss==' '&&ss>=s){
-#line 564 "cwebdir/comm-w2c.ch"
term_write(s,(size_t)(ss-s));p= q->link;q= p;
}else{
term_write(s,(size_t)(ss+1-s));p= name_dir;q= NULL;
-#line 777 "cwebdir/common.w"
}
s= p->byte_start;
}
if(q)term_write("...",3);
}
-/*:42*//*43:*/
-#line 783 "cwebdir/common.w"
+/*:52*//*53:*/
+#line 736 "cwebdir/common.w"
-#line 575 "cwebdir/comm-w2c.ch"
void
sprint_section_name(
char*dest,
name_pointer p)
-#line 788 "cwebdir/common.w"
{
char*ss,*s= first_chunk(p);
name_pointer q= p+1;
@@ -1018,22 +1049,18 @@ p= q->link;q= p;
}else{
ss++;p= name_dir;
}
-#line 584 "cwebdir/comm-w2c.ch"
strncpy(dest,s,(size_t)(ss-s)),dest+= ss-s;
-#line 799 "cwebdir/common.w"
s= p->byte_start;
}
*dest= '\0';
}
-/*:43*//*44:*/
-#line 804 "cwebdir/common.w"
+/*:53*//*54:*/
+#line 757 "cwebdir/common.w"
-#line 592 "cwebdir/comm-w2c.ch"
void
print_prefix_name(
name_pointer p)
-#line 808 "cwebdir/common.w"
{
char*s= first_chunk(p);
int l= prefix_length(p);
@@ -1041,16 +1068,14 @@ term_write(s,l);
if(s+l<(p+1)->byte_start)term_write("...",3);
}
-/*:44*//*45:*/
-#line 825 "cwebdir/common.w"
+/*:54*//*56:*/
+#line 783 "cwebdir/common.w"
-#line 602 "cwebdir/comm-w2c.ch"
static int web_strcmp(
char*j,
int j_len,
char*k,
int k_len)
-#line 829 "cwebdir/common.w"
{
char*j1= j+j_len,*k1= k+k_len;
while(k<k1&&j<j1&&*j==*k)k++,j++;
@@ -1061,10 +1086,9 @@ else if(*j<*k)return less;
else return greater;
}
-/*:45*//*47:*/
-#line 855 "cwebdir/common.w"
+/*:56*//*57:*/
+#line 812 "cwebdir/common.w"
-#line 624 "cwebdir/comm-w2c.ch"
static name_pointer
add_section_name(
name_pointer par,
@@ -1072,16 +1096,14 @@ int c,
char*first,
char*last,
int ispref)
-#line 863 "cwebdir/common.w"
{
name_pointer p= name_ptr;
char*s= first_chunk(p);
-#line 636 "cwebdir/comm-w2c.ch"
int name_len= (int)(last-first)+ispref;
-#line 643 "cwebdir/comm-w2c.ch"
+#line 301 "cwebdir/comm-w2c.ch"
if(s+name_len> byte_mem_end)overflow(_("byte memory"));
if(name_ptr+1>=name_dir_end)overflow(_("name"));
-#line 869 "cwebdir/common.w"
+#line 826 "cwebdir/common.w"
(++name_ptr)->byte_start= byte_ptr= s+name_len;
if(ispref){
*(byte_ptr-1)= ' ';
@@ -1097,46 +1119,41 @@ init_node(p);
return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p);
}
-/*:47*//*48:*/
-#line 884 "cwebdir/common.w"
+/*:57*//*58:*/
+#line 841 "cwebdir/common.w"
-#line 655 "cwebdir/comm-w2c.ch"
static void
extend_section_name(
name_pointer p,
char*first,
char*last,
int ispref)
-#line 891 "cwebdir/common.w"
{
char*s;
name_pointer q= p+1;
-#line 666 "cwebdir/comm-w2c.ch"
int name_len= (int)(last-first)+ispref;
-#line 672 "cwebdir/comm-w2c.ch"
+#line 308 "cwebdir/comm-w2c.ch"
if(name_ptr>=name_dir_end)overflow(_("name"));
-#line 896 "cwebdir/common.w"
+#line 853 "cwebdir/common.w"
while(q->link!=name_dir)q= q->link;
q->link= name_ptr;
s= name_ptr->byte_start;
name_ptr->link= name_dir;
-#line 678 "cwebdir/comm-w2c.ch"
+#line 314 "cwebdir/comm-w2c.ch"
if(s+name_len> byte_mem_end)overflow(_("byte memory"));
-#line 901 "cwebdir/common.w"
+#line 858 "cwebdir/common.w"
(++name_ptr)->byte_start= byte_ptr= s+name_len;
strncpy(s,first,name_len);
if(ispref)*(byte_ptr-1)= ' ';
}
-/*:48*//*49:*/
-#line 912 "cwebdir/common.w"
+/*:58*//*59:*/
+#line 869 "cwebdir/common.w"
-#line 687 "cwebdir/comm-w2c.ch"
name_pointer
section_lookup(
char*first,char*last,
int ispref)
-#line 917 "cwebdir/common.w"
{
int c= 0;
name_pointer p= root;
@@ -1144,11 +1161,9 @@ name_pointer q= NULL;
name_pointer r= NULL;
name_pointer par= NULL;
-#line 696 "cwebdir/comm-w2c.ch"
int name_len= (int)(last-first)+1;
-#line 925 "cwebdir/common.w"
-/*50:*/
-#line 936 "cwebdir/common.w"
+/*60:*/
+#line 893 "cwebdir/common.w"
while(p){
c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p));
@@ -1158,14 +1173,14 @@ par= p;
p= (c==less?p->llink:p->rlink);
}else{
if(r!=NULL){
-#line 702 "cwebdir/comm-w2c.ch"
+#line 320 "cwebdir/comm-w2c.ch"
fputs(_("\n! Ambiguous prefix: matches <"),stdout);
-#line 946 "cwebdir/common.w"
+#line 903 "cwebdir/common.w"
print_prefix_name(p);
-#line 708 "cwebdir/comm-w2c.ch"
+#line 326 "cwebdir/comm-w2c.ch"
fputs(_(">\n and <"),stdout);
-#line 949 "cwebdir/common.w"
+#line 906 "cwebdir/common.w"
print_prefix_name(r);
err_print(">");
return name_dir;
@@ -1178,28 +1193,28 @@ if(p==NULL)
p= q,q= NULL;
}
-/*:50*/
-#line 926 "cwebdir/common.w"
-;
-/*51:*/
-#line 961 "cwebdir/common.w"
+/*:60*/
+#line 883 "cwebdir/common.w"
+
+/*61:*/
+#line 918 "cwebdir/common.w"
if(r==NULL)
return add_section_name(par,c,first,last+1,ispref);
-/*:51*/
-#line 927 "cwebdir/common.w"
-;
-/*52:*/
-#line 969 "cwebdir/common.w"
+/*:61*/
+#line 884 "cwebdir/common.w"
+
+/*62:*/
+#line 926 "cwebdir/common.w"
switch(section_name_cmp(&first,name_len,r)){
case prefix:
if(!ispref){
-#line 714 "cwebdir/comm-w2c.ch"
+#line 332 "cwebdir/comm-w2c.ch"
fputs(_("\n! New name is a prefix of <"),stdout);
-#line 975 "cwebdir/common.w"
+#line 932 "cwebdir/common.w"
print_section_name(r);
err_print(">");
@@ -1211,41 +1226,39 @@ case extension:if(!ispref||first<=last)
extend_section_name(r,first,last+1,ispref);
return r;
case bad_extension:
-#line 720 "cwebdir/comm-w2c.ch"
+#line 338 "cwebdir/comm-w2c.ch"
fputs(_("\n! New name extends <"),stdout);
-#line 987 "cwebdir/common.w"
+#line 944 "cwebdir/common.w"
print_section_name(r);
err_print(">");
return r;
default:
-#line 726 "cwebdir/comm-w2c.ch"
+#line 344 "cwebdir/comm-w2c.ch"
fputs(_("\n! Section name incompatible with <"),stdout);
-#line 993 "cwebdir/common.w"
+#line 950 "cwebdir/common.w"
print_prefix_name(r);
-#line 732 "cwebdir/comm-w2c.ch"
+#line 350 "cwebdir/comm-w2c.ch"
fputs(_(">,\n which abbreviates <"),stdout);
-#line 996 "cwebdir/common.w"
+#line 953 "cwebdir/common.w"
print_section_name(r);
err_print(">");
return r;
}
-/*:52*/
-#line 928 "cwebdir/common.w"
-;
+/*:62*/
+#line 885 "cwebdir/common.w"
+
}
-/*:49*//*54:*/
-#line 1020 "cwebdir/common.w"
+/*:59*//*64:*/
+#line 977 "cwebdir/common.w"
-#line 747 "cwebdir/comm-w2c.ch"
static int section_name_cmp(
char**pfirst,
int len,
name_pointer r)
-#line 1025 "cwebdir/common.w"
{
char*first= *pfirst;
name_pointer q= r+1;
@@ -1259,44 +1272,38 @@ else ispref= 0,ss++,q= name_dir;
switch(c= web_strcmp(first,len,s,ss-s)){
case equal:if(q==name_dir)
if(ispref){
-#line 756 "cwebdir/comm-w2c.ch"
*pfirst= first+(ptrdiff_t)(ss-s);
-#line 1039 "cwebdir/common.w"
return extension;
}else return equal;
else return(q->byte_start==(q+1)->byte_start)?equal:prefix;
case extension:
if(!ispref)return bad_extension;
first+= ss-s;
-#line 762 "cwebdir/comm-w2c.ch"
if(q!=name_dir){len-= (int)(ss-s);s= q->byte_start;r= q;continue;}
-#line 1046 "cwebdir/common.w"
*pfirst= first;return extension;
default:return c;
}
}
}
-/*:54*//*58:*/
-#line 1095 "cwebdir/common.w"
+/*:64*//*66:*/
+#line 1029 "cwebdir/common.w"
-#line 788 "cwebdir/comm-w2c.ch"
void
err_print(
const char*s)
-#line 1099 "cwebdir/common.w"
{
char*k,*l;
printf(*s=='!'?"\n%s":"%s",s);
-if(web_file_open)/*59:*/
-#line 1115 "cwebdir/common.w"
+if(web_file_open)/*67:*/
+#line 1049 "cwebdir/common.w"
{if(changing&&include_depth==change_depth)
-#line 798 "cwebdir/comm-w2c.ch"
+#line 358 "cwebdir/comm-w2c.ch"
printf(_(". (l. %d of change file)\n"),change_line);
else if(include_depth==0)printf(_(". (l. %d)\n"),cur_line);
else printf(_(". (l. %d of include file %s)\n"),cur_line,cur_file_name);
-#line 1120 "cwebdir/common.w"
+#line 1054 "cwebdir/common.w"
l= (loc>=limit?limit:loc);
if(l> buffer){
for(k= buffer;k<l;k++)
@@ -1310,27 +1317,25 @@ if(*limit=='|')putchar('|');
putchar(' ');
}
-/*:59*/
-#line 1102 "cwebdir/common.w"
-;
+/*:67*/
+#line 1036 "cwebdir/common.w"
+
update_terminal;mark_error;
}
-/*:58*//*61:*/
-#line 1150 "cwebdir/common.w"
+/*:66*//*68:*/
+#line 1081 "cwebdir/common.w"
-#line 837 "cwebdir/comm-w2c.ch"
int wrap_up(void){
-if(show_progress||show_happiness||(history> spotless))new_line;
-#line 1153 "cwebdir/common.w"
+if(show_progress)new_line;
if(show_stats)
print_stats();
-#line 844 "cwebdir/comm-w2c.ch"
-/*62:*/
-#line 1160 "cwebdir/common.w"
+#line 388 "cwebdir/comm-w2c.ch"
+/*69:*/
+#line 1091 "cwebdir/common.w"
switch(history){
-#line 868 "cwebdir/comm-w2c.ch"
+#line 412 "cwebdir/comm-w2c.ch"
case spotless:
if(show_happiness)puts(_("(No errors were found.)"));break;
case harmless_message:
@@ -1339,14 +1344,14 @@ case error_message:
puts(_("(Pardon me, but I think I spotted something wrong.)"));break;
case fatal_message:
puts(_("(That was a fatal error, my friend.)"));
-#line 1168 "cwebdir/common.w"
+#line 1099 "cwebdir/common.w"
}
-/*:62*/
-#line 844 "cwebdir/comm-w2c.ch"
+/*:69*/
+#line 388 "cwebdir/comm-w2c.ch"
-/*87:*/
-#line 1271 "cwebdir/comm-w2c.ch"
+/*88:*/
+#line 662 "cwebdir/comm-w2c.ch"
if(C_file)fclose(C_file);
if(tex_file)fclose(tex_file);
@@ -1354,62 +1359,55 @@ if(check_file)fclose(check_file);
if(strlen(check_file_name))
remove(check_file_name);
-/*:87*/
-#line 845 "cwebdir/comm-w2c.ch"
+/*:88*/
+#line 389 "cwebdir/comm-w2c.ch"
-#line 852 "cwebdir/comm-w2c.ch"
+#line 396 "cwebdir/comm-w2c.ch"
switch(history){
case harmless_message:return RETURN_WARN;
case error_message:return RETURN_ERROR;
case fatal_message:return RETURN_FAIL;
default:return RETURN_OK;
}
-#line 1158 "cwebdir/common.w"
+#line 1089 "cwebdir/common.w"
}
-/*:61*//*64:*/
-#line 890 "cwebdir/comm-w2c.ch"
+/*:68*//*70:*/
+#line 1107 "cwebdir/common.w"
void
fatal(
const char*s,const char*t)
-#line 1182 "cwebdir/common.w"
{
-#line 898 "cwebdir/comm-w2c.ch"
if(*s)err_print(s);
-#line 1184 "cwebdir/common.w"
err_print(t);
history= fatal_message;exit(wrap_up());
}
-/*:64*//*65:*/
-#line 906 "cwebdir/comm-w2c.ch"
+/*:70*//*71:*/
+#line 1118 "cwebdir/common.w"
void
overflow(
const char*t)
-#line 1193 "cwebdir/common.w"
{
-#line 914 "cwebdir/comm-w2c.ch"
+#line 425 "cwebdir/comm-w2c.ch"
printf(_("\n! Sorry, %s capacity exceeded"),t);fatal("","");
-#line 1195 "cwebdir/common.w"
+#line 1123 "cwebdir/common.w"
}
-/*:65*//*70:*/
-#line 1254 "cwebdir/common.w"
+/*:71*//*76:*/
+#line 1175 "cwebdir/common.w"
-#line 978 "cwebdir/comm-w2c.ch"
static void
scan_args(void)
-#line 1257 "cwebdir/common.w"
{
char*dot_pos;
char*name_pos;
register char*s;
boolean found_web= 0,found_change= 0,found_out= 0;
-#line 1264 "cwebdir/common.w"
-#line 990 "cwebdir/comm-w2c.ch"
+#line 462 "cwebdir/comm-w2c.ch"
#if defined DEV_NULL
strncpy(change_file_name,DEV_NULL,max_file_name_length-2);
@@ -1421,36 +1419,36 @@ change_file_name[max_file_name_length-2]= '\0';
strcpy(change_file_name,"/dev/null");
#endif
+#line 1186 "cwebdir/common.w"
while(--argc> 0){
-#line 1266 "cwebdir/common.w"
-if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*74:*/
-#line 1068 "cwebdir/comm-w2c.ch"
+if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/
+#line 510 "cwebdir/comm-w2c.ch"
{
if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0)
-/*94:*/
-#line 1423 "cwebdir/comm-w2c.ch"
+/*95:*/
+#line 800 "cwebdir/comm-w2c.ch"
cb_usagehelp(program==ctangle?CTANGLEHELP:
program==cweave?CWEAVEHELP:CTWILLHELP,NULL);
-/*:94*/
-#line 1072 "cwebdir/comm-w2c.ch"
+/*:95*/
+#line 514 "cwebdir/comm-w2c.ch"
if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0)
-/*96:*/
-#line 1466 "cwebdir/comm-w2c.ch"
+/*98:*/
+#line 847 "cwebdir/comm-w2c.ch"
printversionandexit(cb_banner,
program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth",
NULL,"Contemporary development on https://github.com/ascherer/cwebbin.\n");
-/*:96*/
-#line 1075 "cwebdir/comm-w2c.ch"
+/*:98*/
+#line 517 "cwebdir/comm-w2c.ch"
if(strcmp("-verbose",*argv)==0||strcmp("--verbose",*argv)==0)
@@ -1466,17 +1464,16 @@ if(*dot_pos=='q'){
show_banner= show_progress= show_happiness= 0;
}else
if(*dot_pos=='d'){
-if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*75:*/
-#line 1352 "cwebdir/common.w"
+if(sscanf(++dot_pos,"%u",&kpathsea_debug)!=1)/*81:*/
+#line 555 "cwebdir/comm-w2c.ch"
-#line 1118 "cwebdir/comm-w2c.ch"
cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill");
-#line 1363 "cwebdir/common.w"
+#line 1281 "cwebdir/common.w"
-#line 1125 "cwebdir/comm-w2c.ch"
-/*:75*/
-#line 1090 "cwebdir/comm-w2c.ch"
+#line 563 "cwebdir/comm-w2c.ch"
+/*:81*/
+#line 532 "cwebdir/comm-w2c.ch"
while(isdigit(*dot_pos))dot_pos++;
dot_pos--;
@@ -1485,17 +1482,17 @@ if(*dot_pos=='l'){
use_language= ++dot_pos;
break;
}else
-#line 1103 "cwebdir/comm-w2c.ch"
+#line 1267 "cwebdir/common.w"
flags[(eight_bits)*dot_pos]= flag_change;
-#line 1350 "cwebdir/common.w"
}
-/*:74*/
-#line 1266 "cwebdir/common.w"
+#line 555 "cwebdir/comm-w2c.ch"
+/*:80*/
+#line 1187 "cwebdir/common.w"
else{
s= name_pos= *argv;dot_pos= NULL;
-#line 1011 "cwebdir/comm-w2c.ch"
+#line 482 "cwebdir/comm-w2c.ch"
while(*s){
if(*s=='.')dot_pos= s++;
else if(*s==DIR_SEPARATOR||*s==DEVICE_SEPARATOR||*s=='/')
@@ -1503,28 +1500,28 @@ dot_pos= NULL,name_pos= ++s;
else s++;
}
-#line 1274 "cwebdir/common.w"
-if(!found_web)/*71:*/
-#line 1292 "cwebdir/common.w"
+#line 1195 "cwebdir/common.w"
+if(!found_web)/*77:*/
+#line 1212 "cwebdir/common.w"
{
if(s-*argv> max_file_name_length-5)
-/*76:*/
-#line 1125 "cwebdir/comm-w2c.ch"
+/*82:*/
+#line 563 "cwebdir/comm-w2c.ch"
fatal(_("! Filename too long\n"),*argv);
-#line 1365 "cwebdir/common.w"
+#line 1283 "cwebdir/common.w"
+
+/*:82*/
+#line 1215 "cwebdir/common.w"
-/*:76*/
-#line 1295 "cwebdir/common.w"
-;
if(dot_pos==NULL)
sprintf(web_file_name,"%s.w",*argv);
else{
strcpy(web_file_name,*argv);
*dot_pos= 0;
}
-#line 1303 "cwebdir/common.w"
+#line 1223 "cwebdir/common.w"
sprintf(tex_file_name,"%s.tex",name_pos);
sprintf(idx_file_name,"%s.idx",name_pos);
sprintf(scn_file_name,"%s.scn",name_pos);
@@ -1532,52 +1529,48 @@ sprintf(C_file_name,"%s.c",name_pos);
found_web= 1;
}
-/*:71*/
-#line 1275 "cwebdir/common.w"
+/*:77*/
+#line 1196 "cwebdir/common.w"
-else if(!found_change)/*72:*/
-#line 1310 "cwebdir/common.w"
+else if(!found_change)/*78:*/
+#line 1230 "cwebdir/common.w"
{
-#line 1043 "cwebdir/comm-w2c.ch"
if(strcmp(*argv,"-")!=0){
-#line 1314 "cwebdir/common.w"
if(s-*argv> max_file_name_length-4)
-/*76:*/
-#line 1125 "cwebdir/comm-w2c.ch"
+/*82:*/
+#line 563 "cwebdir/comm-w2c.ch"
fatal(_("! Filename too long\n"),*argv);
-#line 1365 "cwebdir/common.w"
+#line 1283 "cwebdir/common.w"
-/*:76*/
-#line 1315 "cwebdir/common.w"
-;
+/*:82*/
+#line 1234 "cwebdir/common.w"
+
if(dot_pos==NULL)
sprintf(change_file_name,"%s.ch",*argv);
else strcpy(change_file_name,*argv);
-#line 1050 "cwebdir/comm-w2c.ch"
}
found_change= 1;
-#line 1321 "cwebdir/common.w"
}
-/*:72*/
-#line 1276 "cwebdir/common.w"
+/*:78*/
+#line 1197 "cwebdir/common.w"
-else if(!found_out)/*73:*/
-#line 1323 "cwebdir/common.w"
+else if(!found_out)/*79:*/
+#line 1242 "cwebdir/common.w"
{
if(s-*argv> max_file_name_length-5)
-/*76:*/
-#line 1125 "cwebdir/comm-w2c.ch"
+/*82:*/
+#line 563 "cwebdir/comm-w2c.ch"
fatal(_("! Filename too long\n"),*argv);
-#line 1365 "cwebdir/common.w"
+#line 1283 "cwebdir/common.w"
+
+/*:82*/
+#line 1245 "cwebdir/common.w"
-/*:76*/
-#line 1326 "cwebdir/common.w"
-;
if(dot_pos==NULL){
sprintf(tex_file_name,"%s.tex",*argv);
sprintf(idx_file_name,"%s.idx",*argv);
@@ -1586,9 +1579,7 @@ sprintf(C_file_name,"%s.c",*argv);
}else{
strcpy(tex_file_name,*argv);
strcpy(C_file_name,*argv);
-#line 1057 "cwebdir/comm-w2c.ch"
if(make_xrefs){
-#line 1336 "cwebdir/common.w"
*dot_pos= 0;
sprintf(idx_file_name,"%s.idx",*argv);
sprintf(scn_file_name,"%s.scn",*argv);
@@ -1597,42 +1588,38 @@ sprintf(scn_file_name,"%s.scn",*argv);
found_out= 1;
}
-#line 1067 "cwebdir/comm-w2c.ch"
-/*:73*/
-#line 1277 "cwebdir/common.w"
+/*:79*/
+#line 1198 "cwebdir/common.w"
-else/*75:*/
-#line 1352 "cwebdir/common.w"
+else/*81:*/
+#line 555 "cwebdir/comm-w2c.ch"
-#line 1118 "cwebdir/comm-w2c.ch"
- cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill");
+cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill");
+
+#line 1281 "cwebdir/common.w"
-#line 1363 "cwebdir/common.w"
+#line 563 "cwebdir/comm-w2c.ch"
+/*:81*/
+#line 1199 "cwebdir/common.w"
-#line 1125 "cwebdir/comm-w2c.ch"
-/*:75*/
-#line 1278 "cwebdir/common.w"
-;
}
}
-if(!found_web)/*75:*/
-#line 1352 "cwebdir/common.w"
+if(!found_web)/*81:*/
+#line 555 "cwebdir/comm-w2c.ch"
-#line 1118 "cwebdir/comm-w2c.ch"
cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill");
-#line 1363 "cwebdir/common.w"
-
-#line 1125 "cwebdir/comm-w2c.ch"
-/*:75*/
#line 1281 "cwebdir/common.w"
-;
-#line 1283 "cwebdir/common.w"
+
+#line 563 "cwebdir/comm-w2c.ch"
+/*:81*/
+#line 1202 "cwebdir/common.w"
+
}
-#line 1030 "cwebdir/comm-w2c.ch"
-/*:70*//*95:*/
-#line 1432 "cwebdir/comm-w2c.ch"
+#line 496 "cwebdir/comm-w2c.ch"
+/*:76*//*97:*/
+#line 813 "cwebdir/comm-w2c.ch"
static void cb_usage(const_string str)
{
@@ -1664,8 +1651,8 @@ textdomain("cweb");
history= spotless;exit(wrap_up());
}
-/*:95*//*97:*/
-#line 1474 "cwebdir/comm-w2c.ch"
+/*:97*//*99:*/
+#line 855 "cwebdir/comm-w2c.ch"
void cb_show_banner(void)
{
@@ -1677,4 +1664,4 @@ textdomain("cweb");
}
-/*:97*/
+/*:99*/
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog
index a737adc0770..a253ba43acf 100644
--- a/Build/source/texk/web2c/cwebdir/ChangeLog
+++ b/Build/source/texk/web2c/cwebdir/ChangeLog
@@ -1,3 +1,35 @@
+2021-02-07 Andreas Scherer <https://ascherer.github.io>
+
+ * Makefile,
+ * README,
+ * comm-{amiga,bs,mac,os2,pc,ql,vms,w32}.ch,
+ * comm-w2c.ch,
+ * comm-w2c.h,
+ * common.c,
+ * common.h,
+ * common.w,
+ * ctang-{bs,pc,ql,vms,w32}.ch,
+ * ctang-man.ch,
+ * ctang-w2c.ch,
+ * ctangle.c,
+ * ctangle.w,
+ * ctwill-mini.ch,
+ * ctwill-w2c.ch,
+ * ctwill.bux,
+ * cweav-{bs,pc,ql,vms,w32}.ch,
+ * cweav-man.ch,
+ * cweav-w2c.ch,
+ * cweave.w,
+ * cweb.1,
+ * cwebmac.tex,
+ * cwebman-w2c.ch,
+ * cwebman.tex,
+ * examples/wmerge.w,
+ * po/{cweb,cweb-tl,web2c-help}.pot,
+ * po/de/{cweb,cweb-tl,web2c-help}.po,
+ * po/it/cweb.po,
+ * system.bux: New CWEB 4.0 and CWEBbin 2021.
+
2020-07-30 Andreas Scherer <https://ascherer.github.io>
* comm-w2c.ch,
diff --git a/Build/source/texk/web2c/cwebdir/Makefile b/Build/source/texk/web2c/cwebdir/Makefile
index 1367d008924..8e4e6d33812 100644
--- a/Build/source/texk/web2c/cwebdir/Makefile
+++ b/Build/source/texk/web2c/cwebdir/Makefile
@@ -1,6 +1,6 @@
# This file is part of CWEB.
# It is distributed WITHOUT ANY WARRANTY, express or implied.
-# Version 3.64 --- February 2002
+# Version 4.0 --- February 2021
# Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
diff --git a/Build/source/texk/web2c/cwebdir/README b/Build/source/texk/web2c/cwebdir/README
index 6429dabfa8f..081dc5aa0b6 100644
--- a/Build/source/texk/web2c/cwebdir/README
+++ b/Build/source/texk/web2c/cwebdir/README
@@ -1,7 +1,7 @@
% This file is part of CWEB.
% The CWEB programs by Silvio Levy are based on programs by D. E. Knuth.
% They are distributed WITHOUT ANY WARRANTY, express or implied.
-% This README file last updated January 2016 by Don Knuth
+% This README file last updated February 2021 by Andreas Scherer
% Copyright (C) 1987,1990,1993,2000,2016 Silvio Levy and Donald E. Knuth
@@ -18,9 +18,13 @@
% there will verify and forward bug reports.
%
% DEK takes no responsibility for the changefiles; they should be
-% maintained independently. His job is to correct errors in
-% ctangle.w, cweave.w, prod.w, common.w, cwebmac.tex, cwebman.tex,
-% and in the files of examples/*.w, nothing more.
+% maintained independently. He even transferred the job to correct errors
+% in ctangle.w, cweave.w, prod.w, common.w, cwebmac.tex, cwebman.tex,
+% and in the files of examples/*.w to Andreas Scherer in 2021.
+% Further significant developments, including versions that neither
+% Don Knuth nor Silvio Levy themselves do maintain, are ongoing.
+% All of the really current news about CWEB is, in fact, now to be found
+% on the CWEB development page https://github.com/ascherer/cweb.
This directory contains the following files:
@@ -30,6 +34,7 @@ comm-amiga.ch
comm-bs.ch
comm-mac.ch
comm-man.ch
+comm-os2.ch
comm-pc.ch
comm-ql.ch
comm-vms.ch
@@ -68,7 +73,7 @@ The files common.c and ctangle.c are used for bootstrapping.
The file cweb.1 is a manual page.
The file cweb.el is suggested for GNU-Emacs users.
The file c++lib.w is for C++ users (say `@i c++lib.w' at beginning of program).
-The files *-man.ch are used if you want to make the full 239-page CWEB manual.
+The files *-man.ch are used if you want to make the full 240-page CWEB manual.
The files *-bs.ch are used instead of *-pc.ch if you are doing BIG programs.
You can use makefile.bs to make CWEB with *-bs.ch.
The files *-ql.ch are for QDOS/SMSQ systems; see readme.ql for further info.
@@ -102,9 +107,3 @@ Note that change files for VMS, AMIGA, MAC, and PCs are provided. When you
are first bootstrapping to a new system, you may need to edit common.c and
ctangle.c by hand, but the vast majority of the change-file changes are
minor refinements that are not necessary for a rudimentary ctangle.
-
------------------------------------------
-These archival sources are maintained only to the extent of fixing
-significant bugs that were unintended at the time of writing.
-A multi-decade ongoing project to improve and extend CWEB can be found at
- https://github.com/ascherer/cwebbin
diff --git a/Build/source/texk/web2c/cwebdir/comm-amiga.ch b/Build/source/texk/web2c/cwebdir/comm-amiga.ch
index 57e65d1ccda..f17c2d333b4 100644
--- a/Build/source/texk/web2c/cwebdir/comm-amiga.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-amiga.ch
@@ -4,14 +4,14 @@ This is the change file for CWEB's COMMON on the Amiga
With Lattice C 5.1, use compilation switches -b0 -r0, and ignore the
compiler warnings. With SAS 6.0, use compilation switches Code=far Data=far.
-@x section 69
+@x section 75
An omitted change file argument means that |"/dev/null"| should be used,
@y
An omitted change file argument means that |"nil:"| should be used,
@z
-@x section 70
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
+@x section 76
+ strcpy(change_file_name,"/dev/null");
@y
- if (found_change<=0) strcpy(change_file_name,"nil:");
+ strcpy(change_file_name,"nil:");
@z
diff --git a/Build/source/texk/web2c/cwebdir/comm-bs.ch b/Build/source/texk/web2c/cwebdir/comm-bs.ch
index 26f79b160d1..1e65f4334c6 100644
--- a/Build/source/texk/web2c/cwebdir/comm-bs.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-bs.ch
@@ -12,55 +12,68 @@ by using "huge" pointers.
(This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94;
revised 24 Jul 94.)
+(Update attempt by Andreas Scherer, 31 Jan 2021. Good luck!)
-@x Section 23.
- cur_file_name[l]='/'; /* \UNIX/ pathname separator */
-@y
- cur_file_name[l]='/'; /* A valid {\mc MSDOS} pathname separator */
-@z
+@x Section 6.
+@d chunk_marker 0
-@x Section 27.
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240 */
-
-@<Definitions that...@>=
+@<Common code...@>=
typedef struct name_info {
char *byte_start; /* beginning of the name in |byte_mem| */
- @<More elements of |name_info| structure@>@;
+ struct name_info *link;
+ union {
+ struct name_info *Rlink; /* right link in binary search tree for section
+ names */
+ char Ilk; /* used by identifiers in \.{CWEAVE} only */
+ } dummy;
+ void *equiv_or_xref; /* info corresponding to names */
} name_info; /* contains information about an identifier or section name */
-typedef name_info *name_pointer; /* pointer into array of |name_info|s */
-char byte_mem[max_bytes]; /* characters of names */
-char *byte_mem_end = byte_mem+max_bytes-1; /* end of |byte_mem| */
-name_info name_dir[max_names]; /* information about names */
-name_pointer name_dir_end = name_dir+max_names-1; /* end of |name_dir| */
+typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
+typedef name_pointer *hash_pointer;
+extern char byte_mem[]; /* characters of names */
+extern char *byte_mem_end; /* end of |byte_mem| */
@y
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240 */
+@d chunk_marker 0
@f huge extern
-@<Definitions that...@>=
+@<Common code...@>=
typedef struct name_info {
char huge* byte_start; /* beginning of the name in |byte_mem| */
- @<More elements of |name_info| structure@>@;
+ struct name_info *link;
+ union {
+ struct name_info *Rlink; /* right link in binary search tree for section
+ names */
+ char Ilk; /* used by identifiers in \.{CWEAVE} only */
+ } dummy;
+ union {
+ void huge* equiv_member;
+ void huge* xref_member;
+ } ptr_union; /* info corresponding to names */
} name_info; /* contains information about an identifier or section name */
-typedef name_info *name_pointer; /* pointer into array of |name_info|s */
-char huge byte_mem[max_bytes]; /* characters of names */
-char huge* byte_mem_end; /* end of |byte_mem| */
-name_info name_dir[max_names]; /* information about names */
-name_pointer name_dir_end = name_dir+max_names-1;
+typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
+typedef name_pointer *hash_pointer;
+extern char huge byte_mem[]; /* characters of names */
+extern char huge* byte_mem_end; /* end of |byte_mem| */
+@z
+
+
+@x Section 39.
+ cur_file_name[l]='/'; /* \UNIX/ pathname separator */
+@y
+ cur_file_name[l]='/'; /* A valid {\mc MSDOS} pathname separator */
@z
-@x Section 29.
+@x Section 44.
char *byte_ptr; /* first unused position in |byte_mem| */
@y
char huge* byte_ptr; /* first unused position in |byte_mem| */
@z
-@x Section 30.
+@x Section 45.
@ @<Init...@>=
name_dir->byte_start=byte_ptr=byte_mem; /* position zero in both arrays */
name_ptr=name_dir+1; /* |name_dir[0]| will be used only for error recovery */
@@ -74,156 +87,137 @@ byte_mem_end = byte_mem+max_bytes-1;
@z
-@x Section 42.
+@x Section 52.
void
-print_section_name(p)
-name_pointer p;
+print_section_name(
+name_pointer p)
{
char *ss, *s = first_chunk(p);
@y
void
-print_section_name(p)
-name_pointer p;
+print_section_name(
+name_pointer p)
{
char huge* ss, huge* s = first_chunk(p);
@z
-@x Section 43.
+@x Section 53.
void
-sprint_section_name(dest,p)
- char*dest;
- name_pointer p;
+sprint_section_name(
+ char *dest,
+ name_pointer p)
{
char *ss, *s = first_chunk(p);
@y
void
-sprint_section_name(dest,p)
- char*dest;
- name_pointer p;
+sprint_section_name(
+ char huge* dest,
+ name_pointer p)
{
char huge* ss, huge* s = first_chunk(p);
@z
-@x Section 44.
+@x Section 54.
void
-print_prefix_name(p)
-name_pointer p;
+print_prefix_name(
+name_pointer p)
{
char *s = first_chunk(p);
@y
void
-print_prefix_name(p)
-name_pointer p;
+print_prefix_name(
+name_pointer p)
{
char huge* s = first_chunk(p);
@z
-@x Section 47.
-name_pointer
-add_section_name(par,c,first,last,ispref) /* install a new node in the tree */
-name_pointer par; /* parent of new node */
-int c; /* right or left? */
-char *first; /* first character of section name */
-char *last; /* last character of section name, plus one */
-int ispref; /* are we adding a prefix or a full name? */
+@x Section 57.
+static name_pointer
+add_section_name(@t\1\1@> /* install a new node in the tree */
+name_pointer par, /* parent of new node */
+int c, /* right or left? */
+char *first, /* first character of section name */
+char *last, /* last character of section name, plus one */
+int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
{
name_pointer p=name_ptr; /* new node */
char *s=first_chunk(p);
@y
-name_pointer
-add_section_name(par,c,first,last,ispref) /* install a new node in the tree */
-name_pointer par; /* parent of new node */
-int c; /* right or left? */
-char *first; /* first character of section name */
-char *last; /* last character of section name, plus one */
-int ispref; /* are we adding a prefix or a full name? */
+static name_pointer
+add_section_name(@t\1\1@> /* install a new node in the tree */
+name_pointer par, /* parent of new node */
+int c, /* right or left? */
+char huge* first, /* first character of section name */
+char huge* last, /* last character of section name, plus one */
+int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
{
name_pointer p=name_ptr; /* new node */
char huge* s=first_chunk(p);
@z
-@x Section 48.
-void
-extend_section_name(p,first,last,ispref)
-name_pointer p; /* name to be extended */
-char *first; /* beginning of extension text */
-char *last; /* one beyond end of extension text */
-int ispref; /* are we adding a prefix or a full name? */
+@x Section 58.
+static void
+extend_section_name(@t\1\1@>
+name_pointer p, /* name to be extended */
+char *first, /* beginning of extension text */
+char *last, /* one beyond end of extension text */
+int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
{
char *s;
@y
-void
-extend_section_name(p,first,last,ispref)
-name_pointer p; /* name to be extended */
-char *first; /* beginning of extension text */
-char *last; /* one beyond end of extension text */
-int ispref; /* are we adding a prefix or a full name? */
+static void
+extend_section_name(@t\1\1@>
+name_pointer p, /* name to be extended */
+char huge* first, /* beginning of extension text */
+char huge* last, /* one beyond end of extension text */
+int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
{
char huge* s;
@z
-@x Section 54.
-int section_name_cmp(pfirst,len,r)
-char **pfirst; /* pointer to beginning of comparison string */
-int len; /* length of string */
-name_pointer r; /* section name being compared */
+@x Section 64.
+static int section_name_cmp(@t\1\1@>
+char **pfirst, /* pointer to beginning of comparison string */
+int len, /* length of string */
+name_pointer r@t\2\2@>) /* section name being compared */
{
char *first=*pfirst; /* beginning of comparison string */
name_pointer q=r+1; /* access to subsequent chunks */
char *ss, *s=first_chunk(r);
@y
-int section_name_cmp(pfirst,len,r)
-char **pfirst; /* pointer to beginning of comparison string */
-int len; /* length of string */
-name_pointer r; /* section name being compared */
+static int section_name_cmp(@t\1\1@>
+char huge** pfirst, /* pointer to beginning of comparison string */
+int len, /* length of string */
+name_pointer r@t\2\2@>) /* section name being compared */
{
- char *first=*pfirst; /* beginning of comparison string */
+ char huge* first=*pfirst; /* beginning of comparison string */
name_pointer q=r+1; /* access to subsequent chunks */
char huge* ss, huge* s=first_chunk(r);
@z
-@x Section 55.
-source files, respectively; here we just declare a common field
-|equiv_or_xref| as a pointer to a |char|.
-
-@<More elements of |name...@>=
-char *equiv_or_xref; /* info corresponding to names */
+@x Section 75.
+An omitted change file argument means that |"/dev/null"| should be used,
@y
-source files, respectively. Here we just declare a common field
-|ptr_union| as a union of pointers to |char|, which happen to have
-different addressing attributes.
-
-@<More elements of |name...@>=
-union {
- char *equiv_member;
- char huge* xref_member;
-} ptr_union; /* info corresponding to names */
+An omitted change file argument means that |"NUL"| should be used,
@z
-@x Section 69.
-An omitted change file argument means that |"/dev/null"| should be used,
+@x Section 76.
+ strcpy(change_file_name,"/dev/null");
@y
-An omitted change file argument means that |"NUL"| should be used,
+ strcpy(change_file_name,"NUL");
@z
-@x Section 70.
+@x Section 76.
else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
else if (*s == ':' || *s == '\\' || *s == '/')
dot_pos=NULL,name_pos=++s;
@z
-
-
-@x Section 70.
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
-@y
- if (found_change<=0) strcpy(change_file_name,"NUL");
-@z
diff --git a/Build/source/texk/web2c/cwebdir/comm-mac.ch b/Build/source/texk/web2c/cwebdir/comm-mac.ch
index b9bd408655e..e7f36a74d9d 100644
--- a/Build/source/texk/web2c/cwebdir/comm-mac.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-mac.ch
@@ -4,19 +4,22 @@ No changes to CTANGLE or CWEAVE are needed.
(Contributed 13 Oct 2000 by AndPio@aol.com; slightly edited by Don Knuth)
@x in limbo, change the title page document to specify Mac version
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
@y
- \centerline{(Version 3.64 for MacOS)}
+ \centerline{(Version 4.0 for MacOS)}
@z
-@x section 9: Make input_ln accept \n, \r, \n\r, or \r\n as line endings
+@x sections 23/24: Make input_ln accept \n, \r, \n\r, or \r\n as line endings
@ In the unlikely event that your standard I/O library does not
support |feof|, |getc|, and |ungetc| you may have to change things here.
@^system dependencies@>
-@c
-int input_ln(fp) /* copies a line into |buffer| or returns 0 */
-FILE *fp; /* what file to read from */
+@<Predecl...@>=
+static boolean input_ln(FILE *);@/
+
+@ @c
+static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns 0 */
+FILE *fp@t\2\2@>) /* what file to read from */
{
register int c=EOF; /* character read; initialized so some compilers won't complain */
register char *k; /* where next character goes */
@@ -28,7 +31,7 @@ FILE *fp; /* what file to read from */
if ((c=getc(fp))!=EOF && c!='\n') {
ungetc(c,fp); loc=buffer; err_print("! Input line too long");
@.Input line too long@>
- }
+ }
if (c==EOF && limit==buffer) return(0); /* there was nothing after
the last newline */
return(1);
@@ -43,8 +46,8 @@ line endings, so that \.{CWEB} will works with ASCII files stored in
@^system dependencies@>
@c
-int input_ln(fp) /* copies a line into |buffer| or returns 0 */
-FILE *fp; /* what file to read from */
+static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns 0 */
+FILE *fp@t\2\2@>) /* what file to read from */
{
register int c=EOF; /* character read; initialized so some compilers won't complain */
register char *k; /* where next character goes */
@@ -71,17 +74,17 @@ FILE *fp; /* what file to read from */
}
@z
-@x section 12, simply return if no change file was specified
+@x section 28, simply return if no change file was specified
change_limit=change_buffer; /* this value is used if the change file ends */
- @<Skip over comment lines in the change file; |return| if end of file@>;
+ @<Skip over comment lines in the change file; |return| if end of file@>@;
@y
change_limit=change_buffer; /* this value is used if the change file ends */
if (change_file_name[0] == '\0') /* no change file specified */
return; /* so we have reached the end of that file */
- @<Skip over comment lines in the change file; |return| if end of file@>;
+ @<Skip over comment lines in the change file; |return| if end of file@>@;
@z
-@x section 19, don't try to open a change file if none was specified
+@x section 36, don't try to open a change file if none was specified
if ((change_file=fopen(change_file_name,"r"))==NULL)
fatal("! Cannot open change file ", change_file_name);
@y
@@ -91,7 +94,7 @@ else if ((change_file=fopen(change_file_name,"r"))==NULL)
fatal("! Cannot open change file ", change_file_name);
@z
-@x section 22, declare colon as Mac's path separator
+@x section 39, declare colon as Mac's path separator
(Colon-separated paths are not supported.)
The remainder of the \.{@@i} line after the file name is ignored.
@@ -104,38 +107,37 @@ The remainder of the \.{@@i} line after the file name is ignored.
@d PATH_SEP ':' /* MacOS pathname separator */
@^system dependencies@>
@z
-
-@x section 23, use the path separator constant
+@x section 39, use the path separator constant
cur_file_name[l]='/'; /* \UNIX/ pathname separator */
@y
cur_file_name[l]=PATH_SEP; /* pathname separator */
@z
-@x section 69, explain the convention for omitted change files
+@x section 75, explain the convention for omitted change files
An omitted change file argument means that |"/dev/null"| should be used,
@y
An omitted change file argument means that no change file should be used,
@z
-@x section 70, use the Metrowerks |ccommand| to access command lines
+@x section 76, make change file name empty when it is unspecified
+ strcpy(change_file_name,"/dev/null");
+@y
+ change_file_name[0]='\0'; /* empty string */
+@z
+@x section 76, use the Metrowerks |ccommand| to access command lines
while (--argc > 0) {
@y
argc = ccommand (&argv); /* use Mac interface to command line */
@^system dependencies@>
while (--argc > 0) {
@z
-@x section 70, use the path separator constant
+@x section 76, use the path separator constant
else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
else if (*s==PATH_SEP) dot_pos=NULL,name_pos=++s;
@z
-@x section 70, make change file name empty when it is unspecified
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
-@y
- if (found_change<=0) change_file_name[0]='\0'; /* empty string */
-@z
-@x section 82, insert an extra module before the index
+@x section 85, insert an extra module before the index
@** Index.
@y by putting the new module here, we preserve all the previous section numbers
@ We assume an interface to \CEE/ command-line emulation as supplied by
diff --git a/Build/source/texk/web2c/cwebdir/comm-os2.ch b/Build/source/texk/web2c/cwebdir/comm-os2.ch
index 5e20a6706ce..2b85f8b1f6d 100644
--- a/Build/source/texk/web2c/cwebdir/comm-os2.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-os2.ch
@@ -4,21 +4,21 @@ This is the change file for CWEB's COMMON under OS/2
These changes tested with WATCOM C v10.0a.
No changes to CTANGLE or CWEAVE are needed with OS/2.
-@x section 69
+@x section 75
An omitted change file argument means that |"/dev/null"| should be used,
@y
An omitted change file argument means that |"NUL"| should be used,
@z
-@x section 70 (this change copied from comm-pc.ch)
- else if (*s=='/') dot_pos=NULL,name_pos=++s;
+@x section 76
+ strcpy(change_file_name,"/dev/null");
@y
- else if (*s == ':' || *s == '\\' || *s == '/')
- dot_pos=NULL,name_pos=++s;
+ strcpy(change_file_name,"NUL");
@z
-@x section 70
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
+@x section 76 (this change copied from comm-pc.ch)
+ else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
- if (found_change<=0) strcpy(change_file_name,"NUL");
+ else if (*s == ':' || *s == '\\' || *s == '/')
+ dot_pos=NULL,name_pos=++s;
@z
diff --git a/Build/source/texk/web2c/cwebdir/comm-pc.ch b/Build/source/texk/web2c/cwebdir/comm-pc.ch
index e69bafb5244..5f7d9c42ffe 100644
--- a/Build/source/texk/web2c/cwebdir/comm-pc.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-pc.ch
@@ -4,30 +4,30 @@ This is the change file for CWEB's COMMON under DOS
Changes necessary for compiling with Borland C/C++
Use compilation switches -mc -w-pro -Ff=5000
-Note: The change to section 27 is not necessary if using a compiler
+Note: The change to section 16 is not necessary if using a compiler
that allows >64K arrays.
-@x section 27
-@d max_bytes 90000 /* the number of bytes in identifiers,
+@x section 16
+@d max_bytes 1000000 /* the number of bytes in identifiers,
@y
@d max_bytes (unsigned)60000 /* the number of bytes in identifiers,
@z
-@x section 69
+@x section 75
An omitted change file argument means that |"/dev/null"| should be used,
@y
An omitted change file argument means that |"NUL"| should be used,
@z
-@x section 70 (this change copied from comm-bs.ch, July 94)
- else if (*s=='/') dot_pos=NULL,name_pos=++s;
+@x section 76
+ strcpy(change_file_name,"/dev/null");
@y
- else if (*s == ':' || *s == '\\' || *s == '/')
- dot_pos=NULL,name_pos=++s;
+ strcpy(change_file_name,"NUL");
@z
-@x section 70
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
+@x section 76 (this change copied from comm-bs.ch, July 94)
+ else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
- if (found_change<=0) strcpy(change_file_name,"NUL");
+ else if (*s == ':' || *s == '\\' || *s == '/')
+ dot_pos=NULL,name_pos=++s;
@z
diff --git a/Build/source/texk/web2c/cwebdir/comm-ql.ch b/Build/source/texk/web2c/cwebdir/comm-ql.ch
index 8859e215b2a..07d394fae7f 100644
--- a/Build/source/texk/web2c/cwebdir/comm-ql.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-ql.ch
@@ -10,61 +10,39 @@ ex <dev_>cc;'-v -h -c -=500000 -DCWEBINPUTS=flp2_ common_c'
@x
\def\v{\char'174} % vertical (|) in typewriter font
-\def\title{Common code for CTANGLE and CWEAVE (Version 3.64)}
+\def\title{Common code for CTANGLE and CWEAVE (Version 4.0)}
\def\topofcontents{\null\vfill
\centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
{\ttitlefont CWEAVE}}
\vskip 15pt
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
\vfill}
\def\botofcontents{\vfill
\noindent
@y
\def\v{\char'174} % vertical (|) in typewriter font
-\def\title{Common code for CTANGLE and CWEAVE (QL Version 3.64)}
+\def\title{Common code for CTANGLE and CWEAVE (QL Version 4.0)}
\def\topofcontents{\null\vfill
\centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
{\ttitlefont CWEAVE}}
\vskip 15pt
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
\vfill}
\def\botofcontents{\vfill
\noindent
@z
-@x
-The line number of each open file is also kept for error reporting and
-for the benefit of \.{CTANGLE}.
-
-@f line x /* make |line| an unreserved word */
-@d max_include_depth 10 /* maximum number of source files open
- simultaneously, not counting the change file */
-@d max_file_name_length 60
-@d cur_file file[include_depth] /* current file */
-@d cur_file_name file_name[include_depth] /* current file name */
-@d cur_line line[include_depth] /* number of current line in current file */
-@d web_file file[0] /* main source file */
-@d web_file_name file_name[0] /* main source file name */
-@y
-The line number of each open file is also kept for error reporting and
-for the benefit of \.{CTANGLE}.
For use on QDOS/SMSQ systems the variable |max_file_name_length| is shortened
to 42 characters, i.e. 5 characters for the device name, 36 characters
for the file name plus one character as string terminator. (Note that
(current) QDOS/SMSQ file systems have a limitation of 36 characters as
maximum length for a file name.
-
-@f line x /* make |line| an unreserved word */
-@d max_include_depth 10 /* maximum number of source files open
- simultaneously, not counting the change file */
+@x
+@d max_file_name_length 1024
+@y
@d max_file_name_length 42
-@d cur_file file[include_depth] /* current file */
-@d cur_file_name file_name[include_depth] /* current file name */
-@d cur_line line[include_depth] /* number of current line in current file */
-@d web_file file[0] /* main source file */
-@d web_file_name file_name[0] /* main source file name */
@z
@@ -90,99 +68,6 @@ when no changes are desired.
@^system dependencies@>
If there's a third file name, it will be the output file.
-
-@<Pred...@>=
-void scan_args();
-
-@ @c
-void
-scan_args()
-{
- char *dot_pos; /* position of |'.'| in the argument */
- char *name_pos; /* file name beginning, sans directory */
- register char *s; /* register for scanning strings */
- boolean found_web=0,found_change=0,found_out=0;
- /* have these names have been seen? */
- boolean flag_change;
-
- while (--argc > 0) {
- if ((**(++argv)=='-'||**argv=='+')&&*(*argv+1)) @<Handle flag argument@>@;
- else {
- s=name_pos=*argv;@+dot_pos=NULL;
- while (*s) {
- if (*s=='.') dot_pos=s++;
- else if (*s=='/') dot_pos=NULL,name_pos=++s;
- else s++;
- }
- if (!found_web) @<Make
- |web_file_name|, |tex_file_name| and |C_file_name|@>@;
- else if (!found_change) @<Make |change_file_name| from |fname|@>@;
- else if (!found_out) @<Override |tex_file_name| and |C_file_name|@>@;
- else @<Print usage error message and quit@>;
- }
- }
- if (!found_web) @<Print usage error message and quit@>;
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
-}
-
-@ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it,
-otherwise we add |".w"|. If this file can't be opened, we prepare an
-|alt_web_file_name| by adding |"web"| after the dot.
-The other file names come from adding other things
-after the dot. We must check that there is enough room in
-|web_file_name| and the other arrays for the argument.
-
-@<Make |web_file_name|...@>=
-{
- if (s-*argv > max_file_name_length-5)
- @<Complain about argument length@>;
- if (dot_pos==NULL)
- sprintf(web_file_name,"%s.w",*argv);
- else {
- strcpy(web_file_name,*argv);
- *dot_pos=0; /* string now ends where the dot was */
- }
- sprintf(alt_web_file_name,"%s.web",*argv);
- sprintf(tex_file_name,"%s.tex",name_pos); /* strip off directory name */
- sprintf(idx_file_name,"%s.idx",name_pos);
- sprintf(scn_file_name,"%s.scn",name_pos);
- sprintf(C_file_name,"%s.c",name_pos);
- found_web=1;
-}
-
-@ @<Make |change_file_name|...@>=
-{
- if (strcmp(*argv,"-")==0) found_change=-1;
- else {
- if (s-*argv > max_file_name_length-4)
- @<Complain about argument length@>;
- if (dot_pos==NULL)
- sprintf(change_file_name,"%s.ch",*argv);
- else strcpy(change_file_name,*argv);
- found_change=1;
- }
-}
-
-@ @<Override...@>=
-{
- if (s-*argv > max_file_name_length-5)
- @<Complain about argument length@>;
- if (dot_pos==NULL) {
- sprintf(tex_file_name,"%s.tex",*argv);
- sprintf(idx_file_name,"%s.idx",*argv);
- sprintf(scn_file_name,"%s.scn",*argv);
- sprintf(C_file_name,"%s.c",*argv);
- } else {
- strcpy(tex_file_name,*argv);
- strcpy(C_file_name,*argv);
- if (flags['x']) { /* indexes will be generated */
- *dot_pos=0;
- sprintf(idx_file_name,"%s.idx",*argv);
- sprintf(scn_file_name,"%s.scn",*argv);
- }
- }
- found_out=1;
-}
@y
@ We now must look at the command line arguments and set the file names
accordingly. At least one file name must be present: the \.{CWEB}
@@ -204,41 +89,42 @@ always use the {\em full} name (i.e. with full path). Fortunately the
routine has been written to search for the last ``dot'', so the altered
version will search for the last |"_"| (including directory separators),
so we have what we want.
+@z
-@<Pred...@>=
-void scan_args();
-@ @c
-void
-scan_args()
-{
+@x
+ char *dot_pos; /* position of |'.'| in the argument */
+@y
char *dot_pos; /* position of |'_'| in the argument */
- char *name_pos; /* file name beginning, sans directory */
- register char *s; /* register for scanning strings */
- boolean found_web=0,found_change=0,found_out=0;
- /* have these names have been seen? */
- boolean flag_change;
-
- while (--argc > 0) {
- if ((**(++argv)=='-'||**argv=='+')&&*(*argv+1)) @<Handle flag argument@>@;
- else {
- s=name_pos=*argv;@+dot_pos=NULL;
- while (*s) {
+@z
+
+
+@x
+ strcpy(change_file_name,"/dev/null");
+@y
+ strcpy(change_file_name,"NUL");
+@z
+
+
+@x
+ if (*s=='.') dot_pos=s++;
+ else if (*s=='/') dot_pos=NULL,name_pos=++s;
+ else s++;
+@y
if (*s=='_') dot_pos=s++;
else if (*s=='_') dot_pos=NULL,name_pos=++s;
else s++;
- }
- if (!found_web) @<Make
- |web_file_name|, |tex_file_name| and |C_file_name|@>@;
- else if (!found_change) @<Make |change_file_name| from |fname|@>@;
- else if (!found_out) @<Override |tex_file_name| and |C_file_name|@>@;
- else @<Print usage error message and quit@>;
- }
- }
- if (!found_web) @<Print usage error message and quit@>;
- if (found_change<=0) strcpy(change_file_name,"NUL");
-}
+@z
+
+@x
+@ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it,
+otherwise we add |".w"|. If this file can't be opened, we prepare an
+|alt_web_file_name| by adding |"web"| after the dot.
+The other file names come from adding other things
+after the dot. We must check that there is enough room in
+|web_file_name| and the other arrays for the argument.
+@y
@ We use all of |*argv| for the |web_file_name| if there is a |'_'| in it,
otherwise we add |"_w"|. If this file can't be opened, we prepare an
|alt_web_file_name| by adding |"web"| after the dot.
@@ -250,7 +136,28 @@ If you've read the section before carefully you'll have noticed, that
QDOS/SMSQ file names contain almost a |"_"|, so this routine will not work,
i.e. you'll {\em have} to add the |"_w"| always. Nevertheless I adapted
the routine as if it would work.
+@z
+
+@x
+@<Make |web_file_name|...@>=
+{
+ if (s-*argv > max_file_name_length-5)
+ @<Complain about argument length@>@;
+ if (dot_pos==NULL)
+ sprintf(web_file_name,"%s.w",*argv);
+ else {
+ strcpy(web_file_name,*argv);
+ *dot_pos=0; /* string now ends where the dot was */
+ }
+ sprintf(alt_web_file_name,"%s.web",*argv);
+ sprintf(tex_file_name,"%s.tex",name_pos); /* strip off directory name */
+ sprintf(idx_file_name,"%s.idx",name_pos);
+ sprintf(scn_file_name,"%s.scn",name_pos);
+ sprintf(C_file_name,"%s.c",name_pos);
+ found_web=1;
+}
+@y
@<Make |web_file_name|...@>=
{
if (s-*argv > max_file_name_length-5)
@@ -268,11 +175,25 @@ the routine as if it would work.
sprintf(C_file_name,"%s_c",name_pos);
found_web=1;
}
+@z
+
+@x
@ @<Make |change_file_name|...@>=
{
- if (strcmp(*argv,"-")==0) found_change=-1;
- else {
+ if (strcmp(*argv,"-")!=0) {
+ if (s-*argv > max_file_name_length-4)
+ @<Complain about argument length@>@;
+ if (dot_pos==NULL)
+ sprintf(change_file_name,"%s.ch",*argv);
+ else strcpy(change_file_name,*argv);
+ }
+ found_change=1;
+}
+@y
+@ @<Make |change_file_name|...@>=
+{
+ if (strcmp(*argv,"-")!=0) {
if (s-*argv > max_file_name_length-4)
@<Complain about argument length@>;
if (dot_pos==NULL)
@@ -281,7 +202,31 @@ the routine as if it would work.
found_change=1;
}
}
+@z
+
+@x
+@ @<Override...@>=
+{
+ if (s-*argv > max_file_name_length-5)
+ @<Complain about argument length@>@;
+ if (dot_pos==NULL) {
+ sprintf(tex_file_name,"%s.tex",*argv);
+ sprintf(idx_file_name,"%s.idx",*argv);
+ sprintf(scn_file_name,"%s.scn",*argv);
+ sprintf(C_file_name,"%s.c",*argv);
+ } else {
+ strcpy(tex_file_name,*argv);
+ strcpy(C_file_name,*argv);
+ if (make_xrefs) { /* indexes will be generated */
+ *dot_pos=0;
+ sprintf(idx_file_name,"%s.idx",*argv);
+ sprintf(scn_file_name,"%s.scn",*argv);
+ }
+ }
+ found_out=1;
+}
+@y
@ @<Override...@>=
{
if (s-*argv > max_file_name_length-5)
@@ -294,7 +239,7 @@ the routine as if it would work.
} else {
strcpy(tex_file_name,*argv);
strcpy(C_file_name,*argv);
- if (flags['x']) { /* indexes will be generated */
+ if (make_xrefs) { /* indexes will be generated */
*dot_pos=0;
sprintf(idx_file_name,"%s_idx",*argv);
sprintf(scn_file_name,"%s_scn",*argv);
diff --git a/Build/source/texk/web2c/cwebdir/comm-vms.ch b/Build/source/texk/web2c/cwebdir/comm-vms.ch
index cd5fe524393..cf6d6198486 100644
--- a/Build/source/texk/web2c/cwebdir/comm-vms.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-vms.ch
@@ -13,19 +13,26 @@ modified:
(only the two changes by BL are necessary for initial bootstrapping
via hand-editing of common.c)
-@x section 5 (01-FEB-1992 ST)
-#include <ctype.h>
+@x section 3 (01-FEB-1992 ST)
+#include <ctype.h> /* definition of |@!isalpha|, |@!isdigit| and so on */
+#include <stdbool.h> /* definition of |@!bool|, |@!true| and |@!false| */
+#include <stddef.h> /* definition of |@!ptrdiff_t| */
+#include <stdint.h> /* definition of |@!uint8_t| and |@!uint16_t| */
+#include <stdlib.h> /* definition of |@!getenv| and |@!exit| */
+#include <stdio.h> /* definition of |@!printf| and friends */
+#include <string.h> /* definition of |@!strlen|, |@!strcmp| and so on */
@y
-#include ctype /* VMS searches Textlibraries faster */
+#include ctype /* definition of |@!isalpha|, |@!isdigit| and so on */
+ /* VMS searches text libraries faster */
+#include stdbool /* definition of |@!bool|, |@!true| and |@!false| */
+#include stddef /* definition of |@!ptrdiff_t| */
+#include stdint /* definition of |@!uint8_t| and |@!uint16_t| */
+#include stdlib /* definition of |@!getenv| and |@!exit| */
+#include stdio /* definition of |@!printf| and friends */
+#include string /* definition of |@!strlen|, |@!strcmp| and so on */
@z
-@x section 8 (01-FEB-1992 ST)
-#include <stdio.h>
-@y
-#include stdio /* VMS searches Textlibraries faster */
-@z
-
-@x section 61 (01-FEB-1992 ST)
+@x section 68 (01-FEB-1992 ST)
programs are started. Here, for instance, we pass the operating system
a status of 0 if and only if only harmless messages were printed.
@y
@@ -37,7 +44,7 @@ A suitable status to signal an error condition to VAX/VMS could be
print |"%SYSTEM-F-ABORT, abort"|, if |history > harmless_message|.
@z
-@x section 61 (1987 BL) (01-FEB-1992 ST) (11-JAN-1993 DEK)
+@x section 68 (1987 BL) (01-FEB-1992 ST) (11-JAN-1993 DEK)
if (history > harmless_message) return(1);
else return(0);
@y
@@ -52,7 +59,7 @@ print |"%SYSTEM-F-ABORT, abort"|, if |history > harmless_message|.
else exit(SS$_NORMAL);
@z
-@x section 69 (01-FEB-1992 ST)
+@x section 75 (01-FEB-1992 ST)
An omitted change file argument means that |"/dev/null"| should be used,
when no changes are desired.
@y
@@ -60,14 +67,14 @@ An omitted change file argument means that the
null device |"NL:"| should be used, when no changes are desired.
@z
-@x section 70 (1987 BL) (01-FEB-1992 ST) (05-APR-1992 DEK)
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
+@x section 76 (1987 BL) (01-FEB-1992 ST) (05-APR-1992 DEK)
+ strcpy(change_file_name,"/dev/null");
@y
- if (found_change<=) strcpy(change_file_name,"NL:");
+ strcpy(change_file_name,"NL:");
/* {\tt NL:} is the VAX/VMS notation for {\tt /dev/null} */
@z
-@x section 82 (01-FEB-1992 ST)
+@x section 85 (01-FEB-1992 ST)
@** Index.
@y
@* VAX/VMS specific code.
diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch
index e134eab9ad7..f12a17353b2 100644
--- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch
@@ -1,31 +1,32 @@
-@q Changes for CWEB in TeX Live from numerous contributors. @>
-@q This file is in the Public Domain. @>
+@q Changes for CWEB in TeX Live from numerous contributors. @>
+@q This file is in the Public Domain. @>
-@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
-@q were merged with the set of change files of the CWEBbin project; @>
-@q see https://github.com/ascherer/cwebbin for the original parts. @>
+@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
+@q were merged with the set of change files of the CWEBbin project; @>
+@q see https://github.com/ascherer/cwebbin for the original parts. @>
-@q This stripped change file {comm,ctang,cweav,ctwill}-w2c.ch has been @>
-@q created from the set of change files {comm,ctang,cweav}-patch.ch, @>
-@q {comm,ctang,cweav}-ansi.ch, {comm,ctang,cweav}-extensions.ch, @>
-@q {comm,ctang,cweav}-output.ch, {comm,ctang,cweav}-i18n.ch, and @>
-@q cweav-twill.ch for CTWILL, and {comm,ctang,cweav,ctwill}-texlive.ch @>
-@q with the 'tie' processor and is used as a monolithic changefile for @>
-@q {common,ctangle,cweave}.w in TeX Live. @>
+@q This stripped change file {comm,ctang,cweav,ctwill,cwebman}-w2c.ch @>
+@q has been created from the elaborate set of change files @>
+@q {comm,ctang,cweav,cwebman}-patch.ch, @>
+@q {comm,cweav,cwebman}-extensions.ch, {comm,ctang,cweav}-output.ch, @>
+@q {comm,ctang,cweav}-i18n.ch, and cweav-twill.ch for CTWILL, and @>
+@q {comm,ctang,cweav,ctwill,cwebman}-texlive.ch with the 'tie' processor @>
+@q and is used as a monolithic changefile for {common,ctangle,cweave}.w @>
+@q and cwebman.tex in TeX Live. @>
-@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
+@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
@x
-\def\title{Common code for CTANGLE and CWEAVE (Version 3.64)}
+\def\title{Common code for CTANGLE and CWEAVE (Version 4.0)}
@y
\def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}} \ifacro\sanitizecommand\Kpathsea{KPATHSEA}\fi
-\def\title{Common code for CTANGLE and CWEAVE (\TeX~Live)}
+\def\title{Common code for CTANGLE and CWEAVE (4.0 [\TeX~Live])}
@z
@x
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
@y
- \centerline{(Version 3.64 [\TeX~Live])}
+ \centerline{(Version 4.0 [\TeX~Live])}
@z
@x
@@ -37,16 +38,7 @@
@x
}
@y
-}}
-\datecontentspage
-@z
-
-@x
-@s not_eq normal @q unreserve a C++ keyword @>
-@y
-@s boolean int
-@s uint8_t int
-@s uint16_t int
+}}\datecontentspage
@z
@x
@@ -63,104 +55,35 @@ sometimes use \.{CWEB} to refer to any of the three component
@z
@x
-|program|.
-
-@d ctangle 0
-@d cweave 1
+@i common.h
@y
-|program|. And \.{CTWILL} adds some extra twists.
+@i comm-w2c.h
@z
@x
-typedef short boolean;
+|program|.
@y
-typedef uint8_t eight_bits;
-typedef uint16_t sixteen_bits;
+|program|. And \.{CTWILL} adds some extra twists.
@z
@x
boolean program; /* \.{CWEAVE} or \.{CTANGLE}? */
@y
-typedef enum {
- @!ctangle, @!cweave, @!ctwill
-} cweb;
cweb program; /* \.{CTANGLE} or \.{CWEAVE} or \.{CTWILL}? */
@z
@x
-void
-common_init()
-@y
-void
-common_init(void)
-@z
-
-@x
- @<Initialize pointers@>;
- @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>;
- @<Scan arguments and open output files@>;
+ @<Initialize pointers@>@;
@y
@<Initialize pointers@>@;
@<Set up |PROGNAME| feature and initialize the search path mechanism@>@;
- @<Set locale and bind language catalogs@>@;
- @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>@;
- @<Scan arguments and open output files@>@;
-@z
-
-@x
-\.{ctype.h} header file.
-
-@<Include files@>=
-#include <ctype.h>
-@y
-\.{ctype.h} header file, included through the \Kpathsea/ interface.
-@z
-
-@x
-@d not_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */
-@y
-@d non_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */
-@z
-
-@x
-@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */
-@y
-@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */
-
-@<Definitions...@>=
-char section_text[longest_name+1]; /* name being sought for */
-char *section_text_end = section_text+longest_name; /* end of |section_text| */
-char *id_first; /* where the current identifier begins in the buffer */
-char *id_loc; /* just after the current identifier in the buffer */
-@z
-
-@x
-@d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
-@y
-@d buf_size 1000 /* for \.{CWEAVE} and \.{CTANGLE} */
-@z
-
-@x
-@d xisspace(c) (isspace(c)&&((unsigned char)c<0200))
-@d xisupper(c) (isupper(c)&&((unsigned char)c<0200))
-@y
-@d xisspace(c) (isspace((eight_bits)c)&&((eight_bits)c<0200))
-@d xisupper(c) (isupper((eight_bits)c)&&((eight_bits)c<0200))
-@z
-
-@x
-@ @<Include files@>=
-#include <stdio.h>
-@y
-@ Most of the standard \CEE/ interface comes from \Kpathsea/.
@z
@x
-int input_ln(fp) /* copies a line into |buffer| or returns 0 */
-FILE *fp; /* what file to read from */
+ @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>@;
@y
-static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns 0 */
-FILE *fp@t\2\2@>) /* what file to read from */
+ @<Set locale and bind language catalogs@>@;
+ @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>@;
@z
@x
@@ -176,39 +99,11 @@ FILE *fp@t\2\2@>) /* what file to read from */
@z
@x
-@d max_file_name_length 60
-@y
-@d max_file_name_length 1024
-@z
-
-@x
char alt_web_file_name[max_file_name_length]; /* alternate name to try */
@y
@z
@x
-@d lines_dont_match (change_limit-change_buffer != limit-buffer ||
- strncmp(buffer, change_buffer, limit-buffer))
-@y
-@d lines_dont_match (change_limit-change_buffer != limit-buffer || @|
- strncmp(buffer, change_buffer, (size_t)(limit-buffer)))
-@z
-
-@x
-void
-prime_the_change_buffer()
-@y
-static void
-prime_the_change_buffer(void)
-@z
-
-@x
- if (xisupper(buffer[1])) buffer[1]=tolower(buffer[1]);
-@y
- if (xisupper(buffer[1])) buffer[1]=tolower((eight_bits)buffer[1]);
-@z
-
-@x
err_print("! Missing @@x in change file");
@y
err_print(_("! Missing @@x in change file"));
@@ -221,34 +116,12 @@ prime_the_change_buffer(void)
@z
@x
- change_limit=change_buffer+(limit-buffer);
- strncpy(change_buffer,buffer,limit-buffer+1);
-@y
- change_limit=change_buffer+(ptrdiff_t)(limit-buffer);
- strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
-@z
-
-@x
-void
-check_change() /* switches to |change_file| if the buffers match */
-@y
-static void
-check_change(void) /* switches to |change_file| if the buffers match */
-@z
-
-@x
err_print("! Change file ended before @@y");
@y
err_print(_("! Change file ended before @@y"));
@z
@x
- char xyz_code=xisupper(buffer[1])? tolower(buffer[1]): buffer[1];
-@y
- char xyz_code=xisupper(buffer[1])? tolower((eight_bits)buffer[1]): buffer[1];
-@z
-
-@x
err_print("! CWEB file ended during a change");
@y
err_print(_("! CWEB file ended during a change"));
@@ -267,14 +140,6 @@ check_change(void) /* switches to |change_file| if the buffers match */
@z
@x
-void
-reset_input()
-@y
-void
-reset_input(void)
-@z
-
-@x
if ((web_file=fopen(web_file_name,"r"))==NULL) {
strcpy(web_file_name,alt_web_file_name);
if ((web_file=fopen(web_file_name,"r"))==NULL)
@@ -310,25 +175,6 @@ if ((found_filename=kpse_find_cweb(change_file_name))==NULL || @|
@z
@x
-@d max_sections 2000 /* number of identifiers, strings, section names;
- must be less than 10240 */
-@y
-@d max_sections 10239 /* number of identifiers, strings, section names;
- must be less than 10240 */
-@z
-
-@x
-typedef unsigned short sixteen_bits;
-@y
-@z
-
-@x
-int get_line() /* inputs the next line */
-@y
-boolean get_line(void) /* inputs the next line */
-@z
-
-@x
err_print("! Include file name not given");
@y
err_print(_("! Include file name not given"));
@@ -357,7 +203,7 @@ stop reading it and start reading from the named include file. The
\.{@@i} line should give a complete file name with or without
double quotes.
The actual file lookup is done with the help of the \Kpathsea/ library;
-see section~\X90:File lookup with \Kpathsea/\X~for details. % FIXME
+see section~\X91:File lookup with \Kpathsea/\X~for details. % FIXME
The remainder of the \.{@@i} line after the file name is ignored.
@^system dependencies@> @.CWEBINPUTS@>
@z
@@ -369,18 +215,6 @@ The remainder of the \.{@@i} line after the file name is ignored.
@z
@x
-@<Include...@>=
-#include <stdlib.h> /* declaration of |getenv| and |exit| */
-@y
-@z
-
-@x
-@ @<Try to open...@>= {
-@y
-@ @.CWEBINPUTS@>@<Try to open...@>= {
-@z
-
-@x
char temp_file_name[max_file_name_length];
char *cur_file_name_end=cur_file_name+max_file_name_length-1;
char *k=cur_file_name, *kk;
@@ -441,98 +275,18 @@ The remainder of the \.{@@i} line after the file name is ignored.
@z
@x
- if (xisupper(buffer[1])) buffer[1]=tolower(buffer[1]);
-@y
- if (xisupper(buffer[1])) buffer[1]=tolower((eight_bits)buffer[1]);
-@z
-
-@x
err_print("! Where is the matching @@z?");
@y
err_print(_("! Where is the matching @@z?"));
@z
@x
-void
-check_complete(){
- if (change_limit!=change_buffer) { /* |changing| is 0 */
- strncpy(buffer,change_buffer,change_limit-change_buffer+1);
- limit=buffer+(int)(change_limit-change_buffer);
-@y
-void
-check_complete(void) {
- if (change_limit!=change_buffer) { /* |changing| is 0 */
- strncpy(buffer,change_buffer,(size_t)(change_limit-change_buffer+1));
- limit=buffer+(ptrdiff_t)(change_limit-change_buffer);
-@z
-
-@x
err_print("! Change file entry did not match");
@y
err_print(_("! Change file entry did not match"));
@z
@x
-@d max_bytes 90000 /* the number of bytes in identifiers,
- index entries, and section names; must be less than $2^{24}$ */
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240 */
-@y
-@d max_bytes 1000000 /* the number of bytes in identifiers,
- index entries, and section names; must be less than $2^{24}$ */
-@d max_names 10239 /* number of identifiers, strings, section names;
- must be less than 10240 */
-@z
-
-@x
-@d length(c) (c+1)->byte_start-(c)->byte_start /* the length of a name */
-@y
-@d length(c) (size_t)((c+1)->byte_start-(c)->byte_start) /* the length of a name */
-@z
-
-@x
-@d hash_size 353 /* should be prime */
-@y
-@d hash_size 8501 /* should be prime */
-@z
-
-@x
-extern int names_match();
-@y
-extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/
-@z
-
-@x
-name_pointer
-id_lookup(first,last,t) /* looks up a string in the identifier table */
-char *first; /* first character of string */
-char *last; /* last character of string plus one */
-char t; /* the |ilk|; used by \.{CWEAVE} only */
-{
- char *i=first; /* position in |buffer| */
-@y
-name_pointer
-id_lookup(@t\1\1@> /* looks up a string in the identifier table */
-const char *first, /* first character of string */
-const char *last, /* last character of string plus one */
-char t@t\2\2@>) /* the |ilk|; used by \.{CWEAVE} only */
-{
- const char *i=first; /* position in |buffer| */
-@z
-
-@x
- l=last-first; /* compute the length */
-@y
- l=(int)(last-first); /* compute the length */
-@z
-
-@x
-void init_p();
-@y
-extern void init_p(name_pointer,eight_bits);@/
-@z
-
-@x
if (byte_ptr+l>byte_mem_end) overflow("byte memory");
if (name_ptr>=name_dir_end) overflow("name");
@y
@@ -541,102 +295,6 @@ extern void init_p(name_pointer,eight_bits);@/
@z
@x
- if (program==cweave) init_p(p,t);
-@y
- init_p(p,t);
-@z
-
-@x
-void
-print_section_name(p)
-name_pointer p;
-@y
-void
-print_section_name(
-name_pointer p)
-@z
-
-@x
- term_write(s,ss-s); p=q->link; q=p;
- } else {
- term_write(s,ss+1-s); p=name_dir; q=NULL;
-@y
- term_write(s,(size_t)(ss-s)); p=q->link; q=p;
- } else {
- term_write(s,(size_t)(ss+1-s)); p=name_dir; q=NULL;
-@z
-
-@x
-void
-sprint_section_name(dest,p)
- char*dest;
- name_pointer p;
-@y
-void
-sprint_section_name(
- char *dest,
- name_pointer p)
-@z
-
-@x
- strncpy(dest,s,ss-s), dest+=ss-s;
-@y
- strncpy(dest,s,(size_t)(ss-s)), dest+=ss-s;
-@z
-
-@x
-void
-print_prefix_name(p)
-name_pointer p;
-@y
-void
-print_prefix_name(
-name_pointer p)
-@z
-
-@x
-int web_strcmp(j,j_len,k,k_len) /* fuller comparison than |strcmp| */
- char *j, *k; /* beginning of first and second strings */
- int j_len, k_len; /* length of strings */
-@y
-static int web_strcmp(@t\1\1@> /* fuller comparison than |strcmp| */
- char *j, /* beginning of first string */
- int j_len, /* length of first string */
- char *k, /* beginning of second string */
- int k_len@t\2\2@>) /* length of second string */
-@z
-
-@x
-extern void init_node();
-@y
-extern void init_node(name_pointer);@/
-@z
-
-@x
-name_pointer
-add_section_name(par,c,first,last,ispref) /* install a new node in the tree */
-name_pointer par; /* parent of new node */
-int c; /* right or left? */
-char *first; /* first character of section name */
-char *last; /* last character of section name, plus one */
-int ispref; /* are we adding a prefix or a full name? */
-@y
-static name_pointer
-add_section_name(@t\1\1@> /* install a new node in the tree */
-name_pointer par, /* parent of new node */
-int c, /* right or left? */
-char *first, /* first character of section name */
-char *last, /* last character of section name, plus one */
-int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
-@z
-
-@x
- int name_len=last-first+ispref; /* length of section name */
-@y
- int name_len=(int)(last-first)+ispref; /* length of section name */
-@z
-
-@x
if (s+name_len>byte_mem_end) overflow("byte memory");
if (name_ptr+1>=name_dir_end) overflow("name");
@y
@@ -645,28 +303,6 @@ int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
@z
@x
-void
-extend_section_name(p,first,last,ispref)
-name_pointer p; /* name to be extended */
-char *first; /* beginning of extension text */
-char *last; /* one beyond end of extension text */
-int ispref; /* are we adding a prefix or a full name? */
-@y
-static void
-extend_section_name(@t\1\1@>
-name_pointer p, /* name to be extended */
-char *first, /* beginning of extension text */
-char *last, /* one beyond end of extension text */
-int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
-@z
-
-@x
- int name_len=last-first+ispref;
-@y
- int name_len=(int)(last-first)+ispref;
-@z
-
-@x
if (name_ptr>=name_dir_end) overflow("name");
@y
if (name_ptr>=name_dir_end) overflow(_("name"));
@@ -679,118 +315,42 @@ int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
@z
@x
-name_pointer
-section_lookup(first,last,ispref) /* find or install section name in tree */
-char *first, *last; /* first and last characters of new name */
-int ispref; /* is the new name a prefix or a full name? */
-@y
-name_pointer
-section_lookup(@t\1\1@> /* find or install section name in tree */
-char *first,char *last, /* first and last characters of new name */
-int ispref@t\2\2@>) /* is the new name a prefix or a full name? */
-@z
-
-@x
- int name_len=last-first+1;
-@y
- int name_len=(int)(last-first)+1;
-@z
-
-@x
- printf("\n! Ambiguous prefix: matches <");
+ fputs("\n! Ambiguous prefix: matches <",stdout);
@y
fputs(_("\n! Ambiguous prefix: matches <"),stdout);
@z
@x
- printf(">\n and <");
+ fputs(">\n and <",stdout);
@y
fputs(_(">\n and <"),stdout);
@z
@x
- printf("\n! New name is a prefix of <");
+ fputs("\n! New name is a prefix of <",stdout);
@y
fputs(_("\n! New name is a prefix of <"),stdout);
@z
@x
- printf("\n! New name extends <");
+ fputs("\n! New name extends <",stdout);
@y
fputs(_("\n! New name extends <"),stdout);
@z
@x
- printf("\n! Section name incompatible with <");
+ fputs("\n! Section name incompatible with <",stdout);
@y
fputs(_("\n! Section name incompatible with <"),stdout);
@z
@x
- printf(">,\n which abbreviates <");
+ fputs(">,\n which abbreviates <",stdout);
@y
fputs(_(">,\n which abbreviates <"),stdout);
@z
@x
-int section_name_cmp();
-@y
-static int section_name_cmp(char **,int,name_pointer);@/
-@z
-
-@x
-int section_name_cmp(pfirst,len,r)
-char **pfirst; /* pointer to beginning of comparison string */
-int len; /* length of string */
-name_pointer r; /* section name being compared */
-@y
-static int section_name_cmp(@t\1\1@>
-char **pfirst, /* pointer to beginning of comparison string */
-int len, /* length of string */
-name_pointer r@t\2\2@>) /* section name being compared */
-@z
-
-@x
- *pfirst=first+(ss-s);
-@y
- *pfirst=first+(ptrdiff_t)(ss-s);
-@z
-
-@x
- if (q!=name_dir) {len -= ss-s; s=q->byte_start; r=q; continue;}
-@y
- if (q!=name_dir) {len -= (int)(ss-s); s=q->byte_start; r=q; continue;}
-@z
-
-@x
-|equiv_or_xref| as a pointer to a |char|.
-
-@<More elements of |name...@>=
-char *equiv_or_xref; /* info corresponding to names */
-@y
-|equiv_or_xref| as a pointer to |void|.
-
-@<More elements of |name...@>=
-void *equiv_or_xref; /* info corresponding to names */
-@z
-
-@x
-void err_print();
-@y
-extern void err_print(const char *);@/
-@z
-
-@x
-void
-err_print(s) /* prints `\..' and location of error message */
-char *s;
-@y
-void
-err_print(@t\1\1@> /* prints `\..' and location of error message */
-const char *s@t\2\2@>)
-@z
-
-@x
printf(". (l. %d of change file)\n", change_line);
else if (include_depth==0) printf(". (l. %d)\n", cur_line);
else printf(". (l. %d of include file %s)\n", cur_line, cur_file_name);
@@ -801,21 +361,13 @@ else if (include_depth==0) printf(_(". (l. %d)\n"), cur_line);
@z
@x
-int wrap_up();
-extern void print_stats();
-@y
-extern int wrap_up(void);@/
-extern void print_stats(void);@/
-@z
-
-@x
-@ Some implementations may wish to pass the |history| value to the
+Some implementations may wish to pass the |history| value to the
operating system so that it can be used to govern whether or not other
programs are started. Here, for instance, we pass the operating system
a status of 0 if and only if only harmless messages were printed.
@^system dependencies@>
@y
-@ On multi-tasking systems like the {\mc AMIGA} it is very convenient to
+On multi-tasking systems like the {\mc AMIGA} it is very convenient to
know a little bit more about the reasons why a program failed. The four
levels of return indicated by the |history| value are very suitable for
this purpose. Here, for instance, we pass the operating system a status
@@ -831,15 +383,7 @@ can be made sensitive to these conditions.
@z
@x
-int wrap_up() {
- putchar('\n');
-@y
-int wrap_up(void) {
- if (show_progress || show_happiness || (history > spotless)) new_line;
-@z
-
-@x
- @<Print the job |history|@>;
+ @<Print the job |history|@>@;
@y
@<Print the job |history|@>@;
@<Remove the temporary file if not already done@>@;
@@ -858,12 +402,12 @@ int wrap_up(void) {
@z
@x
-case spotless: if (show_happiness) printf("(No errors were found.)\n"); break;
+case spotless: if (show_happiness) puts("(No errors were found.)"); break;
case harmless_message:
- printf("(Did you see the warning message above?)\n"); break;
+ puts("(Did you see the warning message above?)"); break;
case error_message:
- printf("(Pardon me, but I think I spotted something wrong.)\n"); break;
-case fatal_message: printf("(That was a fatal error, my friend.)\n");
+ puts("(Pardon me, but I think I spotted something wrong.)"); break;
+case fatal_message: puts("(That was a fatal error, my friend.)");
@y
case spotless:
if (show_happiness) puts(_("(No errors were found.)")); break;
@@ -876,59 +420,12 @@ case fatal_message:
@z
@x
-void fatal(), overflow();
-@y
-extern void fatal(const char *,const char *);@/
-extern void overflow(const char *);@/
-@z
-
-@x
-@c void
-fatal(s,t)
- char *s,*t;
-@y
-@c void
-fatal(
- const char *s,const char *t)
-@z
-
-@x
- if (*s) printf(s);
-@y
- if (*s) err_print(s);
-@z
-
-@x
-@c void
-overflow(t)
- char *t;
-@y
-@c void
-overflow(
- const char *t)
-@z
-
-@x
printf("\n! Sorry, %s capacity exceeded",t); fatal("","");
@y
printf(_("\n! Sorry, %s capacity exceeded"),t); fatal("","");
@z
@x
-@d confusion(s) fatal("! This can't happen: ",s)
-@y
-@d confusion(s) fatal(_("! This can't happen: "),s)
-@z
-
-@x
-@d show_happiness flags['h'] /* should lack of errors be announced? */
-@y
-@d show_happiness flags['h'] /* should lack of errors be announced? */
-@d temporary_output flags['t'] /* should temporary output take precedence? */
-@d make_xrefs flags['x'] /* should cross references be output? */
-@z
-
-@x
char scn_file_name[max_file_name_length]; /* name of |scn_file| */
@y
char scn_file_name[max_file_name_length]; /* name of |scn_file| */
@@ -936,16 +433,10 @@ char check_file_name[max_file_name_length]; /* name of |check_file| */
@z
@x
-boolean flags[128]; /* an option for each 7-bit code */
+show_banner=show_happiness=show_progress=make_xrefs=true;@/
@y
-boolean flags[128]; /* an option for each 7-bit code */
-const char *use_language=""; /* prefix of \.{cwebmac.tex} in \TEX/ output */
-@z
-
-@x
-show_banner=show_happiness=show_progress=1;
-@y
-temporary_output=1; /* Check temporary output for changes */
+make_xrefs=true;@/
+temporary_output=true; /* Check temporary output for changes */
@z
@x
@@ -966,26 +457,7 @@ systems the contents of the compile-time variable |DEV_NULL| (\TeX~Live) or
@z
@x
-void scan_args();
-@y
-static void scan_args(void);@/
-@z
-
-@x
-void
-scan_args()
-@y
-static void
-scan_args(void)
-@z
-
-@x
- boolean flag_change;
-@y
-@z
-
-@x
- while (--argc > 0) {
+ strcpy(change_file_name,"/dev/null");
@y
@#
#if defined DEV_NULL
@@ -998,7 +470,6 @@ scan_args(void)
strcpy(change_file_name,"/dev/null");
#endif
@^system dependencies@>
- while (--argc > 0) {
@z
@x
@@ -1018,11 +489,6 @@ scan_args(void)
@z
@x
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
-@y
-@z
-
-@x
@ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it,
otherwise we add |".w"|. If this file can't be opened, we prepare an
|alt_web_file_name| by adding |"web"| after the dot.
@@ -1037,34 +503,10 @@ otherwise we add |".w"|.
@z
@x
- if (strcmp(*argv,"-")==0) found_change=-1;
- else {
-@y
- if (strcmp(*argv,"-")!=0) {
-@z
-
-@x
- found_change=1;
- }
-@y
- }
- found_change=1;
-@z
-
-@x
- if (flags['x']) { /* indexes will be generated */
-@y
- if (make_xrefs) { /* indexes will be generated */
-@z
-
-@x
-@ @<Handle flag...@>=
+@<Handle flag...@>=
{
- if (**argv=='-') flag_change=0;
- else flag_change=1;
for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++)
@y
-@ @d flag_change (**argv!='-')
@<Handle flag...@>=
{
if (strcmp("-help",*argv)==0 || strcmp("--help",*argv)==0)
@@ -1098,12 +540,7 @@ otherwise we add |".w"|.
@z
@x
- flags[*dot_pos]=flag_change;
-@y
- flags[(eight_bits)*dot_pos]=flag_change;
-@z
-
-@x
+@ @<Print usage error message and quit@>=
{
if (program==ctangle)
fatal(
@@ -1115,6 +552,7 @@ else fatal(
,"");
}
@y
+@ @<Print usage error message and quit@>=
cb_usage(program==ctangle ? "ctangle" : program==cweave ? "cweave" : "ctwill");
@.Usage:@>
@z
@@ -1143,12 +581,12 @@ char *found_filename; /* filename found by |kpse_find_file| */
@ @<Scan arguments and open output files@>=
scan_args();
if (program==ctangle) {
- if ((C_file=fopen(C_file_name,"w"))==NULL)
+ if ((C_file=fopen(C_file_name,"wb"))==NULL)
fatal("! Cannot open output file ", C_file_name);
@.Cannot open output file@>
}
else {
- if ((tex_file=fopen(tex_file_name,"w"))==NULL)
+ if ((tex_file=fopen(tex_file_name,"wb"))==NULL)
fatal("! Cannot open output file ", tex_file_name);
}
@y
@@ -1185,71 +623,24 @@ else {
@z
@x
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-@y
-@ For string handling we include the {\mc ANSI C} system header file---through
-the \Kpathsea/ interface---instead of predeclaring the standard system
-functions |strlen|, |strcmp|, |strcpy|, |strncmp|, and |strncpy|.
-@^system dependencies@>
-@z
-
-@x
@** Index.
@y
-@** Extensions for modern \.{CWEB}. The following sections introduce changes
-and extensions to the code that have been created by numerous contributors over
-the course of a quarter century. They make \.{CWEB} adhere to modern coding
-standards and introduce new or improved features.
+@** Extensions to \.{CWEB}. The following sections introduce new or improved
+features that have been created by numerous contributors over the course of a
+quarter century.
Care has been taken to keep the original section numbering intact, so this new
-section should have the same number as the original ``\&{82.~Index},'' and
-additional material follows below.
+material should nicely integrate with the original ``\&{85.~Index}.''
-@* Function declarations. Here are declarations---conforming to
-{\mc ANSI~C}---of all functions in this code that appear in \.{common.h}
-and thus should agree with \.{CTANGLE} and \.{CWEAVE}.
+@* Language setting. This global variable is set by the argument of the
+`\.{+l}' (or `\.{-l}') command-line option.
-@<Predecl...@>=
-boolean get_line(void);@/
-name_pointer id_lookup(const char *,const char *,char);@/
-name_pointer section_lookup(char *,char *,int);@/
-void check_complete(void);@/
-void common_init(void);@/
-void print_prefix_name(name_pointer);@/
-void print_section_name(name_pointer);@/
-void reset_input(void);@/
-void sprint_section_name(char *,name_pointer);@/
-
-@ The following functions are private to \.{common.w}.
-
-@<Predecl...@>=
-static boolean input_ln(FILE *);@/
-static int web_strcmp(char *,int,char *,int);@/
-static name_pointer add_section_name(name_pointer,int,char *,char *,int);@/
-static void extend_section_name(name_pointer,char *,char *,int);@/
-static void check_change(void);@/
-static void prime_the_change_buffer(void);@/
+@<Global var...@>=
+const char *use_language=""; /* prefix of \.{cwebmac.tex} in \TEX/ output */
-@* Standard C library interfaces. This updated version of \.{CWEB} uses
-standard C types for boolean values, pointers, and objects with fixed sizes
-(|@!uint8_t|, |@!uint16_t|; already in \Kpathsea/).
-@<Include files@>=
-#include <stdbool.h> /* type definition of |bool| */
-#include <stddef.h> /* type definition of |ptrdiff_t| */
-
-@ The |scan_args| and |cb_show_banner| routines and the |bindtextdomain|
-argument string need a few extra variables.
+@* User communation. The |scan_args| and |cb_show_banner| routines and the
+|bindtextdomain| argument string need a few extra variables.
@d max_banner 50
@@ -1257,7 +648,7 @@ argument string need a few extra variables.
@d DIR_SEPARATOR separators[1]
@d DEVICE_SEPARATOR separators[2]
-@<Other...@>=
+@<Global var...@>=
char cb_banner[max_banner];@/
string texmf_locale;@/
#ifndef SEPARATORS
@@ -1275,35 +666,12 @@ if(check_file) fclose(check_file);
if(strlen(check_file_name)) /* Delete the temporary file in case of a break */
remove(check_file_name);
-@* Internationalization. You may have noticed that almost all \.{"strings"}
-in the \.{CWEB} sources are placed in the context of the `|_|'~macro.
-This is just a shortcut for the `|@!gettext|' function from the ``GNU~gettext
-utilities.'' For systems that do not have this library installed, we wrap
-things for neutral behavior without internationalization.
-
-@d _(S) gettext(S)
-
-@<Include files@>=
-#ifndef HAVE_GETTEXT
-#define HAVE_GETTEXT 0
-#endif
-@#
-#if HAVE_GETTEXT
-#include <locale.h> /* |@!LC_MESSAGES|, |@!LC_CTYPE| */
-#include <libintl.h>
-#else
-#define setlocale(A,B) ""
-#define bindtextdomain(A,B) ""
-#define textdomain(A) ""
-#define gettext(A) A
-#endif
-
-@ If translation catalogs for your personal \.{LANGUAGE} are installed at the
-appropriate place, \.{CTANGLE} and \.{CWEAVE} will talk to you in your favorite
-language. Catalog \.{cweb} contains all strings from ``plain \.{CWEB},''
-catalog \.{cweb-tl} contains a few extra strings specific to the \TeX~Live
-interface, and catalog \.{web2c-help} contains the ``\.{--help}'' texts for
-\.{CTANGLE} and \.{CWEAVE}.
+@* Internationalization. If translation catalogs for your personal
+\.{LANGUAGE} are installed at the appropriate place, \.{CTANGLE} and \.{CWEAVE}
+will talk to you in your favorite language. Catalog \.{cweb} contains all
+strings from ``plain \.{CWEB},'' catalog \.{cweb-tl} contains a few extra
+strings specific to the \TeX~Live interface, and catalog \.{web2c-help}
+contains the ``\.{--help}'' texts for \.{CTANGLE} and \.{CWEAVE}.
@.cweb.mo@>
@.cweb-tl.mo@>
@.web2c-help.mo@>
@@ -1339,7 +707,16 @@ There are several ways to set |TEXMFLOCALEDIR|:
e.g., \.{TEXMFLOCALEDIR=\$TEXMFMAIN/locale}\hfil\break
or \.{TEXMFLOCALEDIR.cweb=\$TEXMFMAIN/locale}.\par}
-@<Set locale...@>=
+@<Include files@>=
+#if HAVE_GETTEXT
+#include <locale.h> /* |@!LC_MESSAGES|, |@!LC_CTYPE| */
+#else
+#define setlocale(A,B) ""
+#define bindtextdomain(A,B) ""
+#define textdomain(A) ""
+#endif
+
+@ @<Set locale...@>=
setlocale(LC_MESSAGES, setlocale(LC_CTYPE, ""));
texmf_locale = kpse_var_expand ("${TEXMFLOCALEDIR}");
@@ -1429,7 +806,11 @@ cb_usagehelp(program==ctangle ? CTANGLEHELP :
\.{i18n}/\.{t10n}. We simply filter the strings through the catalogs
(if available).
-@c
+@<Predecl...@>=
+static void cb_usage (const_string str);@/
+static void cb_usagehelp (const_string *message, const_string bug_email);@/
+
+@ @c
static void cb_usage (const_string str)
{
textdomain("cweb-tl");
@@ -1482,10 +863,5 @@ void cb_show_banner (void)
@.cweb.mo@>
}
-@ @<Predecl...@>=
-static void cb_usage (const_string str);@/
-static void cb_usagehelp (const_string *message, const_string bug_email);@/
-void cb_show_banner (void); /* |extern| for option \.{+b} */
-
@** Index.
@z
diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.h b/Build/source/texk/web2c/cwebdir/comm-w2c.h
index a772d1190a4..cc01a9caaec 100644
--- a/Build/source/texk/web2c/cwebdir/comm-w2c.h
+++ b/Build/source/texk/web2c/cwebdir/comm-w2c.h
@@ -2,7 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 3.64 --- February 2017 (works also with later versions)
+% Version 4.0 --- February 2021 (works also with later versions)
% Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth
@@ -15,23 +15,24 @@
% entire resulting derived work is distributed under the terms of a
% permission notice identical to this one.
-% Amendments to 'common.h' resulting in this extended 'comm-w2c.h' were
-% created by numerous collaborators over the course of many years.
+% Amendments to 'common.h' resulting in this updated version were created
+% by numerous collaborators over the course of many years.
% Please send comments, suggestions, etc. to tex-k@@tug.org.
% The next few sections contain stuff from the file |"common.w"| that has
% to be included in both |"ctangle.w"| and |"cweave.w"|. It appears in this
-% file |"common.h"|, which needs to be updated when |"common.w"| changes.
-
-First comes general stuff:
+% file |"common.h"|, which is also included in |"common.w"| to propagate
+% possible changes from this single source consistently.
+% First comes general stuff:
@s boolean int
@s uint8_t int
@s uint16_t int
-@<Common code for \.{CWEAVE} and \.{CTANGLE}@>=
+
+@<Common code...@>=
typedef bool boolean;
typedef uint8_t eight_bits;
typedef uint16_t sixteen_bits;
@@ -60,9 +61,13 @@ internationalization.
#define gettext(A) A
#endif
@#
-#include <stdbool.h> /* |@!bool|, |@!true|, |@!false| */
-#include <stdint.h> /* |@!uint8_t|, |@!uint16_t| */
-#include <stdio.h>
+#include <ctype.h> /* definition of |@!isalpha|, |@!isdigit| and so on */
+#include <stdbool.h> /* definition of |@!bool|, |@!true| and |@!false| */
+#include <stddef.h> /* definition of |@!ptrdiff_t| */
+#include <stdint.h> /* definition of |@!uint8_t| and |@!uint16_t| */
+#include <stdlib.h> /* definition of |@!getenv| and |@!exit| */
+#include <stdio.h> /* definition of |@!printf| and friends */
+#include <string.h> /* definition of |@!strlen|, |@!strcmp| and so on */
@ Code related to the character set:
@^ASCII code dependencies@>
@@ -84,13 +89,12 @@ internationalization.
@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */
@<Common code...@>=
-extern char section_text[]; /* name being sought for */
+extern char section_text[]; /* text being sought for */
extern char *section_text_end; /* end of |section_text| */
extern char *id_first; /* where the current identifier begins in the buffer */
extern char *id_loc; /* just after the current identifier in the buffer */
@ Code related to input routines:
-
@d xisalpha(c) (isalpha((eight_bits)c)&&((eight_bits)c<0200))
@d xisdigit(c) (isdigit((eight_bits)c)&&((eight_bits)c<0200))
@d xisspace(c) (isspace((eight_bits)c)&&((eight_bits)c<0200))
@@ -101,7 +105,7 @@ extern char *id_loc; /* just after the current identifier in the buffer */
@<Common code...@>=
extern char buffer[]; /* where each line of input goes */
extern char *buffer_end; /* end of |buffer| */
-extern char *loc; /* points to the next character to be read from the buffer*/
+extern char *loc; /* points to the next character to be read from the buffer */
extern char *limit; /* points to the last character in the buffer */
@ Code related to identifier and section name storage:
@@ -135,6 +139,8 @@ extern char *byte_ptr; /* first unused position in |byte_mem| */
extern name_pointer hash[]; /* heads of hash lists */
extern hash_pointer hash_end; /* end of |hash| */
extern hash_pointer h; /* index into hash-head array */
+
+@ @<Predecl...@>=
extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/
extern name_pointer id_lookup(const char *,const char *,char);
/* looks up a string in the identifier table */
@@ -153,9 +159,12 @@ extern void sprint_section_name(char *,name_pointer);@/
@d mark_harmless {if (history==spotless) history=harmless_message;}
@d mark_error history=error_message
@d confusion(s) fatal(_("! This can't happen: "),s)
+@.This can't happen@>
-@<Common...@>=
+@<Common code...@>=
extern int history; /* indicates how bad this run was */
+
+@ @<Predecl...@>=
extern int wrap_up(void); /* indicate |history| and exit */
extern void err_print(const char *); /* print error message and context */
extern void fatal(const char *,const char *); /* issue error message and die */
@@ -163,11 +172,14 @@ extern void overflow(const char *); /* succumb because a table has overflowed */
@ Code related to file handling:
@f line x /* make |line| an unreserved word */
+@d max_include_depth 10 /* maximum number of source files open
+ simultaneously, not counting the change file */
@d max_file_name_length 1024
@d cur_file file[include_depth] /* current file */
@d cur_file_name file_name[include_depth] /* current file name */
-@d web_file_name file_name[0] /* main source file name */
@d cur_line line[include_depth] /* number of current line in current file */
+@d web_file file[0] /* main source file */
+@d web_file_name file_name[0] /* main source file name */
@<Common code...@>=
extern int include_depth; /* current level of nesting */
@@ -177,16 +189,18 @@ extern char C_file_name[]; /* name of |C_file| */
extern char tex_file_name[]; /* name of |tex_file| */
extern char idx_file_name[]; /* name of |idx_file| */
extern char scn_file_name[]; /* name of |scn_file| */
-extern char check_file_name[]; /* name of |check_file| */
extern char file_name[][max_file_name_length];
/* stack of non-change file names */
extern char change_file_name[]; /* name of change file */
+extern char check_file_name[]; /* name of |check_file| */
extern int line[]; /* number of current line in the stacked files */
extern int change_line; /* number of current line in change file */
extern int change_depth; /* where \.{@@y} originated during a change */
extern boolean input_has_ended; /* if there is no more input */
extern boolean changing; /* if the current line is from |change_file| */
extern boolean web_file_open; /* if the web file is being read */
+
+@ @<Predecl...@>=
extern boolean get_line(void); /* inputs the next line */
extern void check_complete(void); /* checks that all changes were picked up */
extern void reset_input(void); /* initialize to read the web file and change file */
@@ -201,6 +215,7 @@ extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
@ Code related to command line arguments:
@d show_banner flags['b'] /* should the banner line be printed? */
@d show_progress flags['p'] /* should progress reports be printed? */
+@d show_stats flags['s'] /* should statistics be printed at end of run? */
@d show_happiness flags['h'] /* should lack of errors be announced? */
@d temporary_output flags['t'] /* should temporary output take precedence? */
@d make_xrefs flags['x'] /* should cross references be output? */
@@ -209,25 +224,43 @@ extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
extern int argc; /* copy of |ac| parameter to |main| */
extern char **argv; /* copy of |av| parameter to |main| */
extern boolean flags[]; /* an option for each 7-bit code */
+extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */
@ Code relating to output:
@d update_terminal fflush(stdout) /* empty the terminal output buffer */
@d new_line putchar('\n') @d putxchar putchar
@d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout)
@d C_printf(c,a) fprintf(C_file,c,a)
-@d C_putc(c) putc(c,C_file)
+@d C_putc(c) putc(c,C_file) /* isn't \CEE/ wonderfully consistent? */
@<Common code...@>=
extern FILE *C_file; /* where output of \.{CTANGLE} goes */
extern FILE *tex_file; /* where output of \.{CWEAVE} goes */
extern FILE *idx_file; /* where index from \.{CWEAVE} goes */
extern FILE *scn_file; /* where list of sections from \.{CWEAVE} goes */
-extern FILE *check_file; /* temporary output file */
extern FILE *active_file; /* currently active file for \.{CWEAVE} output */
+extern FILE *check_file; /* temporary output file */
@ The procedure that gets everything rolling:
-
-@<Common code...@>=
+@<Predecl...@>=
extern void common_init(void);@/
extern void print_stats(void);@/
extern void cb_show_banner(void);@/
+
+@ The following parameters were sufficient in the original \.{WEB} to
+handle \TEX/, so they should be sufficient for most applications of
+\.{CWEB}.
+
+@d max_bytes 1000000 /* the number of bytes in identifiers,
+ index entries, and section names */
+@d max_toks 1000000 /* number of bytes in compressed \CEE/ code */
+@d max_names 10239 /* number of identifiers, strings, section names;
+ must be less than 10240 */
+@d max_sections 4000 /* greater than the total number of sections */
+@d max_texts 10239 /* number of replacement texts, must be less than 10240 */
+@d longest_name 10000 /* file and section names and section texts shouldn't be longer than this */
+@d stack_size 500 /* number of simultaneous levels of macro expansion */
+@d buf_size 1000 /* for \.{CWEAVE} */
+@d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */
+
+@ End of \.{COMMON} interface.
diff --git a/Build/source/texk/web2c/cwebdir/comm-w32.ch b/Build/source/texk/web2c/cwebdir/comm-w32.ch
index b300f496d2b..d256cedf121 100644
--- a/Build/source/texk/web2c/cwebdir/comm-w32.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-w32.ch
@@ -35,60 +35,32 @@ Admittedly, this is not vital for cweb, except that I build the whole texlive
set of programs using the __fastcall convention.
@x
-@<Include files@>=
-#include <ctype.h>
+extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/
@y
-@<Include files@>=
-#include <ctype.h>
-#include <string.h>
+extern boolean __cdecl names_match(name_pointer,const char *,size_t,eight_bits);@/
@z
@x
-@ @<Predec...@>=
-extern int names_match();
+extern void init_p(name_pointer,eight_bits);@/
@y
-@ @<Predec...@>=
-extern int __cdecl names_match();
+extern void __cdecl init_p(name_pointer,eight_bits);@/
@z
-@x
-@<Pred...@>=
-void init_p();
+@x section 75
+An omitted change file argument means that |"/dev/null"| should be used,
@y
-@<Pred...@>=
-void __cdecl init_p();
+An omitted change file argument means that |"NUL"| should be used,
@z
-@x section 69
-An omitted change file argument means that |"/dev/null"| should be used,
+@x section 76
+ strcpy(change_file_name,"/dev/null");
@y
-An omitted change file argument means that |"NUL"| should be used,
+ strcpy(change_file_name,"NUL");
@z
-@x section 70 (this change copied from comm-bs.ch, July 94)
+@x section 76 (this change copied from comm-bs.ch, July 94)
else if (*s=='/') dot_pos=NULL,name_pos=++s;
@y
else if (*s == ':' || *s == '\\' || *s == '/')
dot_pos=NULL,name_pos=++s;
@z
-
-@x section 70
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
-@y
- if (found_change<=0) strcpy(change_file_name,"NUL");
-@z
-
-@x
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-@y
-@z
diff --git a/Build/source/texk/web2c/cwebdir/common.c b/Build/source/texk/web2c/cwebdir/common.c
index 2bf7a9d4a81..a01cb2d89ba 100644
--- a/Build/source/texk/web2c/cwebdir/common.c
+++ b/Build/source/texk/web2c/cwebdir/common.c
@@ -1,23 +1,19 @@
/*1:*/
-#line 58 "common.w"
+#line 66 "common.w"
-/*5:*/
-#line 102 "common.w"
-
-#include <ctype.h>
-
-/*:5*//*8:*/
-#line 165 "common.w"
-
-#include <stdio.h>
-
-/*:8*//*22:*/
-#line 471 "common.w"
+/*3:*/
+#line 46 "common.h"
+#include <ctype.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
-/*:22*/
-#line 59 "common.w"
+/*:3*/
+#line 67 "common.w"
#define ctangle 0
#define cweave 1 \
@@ -28,7 +24,7 @@
#define plus_plus 013
#define minus_minus 01
#define minus_gt 031
-#define not_eq 032
+#define non_eq 032
#define lt_eq 034
#define gt_eq 035
#define eq_eq 036
@@ -38,23 +34,66 @@
#define period_ast 026
#define minus_gt_ast 027 \
-#define buf_size 100
-#define longest_name 10000
-#define long_buf_size (buf_size+longest_name)
-#define xisspace(c) (isspace(c) &&((unsigned char) c<0200) )
-#define xisupper(c) (isupper(c) &&((unsigned char) c<0200) ) \
+#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) )
+#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
+
+#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
+#define print_id(c) term_write((c) ->byte_start,length((c) ) )
+#define llink link
+#define rlink dummy.Rlink
+#define root name_dir->rlink \
+
+#define chunk_marker 0 \
+
+#define spotless 0
+#define harmless_message 1
+#define error_message 2
+#define fatal_message 3
+#define mark_harmless {if(history==spotless) history= harmless_message;}
+#define mark_error history= error_message
+#define confusion(s) fatal("! This can't happen: ",s) \
+ \
#define max_include_depth 10 \
-#define max_file_name_length 60
+#define max_file_name_length 1024
#define cur_file file[include_depth]
#define cur_file_name file_name[include_depth]
#define cur_line line[include_depth]
#define web_file file[0]
#define web_file_name file_name[0] \
+#define show_banner flags['b']
+#define show_progress flags['p']
+#define show_stats flags['s']
+#define show_happiness flags['h']
+#define make_xrefs flags['x'] \
+
+#define update_terminal fflush(stdout)
+#define new_line putchar('\n')
+#define putxchar putchar
+#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
+#define C_printf(c,a) fprintf(C_file,c,a)
+#define C_putc(c) putc(c,C_file) \
+
+#define max_bytes 1000000 \
+
+#define max_toks 1000000
+#define max_names 10239 \
+
+#define max_sections 4000
+#define max_texts 10239
+#define longest_name 10000
+#define stack_size 500
+#define buf_size 1000
+#define long_buf_size (buf_size+longest_name) \
+
#define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \
-strncmp(buffer,change_buffer,limit-buffer) ) \
+strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) ) \
#define if_section_start_make_pending(b) {*limit= '!'; \
for(loc= buffer;xisspace(*loc) ;loc++) ; \
@@ -62,30 +101,14 @@ for(loc= buffer;xisspace(*loc) ;loc++) ; \
if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b; \
} \
-#define max_sections 2000 \
- \
-
#define too_long() {include_depth--; \
err_print("! Include file name too long") ;goto restart;} \
-#define max_bytes 90000 \
-
-#define max_names 4000 \
- \
-
-#define length(c) (c+1) ->byte_start-(c) ->byte_start
-#define print_id(c) term_write((c) ->byte_start,length((c) ) ) \
-
-#define hash_size 353 \
-
-#define llink link
-#define rlink dummy.Rlink
-#define root name_dir->rlink \
- \
+#define hash_size 8501 \
#define first_chunk(p) ((p) ->byte_start+2)
-#define prefix_length(p) (int) ((unsigned char) *((p) ->byte_start) *256+ \
-(unsigned char) *((p) ->byte_start+1) )
+#define prefix_length(p) (int) ((eight_bits) *((p) ->byte_start) *256+ \
+(eight_bits) *((p) ->byte_start+1) )
#define set_prefix_length(p,m) (*((p) ->byte_start) = (m) /256, \
*((p) ->byte_start+1) = (m) %256) \
@@ -97,48 +120,139 @@ err_print("! Include file name too long") ;goto restart;} \
#define bad_extension 5 \
-#define spotless 0
-#define harmless_message 1
-#define error_message 2
-#define fatal_message 3
-#define mark_harmless {if(history==spotless) history= harmless_message;}
-#define mark_error history= error_message \
+#define flag_change (**argv!='-')
-#define confusion(s) fatal("! This can't happen: ",s) \
- \
+#line 68 "common.w"
-#define show_banner flags['b']
-#define show_progress flags['p']
-#define show_stats flags['s']
-#define show_happiness flags['h'] \
+/*2:*/
+#line 37 "common.h"
-#define update_terminal fflush(stdout) \
+typedef bool boolean;
+typedef uint8_t eight_bits;
+typedef uint16_t sixteen_bits;
+extern boolean program;
+extern int phase;
-#define new_line putchar('\n')
-#define putxchar putchar
-#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout)
-#define C_printf(c,a) fprintf(C_file,c,a)
-#define C_putc(c) putc(c,C_file) \
+/*:2*//*4:*/
+#line 74 "common.h"
+extern char section_text[];
+extern char*section_text_end;
+extern char*id_first;
+extern char*id_loc;
-#line 60 "common.w"
+/*:4*//*5:*/
+#line 88 "common.h"
-/*2:*/
-#line 73 "common.w"
+extern char buffer[];
+extern char*buffer_end;
+extern char*loc;
+extern char*limit;
+
+/*:5*//*6:*/
+#line 103 "common.h"
+
+typedef struct name_info{
+char*byte_start;
+struct name_info*link;
+union{
+struct name_info*Rlink;
+
+char Ilk;
+}dummy;
+void*equiv_or_xref;
+}name_info;
+typedef name_info*name_pointer;
+typedef name_pointer*hash_pointer;
+extern char byte_mem[];
+extern char*byte_mem_end;
+extern name_info name_dir[];
+extern name_pointer name_dir_end;
+extern name_pointer name_ptr;
+extern char*byte_ptr;
+extern name_pointer hash[];
+extern hash_pointer hash_end;
+extern hash_pointer h;
+
+/*:6*//*8:*/
+#line 147 "common.h"
+
+extern int history;
+
+/*:8*//*10:*/
+#line 167 "common.h"
+
+extern int include_depth;
+extern FILE*file[];
+extern FILE*change_file;
+extern char C_file_name[];
+extern char tex_file_name[];
+extern char idx_file_name[];
+extern char scn_file_name[];
+extern char file_name[][max_file_name_length];
+
+extern char change_file_name[];
+extern int line[];
+extern int change_line;
+extern int change_depth;
+extern boolean input_has_ended;
+extern boolean changing;
+extern boolean web_file_open;
+
+/*:10*//*12:*/
+#line 191 "common.h"
+
+extern sixteen_bits section_count;
+extern boolean changed_section[];
+extern boolean change_pending;
+extern boolean print_where;
+
+/*:12*//*13:*/
+#line 204 "common.h"
+
+extern int argc;
+extern char**argv;
+extern boolean flags[];
+
+/*:13*//*14:*/
+#line 216 "common.h"
+
+extern FILE*C_file;
+extern FILE*tex_file;
+extern FILE*idx_file;
+extern FILE*scn_file;
+extern FILE*active_file;
+
+/*:14*/
+#line 69 "common.w"
+
+/*18:*/
+#line 85 "common.w"
-typedef short boolean;
boolean program;
-/*:2*//*7:*/
-#line 159 "common.w"
+/*:18*//*19:*/
+#line 94 "common.w"
+int phase;
+
+/*:19*//*21:*/
+#line 131 "common.w"
+
+char section_text[longest_name+1];
+char*section_text_end= section_text+longest_name;
+char*id_first;
+char*id_loc;
+
+/*:21*//*22:*/
+#line 151 "common.w"
char buffer[long_buf_size];
char*buffer_end= buffer+buf_size-2;
char*limit= buffer;
char*loc= buffer;
-/*:7*//*10:*/
-#line 214 "common.w"
+/*:22*//*25:*/
+#line 196 "common.w"
int include_depth;
FILE*file[max_include_depth];
@@ -154,71 +268,49 @@ boolean input_has_ended;
boolean changing;
boolean web_file_open= 0;
-/*:10*//*20:*/
-#line 418 "common.w"
+/*:25*//*26:*/
+#line 222 "common.w"
+
+char change_buffer[buf_size];
+char*change_limit;
+
+/*:26*//*37:*/
+#line 403 "common.w"
-typedef unsigned short sixteen_bits;
sixteen_bits section_count;
boolean changed_section[max_sections];
boolean change_pending;
boolean print_where= 0;
-/*:20*//*27:*/
-#line 594 "common.w"
-
-typedef struct name_info{
-char*byte_start;
-/*31:*/
-#line 631 "common.w"
-
-struct name_info*link;
-
-/*:31*//*40:*/
-#line 730 "common.w"
-
-union{
-struct name_info*Rlink;
-
-char Ilk;
-}dummy;
+/*:37*//*43:*/
+#line 600 "common.w"
-/*:40*//*55:*/
-#line 1062 "common.w"
-
-char*equiv_or_xref;
-
-/*:55*/
-#line 597 "common.w"
-
-}name_info;
-typedef name_info*name_pointer;
char byte_mem[max_bytes];
char*byte_mem_end= byte_mem+max_bytes-1;
name_info name_dir[max_names];
name_pointer name_dir_end= name_dir+max_names-1;
-/*:27*//*29:*/
-#line 617 "common.w"
+/*:43*//*44:*/
+#line 611 "common.w"
name_pointer name_ptr;
char*byte_ptr;
-/*:29*//*32:*/
-#line 644 "common.w"
+/*:44*//*46:*/
+#line 631 "common.w"
-typedef name_pointer*hash_pointer;
name_pointer hash[hash_size];
hash_pointer hash_end= hash+hash_size-1;
hash_pointer h;
-/*:32*//*56:*/
-#line 1082 "common.w"
+/*:46*//*65:*/
+#line 1019 "common.w"
int history= spotless;
-/*:56*//*67:*/
-#line 1220 "common.w"
+/*:65*//*73:*/
+#line 1140 "common.w"
int argc;
char**argv;
@@ -228,8 +320,8 @@ char idx_file_name[max_file_name_length];
char scn_file_name[max_file_name_length];
boolean flags[128];
-/*:67*//*77:*/
-#line 1370 "common.w"
+/*:73*//*83:*/
+#line 1288 "common.w"
FILE*C_file;
FILE*tex_file;
@@ -237,134 +329,134 @@ FILE*idx_file;
FILE*scn_file;
FILE*active_file;
-/*:77*/
-#line 61 "common.w"
-
-/*3:*/
-#line 83 "common.w"
-int phase;
+/*:83*/
+#line 70 "common.w"
-/*:3*//*11:*/
-#line 240 "common.w"
+/*7:*/
+#line 126 "common.h"
-char change_buffer[buf_size];
-char*change_limit;
+extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
+extern name_pointer id_lookup(const char*,const char*,char);
-/*:11*/
-#line 62 "common.w"
+extern name_pointer section_lookup(char*,char*,int);
+extern void init_node(name_pointer);
+extern void init_p(name_pointer,eight_bits);
+extern void print_prefix_name(name_pointer);
+extern void print_section_name(name_pointer);
+extern void sprint_section_name(char*,name_pointer);
-/*33:*/
-#line 650 "common.w"
+/*:7*//*9:*/
+#line 150 "common.h"
-extern int names_match();
+extern int wrap_up(void);
+extern void err_print(const char*);
+extern void fatal(const char*,const char*);
+extern void overflow(const char*);
-/*:33*//*38:*/
-#line 703 "common.w"
+/*:9*//*11:*/
+#line 185 "common.h"
-void init_p();
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
-/*:38*//*46:*/
-#line 852 "common.w"
+/*:11*//*15:*/
+#line 224 "common.h"
-extern void init_node();
+extern void common_init(void);
+extern void print_stats(void);
-/*:46*//*53:*/
-#line 1017 "common.w"
+/*:15*//*23:*/
+#line 161 "common.w"
-int section_name_cmp();
+static boolean input_ln(FILE*);
-/*:53*//*57:*/
-#line 1092 "common.w"
+/*:23*//*27:*/
+#line 233 "common.w"
-void err_print();
+static void prime_the_change_buffer(void);
-/*:57*//*60:*/
-#line 1140 "common.w"
+/*:27*//*32:*/
+#line 305 "common.w"
-int wrap_up();
-extern void print_stats();
+static void check_change(void);
-/*:60*//*63:*/
-#line 1173 "common.w"
+/*:32*//*55:*/
+#line 778 "common.w"
-void fatal(),overflow();
+static int web_strcmp(char*,int,char*,int);
+static name_pointer add_section_name(name_pointer,int,char*,char*,int);
+static void extend_section_name(name_pointer,char*,char*,int);
-/*:63*//*69:*/
-#line 1251 "common.w"
+/*:55*//*63:*/
+#line 974 "common.w"
-void scan_args();
+static int section_name_cmp(char**,int,name_pointer);
-/*:69*//*81:*/
-#line 1411 "common.w"
+/*:63*//*75:*/
+#line 1172 "common.w"
-extern int strlen();
-extern int strcmp();
-extern char*strcpy();
-extern int strncmp();
-extern char*strncpy();
+static void scan_args(void);
-/*:81*/
-#line 63 "common.w"
+/*:75*/
+#line 71 "common.w"
-/*:1*//*4:*/
-#line 89 "common.w"
+/*:1*//*20:*/
+#line 100 "common.w"
void
-common_init()
+common_init(void)
{
-/*30:*/
-#line 621 "common.w"
+/*45:*/
+#line 615 "common.w"
name_dir->byte_start= byte_ptr= byte_mem;
name_ptr= name_dir+1;
name_ptr->byte_start= byte_mem;
+root= NULL;
-/*:30*//*34:*/
-#line 655 "common.w"
+/*:45*//*47:*/
+#line 638 "common.w"
for(h= hash;h<=hash_end;*h++= NULL);
-/*:34*//*41:*/
-#line 737 "common.w"
+/*:47*/
+#line 104 "common.w"
-root= NULL;
+/*74:*/
+#line 1153 "common.w"
-/*:41*/
-#line 93 "common.w"
-;
-/*68:*/
-#line 1233 "common.w"
+show_banner= show_happiness= show_progress= make_xrefs= true;
+show_stats= false;
-show_banner= show_happiness= show_progress= 1;
+/*:74*/
+#line 105 "common.w"
-/*:68*/
-#line 94 "common.w"
-;
-/*78:*/
-#line 1377 "common.w"
+/*84:*/
+#line 1295 "common.w"
scan_args();
if(program==ctangle){
-if((C_file= fopen(C_file_name,"w"))==NULL)
+if((C_file= fopen(C_file_name,"wb"))==NULL)
fatal("! Cannot open output file ",C_file_name);
}
else{
-if((tex_file= fopen(tex_file_name,"w"))==NULL)
+if((tex_file= fopen(tex_file_name,"wb"))==NULL)
fatal("! Cannot open output file ",tex_file_name);
}
-/*:78*/
-#line 95 "common.w"
-;
+/*:84*/
+#line 106 "common.w"
+
}
-/*:4*//*9:*/
-#line 172 "common.w"
+/*:20*//*24:*/
+#line 164 "common.w"
-int input_ln(fp)
-FILE*fp;
+static boolean input_ln(
+FILE*fp)
{
register int c= EOF;
register char*k;
@@ -382,22 +474,22 @@ if(c==EOF&&limit==buffer)return(0);
return(1);
}
-/*:9*//*12:*/
-#line 251 "common.w"
+/*:24*//*28:*/
+#line 236 "common.w"
-void
-prime_the_change_buffer()
+static void
+prime_the_change_buffer(void)
{
change_limit= change_buffer;
-/*13:*/
-#line 265 "common.w"
+/*29:*/
+#line 250 "common.w"
while(1){
change_line++;
if(!input_ln(change_file))return;
if(limit<buffer+2)continue;
if(buffer[0]!='@')continue;
-if(xisupper(buffer[1]))buffer[1]= tolower(buffer[1]);
+if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]);
if(buffer[1]=='x')break;
if(buffer[1]=='y'||buffer[1]=='z'||buffer[1]=='i'){
loc= buffer+2;
@@ -406,11 +498,11 @@ err_print("! Missing @x in change file");
}
}
-/*:13*/
-#line 256 "common.w"
-;
-/*14:*/
-#line 282 "common.w"
+/*:29*/
+#line 241 "common.w"
+
+/*30:*/
+#line 267 "common.w"
do{
change_line++;
@@ -421,27 +513,27 @@ return;
}
}while(limit==buffer);
-/*:14*/
-#line 257 "common.w"
-;
-/*15:*/
-#line 292 "common.w"
+/*:30*/
+#line 242 "common.w"
+
+/*31:*/
+#line 277 "common.w"
{
-change_limit= change_buffer+(limit-buffer);
-strncpy(change_buffer,buffer,limit-buffer+1);
+change_limit= change_buffer+(ptrdiff_t)(limit-buffer);
+strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
}
-/*:15*/
-#line 258 "common.w"
-;
+/*:31*/
+#line 243 "common.w"
+
}
-/*:12*//*16:*/
-#line 320 "common.w"
+/*:28*//*33:*/
+#line 308 "common.w"
-void
-check_change()
+static void
+check_change(void)
{
int n= 0;
if(lines_dont_match)return;
@@ -459,9 +551,9 @@ change_limit= change_buffer;changing= 0;
return;
}
if(limit> buffer+1&&buffer[0]=='@'){
-char xyz_code= xisupper(buffer[1])?tolower(buffer[1]):buffer[1];
-/*17:*/
-#line 358 "common.w"
+char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1];
+/*34:*/
+#line 346 "common.w"
if(xyz_code=='x'||xyz_code=='z'){
loc= buffer+2;err_print("! Where is the matching @y?");
@@ -478,21 +570,21 @@ change_depth= include_depth;
return;
}
-/*:17*/
-#line 342 "common.w"
-;
+/*:34*/
+#line 330 "common.w"
+
}
-/*15:*/
-#line 292 "common.w"
+/*31:*/
+#line 277 "common.w"
{
-change_limit= change_buffer+(limit-buffer);
-strncpy(change_buffer,buffer,limit-buffer+1);
+change_limit= change_buffer+(ptrdiff_t)(limit-buffer);
+strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
}
-/*:15*/
-#line 344 "common.w"
-;
+/*:31*/
+#line 332 "common.w"
+
changing= 0;cur_line++;
while(!input_ln(cur_file)){
if(include_depth==0){
@@ -506,15 +598,15 @@ if(lines_dont_match)n++;
}
}
-/*:16*//*18:*/
-#line 378 "common.w"
+/*:33*//*35:*/
+#line 366 "common.w"
void
-reset_input()
+reset_input(void)
{
limit= buffer;loc= buffer+1;buffer[0]= ' ';
-/*19:*/
-#line 393 "common.w"
+/*36:*/
+#line 381 "common.w"
if((web_file= fopen(web_file_name,"r"))==NULL){
strcpy(web_file_name,alt_web_file_name);
@@ -527,24 +619,24 @@ web_file_open= 1;
if((change_file= fopen(change_file_name,"r"))==NULL)
fatal("! Cannot open change file ",change_file_name);
-/*:19*/
-#line 383 "common.w"
-;
+/*:36*/
+#line 371 "common.w"
+
include_depth= 0;cur_line= 0;change_line= 0;
change_depth= include_depth;
changing= 1;prime_the_change_buffer();changing= !changing;
limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= 0;
}
-/*:18*//*21:*/
-#line 426 "common.w"
+/*:35*//*38:*/
+#line 410 "common.w"
-int get_line()
+boolean get_line(void)
{
restart:
if(changing&&include_depth==change_depth)
-/*25:*/
-#line 537 "common.w"
+/*41:*/
+#line 518 "common.w"
{
change_line++;
if(!input_ln(change_file)){
@@ -561,7 +653,7 @@ changed_section[section_count]= 1;change_pending= 0;
}
*limit= ' ';
if(buffer[0]=='@'){
-if(xisupper(buffer[1]))buffer[1]= tolower(buffer[1]);
+if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]);
if(buffer[1]=='x'||buffer[1]=='y'){
loc= buffer+2;
err_print("! Where is the matching @z?");
@@ -574,12 +666,12 @@ prime_the_change_buffer();changing= !changing;print_where= 1;
}
}
-/*:25*/
-#line 431 "common.w"
-;
+/*:41*/
+#line 415 "common.w"
+
if(!changing||include_depth> change_depth){
-/*24:*/
-#line 520 "common.w"
+/*40:*/
+#line 501 "common.w"
{
cur_line++;
while(!input_ln(cur_file)){
@@ -597,9 +689,9 @@ if(buffer[0]==change_buffer[0])
if(change_limit> change_buffer)check_change();
}
-/*:24*/
-#line 433 "common.w"
-;
+/*:40*/
+#line 417 "common.w"
+
if(changing&&include_depth==change_depth)goto restart;
}
if(input_has_ended)return 0;
@@ -618,8 +710,8 @@ err_print("! Too many nested includes");
goto restart;
}
include_depth++;
-/*23:*/
-#line 474 "common.w"
+/*39:*/
+#line 455 "common.w"
{
char temp_file_name[max_file_name_length];
char*cur_file_name_end= cur_file_name+max_file_name_length-1;
@@ -666,54 +758,54 @@ goto restart;
include_depth--;err_print("! Cannot open include file");goto restart;
}
-/*:23*/
-#line 452 "common.w"
-;
+/*:39*/
+#line 436 "common.w"
+
}
return 1;
}
-/*:21*//*26:*/
-#line 569 "common.w"
+/*:38*//*42:*/
+#line 550 "common.w"
void
-check_complete(){
+check_complete(void){
if(change_limit!=change_buffer){
-strncpy(buffer,change_buffer,change_limit-change_buffer+1);
-limit= buffer+(int)(change_limit-change_buffer);
+strncpy(buffer,change_buffer,(size_t)(change_limit-change_buffer+1));
+limit= buffer+(ptrdiff_t)(change_limit-change_buffer);
changing= 1;change_depth= include_depth;loc= buffer;
err_print("! Change file entry did not match");
}
}
-/*:26*//*35:*/
-#line 660 "common.w"
+/*:42*//*48:*/
+#line 643 "common.w"
name_pointer
-id_lookup(first,last,t)
-char*first;
-char*last;
-char t;
+id_lookup(
+const char*first,
+const char*last,
+char t)
{
-char*i= first;
+const char*i= first;
int h;
int l;
name_pointer p;
if(last==NULL)for(last= first;*last!='\0';last++);
-l= last-first;
-/*36:*/
-#line 683 "common.w"
+l= (int)(last-first);
+/*49:*/
+#line 666 "common.w"
-h= (unsigned char)*i;
-while(++i<last)h= (h+h+(int)((unsigned char)*i))%hash_size;
+h= (eight_bits)*i;
+while(++i<last)h= (h+h+(int)((eight_bits)*i))%hash_size;
-/*:36*/
-#line 673 "common.w"
-;
-/*37:*/
-#line 691 "common.w"
+/*:49*/
+#line 656 "common.w"
+
+/*50:*/
+#line 674 "common.w"
p= hash[h];
while(p&&!names_match(p,first,l,t))p= p->link;
@@ -722,53 +814,53 @@ p= name_ptr;
p->link= hash[h];hash[h]= p;
}
-/*:37*/
-#line 674 "common.w"
-;
-if(p==name_ptr)/*39:*/
-#line 706 "common.w"
+/*:50*/
+#line 657 "common.w"
+
+if(p==name_ptr)/*51:*/
+#line 685 "common.w"
{
if(byte_ptr+l> byte_mem_end)overflow("byte memory");
if(name_ptr>=name_dir_end)overflow("name");
strncpy(byte_ptr,first,l);
(++name_ptr)->byte_start= byte_ptr+= l;
-if(program==cweave)init_p(p,t);
+init_p(p,t);
}
-/*:39*/
-#line 675 "common.w"
-;
+/*:51*/
+#line 658 "common.w"
+
return(p);
}
-/*:35*//*42:*/
-#line 764 "common.w"
+/*:48*//*52:*/
+#line 717 "common.w"
void
-print_section_name(p)
-name_pointer p;
+print_section_name(
+name_pointer p)
{
char*ss,*s= first_chunk(p);
name_pointer q= p+1;
while(p!=name_dir){
ss= (p+1)->byte_start-1;
if(*ss==' '&&ss>=s){
-term_write(s,ss-s);p= q->link;q= p;
+term_write(s,(size_t)(ss-s));p= q->link;q= p;
}else{
-term_write(s,ss+1-s);p= name_dir;q= NULL;
+term_write(s,(size_t)(ss+1-s));p= name_dir;q= NULL;
}
s= p->byte_start;
}
if(q)term_write("...",3);
}
-/*:42*//*43:*/
-#line 783 "common.w"
+/*:52*//*53:*/
+#line 736 "common.w"
void
-sprint_section_name(dest,p)
-char*dest;
-name_pointer p;
+sprint_section_name(
+char*dest,
+name_pointer p)
{
char*ss,*s= first_chunk(p);
name_pointer q= p+1;
@@ -779,18 +871,18 @@ p= q->link;q= p;
}else{
ss++;p= name_dir;
}
-strncpy(dest,s,ss-s),dest+= ss-s;
+strncpy(dest,s,(size_t)(ss-s)),dest+= ss-s;
s= p->byte_start;
}
*dest= '\0';
}
-/*:43*//*44:*/
-#line 804 "common.w"
+/*:53*//*54:*/
+#line 757 "common.w"
void
-print_prefix_name(p)
-name_pointer p;
+print_prefix_name(
+name_pointer p)
{
char*s= first_chunk(p);
int l= prefix_length(p);
@@ -798,12 +890,14 @@ term_write(s,l);
if(s+l<(p+1)->byte_start)term_write("...",3);
}
-/*:44*//*45:*/
-#line 825 "common.w"
+/*:54*//*56:*/
+#line 783 "common.w"
-int web_strcmp(j,j_len,k,k_len)
-char*j,*k;
-int j_len,k_len;
+static int web_strcmp(
+char*j,
+int j_len,
+char*k,
+int k_len)
{
char*j1= j+j_len,*k1= k+k_len;
while(k<k1&&j<j1&&*j==*k)k++,j++;
@@ -814,20 +908,20 @@ else if(*j<*k)return less;
else return greater;
}
-/*:45*//*47:*/
-#line 855 "common.w"
+/*:56*//*57:*/
+#line 812 "common.w"
-name_pointer
-add_section_name(par,c,first,last,ispref)
-name_pointer par;
-int c;
-char*first;
-char*last;
-int ispref;
+static name_pointer
+add_section_name(
+name_pointer par,
+int c,
+char*first,
+char*last,
+int ispref)
{
name_pointer p= name_ptr;
char*s= first_chunk(p);
-int name_len= last-first+ispref;
+int name_len= (int)(last-first)+ispref;
if(s+name_len> byte_mem_end)overflow("byte memory");
if(name_ptr+1>=name_dir_end)overflow("name");
(++name_ptr)->byte_start= byte_ptr= s+name_len;
@@ -845,19 +939,19 @@ init_node(p);
return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p);
}
-/*:47*//*48:*/
-#line 884 "common.w"
+/*:57*//*58:*/
+#line 841 "common.w"
-void
-extend_section_name(p,first,last,ispref)
-name_pointer p;
-char*first;
-char*last;
-int ispref;
+static void
+extend_section_name(
+name_pointer p,
+char*first,
+char*last,
+int ispref)
{
char*s;
name_pointer q= p+1;
-int name_len= last-first+ispref;
+int name_len= (int)(last-first)+ispref;
if(name_ptr>=name_dir_end)overflow("name");
while(q->link!=name_dir)q= q->link;
q->link= name_ptr;
@@ -869,13 +963,13 @@ strncpy(s,first,name_len);
if(ispref)*(byte_ptr-1)= ' ';
}
-/*:48*//*49:*/
-#line 912 "common.w"
+/*:58*//*59:*/
+#line 869 "common.w"
name_pointer
-section_lookup(first,last,ispref)
-char*first,*last;
-int ispref;
+section_lookup(
+char*first,char*last,
+int ispref)
{
int c= 0;
name_pointer p= root;
@@ -883,9 +977,9 @@ name_pointer q= NULL;
name_pointer r= NULL;
name_pointer par= NULL;
-int name_len= last-first+1;
-/*50:*/
-#line 936 "common.w"
+int name_len= (int)(last-first)+1;
+/*60:*/
+#line 893 "common.w"
while(p){
c= web_strcmp(first,name_len,first_chunk(p),prefix_length(p));
@@ -895,10 +989,10 @@ par= p;
p= (c==less?p->llink:p->rlink);
}else{
if(r!=NULL){
-printf("\n! Ambiguous prefix: matches <");
+fputs("\n! Ambiguous prefix: matches <",stdout);
print_prefix_name(p);
-printf(">\n and <");
+fputs(">\n and <",stdout);
print_prefix_name(r);
err_print(">");
return name_dir;
@@ -911,26 +1005,26 @@ if(p==NULL)
p= q,q= NULL;
}
-/*:50*/
-#line 926 "common.w"
-;
-/*51:*/
-#line 961 "common.w"
+/*:60*/
+#line 883 "common.w"
+
+/*61:*/
+#line 918 "common.w"
if(r==NULL)
return add_section_name(par,c,first,last+1,ispref);
-/*:51*/
-#line 927 "common.w"
-;
-/*52:*/
-#line 969 "common.w"
+/*:61*/
+#line 884 "common.w"
+
+/*62:*/
+#line 926 "common.w"
switch(section_name_cmp(&first,name_len,r)){
case prefix:
if(!ispref){
-printf("\n! New name is a prefix of <");
+fputs("\n! New name is a prefix of <",stdout);
print_section_name(r);
err_print(">");
@@ -942,33 +1036,33 @@ case extension:if(!ispref||first<=last)
extend_section_name(r,first,last+1,ispref);
return r;
case bad_extension:
-printf("\n! New name extends <");
+fputs("\n! New name extends <",stdout);
print_section_name(r);
err_print(">");
return r;
default:
-printf("\n! Section name incompatible with <");
+fputs("\n! Section name incompatible with <",stdout);
print_prefix_name(r);
-printf(">,\n which abbreviates <");
+fputs(">,\n which abbreviates <",stdout);
print_section_name(r);
err_print(">");
return r;
}
-/*:52*/
-#line 928 "common.w"
-;
+/*:62*/
+#line 885 "common.w"
+
}
-/*:49*//*54:*/
-#line 1020 "common.w"
+/*:59*//*64:*/
+#line 977 "common.w"
-int section_name_cmp(pfirst,len,r)
-char**pfirst;
-int len;
-name_pointer r;
+static int section_name_cmp(
+char**pfirst,
+int len,
+name_pointer r)
{
char*first= *pfirst;
name_pointer q= r+1;
@@ -982,31 +1076,31 @@ else ispref= 0,ss++,q= name_dir;
switch(c= web_strcmp(first,len,s,ss-s)){
case equal:if(q==name_dir)
if(ispref){
-*pfirst= first+(ss-s);
+*pfirst= first+(ptrdiff_t)(ss-s);
return extension;
}else return equal;
else return(q->byte_start==(q+1)->byte_start)?equal:prefix;
case extension:
if(!ispref)return bad_extension;
first+= ss-s;
-if(q!=name_dir){len-= ss-s;s= q->byte_start;r= q;continue;}
+if(q!=name_dir){len-= (int)(ss-s);s= q->byte_start;r= q;continue;}
*pfirst= first;return extension;
default:return c;
}
}
}
-/*:54*//*58:*/
-#line 1095 "common.w"
+/*:64*//*66:*/
+#line 1029 "common.w"
void
-err_print(s)
-char*s;
+err_print(
+const char*s)
{
char*k,*l;
printf(*s=='!'?"\n%s":"%s",s);
-if(web_file_open)/*59:*/
-#line 1115 "common.w"
+if(web_file_open)/*67:*/
+#line 1049 "common.w"
{if(changing&&include_depth==change_depth)
printf(". (l. %d of change file)\n",change_line);
@@ -1025,85 +1119,83 @@ if(*limit=='|')putchar('|');
putchar(' ');
}
-/*:59*/
-#line 1102 "common.w"
-;
+/*:67*/
+#line 1036 "common.w"
+
update_terminal;mark_error;
}
-/*:58*//*61:*/
-#line 1150 "common.w"
+/*:66*//*68:*/
+#line 1081 "common.w"
-int wrap_up(){
-putchar('\n');
+int wrap_up(void){
+if(show_progress)new_line;
if(show_stats)
print_stats();
-/*62:*/
-#line 1160 "common.w"
+/*69:*/
+#line 1091 "common.w"
switch(history){
-case spotless:if(show_happiness)printf("(No errors were found.)\n");break;
+case spotless:if(show_happiness)puts("(No errors were found.)");break;
case harmless_message:
-printf("(Did you see the warning message above?)\n");break;
+puts("(Did you see the warning message above?)");break;
case error_message:
-printf("(Pardon me, but I think I spotted something wrong.)\n");break;
-case fatal_message:printf("(That was a fatal error, my friend.)\n");
+puts("(Pardon me, but I think I spotted something wrong.)");break;
+case fatal_message:puts("(That was a fatal error, my friend.)");
}
-/*:62*/
-#line 1155 "common.w"
-;
+/*:69*/
+#line 1086 "common.w"
+
if(history> harmless_message)return(1);
else return(0);
}
-/*:61*//*64:*/
-#line 1179 "common.w"
+/*:68*//*70:*/
+#line 1107 "common.w"
void
-fatal(s,t)
-char*s,*t;
+fatal(
+const char*s,const char*t)
{
-if(*s)printf(s);
+if(*s)err_print(s);
err_print(t);
history= fatal_message;exit(wrap_up());
}
-/*:64*//*65:*/
-#line 1190 "common.w"
+/*:70*//*71:*/
+#line 1118 "common.w"
void
-overflow(t)
-char*t;
+overflow(
+const char*t)
{
printf("\n! Sorry, %s capacity exceeded",t);fatal("","");
}
-/*:65*//*70:*/
-#line 1254 "common.w"
+/*:71*//*76:*/
+#line 1175 "common.w"
-void
-scan_args()
+static void
+scan_args(void)
{
char*dot_pos;
char*name_pos;
register char*s;
boolean found_web= 0,found_change= 0,found_out= 0;
-boolean flag_change;
+strcpy(change_file_name,"/dev/null");
while(--argc> 0){
-if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*74:*/
-#line 1344 "common.w"
+if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*80:*/
+#line 1264 "common.w"
{
-if(**argv=='-')flag_change= 0;
-else flag_change= 1;
for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++)
-flags[*dot_pos]= flag_change;
+flags[(eight_bits)*dot_pos]= flag_change;
}
-/*:74*/
-#line 1266 "common.w"
+/*:80*/
+#line 1187 "common.w"
else{
s= name_pos= *argv;dot_pos= NULL;
@@ -1112,19 +1204,19 @@ if(*s=='.')dot_pos= s++;
else if(*s=='/')dot_pos= NULL,name_pos= ++s;
else s++;
}
-if(!found_web)/*71:*/
-#line 1292 "common.w"
+if(!found_web)/*77:*/
+#line 1212 "common.w"
{
if(s-*argv> max_file_name_length-5)
-/*76:*/
-#line 1364 "common.w"
+/*82:*/
+#line 1282 "common.w"
fatal("! Filename too long\n",*argv);
-/*:76*/
-#line 1295 "common.w"
-;
+/*:82*/
+#line 1215 "common.w"
+
if(dot_pos==NULL)
sprintf(web_file_name,"%s.w",*argv);
else{
@@ -1139,47 +1231,46 @@ sprintf(C_file_name,"%s.c",name_pos);
found_web= 1;
}
-/*:71*/
-#line 1275 "common.w"
+/*:77*/
+#line 1196 "common.w"
-else if(!found_change)/*72:*/
-#line 1310 "common.w"
+else if(!found_change)/*78:*/
+#line 1230 "common.w"
{
-if(strcmp(*argv,"-")==0)found_change= -1;
-else{
+if(strcmp(*argv,"-")!=0){
if(s-*argv> max_file_name_length-4)
-/*76:*/
-#line 1364 "common.w"
+/*82:*/
+#line 1282 "common.w"
fatal("! Filename too long\n",*argv);
-/*:76*/
-#line 1315 "common.w"
-;
+/*:82*/
+#line 1234 "common.w"
+
if(dot_pos==NULL)
sprintf(change_file_name,"%s.ch",*argv);
else strcpy(change_file_name,*argv);
-found_change= 1;
}
+found_change= 1;
}
-/*:72*/
-#line 1276 "common.w"
+/*:78*/
+#line 1197 "common.w"
-else if(!found_out)/*73:*/
-#line 1323 "common.w"
+else if(!found_out)/*79:*/
+#line 1242 "common.w"
{
if(s-*argv> max_file_name_length-5)
-/*76:*/
-#line 1364 "common.w"
+/*82:*/
+#line 1282 "common.w"
fatal("! Filename too long\n",*argv);
-/*:76*/
-#line 1326 "common.w"
-;
+/*:82*/
+#line 1245 "common.w"
+
if(dot_pos==NULL){
sprintf(tex_file_name,"%s.tex",*argv);
sprintf(idx_file_name,"%s.idx",*argv);
@@ -1188,7 +1279,7 @@ sprintf(C_file_name,"%s.c",*argv);
}else{
strcpy(tex_file_name,*argv);
strcpy(C_file_name,*argv);
-if(flags['x']){
+if(make_xrefs){
*dot_pos= 0;
sprintf(idx_file_name,"%s.idx",*argv);
sprintf(scn_file_name,"%s.scn",*argv);
@@ -1197,11 +1288,11 @@ sprintf(scn_file_name,"%s.scn",*argv);
found_out= 1;
}
-/*:73*/
-#line 1277 "common.w"
+/*:79*/
+#line 1198 "common.w"
-else/*75:*/
-#line 1352 "common.w"
+else/*81:*/
+#line 1270 "common.w"
{
if(program==ctangle)
@@ -1214,13 +1305,13 @@ else fatal(
,"");
}
-/*:75*/
-#line 1278 "common.w"
-;
+/*:81*/
+#line 1199 "common.w"
+
}
}
-if(!found_web)/*75:*/
-#line 1352 "common.w"
+if(!found_web)/*81:*/
+#line 1270 "common.w"
{
if(program==ctangle)
@@ -1233,10 +1324,9 @@ else fatal(
,"");
}
-/*:75*/
-#line 1281 "common.w"
-;
-if(found_change<=0)strcpy(change_file_name,"/dev/null");
+/*:81*/
+#line 1202 "common.w"
+
}
-/*:70*/
+/*:76*/
diff --git a/Build/source/texk/web2c/cwebdir/common.h b/Build/source/texk/web2c/cwebdir/common.h
index d6c0bfb601b..b33dfc10556 100644
--- a/Build/source/texk/web2c/cwebdir/common.h
+++ b/Build/source/texk/web2c/cwebdir/common.h
@@ -2,7 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 3.64 --- February 2017 (works also with later versions)
+% Version 4.0 --- February 2021 (works also with later versions)
% Copyright (C) 1987,1990,1993 Silvio Levy and Donald E. Knuth
@@ -15,25 +15,42 @@
% entire resulting derived work is distributed under the terms of a
% permission notice identical to this one.
-% Please send comments, suggestions, etc. to levy@@math.berkeley.edu.
+% Amendments to 'common.h' resulting in this updated version were created
+% by numerous collaborators over the course of many years.
+
+% Please send comments, suggestions, etc. to tex-k@@tug.org.
% The next few sections contain stuff from the file |"common.w"| that has
% to be included in both |"ctangle.w"| and |"cweave.w"|. It appears in this
-% file |"common.h"|, which needs to be updated when |"common.w"| changes.
+% file |"common.h"|, which is also included in |"common.w"| to propagate
+% possible changes from this single source consistently.
+
+% First comes general stuff:
-First comes general stuff:
+@s boolean int
+@s uint8_t int
+@s uint16_t int
@d ctangle 0
@d cweave 1
-@<Common code for \.{CWEAVE} and \.{CTANGLE}@>=
-typedef short boolean;
-typedef char unsigned eight_bits;
+@<Common code...@>=
+typedef bool boolean;
+typedef uint8_t eight_bits;
+typedef uint16_t sixteen_bits;
extern boolean program; /* \.{CWEAVE} or \.{CTANGLE}? */
extern int phase; /* which phase are we in? */
-@ @<Include files@>=
-#include <stdio.h>
+@ Interface to the standard \CEE/ library:
+
+@<Include files@>=
+#include <ctype.h> /* definition of |@!isalpha|, |@!isdigit| and so on */
+#include <stdbool.h> /* definition of |@!bool|, |@!true| and |@!false| */
+#include <stddef.h> /* definition of |@!ptrdiff_t| */
+#include <stdint.h> /* definition of |@!uint8_t| and |@!uint16_t| */
+#include <stdlib.h> /* definition of |@!getenv| and |@!exit| */
+#include <stdio.h> /* definition of |@!printf| and friends */
+#include <string.h> /* definition of |@!strlen|, |@!strcmp| and so on */
@ Code related to the character set:
@^ASCII code dependencies@>
@@ -44,7 +61,7 @@ extern int phase; /* which phase are we in? */
@d plus_plus 013 /* `\.{++}'\,; corresponds to MIT's {\tentex\char'13} */
@d minus_minus 01 /* `\.{--}'\,; corresponds to MIT's {\tentex\char'1} */
@d minus_gt 031 /* `\.{->}'\,; corresponds to MIT's {\tentex\char'31} */
-@d not_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */
+@d non_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */
@d lt_eq 034 /* `\.{<=}'\,; corresponds to MIT's {\tentex\char'34} */
@d gt_eq 035 /* `\.{>=}'\,; corresponds to MIT's {\tentex\char'35} */
@d eq_eq 036 /* `\.{==}'\,; corresponds to MIT's {\tentex\char'36} */
@@ -55,28 +72,27 @@ extern int phase; /* which phase are we in? */
@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */
@<Common code...@>=
-char section_text[longest_name+1]; /* name being sought for */
-char *section_text_end = section_text+longest_name; /* end of |section_text| */
-char *id_first; /* where the current identifier begins in the buffer */
-char *id_loc; /* just after the current identifier in the buffer */
+extern char section_text[]; /* text being sought for */
+extern char *section_text_end; /* end of |section_text| */
+extern char *id_first; /* where the current identifier begins in the buffer */
+extern char *id_loc; /* just after the current identifier in the buffer */
@ Code related to input routines:
-
-@d xisalpha(c) (isalpha(c)&&((eight_bits)c<0200))
-@d xisdigit(c) (isdigit(c)&&((eight_bits)c<0200))
-@d xisspace(c) (isspace(c)&&((eight_bits)c<0200))
-@d xislower(c) (islower(c)&&((eight_bits)c<0200))
-@d xisupper(c) (isupper(c)&&((eight_bits)c<0200))
-@d xisxdigit(c) (isxdigit(c)&&((eight_bits)c<0200))
+@d xisalpha(c) (isalpha((eight_bits)c)&&((eight_bits)c<0200))
+@d xisdigit(c) (isdigit((eight_bits)c)&&((eight_bits)c<0200))
+@d xisspace(c) (isspace((eight_bits)c)&&((eight_bits)c<0200))
+@d xislower(c) (islower((eight_bits)c)&&((eight_bits)c<0200))
+@d xisupper(c) (isupper((eight_bits)c)&&((eight_bits)c<0200))
+@d xisxdigit(c) (isxdigit((eight_bits)c)&&((eight_bits)c<0200))
@<Common code...@>=
extern char buffer[]; /* where each line of input goes */
extern char *buffer_end; /* end of |buffer| */
-extern char *loc; /* points to the next character to be read from the buffer*/
+extern char *loc; /* points to the next character to be read from the buffer */
extern char *limit; /* points to the last character in the buffer */
@ Code related to identifier and section name storage:
-@d length(c) (c+1)->byte_start-(c)->byte_start /* the length of a name */
+@d length(c) (size_t)((c+1)->byte_start-(c)->byte_start) /* the length of a name */
@d print_id(c) term_write((c)->byte_start,length((c))) /* print identifier */
@d llink link /* left link in binary search tree for section names */
@d rlink dummy.Rlink /* right link in binary search tree for section names */
@@ -93,7 +109,7 @@ typedef struct name_info {
names */
char Ilk; /* used by identifiers in \.{CWEAVE} only */
} dummy;
- char *equiv_or_xref; /* info corresponding to names */
+ void *equiv_or_xref; /* info corresponding to names */
} name_info; /* contains information about an identifier or section name */
typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
typedef name_pointer *hash_pointer;
@@ -106,9 +122,17 @@ extern char *byte_ptr; /* first unused position in |byte_mem| */
extern name_pointer hash[]; /* heads of hash lists */
extern hash_pointer hash_end; /* end of |hash| */
extern hash_pointer h; /* index into hash-head array */
-extern name_pointer id_lookup(); /* looks up a string in the identifier table */
-extern name_pointer section_lookup(); /* finds section name */
-extern void print_section_name(), sprint_section_name();
+
+@ @<Predecl...@>=
+extern boolean names_match(name_pointer,const char *,size_t,eight_bits);@/
+extern name_pointer id_lookup(const char *,const char *,char);
+ /* looks up a string in the identifier table */
+extern name_pointer section_lookup(char *,char *,int); /* finds section name */
+extern void init_node(name_pointer);@/
+extern void init_p(name_pointer,eight_bits);@/
+extern void print_prefix_name(name_pointer);@/
+extern void print_section_name(name_pointer);@/
+extern void sprint_section_name(char *,name_pointer);@/
@ Code related to error handling:
@d spotless 0 /* |history| value for normal jobs */
@@ -118,24 +142,30 @@ extern void print_section_name(), sprint_section_name();
@d mark_harmless {if (history==spotless) history=harmless_message;}
@d mark_error history=error_message
@d confusion(s) fatal("! This can't happen: ",s)
+@.This can't happen@>
-@<Common...@>=
-extern history; /* indicates how bad this run was */
-extern err_print(); /* print error message and context */
-extern wrap_up(); /* indicate |history| and exit */
-extern void fatal(); /* issue error message and die */
-extern void overflow(); /* succumb because a table has overflowed */
+@<Common code...@>=
+extern int history; /* indicates how bad this run was */
+
+@ @<Predecl...@>=
+extern int wrap_up(void); /* indicate |history| and exit */
+extern void err_print(const char *); /* print error message and context */
+extern void fatal(const char *,const char *); /* issue error message and die */
+extern void overflow(const char *); /* succumb because a table has overflowed */
@ Code related to file handling:
@f line x /* make |line| an unreserved word */
-@d max_file_name_length 60
+@d max_include_depth 10 /* maximum number of source files open
+ simultaneously, not counting the change file */
+@d max_file_name_length 1024
@d cur_file file[include_depth] /* current file */
@d cur_file_name file_name[include_depth] /* current file name */
-@d web_file_name file_name[0] /* main source file name */
@d cur_line line[include_depth] /* number of current line in current file */
+@d web_file file[0] /* main source file */
+@d web_file_name file_name[0] /* main source file name */
@<Common code...@>=
-extern include_depth; /* current level of nesting */
+extern int include_depth; /* current level of nesting */
extern FILE *file[]; /* stack of non-change files */
extern FILE *change_file; /* change file */
extern char C_file_name[]; /* name of |C_file| */
@@ -145,19 +175,20 @@ extern char scn_file_name[]; /* name of |scn_file| */
extern char file_name[][max_file_name_length];
/* stack of non-change file names */
extern char change_file_name[]; /* name of change file */
-extern line[]; /* number of current line in the stacked files */
-extern change_line; /* number of current line in change file */
-extern change_depth; /* where \.{@@y} originated during a change */
+extern int line[]; /* number of current line in the stacked files */
+extern int change_line; /* number of current line in change file */
+extern int change_depth; /* where \.{@@y} originated during a change */
extern boolean input_has_ended; /* if there is no more input */
extern boolean changing; /* if the current line is from |change_file| */
extern boolean web_file_open; /* if the web file is being read */
-extern reset_input(); /* initialize to read the web file and change file */
-extern get_line(); /* inputs the next line */
-extern check_complete(); /* checks that all changes were picked up */
+
+@ @<Predecl...@>=
+extern boolean get_line(void); /* inputs the next line */
+extern void check_complete(void); /* checks that all changes were picked up */
+extern void reset_input(void); /* initialize to read the web file and change file */
@ Code related to section numbers:
@<Common code...@>=
-typedef unsigned short sixteen_bits;
extern sixteen_bits section_count; /* the current section number */
extern boolean changed_section[]; /* is the section changed? */
extern boolean change_pending; /* is a decision about change still unclear? */
@@ -166,7 +197,9 @@ extern boolean print_where; /* tells \.{CTANGLE} to print line and file info */
@ Code related to command line arguments:
@d show_banner flags['b'] /* should the banner line be printed? */
@d show_progress flags['p'] /* should progress reports be printed? */
+@d show_stats flags['s'] /* should statistics be printed at end of run? */
@d show_happiness flags['h'] /* should lack of errors be announced? */
+@d make_xrefs flags['x'] /* should cross references be output? */
@<Common code...@>=
extern int argc; /* copy of |ac| parameter to |main| */
@@ -178,7 +211,7 @@ extern boolean flags[]; /* an option for each 7-bit code */
@d new_line putchar('\n') @d putxchar putchar
@d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout)
@d C_printf(c,a) fprintf(C_file,c,a)
-@d C_putc(c) putc(c,C_file)
+@d C_putc(c) putc(c,C_file) /* isn't \CEE/ wonderfully consistent? */
@<Common code...@>=
extern FILE *C_file; /* where output of \.{CTANGLE} goes */
@@ -188,6 +221,24 @@ extern FILE *scn_file; /* where list of sections from \.{CWEAVE} goes */
extern FILE *active_file; /* currently active file for \.{CWEAVE} output */
@ The procedure that gets everything rolling:
-
-@<Common code...@>=
-extern void common_init();
+@<Predecl...@>=
+extern void common_init(void);@/
+extern void print_stats(void);@/
+
+@ The following parameters were sufficient in the original \.{WEB} to
+handle \TEX/, so they should be sufficient for most applications of
+\.{CWEB}.
+
+@d max_bytes 1000000 /* the number of bytes in identifiers,
+ index entries, and section names */
+@d max_toks 1000000 /* number of bytes in compressed \CEE/ code */
+@d max_names 10239 /* number of identifiers, strings, section names;
+ must be less than 10240 */
+@d max_sections 4000 /* greater than the total number of sections */
+@d max_texts 10239 /* number of replacement texts, must be less than 10240 */
+@d longest_name 10000 /* file and section names and section texts shouldn't be longer than this */
+@d stack_size 500 /* number of simultaneous levels of macro expansion */
+@d buf_size 1000 /* for \.{CWEAVE} */
+@d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */
+
+@ End of \.{COMMON} interface.
diff --git a/Build/source/texk/web2c/cwebdir/common.w b/Build/source/texk/web2c/cwebdir/common.w
index d8aacfb7b91..79083985c6a 100644
--- a/Build/source/texk/web2c/cwebdir/common.w
+++ b/Build/source/texk/web2c/cwebdir/common.w
@@ -2,7 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 3.64 --- January 2002
+% Version 4.0 --- February 2021
% Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
@@ -15,14 +15,19 @@
% entire resulting derived work is given a different name and distributed
% under the terms of a permission notice identical to this one.
+% Amendments to 'common.w' resulting in this updated version were created
+% by numerous collaborators over the course of many years.
+
+% Please send comments, suggestions, etc. to tex-k@@tug.org.
+
\def\v{\char'174} % vertical (|) in typewriter font
-\def\title{Common code for CTANGLE and CWEAVE (Version 3.64)}
+\def\title{Common code for CTANGLE and CWEAVE (Version 4.0)}
\def\topofcontents{\null\vfill
\centerline{\titlefont Common code for {\ttitlefont CTANGLE} and
{\ttitlefont CWEAVE}}
\vskip 15pt
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
\vfill}
\def\botofcontents{\vfill
\noindent
@@ -41,7 +46,10 @@ under the terms of a permission notice identical to this one.
\pageno=\contentspagenumber \advance\pageno by 1
\let\maybe=\iftrue
-@s not_eq normal @q unreserve a C++ keyword @>
+
+@s boolean int
+@s uint8_t int
+@s uint16_t int
@** Introduction. This file contains code common
to both \.{CTANGLE} and \.{CWEAVE}, which roughly concerns the following
@@ -58,20 +66,23 @@ The file begins with a few basic definitions.
@c
@<Include files@>@/
@h
-@<Definitions that should agree with \.{CTANGLE} and \.{CWEAVE}@>@/
-@<Other definitions@>@/
+@<Common code for \.{CWEAVE} and \.{CTANGLE}@>@/
+@<Global variables@>@/
@<Predeclaration of procedures@>@/
+@ The details will be filled in due course. The interface of this module
+is included first. It is also used by the main programs.
+
+First comes general stuff:
+
+@i common.h
+
@ In certain cases \.{CTANGLE} and \.{CWEAVE} should do almost, but not
quite, the same thing. In these cases we've written common code for
both, differentiating between the two by means of the global variable
|program|.
-@d ctangle 0
-@d cweave 1
-
-@<Definitions...@>=
-typedef short boolean;
+@<Global var...@>=
boolean program; /* \.{CWEAVE} or \.{CTANGLE}? */
@ \.{CWEAVE} operates in three phases: First it inputs the source
@@ -80,7 +91,7 @@ produces the \TEX/ output file, and finally it sorts and outputs the index.
Similarly, \.{CTANGLE} operates in two phases.
The global variable |phase| tells which phase we are in.
-@<Other...@>= int phase; /* which phase are we in? */
+@<Global var...@>= int phase; /* which phase are we in? */
@ There's an initialization procedure that gets both \.{CTANGLE} and
\.{CWEAVE} off to a good start. We will fill in the details of this
@@ -88,29 +99,26 @@ procedure later.
@c
void
-common_init()
+common_init(void)
{
- @<Initialize pointers@>;
- @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>;
- @<Scan arguments and open output files@>;
+ @<Initialize pointers@>@;
+ @<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>@;
+ @<Scan arguments and open output files@>@;
}
@* The character set.
\.{CWEB} uses the conventions of \CEE/ programs found in the standard
\.{ctype.h} header file.
-@<Include files@>=
-#include <ctype.h>
-
-@ A few character pairs are encoded internally as single characters,
-using the definitions below. These definitions are consistent with
-an extension of ASCII code originally developed at MIT and explained in
-Appendix~C of {\sl The \TEX/book\/}; thus, users who have such a
-character set can type things like \.{\char'32} and \.{\char'4} instead
-of \.{!=} and \.{\&\&}. (However, their files will not be too portable
-until more people adopt the extended code.)
+A few character pairs are encoded internally as single characters,
+using the definitions in the interface sections above. These definitions
+are consistent with an extension of ASCII code originally developed at
+MIT and explained in Appendix~C of {\sl The \TEX/book\/}; thus, users
+who have such a character set can type things like \.{\char'32} and
+\.{\char'4} instead of \.{!=} and \.{\&\&}. (However, their files will
+not be too portable until more people adopt the extended code.)
-If the character set is not ASCII, the definitions given here may conflict
+If the character set is not ASCII, the definitions given may conflict
with existing characters; in such cases, other arbitrary codes should be
substituted. The indexes to \.{CTANGLE} and \.{CWEAVE} mention every
case where similar codes may have to be changed in order to
@@ -120,21 +128,11 @@ in those indexes.
@^ASCII code dependencies@>
@^system dependencies@>
-@d and_and 04 /* `\.{\&\&}'\,; corresponds to MIT's {\tentex\char'4} */
-@d lt_lt 020 /* `\.{<<}'\,; corresponds to MIT's {\tentex\char'20} */
-@d gt_gt 021 /* `\.{>>}'\,; corresponds to MIT's {\tentex\char'21} */
-@d plus_plus 013 /* `\.{++}'\,; corresponds to MIT's {\tentex\char'13} */
-@d minus_minus 01 /* `\.{--}'\,; corresponds to MIT's {\tentex\char'1} */
-@d minus_gt 031 /* `\.{->}'\,; corresponds to MIT's {\tentex\char'31} */
-@d not_eq 032 /* `\.{!=}'\,; corresponds to MIT's {\tentex\char'32} */
-@d lt_eq 034 /* `\.{<=}'\,; corresponds to MIT's {\tentex\char'34} */
-@d gt_eq 035 /* `\.{>=}'\,; corresponds to MIT's {\tentex\char'35} */
-@d eq_eq 036 /* `\.{==}'\,; corresponds to MIT's {\tentex\char'36} */
-@d or_or 037 /* `\.{\v\v}'\,; corresponds to MIT's {\tentex\char'37} */
-@d dot_dot_dot 016 /* `\.{...}'\,; corresponds to MIT's {\tentex\char'16} */
-@d colon_colon 06 /* `\.{::}'\,; corresponds to MIT's {\tentex\char'6} */
-@d period_ast 026 /* `\.{.*}'\,; corresponds to MIT's {\tentex\char'26} */
-@d minus_gt_ast 027 /* `\.{->*}'\,; corresponds to MIT's {\tentex\char'27} */
+@<Global var...@>=
+char section_text[longest_name+1]; /* text being sought for */
+char *section_text_end = section_text+longest_name; /* end of |section_text| */
+char *id_first; /* where the current identifier begins in the buffer */
+char *id_loc; /* just after the current identifier in the buffer */
@** Input routines. The lowest level of input to the \.{CWEB} programs
is performed by |input_ln|, which must be told which file to read from.
@@ -150,28 +148,22 @@ Since |buf_size| is strictly less than |long_buf_size|,
some of \.{CWEB}'s routines use the fact that it is safe to refer to
|*(limit+2)| without overstepping the bounds of the array.
-@d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
-@d longest_name 10000
-@d long_buf_size (buf_size+longest_name) /* for \.{CWEAVE} */
-@d xisspace(c) (isspace(c)&&((unsigned char)c<0200))
-@d xisupper(c) (isupper(c)&&((unsigned char)c<0200))
-
-@<Definitions...@>=
+@<Global var...@>=
char buffer[long_buf_size]; /* where each line of input goes */
char *buffer_end=buffer+buf_size-2; /* end of |buffer| */
char *limit=buffer; /* points to the last character in the buffer */
char *loc=buffer; /* points to the next character to be read from the buffer */
-@ @<Include files@>=
-#include <stdio.h>
-
@ In the unlikely event that your standard I/O library does not
support |feof|, |getc|, and |ungetc| you may have to change things here.
@^system dependencies@>
-@c
-int input_ln(fp) /* copies a line into |buffer| or returns 0 */
-FILE *fp; /* what file to read from */
+@<Predecl...@>=
+static boolean input_ln(FILE *);@/
+
+@ @c
+static boolean input_ln(@t\1\1@> /* copies a line into |buffer| or returns 0 */
+FILE *fp@t\2\2@>) /* what file to read from */
{
register int c=EOF; /* character read; initialized so some compilers won't complain */
register char *k; /* where next character goes */
@@ -183,7 +175,7 @@ FILE *fp; /* what file to read from */
if ((c=getc(fp))!=EOF && c!='\n') {
ungetc(c,fp); loc=buffer; err_print("! Input line too long");
@.Input line too long@>
- }
+ }
if (c==EOF && limit==buffer) return(0); /* there was nothing after
the last newline */
return(1);
@@ -201,17 +193,7 @@ from the |change_file|.
The line number of each open file is also kept for error reporting and
for the benefit of \.{CTANGLE}.
-@f line x /* make |line| an unreserved word */
-@d max_include_depth 10 /* maximum number of source files open
- simultaneously, not counting the change file */
-@d max_file_name_length 60
-@d cur_file file[include_depth] /* current file */
-@d cur_file_name file_name[include_depth] /* current file name */
-@d cur_line line[include_depth] /* number of current line in current file */
-@d web_file file[0] /* main source file */
-@d web_file_name file_name[0] /* main source file name */
-
-@<Definitions...@>=
+@<Global var...@>=
int include_depth; /* current level of nesting */
FILE *file[max_include_depth]; /* stack of non-change files */
FILE *change_file; /* change file */
@@ -234,10 +216,10 @@ so that no further matches will be made.
Here's a shorthand expression for inequality between the two lines:
-@d lines_dont_match (change_limit-change_buffer != limit-buffer ||
- strncmp(buffer, change_buffer, limit-buffer))
+@d lines_dont_match (change_limit-change_buffer != limit-buffer || @|
+ strncmp(buffer, change_buffer, (size_t)(limit-buffer)))
-@<Other...@>=
+@<Global var...@>=
char change_buffer[buf_size]; /* next line of |change_file| */
char *change_limit; /* points to the last character in |change_buffer| */
@@ -248,14 +230,17 @@ Since blank lines in the change file are not used for matching, we have
the change file is exhausted. This procedure is called only when
|changing| is 1; hence error messages will be reported correctly.
-@c
-void
-prime_the_change_buffer()
+@<Predecl...@>=
+static void prime_the_change_buffer(void);@/
+
+@ @c
+static void
+prime_the_change_buffer(void)
{
change_limit=change_buffer; /* this value is used if the change file ends */
- @<Skip over comment lines in the change file; |return| if end of file@>;
- @<Skip to the next nonblank line; |return| if end of file@>;
- @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>;
+ @<Skip over comment lines in the change file; |return| if end of file@>@;
+ @<Skip to the next nonblank line; |return| if end of file@>@;
+ @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>@;
}
@ While looking for a line that begins with \.{@@x} in the change file, we
@@ -268,7 +253,7 @@ while(1) {
if (!input_ln(change_file)) return;
if (limit<buffer+2) continue;
if (buffer[0]!='@@') continue;
- if (xisupper(buffer[1])) buffer[1]=tolower(buffer[1]);
+ if (xisupper(buffer[1])) buffer[1]=tolower((eight_bits)buffer[1]);
if (buffer[1]=='x') break;
if (buffer[1]=='y' || buffer[1]=='z' || buffer[1]=='i') {
loc=buffer+2;
@@ -291,8 +276,8 @@ do {
@ @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>=
{
- change_limit=change_buffer+(limit-buffer);
- strncpy(change_buffer,buffer,limit-buffer+1);
+ change_limit=change_buffer+(ptrdiff_t)(limit-buffer);
+ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
}
@ The following procedure is used to see if the next change entry should
@@ -317,9 +302,12 @@ current line is nonempty.
if (*loc=='@@' && (xisspace(*(loc+1)) || *(loc+1)=='*')) change_pending=b;
}
-@c
-void
-check_change() /* switches to |change_file| if the buffers match */
+@<Predecl...@>=
+static void check_change(void);@/
+
+@ @c
+static void
+check_change(void) /* switches to |change_file| if the buffers match */
{
int n=0; /* the number of discrepancies found */
if (lines_dont_match) return;
@@ -337,11 +325,11 @@ check_change() /* switches to |change_file| if the buffers match */
return;
}
if (limit>buffer+1 && buffer[0]=='@@') {
- char xyz_code=xisupper(buffer[1])? tolower(buffer[1]): buffer[1];
+ char xyz_code=xisupper(buffer[1])? tolower((eight_bits)buffer[1]): buffer[1];
@<If the current line starts with \.{@@y},
- report any discrepancies and |return|@>;
+ report any discrepancies and |return|@>@;
}
- @<Move |buffer| and |limit|...@>;
+ @<Move |buffer| and |limit|...@>@;
changing=0; cur_line++;
while (!input_ln(cur_file)) { /* pop the stack or quit */
if (include_depth==0) {
@@ -377,10 +365,10 @@ phases one and two of \.{CWEAVE}.
@c
void
-reset_input()
+reset_input(void)
{
limit=buffer; loc=buffer+1; buffer[0]=' ';
- @<Open input files@>;
+ @<Open input files@>@;
include_depth=0; cur_line=0; change_line=0;
change_depth=include_depth;
changing=1; prime_the_change_buffer(); changing=!changing;
@@ -412,11 +400,7 @@ If we've just changed from the |cur_file| to the |change_file|, or if
the |cur_file| has changed, we tell \.{CTANGLE} to print this
information in the \CEE/ file by means of the |print_where| flag.
-@d max_sections 2000 /* number of identifiers, strings, section names;
- must be less than 10240 */
-
-@<Defin...@>=
-typedef unsigned short sixteen_bits;
+@<Global var...@>=
sixteen_bits section_count; /* the current section number */
boolean changed_section[max_sections]; /* is the section changed? */
boolean change_pending; /* if the current change is not yet recorded in
@@ -424,13 +408,13 @@ boolean change_pending; /* if the current change is not yet recorded in
boolean print_where=0; /* should \.{CTANGLE} print line and file info? */
@ @c
-int get_line() /* inputs the next line */
+boolean get_line(void) /* inputs the next line */
{
restart:
if (changing && include_depth==change_depth)
- @<Read from |change_file| and maybe turn off |changing|@>;
+ @<Read from |change_file| and maybe turn off |changing|@>@;
if (! changing || include_depth>change_depth) {
- @<Read from |cur_file| and maybe turn on |changing|@>;
+ @<Read from |cur_file| and maybe turn on |changing|@>@;
if (changing && include_depth==change_depth) goto restart;
}
if (input_has_ended) return 0;
@@ -449,7 +433,7 @@ int get_line() /* inputs the next line */
goto restart;
}
include_depth++; /* push input stack */
- @<Try to open include file, abort push if unsuccessful, go to |restart|@>;
+ @<Try to open include file, abort push if unsuccessful, go to |restart|@>@;
}
return 1;
}
@@ -468,10 +452,7 @@ The remainder of the \.{@@i} line after the file name is ignored.
@d too_long() {include_depth--;
err_print("! Include file name too long"); goto restart;}
-@<Include...@>=
-#include <stdlib.h> /* declaration of |getenv| and |exit| */
-
-@ @<Try to open...@>= {
+@.CWEBINPUTS@>@<Try to open...@>= {
char temp_file_name[max_file_name_length];
char *cur_file_name_end=cur_file_name+max_file_name_length-1;
char *k=cur_file_name, *kk;
@@ -550,7 +531,7 @@ The remainder of the \.{@@i} line after the file name is ignored.
}
*limit=' ';
if (buffer[0]=='@@') {
- if (xisupper(buffer[1])) buffer[1]=tolower(buffer[1]);
+ if (xisupper(buffer[1])) buffer[1]=tolower((eight_bits)buffer[1]);
if (buffer[1]=='x' || buffer[1]=='y') {
loc=buffer+2;
err_print("! Where is the matching @@z?");
@@ -568,10 +549,10 @@ had a line that didn't match any relevant line in |web_file|.
@c
void
-check_complete(){
+check_complete(void) {
if (change_limit!=change_buffer) { /* |changing| is 0 */
- strncpy(buffer,change_buffer,change_limit-change_buffer+1);
- limit=buffer+(int)(change_limit-change_buffer);
+ strncpy(buffer,change_buffer,(size_t)(change_limit-change_buffer+1));
+ limit=buffer+(ptrdiff_t)(change_limit-change_buffer);
changing=1; change_depth=include_depth; loc=buffer;
err_print("! Change file entry did not match");
@.Change file entry did not match@>
@@ -584,37 +565,50 @@ other strings in a large array of |char|s, called |byte_mem|.
Information about the names is kept in the array |name_dir|, whose
elements are structures of type |name_info|, containing a pointer into
the |byte_mem| array (the address where the name begins) and other data.
-A |name_pointer| variable is a pointer into |name_dir|.
-
-@d max_bytes 90000 /* the number of bytes in identifiers,
- index entries, and section names; must be less than $2^{24}$ */
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240 */
-
-@<Definitions that...@>=
-typedef struct name_info {
- char *byte_start; /* beginning of the name in |byte_mem| */
- @<More elements of |name_info| structure@>@;
-} name_info; /* contains information about an identifier or section name */
-typedef name_info *name_pointer; /* pointer into array of |name_info|s */
+A |name_pointer| variable is a pointer into |name_dir|. You find the
+complete layout of |name_info| in the interface sections above.
+
+The actual sequence of characters in the name pointed to by a |name_pointer
+p| appears in positions |p->byte_start| to |(p+1)->byte_start-1|, inclusive.
+
+The names of identifiers are found by computing a hash address |h| and
+then looking at strings of bytes signified by the |name_pointer|s
+|hash[h]|, |hash[h]->link|, |hash[h]->link->link|, \dots,
+until either finding the desired name or encountering the null pointer.
+
+The names of sections are stored in |byte_mem| together
+with the identifier names, but a hash table is not used for them because
+\.{CTANGLE} needs to be able to recognize a section name when given a prefix of
+that name. A conventional binary search tree is used to retrieve section names,
+with fields called |llink| and |rlink| (where |llink| takes the place
+of |link|). The root of this tree is stored in |name_dir->rlink|;
+this will be the only information in |name_dir[0]|.
+
+Since the space used by |rlink| has a different function for
+identifiers than for section names, we declare it as a |union|.
+
+The last component of |name_info| is different for \.{CTANGLE} and
+\.{CWEAVE}. In \.{CTANGLE}, if |p| is a pointer to a section name,
+|p->equiv| is a pointer to its replacement text, an element of the
+array |text_info|. In \.{CWEAVE}, on the other hand, if
+|p| points to an identifier, |p->xref| is a pointer to its
+list of cross-references, an element of the array |xmem|. The make-up
+of |text_info| and |xmem| is discussed in the \.{CTANGLE} and \.{CWEAVE}
+source files, respectively; here we just declare a common field
+|equiv_or_xref| as a pointer to |void|.
+
+@<Global var...@>=
char byte_mem[max_bytes]; /* characters of names */
char *byte_mem_end = byte_mem+max_bytes-1; /* end of |byte_mem| */
name_info name_dir[max_names]; /* information about names */
name_pointer name_dir_end = name_dir+max_names-1; /* end of |name_dir| */
-@ The actual sequence of characters in the name pointed to by a |name_pointer
-p| appears in positions |p->byte_start| to |(p+1)->byte_start-1|, inclusive.
-The |print_id| macro prints this text on the user's terminal.
-
-@d length(c) (c+1)->byte_start-(c)->byte_start /* the length of a name */
-@d print_id(c) term_write((c)->byte_start,length((c))) /* print identifier */
-
@ The first unused position in |byte_mem| and |name_dir| is
kept in |byte_ptr| and |name_ptr|, respectively. Thus we
usually have |name_ptr->byte_start==byte_ptr|, and certainly
we want to keep |name_ptr<=name_dir_end| and |byte_ptr<=byte_mem_end|.
-@<Defini...@>=
+@<Global var...@>=
name_pointer name_ptr; /* first unused position in |name_dir| */
char *byte_ptr; /* first unused position in |byte_mem| */
@@ -622,14 +616,7 @@ char *byte_ptr; /* first unused position in |byte_mem| */
name_dir->byte_start=byte_ptr=byte_mem; /* position zero in both arrays */
name_ptr=name_dir+1; /* |name_dir[0]| will be used only for error recovery */
name_ptr->byte_start=byte_mem; /* this makes name 0 of length zero */
-
-@ The names of identifiers are found by computing a hash address |h| and
-then looking at strings of bytes signified by the |name_pointer|s
-|hash[h]|, |hash[h]->link|, |hash[h]->link->link|, \dots,
-until either finding the desired name or encountering the null pointer.
-
-@<More elements of |name...@>=
-struct name_info *link;
+root=NULL; /* the binary search tree starts out with nothing in it */
@ The hash table itself
consists of |hash_size| entries of type |name_pointer|, and is
@@ -639,17 +626,13 @@ function |names_match|, which is slightly different in
\.{CWEAVE} and \.{CTANGLE}. If there is no match for the identifier,
it is inserted into the table.
-@d hash_size 353 /* should be prime */
+@d hash_size 8501 /* should be prime */
-@<Defini...@>=
-typedef name_pointer *hash_pointer;
+@<Global var...@>=
name_pointer hash[hash_size]; /* heads of hash lists */
hash_pointer hash_end = hash+hash_size-1; /* end of |hash| */
hash_pointer h; /* index into hash-head array */
-@ @<Predec...@>=
-extern int names_match();
-
@ Initially all the hash lists are empty.
@<Init...@>=
@@ -659,20 +642,20 @@ for (h=hash; h<=hash_end; *h++=NULL) ;
@c
name_pointer
-id_lookup(first,last,t) /* looks up a string in the identifier table */
-char *first; /* first character of string */
-char *last; /* last character of string plus one */
-char t; /* the |ilk|; used by \.{CWEAVE} only */
+id_lookup(@t\1\1@> /* looks up a string in the identifier table */
+const char *first, /* first character of string */
+const char *last, /* last character of string plus one */
+char t@t\2\2@>) /* the |ilk|; used by \.{CWEAVE} only */
{
- char *i=first; /* position in |buffer| */
+ const char *i=first; /* position in |buffer| */
int h; /* hash code */
int l; /* length of the given identifier */
name_pointer p; /* where the identifier is being sought */
if (last==NULL) for (last=first; *last!='\0'; last++);
- l=last-first; /* compute the length */
- @<Compute the hash code |h|@>;
- @<Compute the name location |p|@>;
- if (p==name_ptr) @<Enter a new name into the table at position |p|@>;
+ l=(int)(last-first); /* compute the length */
+ @<Compute the hash code |h|@>@;
+ @<Compute the name location |p|@>@;
+ if (p==name_ptr) @<Enter a new name into the table at position |p|@>@;
return(p);
}
@@ -681,8 +664,8 @@ character codes is $c_1c_2\ldots c_n$, its hash value will be
$$(2^{n-1}c_1+2^{n-2}c_2+\cdots+c_n)\,\bmod\,|hash_size|.$$
@<Compute the hash...@>=
-h=(unsigned char)*i;
-while (++i<last) h=(h+h+(int)((unsigned char)*i)) % hash_size;
+h=(eight_bits)*i;
+while (++i<last) h=(h+h+(int)((eight_bits)*i)) % hash_size;
@^high-bit character handling@>
@ If the identifier is new, it will be placed in position |p=name_ptr|,
@@ -699,44 +682,14 @@ if (p==NULL) {
@ The information associated with a new identifier must be initialized
in a slightly different way in \.{CWEAVE} than in \.{CTANGLE}; hence the
|init_p| procedure.
-
-@<Pred...@>=
-void init_p();
-
-@ @<Enter a new name...@>= {
+@<Enter a new name...@>= {
if (byte_ptr+l>byte_mem_end) overflow("byte memory");
if (name_ptr>=name_dir_end) overflow("name");
strncpy(byte_ptr,first,l);
(++name_ptr)->byte_start=byte_ptr+=l;
- if (program==cweave) init_p(p,t);
+ init_p(p,t);
}
-@ The names of sections are stored in |byte_mem| together
-with the identifier names, but a hash table is not used for them because
-\.{CTANGLE} needs to be able to recognize a section name when given a prefix of
-that name. A conventional binary search tree is used to retrieve section names,
-with fields called |llink| and |rlink| (where |llink| takes the place
-of |link|). The root of this tree is stored in |name_dir->rlink|;
-this will be the only information in |name_dir[0]|.
-
-Since the space used by |rlink| has a different function for
-identifiers than for section names, we declare it as a |union|.
-
-@d llink link /* left link in binary search tree for section names */
-@d rlink dummy.Rlink /* right link in binary search tree for section names */
-@d root name_dir->rlink /* the root of the binary search tree
- for section names */
-
-@<More elements of |name...@>=
-union {
- struct name_info *Rlink; /* right link in binary search tree for section
- names */
- char Ilk; /* used by identifiers in \.{CWEAVE} only */
-} dummy;
-
-@ @<Init...@>=
-root=NULL; /* the binary search tree starts out with nothing in it */
-
@ If |p| is a |name_pointer| variable, as we have seen,
|p->byte_start| is the beginning of the area where the name
corresponding to |p| is stored. However, if |p| refers to a section
@@ -756,24 +709,24 @@ to additional chunks in the same way. Null links are represented by
|name_dir|.
@d first_chunk(p) ((p)->byte_start+2)
-@d prefix_length(p) (int)((unsigned char)*((p)->byte_start)*256 +
- (unsigned char)*((p)->byte_start+1))
+@d prefix_length(p) (int)((eight_bits)*((p)->byte_start)*256 +
+ (eight_bits)*((p)->byte_start+1))
@d set_prefix_length(p,m) (*((p)->byte_start)=(m)/256,
*((p)->byte_start+1)=(m)%256)
@c
void
-print_section_name(p)
-name_pointer p;
+print_section_name(
+name_pointer p)
{
char *ss, *s = first_chunk(p);
name_pointer q = p+1;
while (p!=name_dir) {
ss = (p+1)->byte_start-1;
if (*ss==' ' && ss>=s) {
- term_write(s,ss-s); p=q->link; q=p;
+ term_write(s,(size_t)(ss-s)); p=q->link; q=p;
} else {
- term_write(s,ss+1-s); p=name_dir; q=NULL;
+ term_write(s,(size_t)(ss+1-s)); p=name_dir; q=NULL;
}
s = p->byte_start;
}
@@ -782,9 +735,9 @@ name_pointer p;
@ @c
void
-sprint_section_name(dest,p)
- char*dest;
- name_pointer p;
+sprint_section_name(
+ char *dest,
+ name_pointer p)
{
char *ss, *s = first_chunk(p);
name_pointer q = p+1;
@@ -795,7 +748,7 @@ sprint_section_name(dest,p)
} else {
ss++; p=name_dir;
}
- strncpy(dest,s,ss-s), dest+=ss-s;
+ strncpy(dest,s,(size_t)(ss-s)), dest+=ss-s;
s = p->byte_start;
}
*dest='\0';
@@ -803,8 +756,8 @@ sprint_section_name(dest,p)
@ @c
void
-print_prefix_name(p)
-name_pointer p;
+print_prefix_name(
+name_pointer p)
{
char *s = first_chunk(p);
int l = prefix_length(p);
@@ -822,10 +775,17 @@ are null-terminated, and we keep an eye open for prefixes and extensions.
@d prefix 3 /* the first name is a proper prefix of the second */
@d extension 4 /* the first name is a proper extension of the second */
-@c
-int web_strcmp(j,j_len,k,k_len) /* fuller comparison than |strcmp| */
- char *j, *k; /* beginning of first and second strings */
- int j_len, k_len; /* length of strings */
+@<Predecl...@>=
+static int web_strcmp(char *,int,char *,int);@/
+static name_pointer add_section_name(name_pointer,int,char *,char *,int);@/
+static void extend_section_name(name_pointer,char *,char *,int);@/
+
+@ @c
+static int web_strcmp(@t\1\1@> /* fuller comparison than |strcmp| */
+ char *j, /* beginning of first string */
+ int j_len, /* length of first string */
+ char *k, /* beginning of second string */
+ int k_len@t\2\2@>) /* length of second string */
{
char *j1=j+j_len, *k1=k+k_len;
while (k<k1 && j<j1 && *j==*k) k++, j++;
@@ -849,21 +809,18 @@ differently in \.{CWEAVE} and \.{CTANGLE}; hence the
|init_node| procedure, which is defined differently in \.{cweave.w}
and \.{ctangle.w}.
-@<Prede...@>=
-extern void init_node();
-
-@ @c
-name_pointer
-add_section_name(par,c,first,last,ispref) /* install a new node in the tree */
-name_pointer par; /* parent of new node */
-int c; /* right or left? */
-char *first; /* first character of section name */
-char *last; /* last character of section name, plus one */
-int ispref; /* are we adding a prefix or a full name? */
+@c
+static name_pointer
+add_section_name(@t\1\1@> /* install a new node in the tree */
+name_pointer par, /* parent of new node */
+int c, /* right or left? */
+char *first, /* first character of section name */
+char *last, /* last character of section name, plus one */
+int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
{
name_pointer p=name_ptr; /* new node */
char *s=first_chunk(p);
- int name_len=last-first+ispref; /* length of section name */
+ int name_len=(int)(last-first)+ispref; /* length of section name */
if (s+name_len>byte_mem_end) overflow("byte memory");
if (name_ptr+1>=name_dir_end) overflow("name");
(++name_ptr)->byte_start=byte_ptr=s+name_len;
@@ -882,16 +839,16 @@ int ispref; /* are we adding a prefix or a full name? */
}
@ @c
-void
-extend_section_name(p,first,last,ispref)
-name_pointer p; /* name to be extended */
-char *first; /* beginning of extension text */
-char *last; /* one beyond end of extension text */
-int ispref; /* are we adding a prefix or a full name? */
+static void
+extend_section_name(@t\1\1@>
+name_pointer p, /* name to be extended */
+char *first, /* beginning of extension text */
+char *last, /* one beyond end of extension text */
+int ispref@t\2\2@>) /* are we adding a prefix or a full name? */
{
char *s;
name_pointer q=p+1;
- int name_len=last-first+ispref;
+ int name_len=(int)(last-first)+ispref;
if (name_ptr>=name_dir_end) overflow("name");
while (q->link!=name_dir) q=q->link;
q->link=name_ptr;
@@ -911,9 +868,9 @@ exactly equals or is a prefix or extension of a name in the tree.
@c
name_pointer
-section_lookup(first,last,ispref) /* find or install section name in tree */
-char *first, *last; /* first and last characters of new name */
-int ispref; /* is the new name a prefix or a full name? */
+section_lookup(@t\1\1@> /* find or install section name in tree */
+char *first,char *last, /* first and last characters of new name */
+int ispref@t\2\2@>) /* is the new name a prefix or a full name? */
{
int c=0; /* comparison between two names; initialized so some compilers won't complain */
name_pointer p=root; /* current node of the search tree */
@@ -921,11 +878,11 @@ int ispref; /* is the new name a prefix or a full name? */
name_pointer r=NULL; /* where a match has been found */
name_pointer par=NULL; /* parent of |p|, if |r| is |NULL|;
otherwise parent of |r| */
- int name_len=last-first+1;
+ int name_len=(int)(last-first)+1;
@<Look for matches for new name among shortest prefixes, complaining
- if more than one is found@>;
- @<If no match found, add new name to tree@>;
- @<If one match found, check for compatibility and return match@>;
+ if more than one is found@>@;
+ @<If no match found, add new name to tree@>@;
+ @<If one match found, check for compatibility and return match@>@;
}
@ A legal new name matches an existing section name if and only if it
@@ -942,10 +899,10 @@ while (p) { /* compare shortest prefix of |p| with new name */
p=(c==less?p->llink:p->rlink);
} else { /* new name matches |p| */
if (r!=NULL) { /* and also |r|: illegal */
- printf("\n! Ambiguous prefix: matches <");
+ fputs("\n! Ambiguous prefix: matches <",stdout);
@.Ambiguous prefix ... @>
print_prefix_name(p);
- printf(">\n and <");
+ fputs(">\n and <",stdout);
print_prefix_name(r);
err_print(">");
return name_dir; /* the unsection */
@@ -971,7 +928,7 @@ switch(section_name_cmp(&first,name_len,r)) {
/* compare all of |r| with new name */
case prefix:
if (!ispref) {
- printf("\n! New name is a prefix of <");
+ fputs("\n! New name is a prefix of <",stdout);
@.New name is a prefix...@>
print_section_name(r);
err_print(">");
@@ -983,16 +940,16 @@ switch(section_name_cmp(&first,name_len,r)) {
extend_section_name(r,first,last+1,ispref);
return r;
case bad_extension:
- printf("\n! New name extends <");
+ fputs("\n! New name extends <",stdout);
@.New name extends...@>
print_section_name(r);
err_print(">");
return r;
default: /* no match: illegal */
- printf("\n! Section name incompatible with <");
+ fputs("\n! Section name incompatible with <",stdout);
@.Section name incompatible...@>
print_prefix_name(r);
- printf(">,\n which abbreviates <");
+ fputs(">,\n which abbreviates <",stdout);
print_section_name(r);
err_print(">");
return r;
@@ -1015,13 +972,13 @@ us to regard \.{@@<foo...@@>} as an ``extension'' of itself.
@d bad_extension 5
@<Predec...@>=
-int section_name_cmp();
+static int section_name_cmp(char **,int,name_pointer);@/
@ @c
-int section_name_cmp(pfirst,len,r)
-char **pfirst; /* pointer to beginning of comparison string */
-int len; /* length of string */
-name_pointer r; /* section name being compared */
+static int section_name_cmp(@t\1\1@>
+char **pfirst, /* pointer to beginning of comparison string */
+int len, /* length of string */
+name_pointer r@t\2\2@>) /* section name being compared */
{
char *first=*pfirst; /* beginning of comparison string */
name_pointer q=r+1; /* access to subsequent chunks */
@@ -1035,33 +992,20 @@ name_pointer r; /* section name being compared */
switch(c=web_strcmp(first,len,s,ss-s)) {
case equal: if (q==name_dir)
if (ispref) {
- *pfirst=first+(ss-s);
+ *pfirst=first+(ptrdiff_t)(ss-s);
return extension; /* null extension */
} else return equal;
else return (q->byte_start==(q+1)->byte_start)? equal: prefix;
case extension:
if (!ispref) return bad_extension;
first += ss-s;
- if (q!=name_dir) {len -= ss-s; s=q->byte_start; r=q; continue;}
+ if (q!=name_dir) {len -= (int)(ss-s); s=q->byte_start; r=q; continue;}
*pfirst=first; return extension;
default: return c;
}
}
}
-@ The last component of |name_info| is different for \.{CTANGLE} and
-\.{CWEAVE}. In \.{CTANGLE}, if |p| is a pointer to a section name,
-|p->equiv| is a pointer to its replacement text, an element of the
-array |text_info|. In \.{CWEAVE}, on the other hand, if
-|p| points to an identifier, |p->xref| is a pointer to its
-list of cross-references, an element of the array |xmem|. The make-up
-of |text_info| and |xmem| is discussed in the \.{CTANGLE} and \.{CWEAVE}
-source files, respectively; here we just declare a common field
-|equiv_or_xref| as a pointer to a |char|.
-
-@<More elements of |name...@>=
-char *equiv_or_xref; /* info corresponding to names */
-
@** Reporting errors to the user.
A global variable called |history| will contain one of four values
at the end of every run: |spotless| means that no unusual messages were
@@ -1072,14 +1016,7 @@ terminated abnormally. The value of |history| does not influence the
behavior of the program; it is simply computed for the convenience
of systems that might want to use such information.
-@d spotless 0 /* |history| value for normal jobs */
-@d harmless_message 1 /* |history| value when non-serious info was printed */
-@d error_message 2 /* |history| value when an error was noted */
-@d fatal_message 3 /* |history| value when we had to stop prematurely */
-@d mark_harmless {if (history==spotless) history=harmless_message;}
-@d mark_error history=error_message
-
-@<Definit...@>=
+@<Global var...@>=
int history=spotless; /* indicates how bad this run was */
@ The command `|err_print("! Error message")|' will report a syntax error to
@@ -1089,17 +1026,14 @@ Note that no period follows the error message, since the error routine
will automatically supply a period. A newline is automatically supplied
if the string begins with |"!"|.
-@<Predecl...@>=
-void err_print();
-
-@ @c
+@c
void
-err_print(s) /* prints `\..' and location of error message */
-char *s;
+err_print(@t\1\1@> /* prints `\..' and location of error message */
+const char *s@t\2\2@>)
{
char *k,*l; /* pointers into |buffer| */
printf(*s=='!'? "\n%s" : "%s",s);
- if(web_file_open) @<Print error location based on input buffer@>;
+ if(web_file_open) @<Print error location based on input buffer@>@;
update_terminal; mark_error;
}
@@ -1135,52 +1069,46 @@ up and quit as graciously as possible. This is done by calling the
function |wrap_up| at the end of the code.
\.{CTANGLE} and \.{CWEAVE} have their own notions about how to
-print the job statistics.
-
-@<Prede...@>=
-int wrap_up();
-extern void print_stats();
+print the job statistics. See the function(s) |print_stats| in the
+interface above and in the index.
-@ Some implementations may wish to pass the |history| value to the
+Some implementations may wish to pass the |history| value to the
operating system so that it can be used to govern whether or not other
programs are started. Here, for instance, we pass the operating system
a status of 0 if and only if only harmless messages were printed.
@^system dependencies@>
@c
-int wrap_up() {
- putchar('\n');
+int wrap_up(void) {
+ if (show_progress) new_line;
if (show_stats)
print_stats(); /* print statistics about memory usage */
- @<Print the job |history|@>;
+ @<Print the job |history|@>@;
if (history > harmless_message) return(1);
else return(0);
}
@ @<Print the job |history|@>=
switch (history) {
-case spotless: if (show_happiness) printf("(No errors were found.)\n"); break;
+case spotless: if (show_happiness) puts("(No errors were found.)"); break;
case harmless_message:
- printf("(Did you see the warning message above?)\n"); break;
+ puts("(Did you see the warning message above?)"); break;
case error_message:
- printf("(Pardon me, but I think I spotted something wrong.)\n"); break;
-case fatal_message: printf("(That was a fatal error, my friend.)\n");
+ puts("(Pardon me, but I think I spotted something wrong.)"); break;
+case fatal_message: puts("(That was a fatal error, my friend.)");
} /* there are no other cases */
@ When there is no way to recover from an error, the |fatal| subroutine is
invoked. This happens most often when |overflow| occurs.
-@<Predec...@>=
-void fatal(), overflow();
-
-@ The two parameters to |fatal| are strings that are essentially
+The two parameters to |fatal| are strings that are essentially
concatenated to print the final error message.
@c void
-fatal(s,t)
- char *s,*t;
+fatal(
+ const char *s,const char *t)
{
- if (*s) printf(s);
+ if (*s) err_print(s);
err_print(t);
history=fatal_message; exit(wrap_up());
}
@@ -1188,8 +1116,8 @@ fatal(s,t)
@ An overflow stop occurs if \.{CWEB}'s tables aren't large enough.
@c void
-overflow(t)
- char *t;
+overflow(
+ const char *t)
{
printf("\n! Sorry, %s capacity exceeded",t); fatal("","");
}
@@ -1200,9 +1128,6 @@ and \.{CWEB} prints an error message that is really for the \.{CWEB}
maintenance person, not the user. In such cases the program says
|confusion("indication of where we are")|.
-@d confusion(s) fatal("! This can't happen: ",s)
-@.This can't happen@>
-
@** Command line arguments.
The user calls \.{CWEAVE} and \.{CTANGLE} with arguments on the command line.
These are either file names or flags to be turned off (beginning with |"-"|)
@@ -1212,12 +1137,7 @@ of the program. The various file name variables contain strings with
the names of those files. Most of the 128 flags are undefined but available
for future extensions.
-@d show_banner flags['b'] /* should the banner line be printed? */
-@d show_progress flags['p'] /* should progress reports be printed? */
-@d show_stats flags['s'] /* should statistics be printed at end of run? */
-@d show_happiness flags['h'] /* should lack of errors be announced? */
-
-@<Defin...@>=
+@<Global var...@>=
int argc; /* copy of |ac| parameter to |main| */
char **argv; /* copy of |av| parameter to |main| */
char C_file_name[max_file_name_length]; /* name of |C_file| */
@@ -1231,7 +1151,8 @@ scanning the arguments; if additional flags are 1 by default they
should be set before calling |common_init|.
@<Set the default options common to \.{CTANGLE} and \.{CWEAVE}@>=
-show_banner=show_happiness=show_progress=1;
+show_banner=show_happiness=show_progress=make_xrefs=true;@/
+show_stats=false;@/
@ We now must look at the command line arguments and set the file names
accordingly. At least one file name must be present: the \.{CWEB}
@@ -1249,19 +1170,19 @@ when no changes are desired.
If there's a third file name, it will be the output file.
@<Pred...@>=
-void scan_args();
+static void scan_args(void);@/
@ @c
-void
-scan_args()
+static void
+scan_args(void)
{
char *dot_pos; /* position of |'.'| in the argument */
char *name_pos; /* file name beginning, sans directory */
register char *s; /* register for scanning strings */
boolean found_web=0,found_change=0,found_out=0;
/* have these names been seen? */
- boolean flag_change;
+ strcpy(change_file_name,"/dev/null");
while (--argc > 0) {
if ((**(++argv)=='-'||**argv=='+')&&*(*argv+1)) @<Handle flag argument@>@;
else {
@@ -1275,11 +1196,10 @@ scan_args()
|web_file_name|, |tex_file_name|, and |C_file_name|@>@;
else if (!found_change) @<Make |change_file_name| from |fname|@>@;
else if (!found_out) @<Override |tex_file_name| and |C_file_name|@>@;
- else @<Print usage error message and quit@>;
+ else @<Print usage error message and quit@>@;
}
}
- if (!found_web) @<Print usage error message and quit@>;
- if (found_change<=0) strcpy(change_file_name,"/dev/null");
+ if (!found_web) @<Print usage error message and quit@>@;
}
@ We use all of |*argv| for the |web_file_name| if there is a |'.'| in it,
@@ -1292,7 +1212,7 @@ after the dot. We must check that there is enough room in
@<Make |web_file_name|...@>=
{
if (s-*argv > max_file_name_length-5)
- @<Complain about argument length@>;
+ @<Complain about argument length@>@;
if (dot_pos==NULL)
sprintf(web_file_name,"%s.w",*argv);
else {
@@ -1309,21 +1229,20 @@ after the dot. We must check that there is enough room in
@ @<Make |change_file_name|...@>=
{
- if (strcmp(*argv,"-")==0) found_change=-1;
- else {
+ if (strcmp(*argv,"-")!=0) {
if (s-*argv > max_file_name_length-4)
- @<Complain about argument length@>;
+ @<Complain about argument length@>@;
if (dot_pos==NULL)
sprintf(change_file_name,"%s.ch",*argv);
else strcpy(change_file_name,*argv);
- found_change=1;
}
+ found_change=1;
}
@ @<Override...@>=
{
if (s-*argv > max_file_name_length-5)
- @<Complain about argument length@>;
+ @<Complain about argument length@>@;
if (dot_pos==NULL) {
sprintf(tex_file_name,"%s.tex",*argv);
sprintf(idx_file_name,"%s.idx",*argv);
@@ -1332,7 +1251,7 @@ after the dot. We must check that there is enough room in
} else {
strcpy(tex_file_name,*argv);
strcpy(C_file_name,*argv);
- if (flags['x']) { /* indexes will be generated */
+ if (make_xrefs) { /* indexes will be generated */
*dot_pos=0;
sprintf(idx_file_name,"%s.idx",*argv);
sprintf(scn_file_name,"%s.scn",*argv);
@@ -1341,12 +1260,11 @@ after the dot. We must check that there is enough room in
found_out=1;
}
-@ @<Handle flag...@>=
+@ @d flag_change (**argv!='-')
+@<Handle flag...@>=
{
- if (**argv=='-') flag_change=0;
- else flag_change=1;
for(dot_pos=*argv+1;*dot_pos>'\0';dot_pos++)
- flags[*dot_pos]=flag_change;
+ flags[(eight_bits)*dot_pos]=flag_change;
}
@ @<Print usage error message and quit@>=
@@ -1367,7 +1285,7 @@ else fatal(
@** Output. Here is the code that opens the output file:
@^system dependencies@>
-@<Defin...@>=
+@<Global var...@>=
FILE *C_file; /* where output of \.{CTANGLE} goes */
FILE *tex_file; /* where output of \.{CWEAVE} goes */
FILE *idx_file; /* where index from \.{CWEAVE} goes */
@@ -1377,42 +1295,13 @@ FILE *active_file; /* currently active file for \.{CWEAVE} output */
@ @<Scan arguments and open output files@>=
scan_args();
if (program==ctangle) {
- if ((C_file=fopen(C_file_name,"w"))==NULL)
+ if ((C_file=fopen(C_file_name,"wb"))==NULL)
fatal("! Cannot open output file ", C_file_name);
@.Cannot open output file@>
}
else {
- if ((tex_file=fopen(tex_file_name,"w"))==NULL)
+ if ((tex_file=fopen(tex_file_name,"wb"))==NULL)
fatal("! Cannot open output file ", tex_file_name);
}
-@ The |update_terminal| procedure is called when we want
-to make sure that everything we have output to the terminal so far has
-actually left the computer's internal buffers and been sent.
-@^system dependencies@>
-
-@d update_terminal fflush(stdout) /* empty the terminal output buffer */
-
-@ Terminal output uses |putchar| and |putc| when we have to
-translate from \.{CWEB}'s code into the external character code,
-and |printf| when we just want to print strings.
-Several macros make other kinds of output convenient.
-@^system dependencies@>
-@d new_line putchar('\n') @d putxchar putchar
-@d term_write(a,b) fflush(stdout),fwrite(a,sizeof(char),b,stdout)
-@d C_printf(c,a) fprintf(C_file,c,a)
-@d C_putc(c) putc(c,C_file) /* isn't \CEE/ wonderfully consistent? */
-
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-
@** Index.
diff --git a/Build/source/texk/web2c/cwebdir/ctang-bs.ch b/Build/source/texk/web2c/cwebdir/ctang-bs.ch
index c4062c4064c..02d1f4dbf4f 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-bs.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-bs.ch
@@ -17,59 +17,12 @@ by using "huge" pointers.
The ``banner line'' defined here should be changed whenever \.{CTANGLE}
is modified.
-@d banner "This is CTANGLE (Version 3.64)\n"
+@d banner "This is CTANGLE (Version 4.0)"
@y
The ``banner line'' defined here should be changed whenever \.{CTANGLE}
is modified.
-@d banner "This is CTANGLE (Version 3.64pc/big)\n"
-@z
-
-
-@x Section 4.
-@ The following parameters were sufficient in the original \.{TANGLE} to
-handle \TEX/,
-so they should be sufficient for most applications of \.{CTANGLE}.
-If you change |max_bytes|, |max_names| or |hash_size| you should also
-change them in the file |"common.w"|.
-
-@d max_bytes 90000 /* the number of bytes in identifiers,
- index entries, and section names; used in |"common.w"| */
-@d max_toks 270000 /* number of bytes in compressed \CEE/ code */
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240; used in |"common.w"| */
-@d max_texts 2500 /* number of replacement texts, must be less than 10240 */
-@d hash_size 353 /* should be prime; used in |"common.w"| */
-@d longest_name 10000 /* section names shouldn't be longer than this */
-@d stack_size 50 /* number of simultaneous levels of macro expansion */
-@d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
-@y
-@ The following parameters were sufficient in the original \.{TANGLE} to
-handle \TEX/,
-so they should be sufficient for most applications of \.{CTANGLE}.
-If you change |max_bytes|, |max_names| or |hash_size| you should also
-change them in the file |"common.w"|.
-
-(This is a modified version of \.{CTANGLE}, and in fact one of the parameters
-has been reduced in value. The parameter |max_toks|
-has been reduced from 270000 [which
-was sufficient to handle \TEX/] to
-170000, so that \.{CTANGLE}
-may be run on {\mc MSDOS}
-systems that are tight on memory. Consider, for
-instance, an 80286-based machine with several TSRs and drivers, trying
-to run \.{CTANGLE} from a makefile.)
-
-@d max_bytes 90000 /* the number of bytes in identifiers,
- index entries, and section names; used in |"common.w"| */
-@d max_toks 170000 /* number of bytes in compressed \CEE/ code */
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240; used in |"common.w"| */
-@d max_texts 2500 /* number of replacement texts, must be less than 10240 */
-@d hash_size 353 /* should be prime; used in |"common.w"| */
-@d longest_name 10000 /* section names shouldn't be longer than this */
-@d stack_size 50 /* number of simultaneous levels of macro expansion */
-@d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
+@d banner "This is CTANGLE (Version 4.0pc/big)"
@z
@@ -85,7 +38,7 @@ typedef struct name_info {
names */
char Ilk; /* used by identifiers in \.{CWEAVE} only */
} dummy;
- char *equiv_or_xref; /* info corresponding to names */
+ void *equiv_or_xref; /* info corresponding to names */
} name_info; /* contains information about an identifier or section name */
typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
typedef name_pointer *hash_pointer;
@@ -98,9 +51,6 @@ extern char *byte_ptr; /* first unused position in |byte_mem| */
extern name_pointer hash[]; /* heads of hash lists */
extern hash_pointer hash_end; /* end of |hash| */
extern hash_pointer h; /* index into hash-head array */
-extern name_pointer id_lookup(); /* looks up a string in the identifier table */
-extern name_pointer section_lookup(); /* finds section name */
-extern void print_section_name(), sprint_section_name();
@y
@d chunk_marker 0
@@ -131,9 +81,49 @@ extern char huge* byte_ptr; /* first unused position in |byte_mem| */
extern name_pointer hash[]; /* heads of hash lists */
extern hash_pointer hash_end; /* end of |hash| */
extern hash_pointer h; /* index into hash-head array */
-extern name_pointer id_lookup(); /* looks up a string in the identifier table */
-extern name_pointer section_lookup(); /* finds section name */
-extern void print_section_name(), sprint_section_name();
+@z
+
+
+@x Section 17.
+@ The following parameters were sufficient in the original \.{WEB} to
+handle \TEX/, so they should be sufficient for most applications of
+\.{CWEB}.
+
+@d max_bytes 1000000 /* the number of bytes in identifiers,
+ index entries, and section names */
+@d max_toks 1000000 /* number of bytes in compressed \CEE/ code */
+@d max_names 10239 /* number of identifiers, strings, section names;
+ must be less than 10240 */
+@d max_sections 4000 /* greater than the total number of sections */
+@d max_texts 10239 /* number of replacement texts, must be less than 10240 */
+@d longest_name 10000 /* file and section names and section texts shouldn't be longer than this */
+@d stack_size 500 /* number of simultaneous levels of macro expansion */
+@d buf_size 1000 /* for \.{CWEAVE} */
+@y
+@ The following parameters were sufficient in the original \.{WEB} to
+handle \TEX/, so they should be sufficient for most applications of
+\.{CWEB}.
+
+(This is a modified version of \.{CTANGLE}, and in fact one of the parameters
+has been reduced in value. The parameter |max_toks|
+has been reduced from 270000 [which
+was sufficient to handle \TEX/] to
+170000, so that \.{CTANGLE}
+may be run on {\mc MSDOS}
+systems that are tight on memory. Consider, for
+instance, an 80286-based machine with several TSRs and drivers, trying
+to run \.{CTANGLE} from a makefile.)
+
+@d max_bytes 90000 /* the number of bytes in identifiers,
+ index entries, and section names */
+@d max_toks 170000 /* number of bytes in compressed \CEE/ code */
+@d max_names 4000 /* number of identifiers, strings, section names;
+ must be less than 10240 */
+@d max_sections 4000 /* greater than the total number of sections */
+@d max_texts 2500 /* number of replacement texts, must be less than 10240 */
+@d longest_name 10000 /* file and section names and section texts shouldn't be longer than this */
+@d stack_size 50 /* number of simultaneous levels of macro expansion */
+@d buf_size 100 /* for \.{CWEAVE} */
@z
@@ -190,8 +180,8 @@ text_ptr=text_info+1; text_ptr->tok_start=tok_mem;
@x Section 49.
-out_char(cur_char)
-eight_bits cur_char;
+out_char(
+eight_bits cur_char)
{
char *j, *k; /* pointer into |byte_mem| */
@y
diff --git a/Build/source/texk/web2c/cwebdir/ctang-man.ch b/Build/source/texk/web2c/cwebdir/ctang-man.ch
index 12e9d3248ef..5b4d06c88b1 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-man.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-man.ch
@@ -16,7 +16,7 @@ under the terms of a permission notice identical to this one.
}
@y
\def\botofcontents{\vfill\titlefalse}
-\def\contentspagenumber{63}
+\def\contentspagenumber{66}
\def\title{APPENDIX E: CTANGLE}
\let\K=\leftarrow
@z
diff --git a/Build/source/texk/web2c/cwebdir/ctang-pc.ch b/Build/source/texk/web2c/cwebdir/ctang-pc.ch
index 67f32fae0c2..a22a165be9e 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-pc.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-pc.ch
@@ -9,16 +9,16 @@ that allows >64K arrays. If you need lots of bytes and toks, try the
alternate change files with -bs suffix instead of -pc.
@x section 1
-@d banner "This is CTANGLE (Version 3.64)\n"
+@d banner "This is CTANGLE (Version 4.0)"
@y
-@d banner "This is CTANGLE (Version 3.64pc)\n"
+@d banner "This is CTANGLE (Version 4.0pc)"
@z
@x section 4
-@d max_bytes 90000 /* the number of bytes in identifiers,
- index entries, and section names; used in |"common.w"| */
-@d max_toks 270000 /* number of bytes in compressed \CEE/ code */
+@d max_bytes 1000000 /* the number of bytes in identifiers,
+ index entries, and section names */
+@d max_toks 1000000 /* number of bytes in compressed \CEE/ code */
@y (note that CWEAVE itself needs only about 42K toks)
@d max_bytes (unsigned)60000 /* the number of bytes in identifiers,
- index entries, and section names; used in |"common.w"| */
+ index entries, and section names */
@d max_toks (unsigned)60000 /* number of bytes in compressed \CEE/ code */
@z
diff --git a/Build/source/texk/web2c/cwebdir/ctang-ql.ch b/Build/source/texk/web2c/cwebdir/ctang-ql.ch
index a0920243a97..d6cd1ee5e57 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-ql.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-ql.ch
@@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c -=500000 ctangle_c"
@x
-\def\title{CTANGLE (Version 3.64)}
+\def\title{CTANGLE (Version 4.0)}
@y
-\def\title{CTANGLE (QL Version 3.64)}
+\def\title{CTANGLE (QL Version 4.0)}
@z
@x section 1
-@d banner "This is CTANGLE (Version 3.64)\n"
+@d banner "This is CTANGLE (Version 4.0)"
@y
-@d banner "This is CTANGLE (QL Version 3.64)\n"
+@d banner "This is CTANGLE (QL Version 4.0)"
@z
@x
diff --git a/Build/source/texk/web2c/cwebdir/ctang-vms.ch b/Build/source/texk/web2c/cwebdir/ctang-vms.ch
index 7e538abc27f..a4940e60e23 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-vms.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-vms.ch
@@ -10,26 +10,26 @@ created:
(these changes not necessary for initial bootstrapping)
@x section 1 (01-FEB-1992 ST)
-@d banner "This is CTANGLE (Version 3.64)\n"
+@d banner "This is CTANGLE (Version 4.0)"
@y
-@d banner "This is CTANGLE (VAX/VMS Version 3.64)\n"
+@d banner "This is CTANGLE (VAX/VMS Version 4.0)"
@z
-@x section 6 (from common.h) (01-FEB-1992 ST)
-#include <stdio.h>
+@x section 3 (01-FEB-1992 ST)
+#include <ctype.h> /* definition of |@!isalpha|, |@!isdigit| and so on */
+#include <stdbool.h> /* definition of |@!bool|, |@!true| and |@!false| */
+#include <stddef.h> /* definition of |@!ptrdiff_t| */
+#include <stdint.h> /* definition of |@!uint8_t| and |@!uint16_t| */
+#include <stdlib.h> /* definition of |@!getenv| and |@!exit| */
+#include <stdio.h> /* definition of |@!printf| and friends */
+#include <string.h> /* definition of |@!strlen|, |@!strcmp| and so on */
@y
-#include stdio /* VMS searches Textlibraries faster */
-@z
-
-@x section 62 (01-FEB-1992 ST)
-#include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
-@y
-#include ctype /* definition of |isalpha|, |isdigit| and so on */
+#include ctype /* definition of |@!isalpha|, |@!isdigit| and so on */
/* VMS searches text libraries faster */
-@z
-
-@x section 63 (01-FEB-1992 ST)
-@d isxalpha(c) ((c)=='_') /* non-alpha character allowed in identifier */
-@y
-@d isxalpha(c) ((c)=='_' || (c)=='$') /* non-alpha characters allowed in id */
+#include stdbool /* definition of |@!bool|, |@!true| and |@!false| */
+#include stddef /* definition of |@!ptrdiff_t| */
+#include stdint /* definition of |@!uint8_t| and |@!uint16_t| */
+#include stdlib /* definition of |@!getenv| and |@!exit| */
+#include stdio /* definition of |@!printf| and friends */
+#include string /* definition of |@!strlen|, |@!strcmp| and so on */
@z
diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
index 29a525aaf39..f814b343351 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
@@ -1,30 +1,31 @@
-@q Changes for CWEB in TeX Live from numerous contributors. @>
-@q This file is in the Public Domain. @>
+@q Changes for CWEB in TeX Live from numerous contributors. @>
+@q This file is in the Public Domain. @>
-@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
-@q were merged with the set of change files of the CWEBbin project; @>
-@q see https://github.com/ascherer/cwebbin for the original parts. @>
+@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
+@q were merged with the set of change files of the CWEBbin project; @>
+@q see https://github.com/ascherer/cwebbin for the original parts. @>
-@q This stripped change file {comm,ctang,cweav,ctwill}-w2c.ch has been @>
-@q created from the set of change files {comm,ctang,cweav}-patch.ch, @>
-@q {comm,ctang,cweav}-ansi.ch, {comm,ctang,cweav}-extensions.ch, @>
-@q {comm,ctang,cweav}-output.ch, {comm,ctang,cweav}-i18n.ch, and @>
-@q cweav-twill.ch for CTWILL, and {comm,ctang,cweav,ctwill}-texlive.ch @>
-@q with the 'tie' processor and is used as a monolithic changefile for @>
-@q {common,ctangle,cweave}.w in TeX Live. @>
+@q This stripped change file {comm,ctang,cweav,ctwill,cwebman}-w2c.ch @>
+@q has been created from the elaborate set of change files @>
+@q {comm,ctang,cweav,cwebman}-patch.ch, @>
+@q {comm,cweav,cwebman}-extensions.ch, {comm,ctang,cweav}-output.ch, @>
+@q {comm,ctang,cweav}-i18n.ch, and cweav-twill.ch for CTWILL, and @>
+@q {comm,ctang,cweav,ctwill,cwebman}-texlive.ch with the 'tie' processor @>
+@q and is used as a monolithic changefile for {common,ctangle,cweave}.w @>
+@q and cwebman.tex in TeX Live. @>
-@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
+@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
@x
-\def\title{CTANGLE (Version 3.64)}
+\def\title{CTANGLE (Version 4.0)}
@y
-\def\title{CTANGLE (Version 3.64 [\TeX~Live])}
+\def\title{CTANGLE (Version 4.0 [\TeX~Live])}
@z
@x
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
@y
- \centerline{(Version 3.64 [\TeX~Live])}
+ \centerline{(Version 4.0 [\TeX~Live])}
@z
@x
@@ -36,244 +37,54 @@
@x
}
@y
-}}
-\datecontentspage
+}}\datecontentspage
@z
@x
-@s not_eq normal @q unreserve a C++ keyword @>
+@d banner "This is CTANGLE (Version 4.0)"
@y
-@z
-
-@x
-@d banner "This is CTANGLE (Version 3.64)\n"
-@y
-@d banner "This is CTANGLE, Version 3.64"
+@d banner "This is CTANGLE, Version 4.0"
/* will be extended by the \TeX~Live |versionstring| */
@z
@x
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-@y
-@ For string handling we include the {\mc ANSI C} system header file instead
-of predeclaring the standard system functions |@!strlen|, |@!strcmp|,
-|@!strcpy|, |@!strncmp|, and |@!strncpy|.
-@^system dependencies@>
-
-@<Include files@>=
-#include <string.h>
-@z
-
-@x
-int main (ac, av)
-int ac;
-char **av;
-@y
-int main (
-int ac,
-char **av)
-@z
-
-@x
- if (show_banner) printf(banner); /* print a ``banner line'' */
+ if (show_banner) puts(banner); /* print a ``banner line'' */
@y
if (show_banner) cb_show_banner(); /* print a ``banner line'' */
@z
@x
-@d max_bytes 90000 /* the number of bytes in identifiers,
-@y
-@d max_bytes 1000000 /* the number of bytes in identifiers,
-@z
-
-@x
-@d max_toks 270000 /* number of bytes in compressed \CEE/ code */
-@d max_names 4000 /* number of identifiers, strings, section names;
-@y
-@d max_toks 1000000 /* number of bytes in compressed \CEE/ code */
-@d max_names 10239 /* number of identifiers, strings, section names;
-@z
-
-@x
-@d max_texts 2500 /* number of replacement texts, must be less than 10240 */
-@d hash_size 353 /* should be prime; used in |"common.w"| */
-@y
-@d max_texts 10239 /* number of replacement texts, must be less than 10240 */
-@d hash_size 8501 /* should be prime; used in |"common.w"| */
-@z
-
-@x
-@d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
-@y
-@d buf_size 1000 /* for \.{CWEAVE} and \.{CTANGLE} */
-@z
-
-@x
@i common.h
@y
@i comm-w2c.h
@z
@x
-the array |text_info|, and we use a |text_pointer| variable to refer
-@y
-the array |text_info|, and we use a \&{text\_pointer} variable to refer
-@z
-
-@x
-If your machine does not support |unsigned char| you should change
-the definition of \&{eight\_bits} to |unsigned short|.
-@^system dependencies@>
-@y
-@z
-
-@x
-name_dir->equiv=(char *)text_info; /* the undefined section has no replacement text */
-@y
-init_node(name_dir); /* the undefined section has no replacement text */
-@z
-
-@x
-int names_match(p,first,l)
-name_pointer p; /* points to the proposed match */
-char *first; /* position of first character of string */
-int l; /* length of identifier */
-{
-@y
-boolean names_match(@t\1\1@>
-name_pointer p, /* points to the proposed match */
-const char *first, /* position of first character of string */
-size_t l, /* length of identifier */
-eight_bits t@t\2\2@>) /* not used by \.{TANGLE} */
-{@+(void)t;
-@z
-
-@x
-void
-init_node(node)
-name_pointer node;
-@y
-void
-init_node(
-name_pointer node)
-@z
-
-@x
- node->equiv=(char *)text_info;
-@y
- node->equiv=(void *)text_info;
-@z
-
-@x
-void
-init_p() {}
-@y
-void
-init_p(name_pointer p,eight_bits t) {@+(void)p;@+(void)t;@+}
-@z
-
-@x
-void
-store_two_bytes(x)
-sixteen_bits x;
-@y
-static void
-store_two_bytes(
-sixteen_bits x)
-@z
-
-@x
if (tok_ptr+2>tok_mem_end) overflow("token");
@y
if (tok_ptr+2>tok_mem_end) overflow(_("token"));
@z
@x
-void
-push_level(p) /* suspends the current level */
-name_pointer p;
-@y
-static void
-push_level(@t\1\1@> /* suspends the current level */
-name_pointer p@t\2\2@>)
-@z
-
-@x
if (stack_ptr==stack_end) overflow("stack");
@y
if (stack_ptr==stack_end) overflow(_("stack"));
@z
@x
-void
-pop_level(flag) /* do this when |cur_byte| reaches |cur_end| */
-int flag; /* |flag==0| means we are in |output_defs| */
-@y
-static void
-pop_level(@t\1\1@> /* do this when |cur_byte| reaches |cur_end| */
-int flag@t\2\2@>) /* |flag==0| means we are in |output_defs| */
-@z
-
-@x
-void
-get_output() /* sends next token to |out_char| */
-@y
-static void
-get_output(void) /* sends next token to |out_char| */
-@z
-
-@x
- if ((a+name_dir)->equiv!=(char *)text_info) push_level(a+name_dir);
-@y
- if ((a+name_dir)->equiv!=(void *)text_info) push_level(a+name_dir);
-@z
-
-@x
- printf("\n! Not present: <");
+ fputs("\n! Not present: <",stdout);
@y
fputs(_("\n! Not present: <"),stdout);
@z
@x
-void
-flush_buffer() /* writes one line to output file */
-@y
-static void
-flush_buffer(void) /* writes one line to output file */
-@z
-
-@x
overflow("output files");
@y
overflow(_("output files"));
@z
@x
-void phase_two();
-@y
-static void phase_two(void);@/
-@z
-
-@x
-void
-phase_two () {
-@y
-static void
-phase_two (void) {
-@z
-
-@x
- printf("\n! No program text was specified."); mark_harmless;
+ fputs("\n! No program text was specified.",stdout); mark_harmless;
@y
fputs(_("\n! No program text was specified."),stdout); mark_harmless;
@z
@@ -285,18 +96,15 @@ phase_two (void) {
@z
@x
- printf("\nWriting the output files:");
+ fputs("\nWriting the output files:",stdout);
@y
fputs(_("\nWriting the output files:"),stdout);
@z
@x
- if(show_happiness) printf("\nDone.");
+ fputs("Done.",stdout);
@y
- if (show_happiness) {
- if (show_progress) new_line;
fputs(_("Done."),stdout);
- }
@z
@x
@@ -305,10 +113,10 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) {
an_output_file--;
sprint_section_name(output_file_name,*an_output_file);
fclose(C_file);
- C_file=fopen(output_file_name,"w");
- if (C_file ==0) fatal("! Cannot open output file:",output_file_name);
+ C_file=fopen(output_file_name,"wb");
+ if (C_file ==0) fatal("! Cannot open output file ",output_file_name);
@.Cannot open output file@>
- printf("\n(%s)",output_file_name); update_terminal;
+ if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; }
cur_line=1;
stack_ptr=stack+1;
cur_name= (*an_output_file);
@@ -346,98 +154,12 @@ strcpy(check_file_name,""); /* We want to get rid of the temporary file */
@z
@x
-void output_defs();
-@y
-static void output_defs(void);@/
-@z
-
-@x
-void
-output_defs()
-@y
-static void
-output_defs(void)
-@z
-
-@x
else if (a<050000) { confusion("macro defs have strange char");}
@y
else if (a<050000) { confusion(_("macro defs have strange char"));}
@z
@x
-static void out_char();
-@y
-static void out_char(eight_bits);@/
-@z
-
-@x
-static void
-out_char(cur_char)
-eight_bits cur_char;
-@y
-static void
-out_char(
-eight_bits cur_char)
-@z
-
-@x
-@ @<Cases like \.{!=}@>=
-case plus_plus: C_putc('+'); C_putc('+'); out_state=normal; break;
-case minus_minus: C_putc('-'); C_putc('-'); out_state=normal; break;
-case minus_gt: C_putc('-'); C_putc('>'); out_state=normal; break;
-case gt_gt: C_putc('>'); C_putc('>'); out_state=normal; break;
-case eq_eq: C_putc('='); C_putc('='); out_state=normal; break;
-case lt_lt: C_putc('<'); C_putc('<'); out_state=normal; break;
-case gt_eq: C_putc('>'); C_putc('='); out_state=normal; break;
-case lt_eq: C_putc('<'); C_putc('='); out_state=normal; break;
-case not_eq: C_putc('!'); C_putc('='); out_state=normal; break;
-case and_and: C_putc('&'); C_putc('&'); out_state=normal; break;
-case or_or: C_putc('|'); C_putc('|'); out_state=normal; break;
-case dot_dot_dot: C_putc('.'); C_putc('.'); C_putc('.'); out_state=normal;
- break;
-case colon_colon: C_putc(':'); C_putc(':'); out_state=normal; break;
-case period_ast: C_putc('.'); C_putc('*'); out_state=normal; break;
-case minus_gt_ast: C_putc('-'); C_putc('>'); C_putc('*'); out_state=normal;
- break;
-@y
-@ @<Cases like \.{!=}@>=
-case plus_plus: C_putc('+');@+C_putc('+'); out_state=normal; break;
-case minus_minus: C_putc('-');@+C_putc('-'); out_state=normal; break;
-case minus_gt: C_putc('-');@+C_putc('>'); out_state=normal; break;
-case gt_gt: C_putc('>');@+C_putc('>'); out_state=normal; break;
-case eq_eq: C_putc('=');@+C_putc('='); out_state=normal; break;
-case lt_lt: C_putc('<');@+C_putc('<'); out_state=normal; break;
-case gt_eq: C_putc('>');@+C_putc('='); out_state=normal; break;
-case lt_eq: C_putc('<');@+C_putc('='); out_state=normal; break;
-case non_eq: C_putc('!');@+C_putc('='); out_state=normal; break;
-case and_and: C_putc('&');@+C_putc('&'); out_state=normal; break;
-case or_or: C_putc('|');@+C_putc('|'); out_state=normal; break;
-case dot_dot_dot: C_putc('.');@+C_putc('.');@+C_putc('.'); out_state=normal;
- break;
-case colon_colon: C_putc(':');@+C_putc(':'); out_state=normal; break;
-case period_ast: C_putc('.');@+C_putc('*'); out_state=normal; break;
-case minus_gt_ast: C_putc('-');@+C_putc('>');@+C_putc('*'); out_state=normal;
- break;
-@z
-
-@x
-eight_bits
-skip_ahead() /* skip to next control code */
-@y
-static eight_bits
-skip_ahead(void) /* skip to next control code */
-@z
-
-@x
-int skip_comment(is_long_comment) /* skips over comments */
-boolean is_long_comment;
-@y
-static boolean skip_comment(@t\1\1@> /* skips over comments */
-boolean is_long_comment@t\2\2@>)
-@z
-
-@x
err_print("! Input ended in mid-comment");
@y
err_print(_("! Input ended in mid-comment"));
@@ -450,54 +172,6 @@ boolean is_long_comment@t\2\2@>)
@z
@x
-eight_bits
-get_next() /* produces the next input token */
-@y
-static eight_bits
-get_next(void) /* produces the next input token */
-@z
-
-@x
- else if (c=='\'' || c=='"' || (c=='L'&&(*loc=='\'' || *loc=='"')))
-@y
- else if (c=='\'' || c=='"'@|
- || ((c=='L' || c=='u' || c=='U')&&(*loc=='\'' || *loc=='"'))@|
- || ((c=='u' && *loc=='8')&&(*(loc+1)=='\'' || *(loc+1)=='"')))
-@z
-
-@x
- else if (*loc=='>') if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
- else compress(minus_gt); break;
-@y
- else { if (*loc=='>') { if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
- else compress(minus_gt); } } break;
-@z
-
-@x
- case '!': if (*loc=='=') compress(not_eq); break;
-@y
- case '!': if (*loc=='=') compress(non_eq); break;
-@z
-
-@x
- while (isalpha(*++loc) || isdigit(*loc) || isxalpha(*loc) || ishigh(*loc));
-@y
- while (isalpha((eight_bits)*++loc) || isdigit((eight_bits)*loc) @|
- || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc));
-@z
-
-@x
- if (delim=='L') { /* wide character constant */
- delim=*loc++; *++id_loc=delim;
- }
-@y
- if (delim=='L' || delim=='u' || delim=='U') { /* wide character constant */
- if (delim=='u' && *loc=='8') { *++id_loc=*loc++; }
- delim=*loc++; *++id_loc=delim;
- }
-@z
-
-@x
err_print("! String didn't end"); loc=limit; break;
@y
err_print(_("! String didn't end")); loc=limit; break;
@@ -510,7 +184,7 @@ get_next(void) /* produces the next input token */
@z
@x
- printf("\n! String too long: ");
+ fputs("\n! String too long: ",stdout);
@y
fputs(_("\n! String too long: "),stdout);
@z
@@ -546,7 +220,7 @@ get_next(void) /* produces the next input token */
@z
@x
- printf("\n! Section name too long: ");
+ fputs("\n! Section name too long: ",stdout);
@y
fputs(_("\n! Section name too long: "),stdout);
@z
@@ -576,30 +250,12 @@ get_next(void) /* produces the next input token */
@z
@x
-void
-scan_repl(t) /* creates a replacement text */
-eight_bits t;
-@y
-static void
-scan_repl(@t\1\1@> /* creates a replacement text */
-eight_bits t@t\2\2@>)
-@z
-
-@x
if (text_ptr>text_info_end) overflow("text");
@y
if (text_ptr>text_info_end) overflow(_("text"));
@z
@x
-{int a=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a / 0400)+0200);
- app_repl(a % 0400);}
-@y
-{int a_l=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a_l / 0400)+0200);
- app_repl(a_l % 0400);}
-@z
-
-@x
case output_defs_code: if (t!=section_name) err_print("! Misplaced @@h");
@y
case output_defs_code: if (t!=section_name) err_print(_("! Misplaced @@h"));
@@ -624,72 +280,18 @@ case output_defs_code: if (t!=section_name) err_print(_("! Misplaced @@h"));
@z
@x
- c=toupper(*id_first)-'A'+10;
-@y
- c=toupper((eight_bits)*id_first)-'A'+10;
-@z
-
-@x
- c=16*c+toupper(*id_first)-'A'+10;
-@y
- c=16*c+toupper((eight_bits)*id_first)-'A'+10;
-@z
-
-@x
default: err_print("! Unrecognized escape sequence");
@y
default: err_print(_("! Unrecognized escape sequence"));
@z
@x
-void
-scan_section()
-@y
-static void
-scan_section(void)
-@z
-
-@x
err_print("! Definition flushed, must start with identifier");
@y
err_print(_("! Definition flushed, must start with identifier"));
@z
@x
-else if (p->equiv==(char *)text_info) p->equiv=(char *)cur_text;
-@y
-else if (p->equiv==(void *)text_info) p->equiv=(void *)cur_text;
-@z
-
-@x
-void phase_one();
-@y
-static void phase_one(void);@/
-@z
-
-@x
-void
-phase_one() {
-@y
-static void
-phase_one(void) {
-@z
-
-@x
-void skip_limbo();
-@y
-static void skip_limbo(void);@/
-@z
-
-@x
-void
-skip_limbo()
-@y
-static void
-skip_limbo(void)
-@z
-
-@x
err_print("! Double @@ should be used in control text");
@y
err_print(_("! Double @@ should be used in control text"));
@@ -714,66 +316,34 @@ skip_limbo(void)
@z
@x
- strncpy(translit[i-0200],beg,loc-beg);
-@y
- strncpy(translit[i-0200],beg,(size_t)(loc-beg));
-@z
-
-@x
-void
-print_stats() {
-@y
-void
-print_stats(void) {
-@z
-
-@x
- printf("\nMemory usage statistics:\n");
+ puts("\nMemory usage statistics:");
printf("%ld names (out of %ld)\n",
- (long)(name_ptr-name_dir),(long)max_names);
+ (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf("%ld replacement texts (out of %ld)\n",
- (long)(text_ptr-text_info),(long)max_texts);
+ (ptrdiff_t)(text_ptr-text_info),(long)max_texts);
printf("%ld bytes (out of %ld)\n",
- (long)(byte_ptr-byte_mem),(long)max_bytes);
+ (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
printf("%ld tokens (out of %ld)\n",
@y
puts(_("\nMemory usage statistics:"));
printf(_("%ld names (out of %ld)\n"),
- (long)(name_ptr-name_dir),(long)max_names);
+ (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf(_("%ld replacement texts (out of %ld)\n"),
- (long)(text_ptr-text_info),(long)max_texts);
+ (ptrdiff_t)(text_ptr-text_info),(long)max_texts);
printf(_("%ld bytes (out of %ld)\n"),
- (long)(byte_ptr-byte_mem),(long)max_bytes);
+ (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
printf(_("%ld tokens (out of %ld)\n"),
@z
@x
@** Index.
@y
-@** Extensions for modern \.{CWEB}. The following sections introduce changes
-and extensions to the code that have been created by numerous contributors over
-the course of a quarter century. They make \.{CWEB} adhere to modern coding
-standards and introduce new or improved features.
+@** Extensions to \.{CWEB}. The following sections introduce new or improved
+features that have been created by numerous contributors over the course of a
+quarter century.
Care has been taken to keep the original section numbering intact, so this new
-section should have the same number as the original ``\&{96.~Index},'' and
-additional material follows below.
-
-@* Function declarations. Here are declarations---conforming to
-{\mc ANSI~C}---of all functions in this code, as far as they are
-not already in |"common.h"|. These are private to \.{CTANGLE}.
-
-@<Predecl...@>=
-static eight_bits get_next(void);@/
-static eight_bits skip_ahead(void);@/
-static boolean skip_comment(boolean);@/
-static void flush_buffer(void);@/
-static void get_output(void);@/
-static void pop_level(int);@/
-static void push_level(name_pointer);@/
-static void scan_repl(eight_bits);@/
-static void scan_section(void);@/
-static void store_two_bytes(sixteen_bits);@/
+material should nicely integrate with the original ``\&{105.~Index}.''
@* Output file update. Most \CEE/ projects are controlled by a
\.{Makefile} that automatically takes care of the temporal dependecies
diff --git a/Build/source/texk/web2c/cwebdir/ctang-w32.ch b/Build/source/texk/web2c/cwebdir/ctang-w32.ch
index 523985ce3da..01b22a3d662 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-w32.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-w32.ch
@@ -4,63 +4,41 @@ This is the change file for CWEB's CTANGLE under Win32
Changes necessary for compiling with Borland C/C++
@x section 1
-@d banner "This is CTANGLE (Version 3.64)\n"
+@d banner "This is CTANGLE (Version 4.0)"
@y
-@d banner "This is CTANGLE (Version 3.64win32)\n"
+@d banner "This is CTANGLE (Version 4.0win32)"
@z
@x
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-@y
-@z
-
-@x
-int names_match(p,first,l)
-name_pointer p; /* points to the proposed match */
-char *first; /* position of first character of string */
+boolean names_match(@t\1\1@>
+name_pointer p, /* points to the proposed match */
+const char *first, /* position of first character of string */
+size_t l, /* length of identifier */
+eight_bits t@t\2\2@>) /* not used by \.{TANGLE} */
@y
-int __cdecl names_match(p,first,l)
-name_pointer p; /* points to the proposed match */
-char *first; /* position of first character of string */
+boolean __cdecl names_match(@t\1\1@>
+name_pointer p, /* points to the proposed match */
+const char *first, /* position of first character of string */
+size_t l, /* length of identifier */
+eight_bits t@t\2\2@>) /* not used by \.{TANGLE} */
@z
@x
void
-init_node(node)
-name_pointer node;
+init_node(
+name_pointer node)
{
- node->equiv=(char *)text_info;
+ node->equiv=(void *)text_info;
}
void
-init_p() {}
+init_p(name_pointer p,eight_bits t) {@+(void)p;@+(void)t;@+}
@y
void
-init_node(node)
-name_pointer node;
+init_node(
+name_pointer node)
{
- node->equiv=(char *)text_info;
+ node->equiv=(void *)text_info;
}
void __cdecl
-init_p() {}
-@z
-
-@x
-@ @<Include...@>=
-#include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
-#include <stdlib.h> /* definition of |exit| */
-@y
-@ @<Include...@>=
-#include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
-#include <stdlib.h> /* definition of |exit| */
-#include <string.h>
+init_p(name_pointer p,eight_bits t) {@+(void)p;@+(void)t;@+}
@z
diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c
index b7a1b553cee..3c8b2649da0 100644
--- a/Build/source/texk/web2c/cwebdir/ctangle.c
+++ b/Build/source/texk/web2c/cwebdir/ctangle.c
@@ -1,32 +1,21 @@
/*1:*/
-#line 64 "ctangle.w"
-
-/*6:*/
-#line 35 "common.h"
-
-#include <stdio.h>
+#line 66 "ctangle.w"
-/*:6*//*62:*/
-#line 888 "ctangle.w"
+/*4:*/
+#line 46 "common.h"
#include <ctype.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
-/*:62*/
-#line 65 "ctangle.w"
-
-#define banner "This is CTANGLE (Version 3.64)\n" \
-
-#define max_bytes 90000 \
-
-#define max_toks 270000
-#define max_names 4000 \
+/*:4*/
+#line 67 "ctangle.w"
-#define max_texts 2500
-#define hash_size 353
-#define longest_name 10000
-#define stack_size 50
-#define buf_size 100 \
+#define banner "This is CTANGLE (Version 4.0)" \
#define ctangle 0
#define cweave 1 \
@@ -37,7 +26,7 @@
#define plus_plus 013
#define minus_minus 01
#define minus_gt 031
-#define not_eq 032
+#define non_eq 032
#define lt_eq 034
#define gt_eq 035
#define eq_eq 036
@@ -47,14 +36,14 @@
#define period_ast 026
#define minus_gt_ast 027 \
-#define xisalpha(c) (isalpha(c) &&((eight_bits) c<0200) )
-#define xisdigit(c) (isdigit(c) &&((eight_bits) c<0200) )
-#define xisspace(c) (isspace(c) &&((eight_bits) c<0200) )
-#define xislower(c) (islower(c) &&((eight_bits) c<0200) )
-#define xisupper(c) (isupper(c) &&((eight_bits) c<0200) )
-#define xisxdigit(c) (isxdigit(c) &&((eight_bits) c<0200) ) \
+#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) )
+#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
-#define length(c) (c+1) ->byte_start-(c) ->byte_start
+#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
#define print_id(c) term_write((c) ->byte_start,length((c) ) )
#define llink link
#define rlink dummy.Rlink
@@ -69,16 +58,22 @@
#define mark_harmless {if(history==spotless) history= harmless_message;}
#define mark_error history= error_message
#define confusion(s) fatal("! This can't happen: ",s) \
+ \
-#define max_file_name_length 60
+#define max_include_depth 10 \
+
+#define max_file_name_length 1024
#define cur_file file[include_depth]
#define cur_file_name file_name[include_depth]
-#define web_file_name file_name[0]
-#define cur_line line[include_depth] \
+#define cur_line line[include_depth]
+#define web_file file[0]
+#define web_file_name file_name[0] \
#define show_banner flags['b']
#define show_progress flags['p']
-#define show_happiness flags['h'] \
+#define show_stats flags['s']
+#define show_happiness flags['h']
+#define make_xrefs flags['x'] \
#define update_terminal fflush(stdout)
#define new_line putchar('\n')
@@ -87,6 +82,18 @@
#define C_printf(c,a) fprintf(C_file,c,a)
#define C_putc(c) putc(c,C_file) \
+#define max_bytes 1000000 \
+
+#define max_toks 1000000
+#define max_names 10239 \
+
+#define max_sections 4000
+#define max_texts 10239
+#define longest_name 10000
+#define stack_size 500
+#define buf_size 1000
+#define long_buf_size (buf_size+longest_name) \
+
#define equiv equiv_or_xref \
#define section_flag max_texts \
@@ -128,7 +135,7 @@
#define isxalpha(c) ((c) =='_'||(c) =='$') \
-#define ishigh(c) ((unsigned char) (c) > 0177) \
+#define ishigh(c) ((eight_bits) (c) > 0177) \
\
#define compress(c) if(loc++<=limit) return(c) \
@@ -137,34 +144,35 @@
#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \
-#line 66 "ctangle.w"
+#line 68 "ctangle.w"
-/*5:*/
-#line 29 "common.h"
+/*3:*/
+#line 37 "common.h"
-typedef short boolean;
-typedef char unsigned eight_bits;
+typedef bool boolean;
+typedef uint8_t eight_bits;
+typedef uint16_t sixteen_bits;
extern boolean program;
extern int phase;
-/*:5*//*7:*/
-#line 57 "common.h"
+/*:3*//*5:*/
+#line 74 "common.h"
-char section_text[longest_name+1];
-char*section_text_end= section_text+longest_name;
-char*id_first;
-char*id_loc;
+extern char section_text[];
+extern char*section_text_end;
+extern char*id_first;
+extern char*id_loc;
-/*:7*//*8:*/
-#line 72 "common.h"
+/*:5*//*6:*/
+#line 88 "common.h"
extern char buffer[];
extern char*buffer_end;
extern char*loc;
extern char*limit;
-/*:8*//*9:*/
-#line 87 "common.h"
+/*:6*//*7:*/
+#line 103 "common.h"
typedef struct name_info{
char*byte_start;
@@ -174,7 +182,7 @@ struct name_info*Rlink;
char Ilk;
}dummy;
-char*equiv_or_xref;
+void*equiv_or_xref;
}name_info;
typedef name_info*name_pointer;
typedef name_pointer*hash_pointer;
@@ -187,23 +195,16 @@ extern char*byte_ptr;
extern name_pointer hash[];
extern hash_pointer hash_end;
extern hash_pointer h;
-extern name_pointer id_lookup();
-extern name_pointer section_lookup();
-extern void print_section_name(),sprint_section_name();
-/*:9*//*10:*/
-#line 122 "common.h"
+/*:7*//*9:*/
+#line 147 "common.h"
-extern history;
-extern err_print();
-extern wrap_up();
-extern void fatal();
-extern void overflow();
+extern int history;
-/*:10*//*11:*/
-#line 137 "common.h"
+/*:9*//*11:*/
+#line 167 "common.h"
-extern include_depth;
+extern int include_depth;
extern FILE*file[];
extern FILE*change_file;
extern char C_file_name[];
@@ -213,34 +214,30 @@ extern char scn_file_name[];
extern char file_name[][max_file_name_length];
extern char change_file_name[];
-extern line[];
-extern change_line;
-extern change_depth;
+extern int line[];
+extern int change_line;
+extern int change_depth;
extern boolean input_has_ended;
extern boolean changing;
extern boolean web_file_open;
-extern reset_input();
-extern get_line();
-extern check_complete();
-/*:11*//*12:*/
-#line 159 "common.h"
+/*:11*//*13:*/
+#line 191 "common.h"
-typedef unsigned short sixteen_bits;
extern sixteen_bits section_count;
extern boolean changed_section[];
extern boolean change_pending;
extern boolean print_where;
-/*:12*//*13:*/
-#line 171 "common.h"
+/*:13*//*14:*/
+#line 204 "common.h"
extern int argc;
extern char**argv;
extern boolean flags[];
-/*:13*//*14:*/
-#line 183 "common.h"
+/*:14*//*15:*/
+#line 216 "common.h"
extern FILE*C_file;
extern FILE*tex_file;
@@ -248,17 +245,11 @@ extern FILE*idx_file;
extern FILE*scn_file;
extern FILE*active_file;
-/*:14*//*15:*/
-#line 192 "common.h"
-
-extern void common_init();
-#line 128 "ctangle.w"
-
/*:15*/
-#line 67 "ctangle.w"
+#line 69 "ctangle.w"
-/*16:*/
-#line 152 "ctangle.w"
+/*19:*/
+#line 124 "ctangle.w"
typedef struct{
eight_bits*tok_start;
@@ -266,8 +257,8 @@ sixteen_bits text_link;
}text;
typedef text*text_pointer;
-/*:16*//*27:*/
-#line 296 "ctangle.w"
+/*:19*//*31:*/
+#line 272 "ctangle.w"
typedef struct{
eight_bits*end_field;
@@ -278,11 +269,11 @@ sixteen_bits section_field;
}output_state;
typedef output_state*stack_pointer;
-/*:27*/
-#line 68 "ctangle.w"
+/*:31*/
+#line 70 "ctangle.w"
-/*17:*/
-#line 159 "ctangle.w"
+/*20:*/
+#line 131 "ctangle.w"
text text_info[max_texts];
text_pointer text_info_end= text_info+max_texts-1;
@@ -291,13 +282,13 @@ eight_bits tok_mem[max_toks];
eight_bits*tok_mem_end= tok_mem+max_toks-1;
eight_bits*tok_ptr;
-/*:17*//*23:*/
-#line 227 "ctangle.w"
+/*:20*//*26:*/
+#line 200 "ctangle.w"
text_pointer last_unnamed;
-/*:23*//*28:*/
-#line 312 "ctangle.w"
+/*:26*//*32:*/
+#line 288 "ctangle.w"
output_state cur_state;
@@ -305,143 +296,206 @@ output_state stack[stack_size+1];
stack_pointer stack_ptr;
stack_pointer stack_end= stack+stack_size;
-/*:28*//*32:*/
-#line 384 "ctangle.w"
+/*:32*//*37:*/
+#line 364 "ctangle.w"
int cur_val;
-/*:32*//*36:*/
-#line 473 "ctangle.w"
+/*:37*//*42:*/
+#line 456 "ctangle.w"
eight_bits out_state;
boolean protect;
-/*:36*//*38:*/
-#line 502 "ctangle.w"
+/*:42*//*45:*/
+#line 488 "ctangle.w"
name_pointer output_files[max_files];
name_pointer*cur_out_file,*end_output_files,*an_output_file;
char cur_section_name_char;
-char output_file_name[longest_name];
+char output_file_name[longest_name+1];
-/*:38*//*45:*/
-#line 599 "ctangle.w"
+/*:45*//*52:*/
+#line 588 "ctangle.w"
boolean output_defs_seen= 0;
-/*:45*//*51:*/
-#line 710 "ctangle.w"
+/*:52*//*57:*/
+#line 697 "ctangle.w"
char translit[128][translit_length];
-/*:51*//*56:*/
-#line 789 "ctangle.w"
+/*:57*//*62:*/
+#line 776 "ctangle.w"
eight_bits ccode[256];
-/*:56*//*59:*/
-#line 845 "ctangle.w"
+/*:62*//*66:*/
+#line 836 "ctangle.w"
boolean comment_continues= 0;
-/*:59*//*61:*/
-#line 884 "ctangle.w"
+/*:66*//*68:*/
+#line 875 "ctangle.w"
name_pointer cur_section_name;
int no_where;
-/*:61*//*75:*/
-#line 1195 "ctangle.w"
+/*:68*//*82:*/
+#line 1189 "ctangle.w"
text_pointer cur_text;
eight_bits next_control;
-/*:75*//*82:*/
-#line 1353 "ctangle.w"
+/*:82*//*90:*/
+#line 1350 "ctangle.w"
extern sixteen_bits section_count;
-/*:82*/
-#line 69 "ctangle.w"
+/*:90*/
+#line 71 "ctangle.w"
+
+/*8:*/
+#line 126 "common.h"
+
+extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
+extern name_pointer id_lookup(const char*,const char*,char);
+
+extern name_pointer section_lookup(char*,char*,int);
+extern void init_node(name_pointer);
+extern void init_p(name_pointer,eight_bits);
+extern void print_prefix_name(name_pointer);
+extern void print_section_name(name_pointer);
+extern void sprint_section_name(char*,name_pointer);
+
+/*:8*//*10:*/
+#line 150 "common.h"
+
+extern int wrap_up(void);
+extern void err_print(const char*);
+extern void fatal(const char*,const char*);
+extern void overflow(const char*);
+
+/*:10*//*12:*/
+#line 185 "common.h"
+
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
+
+/*:12*//*16:*/
+#line 224 "common.h"
+
+extern void common_init(void);
+extern void print_stats(void);
+
+/*:16*//*29:*/
+#line 233 "ctangle.w"
+
+static void store_two_bytes(sixteen_bits);
+
+/*:29*//*34:*/
+#line 312 "ctangle.w"
+
+static void push_level(name_pointer);
+static void pop_level(int);
+
+/*:34*//*38:*/
+#line 371 "ctangle.w"
-/*2:*/
-#line 77 "ctangle.w"
+static void get_output(void);
-extern int strlen();
-extern int strcmp();
-extern char*strcpy();
-extern int strncmp();
-extern char*strncpy();
+/*:38*//*43:*/
+#line 464 "ctangle.w"
-/*:2*//*41:*/
-#line 533 "ctangle.w"
+static void flush_buffer(void);
-void phase_two();
+/*:43*//*48:*/
+#line 519 "ctangle.w"
-/*:41*//*46:*/
-#line 602 "ctangle.w"
+static void phase_two(void);
-void output_defs();
+/*:48*//*53:*/
+#line 591 "ctangle.w"
-/*:46*//*48:*/
-#line 648 "ctangle.w"
+static void output_defs(void);
+static void out_char(eight_bits);
-static void out_char();
+/*:53*//*64:*/
+#line 800 "ctangle.w"
-/*:48*//*90:*/
+static eight_bits skip_ahead(void);
+static boolean skip_comment(boolean);
+
+/*:64*//*69:*/
+#line 887 "ctangle.w"
+
+static eight_bits get_next(void);
+
+/*:69*//*83:*/
+#line 1193 "ctangle.w"
+
+static void scan_repl(eight_bits);
+
+/*:83*//*91:*/
+#line 1357 "ctangle.w"
+
+static void scan_section(void);
+
+/*:91*//*99:*/
#line 1460 "ctangle.w"
-void phase_one();
+static void phase_one(void);
-/*:90*//*92:*/
+/*:99*//*101:*/
#line 1478 "ctangle.w"
-void skip_limbo();
+static void skip_limbo(void);
-/*:92*/
-#line 70 "ctangle.w"
+/*:101*/
+#line 72 "ctangle.w"
-/*:1*//*3:*/
-#line 91 "ctangle.w"
+/*:1*//*2:*/
+#line 81 "ctangle.w"
-int main(ac,av)
-int ac;
-char**av;
+int main(
+int ac,
+char**av)
{
argc= ac;argv= av;
program= ctangle;
-/*18:*/
-#line 167 "ctangle.w"
+/*21:*/
+#line 139 "ctangle.w"
text_info->tok_start= tok_ptr= tok_mem;
text_ptr= text_info+1;text_ptr->tok_start= tok_mem;
-/*:18*//*20:*/
-#line 177 "ctangle.w"
+/*:21*//*23:*/
+#line 149 "ctangle.w"
-name_dir->equiv= (char*)text_info;
+init_node(name_dir);
-/*:20*//*24:*/
-#line 230 "ctangle.w"
+/*:23*//*27:*/
+#line 203 "ctangle.w"
last_unnamed= text_info;text_info->text_link= 0;
-/*:24*//*39:*/
-#line 512 "ctangle.w"
+/*:27*//*46:*/
+#line 498 "ctangle.w"
cur_out_file= end_output_files= output_files+max_files;
-/*:39*//*52:*/
-#line 713 "ctangle.w"
+/*:46*//*58:*/
+#line 700 "ctangle.w"
{
int i;
-for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned)(128+i));
+for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i));
}
-/*:52*//*57:*/
-#line 792 "ctangle.w"
+/*:58*//*63:*/
+#line 779 "ctangle.w"
{
int c;
for(c= 0;c<256;c++)ccode[c]= ignore;
@@ -460,62 +514,63 @@ ccode['<']= ccode['(']= section_name;
ccode['\'']= ord;
}
-/*:57*//*71:*/
-#line 1116 "ctangle.w"
+/*:63*//*78:*/
+#line 1110 "ctangle.w"
section_text[0]= ' ';
-/*:71*/
-#line 98 "ctangle.w"
-;
+/*:78*/
+#line 88 "ctangle.w"
+
common_init();
-if(show_banner)printf(banner);
+if(show_banner)puts(banner);
phase_one();
phase_two();
return wrap_up();
}
-/*:3*//*21:*/
-#line 183 "ctangle.w"
+/*:2*//*24:*/
+#line 155 "ctangle.w"
-int names_match(p,first,l)
-name_pointer p;
-char*first;
-int l;
-{
+boolean names_match(
+name_pointer p,
+const char*first,
+size_t l,
+eight_bits t)
+{(void)t;
if(length(p)!=l)return 0;
return!strncmp(first,p->byte_start,l);
}
-/*:21*//*22:*/
-#line 198 "ctangle.w"
+/*:24*//*25:*/
+#line 171 "ctangle.w"
void
-init_node(node)
-name_pointer node;
+init_node(
+name_pointer node)
{
-node->equiv= (char*)text_info;
+node->equiv= (void*)text_info;
}
void
-init_p(){}
+init_p(name_pointer p,eight_bits t){(void)p;(void)t;}
-/*:22*//*26:*/
-#line 260 "ctangle.w"
+/*:25*//*30:*/
+#line 236 "ctangle.w"
void
-store_two_bytes(x)
-sixteen_bits x;
+store_two_bytes(
+sixteen_bits x)
{
if(tok_ptr+2> tok_mem_end)overflow("token");
*tok_ptr++= x>>8;
*tok_ptr++= x&0377;
}
-/*:26*//*30:*/
-#line 336 "ctangle.w"
+/*:30*//*35:*/
+#line 316 "ctangle.w"
-void
-push_level(p)
-name_pointer p;
+static void
+push_level(
+name_pointer p)
{
if(stack_ptr==stack_end)overflow("stack");
*stack_ptr= cur_state;
@@ -527,12 +582,12 @@ cur_section= 0;
}
}
-/*:30*//*31:*/
-#line 355 "ctangle.w"
+/*:35*//*36:*/
+#line 335 "ctangle.w"
-void
-pop_level(flag)
-int flag;
+static void
+pop_level(
+int flag)
{
if(flag&&cur_repl->text_link<section_flag){
cur_repl= cur_repl->text_link+text_info;
@@ -543,11 +598,11 @@ stack_ptr--;
if(stack_ptr> stack)cur_state= *stack_ptr;
}
-/*:31*//*33:*/
-#line 391 "ctangle.w"
+/*:36*//*39:*/
+#line 374 "ctangle.w"
-void
-get_output()
+static void
+get_output(void)
{
sixteen_bits a;
restart:if(stack_ptr==stack)return;
@@ -566,23 +621,23 @@ a= (a-0200)*0400+*cur_byte++;
switch(a/024000){
case 0:cur_val= a;out_char(identifier);break;
case 1:if(a==output_defs_flag)output_defs();
-else/*34:*/
-#line 423 "ctangle.w"
+else/*40:*/
+#line 406 "ctangle.w"
{
a-= 024000;
-if((a+name_dir)->equiv!=(char*)text_info)push_level(a+name_dir);
+if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir);
else if(a!=0){
-printf("\n! Not present: <");
+fputs("\n! Not present: <",stdout);
print_section_name(a+name_dir);err_print(">");
}
goto restart;
}
-/*:34*/
-#line 412 "ctangle.w"
-;
+/*:40*/
+#line 395 "ctangle.w"
+
break;
default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val;
out_char(section_number);
@@ -590,11 +645,11 @@ out_char(section_number);
}
}
-/*:33*//*37:*/
-#line 481 "ctangle.w"
+/*:39*//*44:*/
+#line 467 "ctangle.w"
-void
-flush_buffer()
+static void
+flush_buffer(void)
{
C_putc('\n');
if(cur_line%100==0&&show_progress){
@@ -605,33 +660,33 @@ update_terminal;
cur_line++;
}
-/*:37*//*42:*/
-#line 536 "ctangle.w"
+/*:44*//*49:*/
+#line 522 "ctangle.w"
-void
-phase_two(){
+static void
+phase_two(void){
web_file_open= 0;
cur_line= 1;
-/*29:*/
-#line 325 "ctangle.w"
+/*33:*/
+#line 301 "ctangle.w"
stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info;
cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0;
-/*:29*/
-#line 541 "ctangle.w"
-;
-/*44:*/
-#line 595 "ctangle.w"
+/*:33*/
+#line 527 "ctangle.w"
+
+/*51:*/
+#line 584 "ctangle.w"
if(!output_defs_seen)
output_defs();
-/*:44*/
-#line 542 "ctangle.w"
-;
+/*:51*/
+#line 528 "ctangle.w"
+
if(text_info->text_link==0&&cur_out_file==end_output_files){
-printf("\n! No program text was specified.");mark_harmless;
+fputs("\n! No program text was specified.",stdout);mark_harmless;
}
else{
@@ -641,7 +696,7 @@ printf("\nWriting the output file (%s):",C_file_name);
}
else{
if(show_progress){
-printf("\nWriting the output files:");
+fputs("\nWriting the output files:",stdout);
printf(" (%s)",C_file_name);
update_terminal;
@@ -650,17 +705,17 @@ if(text_info->text_link==0)goto writeloop;
}
while(stack_ptr> stack)get_output();
flush_buffer();
-writeloop:/*43:*/
-#line 572 "ctangle.w"
+writeloop:/*50:*/
+#line 561 "ctangle.w"
for(an_output_file= end_output_files;an_output_file> cur_out_file;){
an_output_file--;
sprint_section_name(output_file_name,*an_output_file);
fclose(C_file);
-C_file= fopen(output_file_name,"w");
-if(C_file==0)fatal("! Cannot open output file:",output_file_name);
+C_file= fopen(output_file_name,"wb");
+if(C_file==0)fatal("! Cannot open output file ",output_file_name);
-printf("\n(%s)",output_file_name);update_terminal;
+if(show_progress){printf("\n(%s)",output_file_name);update_terminal;}
cur_line= 1;
stack_ptr= stack+1;
cur_name= (*an_output_file);
@@ -671,18 +726,21 @@ while(stack_ptr> stack)get_output();
flush_buffer();
}
-/*:43*/
-#line 563 "ctangle.w"
-;
-if(show_happiness)printf("\nDone.");
+/*:50*/
+#line 549 "ctangle.w"
+
+if(show_happiness){
+if(show_progress)new_line;
+fputs("Done.",stdout);
+}
}
}
-/*:42*//*47:*/
-#line 605 "ctangle.w"
+/*:49*//*54:*/
+#line 595 "ctangle.w"
-void
-output_defs()
+static void
+output_defs(void)
{
sixteen_bits a;
push_level(NULL);
@@ -718,12 +776,12 @@ flush_buffer();
pop_level(0);
}
-/*:47*//*49:*/
-#line 651 "ctangle.w"
+/*:54*//*55:*/
+#line 638 "ctangle.w"
static void
-out_char(cur_char)
-eight_bits cur_char;
+out_char(
+eight_bits cur_char)
{
char*j,*k;
restart:
@@ -731,26 +789,26 @@ switch(cur_char){
case'\n':if(protect&&out_state!=verbatim)C_putc(' ');
if(protect||out_state==verbatim)C_putc('\\');
flush_buffer();if(out_state!=verbatim)out_state= normal;break;
-/*53:*/
-#line 719 "ctangle.w"
+/*59:*/
+#line 706 "ctangle.w"
case identifier:
if(out_state==num_or_id)C_putc(' ');
j= (cur_val+name_dir)->byte_start;
k= (cur_val+name_dir+1)->byte_start;
while(j<k){
-if((unsigned char)(*j)<0200)C_putc(*j);
+if((eight_bits)(*j)<0200)C_putc(*j);
-else C_printf("%s",translit[(unsigned char)(*j)-0200]);
+else C_printf("%s",translit[(eight_bits)(*j)-0200]);
j++;
}
out_state= num_or_id;break;
-/*:53*/
-#line 662 "ctangle.w"
-;
-/*54:*/
-#line 732 "ctangle.w"
+/*:59*/
+#line 649 "ctangle.w"
+
+/*60:*/
+#line 719 "ctangle.w"
case section_number:
if(cur_val> 0)C_printf("/*%d:*/",cur_val);
@@ -776,11 +834,11 @@ C_printf("%s","\"\n");
}
break;
-/*:54*/
-#line 663 "ctangle.w"
-;
-/*50:*/
-#line 681 "ctangle.w"
+/*:60*/
+#line 650 "ctangle.w"
+
+/*56:*/
+#line 668 "ctangle.w"
case plus_plus:C_putc('+');C_putc('+');out_state= normal;break;
case minus_minus:C_putc('-');C_putc('-');out_state= normal;break;
@@ -790,7 +848,7 @@ case eq_eq:C_putc('=');C_putc('=');out_state= normal;break;
case lt_lt:C_putc('<');C_putc('<');out_state= normal;break;
case gt_eq:C_putc('>');C_putc('=');out_state= normal;break;
case lt_eq:C_putc('<');C_putc('=');out_state= normal;break;
-case not_eq:C_putc('!');C_putc('=');out_state= normal;break;
+case non_eq:C_putc('!');C_putc('=');out_state= normal;break;
case and_and:C_putc('&');C_putc('&');out_state= normal;break;
case or_or:C_putc('|');C_putc('|');out_state= normal;break;
case dot_dot_dot:C_putc('.');C_putc('.');C_putc('.');out_state= normal;
@@ -800,9 +858,9 @@ case period_ast:C_putc('.');C_putc('*');out_state= normal;break;
case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal;
break;
-/*:50*/
-#line 664 "ctangle.w"
-;
+/*:56*/
+#line 651 "ctangle.w"
+
case'=':case'>':C_putc(cur_char);C_putc(' ');
out_state= normal;break;
case join:out_state= unbreakable;break;
@@ -819,11 +877,11 @@ default:C_putc(cur_char);out_state= normal;break;
}
}
-/*:49*//*58:*/
-#line 813 "ctangle.w"
+/*:55*//*65:*/
+#line 804 "ctangle.w"
-eight_bits
-skip_ahead()
+static eight_bits
+skip_ahead(void)
{
eight_bits c;
while(1){
@@ -837,11 +895,11 @@ if(c!=ignore||*(loc-1)=='>')return(c);
}
}
-/*:58*//*60:*/
-#line 848 "ctangle.w"
+/*:65*//*67:*/
+#line 839 "ctangle.w"
-int skip_comment(is_long_comment)
-boolean is_long_comment;
+static boolean skip_comment(
+boolean is_long_comment)
{
char c;
while(1){
@@ -871,11 +929,11 @@ else loc++;
}
}
-/*:60*//*63:*/
-#line 900 "ctangle.w"
+/*:67*//*70:*/
+#line 890 "ctangle.w"
-eight_bits
-get_next()
+static eight_bits
+get_next(void)
{
static int preprocessing= 0;
eight_bits c;
@@ -885,8 +943,8 @@ if(preprocessing&&*(limit-1)!='\\')preprocessing= 0;
if(get_line()==0)return(new_section);
else if(print_where&&!no_where){
print_where= 0;
-/*77:*/
-#line 1225 "ctangle.w"
+/*85:*/
+#line 1222 "ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -897,12 +955,12 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
-app_repl(a%0400);}
+{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
+app_repl(a_l%0400);}
+
+/*:85*/
+#line 902 "ctangle.w"
-/*:77*/
-#line 912 "ctangle.w"
-;
}
else return('\n');
}
@@ -914,8 +972,8 @@ if(comment_continues)return('\n');
else continue;
}
loc++;
-if(xisdigit(c)||c=='.')/*66:*/
-#line 978 "ctangle.w"
+if(xisdigit(c)||c=='.')/*73:*/
+#line 971 "ctangle.w"
{
id_first= loc-1;
if(*id_first=='.'&&!xisdigit(*loc))goto mistake;
@@ -939,17 +997,20 @@ id_loc= loc;
return(constant);
}
-/*:66*/
-#line 924 "ctangle.w"
+/*:73*/
+#line 914 "ctangle.w"
-else if(c=='\''||c=='"'||(c=='L'&&(*loc=='\''||*loc=='"')))
-/*67:*/
-#line 1006 "ctangle.w"
+else if(c=='\''||c=='"'
+||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"'))
+||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"')))
+/*74:*/
+#line 999 "ctangle.w"
{
char delim= c;
id_first= section_text+1;
id_loc= section_text;*++id_loc= delim;
-if(delim=='L'){
+if(delim=='L'||delim=='u'||delim=='U'){
+if(delim=='u'&&*loc=='8'){*++id_loc= *loc++;}
delim= *loc++;*++id_loc= delim;
}
while(1){
@@ -977,7 +1038,7 @@ c= *loc++;
if(++id_loc<=section_text_end)*id_loc= c;
}
if(id_loc>=section_text_end){
-printf("\n! String too long: ");
+fputs("\n! String too long: ",stdout);
term_write(section_text+1,25);
err_print("...");
@@ -986,23 +1047,24 @@ id_loc++;
return(string);
}
-/*:67*/
-#line 926 "ctangle.w"
+/*:74*/
+#line 918 "ctangle.w"
else if(isalpha(c)||isxalpha(c)||ishigh(c))
-/*65:*/
-#line 972 "ctangle.w"
+/*72:*/
+#line 964 "ctangle.w"
{
id_first= --loc;
-while(isalpha(*++loc)||isdigit(*loc)||isxalpha(*loc)||ishigh(*loc));
+while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc)
+||isxalpha((eight_bits)*loc)||ishigh((eight_bits)*loc));
id_loc= loc;return(identifier);
}
-/*:65*/
-#line 928 "ctangle.w"
+/*:72*/
+#line 920 "ctangle.w"
-else if(c=='@')/*68:*/
-#line 1050 "ctangle.w"
+else if(c=='@')/*75:*/
+#line 1044 "ctangle.w"
{
c= ccode[(eight_bits)*loc++];
switch(c){
@@ -1017,12 +1079,12 @@ err_print("! Double @ should be used in control text");
continue;
case section_name:
cur_section_name_char= *(loc-1);
-/*70:*/
-#line 1098 "ctangle.w"
+/*77:*/
+#line 1092 "ctangle.w"
{
char*k;
-/*72:*/
-#line 1118 "ctangle.w"
+/*79:*/
+#line 1112 "ctangle.w"
k= section_text;
while(1){
@@ -1032,8 +1094,8 @@ err_print("! Input ended in section name");
loc= buffer+1;break;
}
c= *loc;
-/*73:*/
-#line 1142 "ctangle.w"
+/*80:*/
+#line 1136 "ctangle.w"
if(c=='@'){
c= *(loc+1);
@@ -1051,9 +1113,9 @@ err_print("! Nesting of section names not allowed");break;
*(++k)= '@';loc++;
}
-/*:73*/
-#line 1127 "ctangle.w"
-;
+/*:80*/
+#line 1121 "ctangle.w"
+
loc++;if(k<section_text_end)k++;
if(xisspace(c)){
c= ' ';if(*(k-1)==' ')k--;
@@ -1061,22 +1123,22 @@ c= ' ';if(*(k-1)==' ')k--;
*k= c;
}
if(k>=section_text_end){
-printf("\n! Section name too long: ");
+fputs("\n! Section name too long: ",stdout);
term_write(section_text+1,25);
printf("...");mark_harmless;
}
if(*k==' '&&k> section_text)k--;
-/*:72*/
-#line 1100 "ctangle.w"
-;
+/*:79*/
+#line 1094 "ctangle.w"
+
if(k-section_text> 3&&strncmp(k-2,"...",3)==0)
cur_section_name= section_lookup(section_text+1,k-3,1);
else cur_section_name= section_lookup(section_text+1,k,0);
if(cur_section_name_char=='(')
-/*40:*/
-#line 516 "ctangle.w"
+/*47:*/
+#line 502 "ctangle.w"
{
for(an_output_file= cur_out_file;
@@ -1091,17 +1153,17 @@ overflow("output files");
}
}
-/*:40*/
-#line 1106 "ctangle.w"
-;
+/*:47*/
+#line 1100 "ctangle.w"
+
return(section_name);
}
-/*:70*/
-#line 1064 "ctangle.w"
-;
-case string:/*74:*/
-#line 1164 "ctangle.w"
+/*:77*/
+#line 1058 "ctangle.w"
+
+case string:/*81:*/
+#line 1158 "ctangle.w"
{
id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';
while(*loc!='@'||*(loc+1)!='>')loc++;
@@ -1111,11 +1173,11 @@ id_loc= loc;loc+= 2;
return(string);
}
-/*:74*/
-#line 1065 "ctangle.w"
-;
-case ord:/*69:*/
-#line 1077 "ctangle.w"
+/*:81*/
+#line 1059 "ctangle.w"
+
+case ord:/*76:*/
+#line 1071 "ctangle.w"
id_first= loc;
if(*loc=='\\'){
@@ -1137,15 +1199,15 @@ err_print("! String didn't end");loc= limit-1;break;
loc++;
return(ord);
-/*:69*/
-#line 1066 "ctangle.w"
-;
+/*:76*/
+#line 1060 "ctangle.w"
+
default:return(c);
}
}
-/*:68*/
-#line 929 "ctangle.w"
+/*:75*/
+#line 921 "ctangle.w"
else if(xisspace(c)){
if(!preprocessing||loc> limit)continue;
@@ -1153,14 +1215,14 @@ if(!preprocessing||loc> limit)continue;
else return(' ');
}
else if(c=='#'&&loc==buffer+1)preprocessing= 1;
-mistake:/*64:*/
-#line 950 "ctangle.w"
+mistake:/*71:*/
+#line 942 "ctangle.w"
switch(c){
case'+':if(*loc=='+')compress(plus_plus);break;
case'-':if(*loc=='-'){compress(minus_minus);}
-else if(*loc=='>')if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);}
-else compress(minus_gt);break;
+else{if(*loc=='>'){if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);}
+else compress(minus_gt);}}break;
case'.':if(*loc=='*'){compress(period_ast);}
else if(*loc=='.'&&*(loc+1)=='.'){
loc++;compress(dot_dot_dot);
@@ -1174,26 +1236,26 @@ case'<':if(*loc=='='){compress(lt_eq);}
else if(*loc=='<')compress(lt_lt);break;
case'&':if(*loc=='&')compress(and_and);break;
case'|':if(*loc=='|')compress(or_or);break;
-case'!':if(*loc=='=')compress(not_eq);break;
+case'!':if(*loc=='=')compress(non_eq);break;
}
-/*:64*/
-#line 936 "ctangle.w"
+/*:71*/
+#line 928 "ctangle.w"
return(c);
}
}
-/*:63*//*76:*/
-#line 1199 "ctangle.w"
+/*:70*//*84:*/
+#line 1196 "ctangle.w"
-void
-scan_repl(t)
-eight_bits t;
+static void
+scan_repl(
+eight_bits t)
{
sixteen_bits a;
-if(t==section_name){/*77:*/
-#line 1225 "ctangle.w"
+if(t==section_name){/*85:*/
+#line 1222 "ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1204,23 +1266,23 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
-app_repl(a%0400);}
+{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
+app_repl(a_l%0400);}
-/*:77*/
-#line 1205 "ctangle.w"
-;}
+/*:85*/
+#line 1202 "ctangle.w"
+}
while(1)switch(a= get_next()){
-/*78:*/
-#line 1238 "ctangle.w"
+/*86:*/
+#line 1235 "ctangle.w"
case identifier:a= id_lookup(id_first,id_loc,0)-name_dir;
app_repl((a/0400)+0200);
app_repl(a%0400);break;
case section_name:if(t!=section_name)goto done;
else{
-/*79:*/
-#line 1271 "ctangle.w"
+/*87:*/
+#line 1268 "ctangle.w"
{
char*try_loc= loc;
while(*try_loc==' '&&try_loc<limit)try_loc++;
@@ -1232,14 +1294,14 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section");
}
-/*:79*/
-#line 1244 "ctangle.w"
-;
+/*:87*/
+#line 1241 "ctangle.w"
+
a= cur_section_name-name_dir;
app_repl((a/0400)+0250);
app_repl(a%0400);
-/*77:*/
-#line 1225 "ctangle.w"
+/*85:*/
+#line 1222 "ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1250,12 +1312,12 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
-app_repl(a%0400);}
+{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
+app_repl(a_l%0400);}
-/*:77*/
-#line 1248 "ctangle.w"
-;break;
+/*:85*/
+#line 1245 "ctangle.w"
+break;
}
case output_defs_code:if(t!=section_name)err_print("! Misplaced @h");
@@ -1264,8 +1326,8 @@ output_defs_seen= 1;
a= output_defs_flag;
app_repl((a/0400)+0200);
app_repl(a%0400);
-/*77:*/
-#line 1225 "ctangle.w"
+/*85:*/
+#line 1222 "ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1276,17 +1338,17 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
-app_repl(a%0400);}
+{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
+app_repl(a_l%0400);}
+
+/*:85*/
+#line 1254 "ctangle.w"
-/*:77*/
-#line 1257 "ctangle.w"
-;
}
break;
case constant:case string:
-/*80:*/
-#line 1282 "ctangle.w"
+/*88:*/
+#line 1279 "ctangle.w"
app_repl(a);
while(id_first<id_loc){
@@ -1299,12 +1361,12 @@ app_repl(*id_first++);
}
app_repl(a);break;
-/*:80*/
-#line 1261 "ctangle.w"
-;
+/*:88*/
+#line 1258 "ctangle.w"
+
case ord:
-/*81:*/
-#line 1298 "ctangle.w"
+/*89:*/
+#line 1295 "ctangle.w"
{
int c= (eight_bits)*id_first;
if(c=='\\'){
@@ -1330,12 +1392,12 @@ case'x':
if(xisdigit(*(id_first+1)))c= *(++id_first)-'0';
else if(xisxdigit(*(id_first+1))){
++id_first;
-c= toupper(*id_first)-'A'+10;
+c= toupper((eight_bits)*id_first)-'A'+10;
}
if(xisdigit(*(id_first+1)))c= 16*c+*(++id_first)-'0';
else if(xisxdigit(*(id_first+1))){
++id_first;
-c= 16*c+toupper(*id_first)-'A'+10;
+c= 16*c+toupper((eight_bits)*id_first)-'A'+10;
}
break;
case'\\':c= '\\';break;
@@ -1354,9 +1416,9 @@ app_repl(constant);
}
break;
-/*:81*/
-#line 1263 "ctangle.w"
-;
+/*:89*/
+#line 1260 "ctangle.w"
+
case definition:case format_code:case begin_C:if(t!=section_name)goto done;
else{
err_print("! @d, @f and @c are ignored in C text");continue;
@@ -1364,8 +1426,8 @@ err_print("! @d, @f and @c are ignored in C text");continue;
}
case new_section:goto done;
-/*:78*/
-#line 1210 "ctangle.w"
+/*:86*/
+#line 1207 "ctangle.w"
case')':app_repl(a);
if(t==macro)app_repl(' ');
@@ -1377,11 +1439,11 @@ if(text_ptr> text_info_end)overflow("text");
cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr;
}
-/*:76*//*83:*/
+/*:84*//*92:*/
#line 1360 "ctangle.w"
-void
-scan_section()
+static void
+scan_section(void)
{
name_pointer p;
text_pointer q;
@@ -1392,7 +1454,7 @@ printf("*%d",section_count);update_terminal;
}
next_control= 0;
while(1){
-/*84:*/
+/*93:*/
#line 1399 "ctangle.w"
while(next_control<definition)
@@ -1401,11 +1463,11 @@ if((next_control= skip_ahead())==section_name){
loc-= 2;next_control= get_next();
}
-/*:84*/
+/*:93*/
#line 1374 "ctangle.w"
-;
+
if(next_control==definition){
-/*85:*/
+/*94:*/
#line 1406 "ctangle.w"
{
while((next_control= get_next())=='\n');
@@ -1424,7 +1486,7 @@ scan_repl(macro);
cur_text->text_link= 0;
}
-/*:85*/
+/*:94*/
#line 1376 "ctangle.w"
continue;
@@ -1434,41 +1496,41 @@ p= name_dir;break;
}
if(next_control==section_name){
p= cur_section_name;
-/*86:*/
+/*95:*/
#line 1431 "ctangle.w"
while((next_control= get_next())=='+');
if(next_control!='='&&next_control!=eq_eq)
continue;
-/*:86*/
+/*:95*/
#line 1384 "ctangle.w"
-;
+
break;
}
return;
}
no_where= print_where= 0;
-/*87:*/
+/*96:*/
#line 1436 "ctangle.w"
-/*88:*/
+/*97:*/
#line 1441 "ctangle.w"
store_two_bytes((sixteen_bits)(0150000+section_count));
-/*:88*/
+/*:97*/
#line 1437 "ctangle.w"
-;
+
scan_repl(section_name);
-/*89:*/
+/*98:*/
#line 1445 "ctangle.w"
if(p==name_dir||p==0){
(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;
}
-else if(p->equiv==(char*)text_info)p->equiv= (char*)cur_text;
+else if(p->equiv==(void*)text_info)p->equiv= (void*)cur_text;
else{
q= (text_pointer)p->equiv;
@@ -1479,20 +1541,20 @@ q->text_link= cur_text-text_info;
cur_text->text_link= section_flag;
-/*:89*/
+/*:98*/
#line 1439 "ctangle.w"
-;
-/*:87*/
+
+/*:96*/
#line 1390 "ctangle.w"
-;
+
}
-/*:83*//*91:*/
+/*:92*//*100:*/
#line 1463 "ctangle.w"
-void
-phase_one(){
+static void
+phase_one(void){
phase= 1;
section_count= 0;
reset_input();
@@ -1502,11 +1564,11 @@ check_complete();
phase= 2;
}
-/*:91*//*93:*/
+/*:100*//*102:*/
#line 1481 "ctangle.w"
-void
-skip_limbo()
+static void
+skip_limbo(void)
{
char c;
while(1){
@@ -1517,7 +1579,7 @@ if(loc++<=limit){
c= *loc++;
if(ccode[(eight_bits)c]==new_section)break;
switch(ccode[(eight_bits)c]){
-case translit_code:/*94:*/
+case translit_code:/*103:*/
#line 1510 "ctangle.w"
while(xisspace(*loc)&&loc<limit)loc++;
@@ -1527,7 +1589,7 @@ if(loc> limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2))
err_print("! Improper hex number following @l");
else{
-unsigned i;
+unsigned int i;
char*beg;
sscanf(loc-3,"%x",&i);
while(xisspace(*loc)&&loc<limit)loc++;
@@ -1537,14 +1599,14 @@ if(loc-beg>=translit_length)
err_print("! Replacement string in @l too long");
else{
-strncpy(translit[i-0200],beg,loc-beg);
+strncpy(translit[i-0200],beg,(size_t)(loc-beg));
translit[i-0200][loc-beg]= '\0';
}
}
-/*:94*/
+/*:103*/
#line 1494 "ctangle.w"
-;break;
+break;
case format_code:case'@':break;
case control_text:if(c=='q'||c=='Q'){
while((c= skip_ahead())=='@');
@@ -1560,20 +1622,20 @@ default:err_print("! Double @ should be used in limbo");
}
}
-/*:93*//*95:*/
+/*:102*//*104:*/
#line 1536 "ctangle.w"
void
-print_stats(){
-printf("\nMemory usage statistics:\n");
+print_stats(void){
+puts("\nMemory usage statistics:");
printf("%ld names (out of %ld)\n",
-(long)(name_ptr-name_dir),(long)max_names);
+(ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf("%ld replacement texts (out of %ld)\n",
-(long)(text_ptr-text_info),(long)max_texts);
+(ptrdiff_t)(text_ptr-text_info),(long)max_texts);
printf("%ld bytes (out of %ld)\n",
-(long)(byte_ptr-byte_mem),(long)max_bytes);
+(ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
printf("%ld tokens (out of %ld)\n",
-(long)(tok_ptr-tok_mem),(long)max_toks);
+(ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks);
}
-/*:95*/
+/*:104*/
diff --git a/Build/source/texk/web2c/cwebdir/ctangle.w b/Build/source/texk/web2c/cwebdir/ctangle.w
index 130800210e5..92a55a180a5 100644
--- a/Build/source/texk/web2c/cwebdir/ctangle.w
+++ b/Build/source/texk/web2c/cwebdir/ctangle.w
@@ -2,9 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 3.64 --- February 2002
-% (same as Version 3.5 except for minor corrections)
-% (also quotes backslashes in file names of #line directives)
+% Version 4.0 --- February 2021
% Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
@@ -17,6 +15,11 @@
% entire resulting derived work is given a different name and distributed
% under the terms of a permission notice identical to this one.
+% Amendments to 'ctangle.w' resulting in this updated version were created
+% by numerous collaborators over the course of many years.
+
+% Please send comments, suggestions, etc. to tex-k@@tug.org.
+
% Here is TeX material that gets inserted after \input cwebmac
\def\hang{\hangindent 3em\indent\ignorespaces}
\def\pb{$\.|\ldots\.|$} % C brackets (|...|)
@@ -24,11 +27,11 @@
\mathchardef\RA="3221 % right arrow
\mathchardef\BA="3224 % double arrow
-\def\title{CTANGLE (Version 3.64)}
+\def\title{CTANGLE (Version 4.0)}
\def\topofcontents{\null\vfill
\centerline{\titlefont The {\ttitlefont CTANGLE} processor}
\vskip 15pt
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
\vfill}
\def\botofcontents{\vfill
\noindent
@@ -46,7 +49,6 @@ under the terms of a permission notice identical to this one.
}
\pageno=\contentspagenumber \advance\pageno by 1
\let\maybe=\iftrue
-@s not_eq normal @q unreserve a C++ keyword @>
@** Introduction.
This is the \.{CTANGLE} program by Silvio Levy and Donald E. Knuth,
@@ -59,7 +61,7 @@ Joachim Schrod, Lee Wittenberg, and others who have contributed improvements.
The ``banner line'' defined here should be changed whenever \.{CTANGLE}
is modified.
-@d banner "This is CTANGLE (Version 3.64)\n"
+@d banner "This is CTANGLE (Version 4.0)"
@c
@<Include files@>@/
@@ -69,18 +71,6 @@ is modified.
@<Global variables@>@/
@<Predeclaration of procedures@>@/
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-
@ \.{CTANGLE} has a fairly straightforward outline. It operates in
two phases: First it reads the source file, saving the \CEE/ code in
compressed form; then it shuffles and outputs the code.
@@ -89,40 +79,26 @@ Please read the documentation for \.{common}, the set of routines common
to \.{CTANGLE} and \.{CWEAVE}, before proceeding further.
@c
-int main (ac, av)
-int ac;
-char **av;
+int main (
+int ac,
+char **av)
{
argc=ac; argv=av;
program=ctangle;
- @<Set initial values@>;
+ @<Set initial values@>@;
common_init();
- if (show_banner) printf(banner); /* print a ``banner line'' */
+ if (show_banner) puts(banner); /* print a ``banner line'' */
phase_one(); /* read all the user's text and compress it into |tok_mem| */
phase_two(); /* output the contents of the compressed tables */
return wrap_up(); /* and exit gracefully */
}
-@ The following parameters were sufficient in the original \.{TANGLE} to
-handle \TEX/,
-so they should be sufficient for most applications of \.{CTANGLE}.
-If you change |max_bytes|, |max_names|, or |hash_size| you should also
-change them in the file |"common.w"|.
-
-@d max_bytes 90000 /* the number of bytes in identifiers,
- index entries, and section names; used in |"common.w"| */
-@d max_toks 270000 /* number of bytes in compressed \CEE/ code */
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240; used in |"common.w"| */
-@d max_texts 2500 /* number of replacement texts, must be less than 10240 */
-@d hash_size 353 /* should be prime; used in |"common.w"| */
-@d longest_name 10000 /* section names and strings shouldn't be longer than this */
-@d stack_size 50 /* number of simultaneous levels of macro expansion */
-@d buf_size 100 /* for \.{CWEAVE} and \.{CTANGLE} */
-
@ The next few sections contain stuff from the file |"common.w"| that must
be included in both |"ctangle.w"| and |"cweave.w"|. It appears in
-file |"common.h"|, which needs to be updated when |"common.w"| changes.
+file |"common.h"|, which is also included in |"common.w"| to propagate
+possible changes from this \.{COMMON} interface consistently.
+
+First comes general stuff:
@i common.h
@@ -137,7 +113,7 @@ A \&{text} variable is a structure containing a pointer into
|tok_mem|, which tells where the corresponding text starts, and an
integer |text_link|, which, as we shall see later, is used to connect
pieces of text that have the same name. All the \&{text}s are stored in
-the array |text_info|, and we use a |text_pointer| variable to refer
+the array |text_info|, and we use a \&{text\_pointer} variable to refer
to them.
The first position of |tok_mem| that is unoccupied by
@@ -145,10 +121,6 @@ replacement text is called |tok_ptr|, and the first unused location of
|text_info| is called |text_ptr|. Thus we usually have the identity
|text_ptr->tok_start==tok_ptr|.
-If your machine does not support |unsigned char| you should change
-the definition of \&{eight\_bits} to |unsigned short|.
-@^system dependencies@>
-
@<Typed...@>=
typedef struct {
eight_bits *tok_start; /* pointer into |tok_mem| */
@@ -175,17 +147,18 @@ replacement text, an element of the array |text_info|.
@d equiv equiv_or_xref /* info corresponding to names */
@ @<Set init...@>=
-name_dir->equiv=(char *)text_info; /* the undefined section has no replacement text */
+init_node(name_dir); /* the undefined section has no replacement text */
@ Here's the procedure that decides whether a name of length |l|
starting at position |first| equals the identifier pointed to by |p|:
@c
-int names_match(p,first,l)
-name_pointer p; /* points to the proposed match */
-char *first; /* position of first character of string */
-int l; /* length of identifier */
-{
+boolean names_match(@t\1\1@>
+name_pointer p, /* points to the proposed match */
+const char *first, /* position of first character of string */
+size_t l, /* length of identifier */
+eight_bits t@t\2\2@>) /* not used by \.{TANGLE} */
+{@+(void)t;
if (length(p)!=l) return 0;
return !strncmp(first,p->byte_start,l);
}
@@ -197,13 +170,13 @@ the loader won't complain of its absence.
@c
void
-init_node(node)
-name_pointer node;
+init_node(
+name_pointer node)
{
- node->equiv=(char *)text_info;
+ node->equiv=(void *)text_info;
}
void
-init_p() {}
+init_p(name_pointer p,eight_bits t) {@+(void)p;@+(void)t;@+}
@* Tokens.
Replacement texts, which represent \CEE/ code in a compressed format,
@@ -257,10 +230,13 @@ construction or numerical constant.
@ The following procedure is used to enter a two-byte value into
|tok_mem| when a replacement text is being generated.
-@c
+@<Predecl...@>=
+static void store_two_bytes(sixteen_bits);@/
+
+@ @c
void
-store_two_bytes(x)
-sixteen_bits x;
+store_two_bytes(
+sixteen_bits x)
{
if (tok_ptr+2>tok_mem_end) overflow("token");
*tok_ptr++=x>>8; /* store high byte */
@@ -333,10 +309,14 @@ the new one going.
We assume that the \CEE/ compiler can copy structures.
@^system dependencies@>
-@c
-void
-push_level(p) /* suspends the current level */
-name_pointer p;
+@<Predecl...@>=
+static void push_level(name_pointer);@/
+static void pop_level(int);@/
+
+@ @c
+static void
+push_level(@t\1\1@> /* suspends the current level */
+name_pointer p@t\2\2@>)
{
if (stack_ptr==stack_end) overflow("stack");
*stack_ptr=cur_state;
@@ -353,9 +333,9 @@ does the right thing: It either moves to the continuation of this replacement
text or returns the state to the most recently stacked level.
@c
-void
-pop_level(flag) /* do this when |cur_byte| reaches |cur_end| */
-int flag; /* |flag==0| means we are in |output_defs| */
+static void
+pop_level(@t\1\1@> /* do this when |cur_byte| reaches |cur_end| */
+int flag@t\2\2@>) /* |flag==0| means we are in |output_defs| */
{
if (flag && cur_repl->text_link<section_flag) { /* link to a continuation */
cur_repl=cur_repl->text_link+text_info; /* stay on the same level */
@@ -388,9 +368,12 @@ int cur_val; /* additional information corresponding to output token */
|stack_ptr==stack|.
@^high-bit character handling@>
-@c
-void
-get_output() /* sends next token to |out_char| */
+@<Predecl...@>=
+static void get_output(void);@/
+
+@ @c
+static void
+get_output(void) /* sends next token to |out_char| */
{
sixteen_bits a; /* value of current byte */
restart: if (stack_ptr==stack) return;
@@ -409,7 +392,7 @@ get_output() /* sends next token to |out_char| */
switch (a/024000) { /* |024000==(0250-0200)*0400| */
case 0: cur_val=a; out_char(identifier); break;
case 1: if (a==output_defs_flag) output_defs();
- else @<Expand section |a-024000|, |goto restart|@>;
+ else @<Expand section |a-024000|, |goto restart|@>@;
break;
default: cur_val=a-050000; if (cur_val>0) cur_section=cur_val;
out_char(section_number);
@@ -423,9 +406,9 @@ or the \CEE/ text may have been associated with a different name by mistake.
@<Expand section |a-...@>=
{
a-=024000;
- if ((a+name_dir)->equiv!=(char *)text_info) push_level(a+name_dir);
+ if ((a+name_dir)->equiv!=(void *)text_info) push_level(a+name_dir);
else if (a!=0) {
- printf("\n! Not present: <");
+ fputs("\n! Not present: <",stdout);
print_section_name(a+name_dir); err_print(">");
@.Not present: <section name>@>
}
@@ -478,9 +461,12 @@ boolean protect; /* should newline characters be quoted? */
During the output process, |cur_line| equals the number of the next line
to be output.
-@c
-void
-flush_buffer() /* writes one line to output file */
+@<Predecl...@>=
+static void flush_buffer(void);@/
+
+@ @c
+static void
+flush_buffer(void) /* writes one line to output file */
{
C_putc('\n');
if (cur_line % 100 == 0 && show_progress) {
@@ -503,7 +489,7 @@ We write them out after we've done the unnamed section.
name_pointer output_files[max_files];
name_pointer *cur_out_file, *end_output_files, *an_output_file;
char cur_section_name_char; /* is it |'<'| or |'('| */
-char output_file_name[longest_name]; /* name of the file */
+char output_file_name[longest_name+1]; /* name of the file */
@ We make |end_output_files| point just beyond the end of
|output_files|. The stack pointer
@@ -531,17 +517,17 @@ complain we're out of room@>=
output.
@<Predecl...@>=
-void phase_two();
+static void phase_two(void);@/
@ @c
-void
-phase_two () {
+static void
+phase_two (void) {
web_file_open=0;
cur_line=1;
- @<Initialize the output stacks@>;
- @<Output macro definitions if appropriate@>;
+ @<Initialize the output stacks@>@;
+ @<Output macro definitions if appropriate@>@;
if (text_info->text_link==0 && cur_out_file==end_output_files) {
- printf("\n! No program text was specified."); mark_harmless;
+ fputs("\n! No program text was specified.",stdout); mark_harmless;
@.No program text...@>
}
else {
@@ -551,7 +537,7 @@ phase_two () {
}
else {
if (show_progress) {
- printf("\nWriting the output files:");
+ fputs("\nWriting the output files:",stdout);
@.Writing the output...@>
printf(" (%s)",C_file_name);
update_terminal;
@@ -560,8 +546,11 @@ phase_two () {
}
while (stack_ptr>stack) get_output();
flush_buffer();
-writeloop: @<Write all the named output files@>;
- if(show_happiness) printf("\nDone.");
+writeloop: @<Write all the named output files@>@;
+ if (show_happiness) {
+ if (show_progress) new_line;
+ fputs("Done.",stdout);
+ }
}
}
@@ -574,10 +563,10 @@ for (an_output_file=end_output_files; an_output_file>cur_out_file;) {
an_output_file--;
sprint_section_name(output_file_name,*an_output_file);
fclose(C_file);
- C_file=fopen(output_file_name,"w");
- if (C_file ==0) fatal("! Cannot open output file:",output_file_name);
+ C_file=fopen(output_file_name,"wb");
+ if (C_file ==0) fatal("! Cannot open output file ",output_file_name);
@.Cannot open output file@>
- printf("\n(%s)",output_file_name); update_terminal;
+ if (show_progress) { printf("\n(%s)",output_file_name); update_terminal; }
cur_line=1;
stack_ptr=stack+1;
cur_name= (*an_output_file);
@@ -600,11 +589,12 @@ that refer to macros, preceded by the \.{\#define} preprocessor command.
boolean output_defs_seen=0;
@ @<Predecl...@>=
-void output_defs();
+static void output_defs(void);@/
+static void out_char(eight_bits);@/
@ @c
-void
-output_defs()
+static void
+output_defs(void)
{
sixteen_bits a;
push_level(NULL);
@@ -645,13 +635,10 @@ is not called if |out_state==verbatim|, except perhaps with arguments
|'\n'| (protect the newline), |string| (end the string), or |constant|
(end the constant).
-@<Predecl...@>=
-static void out_char();
-
-@ @c
+@c
static void
-out_char(cur_char)
-eight_bits cur_char;
+out_char(
+eight_bits cur_char)
{
char *j, *k; /* pointer into |byte_mem| */
restart:
@@ -659,9 +646,9 @@ restart:
case '\n': if (protect && out_state!=verbatim) C_putc(' ');
if (protect || out_state==verbatim) C_putc('\\');
flush_buffer(); if (out_state!=verbatim) out_state=normal; break;
- @/@t\4@>@<Case of an identifier@>;
- @/@t\4@>@<Case of a section number@>;
- @/@t\4@>@<Cases like \.{!=}@>;
+ @/@t\4@>@<Case of an identifier@>@;
+ @/@t\4@>@<Case of a section number@>@;
+ @/@t\4@>@<Cases like \.{!=}@>@;
case '=': case '>': C_putc(cur_char); C_putc(' ');
out_state=normal; break;
case join: out_state=unbreakable; break;
@@ -679,22 +666,22 @@ restart:
}
@ @<Cases like \.{!=}@>=
-case plus_plus: C_putc('+'); C_putc('+'); out_state=normal; break;
-case minus_minus: C_putc('-'); C_putc('-'); out_state=normal; break;
-case minus_gt: C_putc('-'); C_putc('>'); out_state=normal; break;
-case gt_gt: C_putc('>'); C_putc('>'); out_state=normal; break;
-case eq_eq: C_putc('='); C_putc('='); out_state=normal; break;
-case lt_lt: C_putc('<'); C_putc('<'); out_state=normal; break;
-case gt_eq: C_putc('>'); C_putc('='); out_state=normal; break;
-case lt_eq: C_putc('<'); C_putc('='); out_state=normal; break;
-case not_eq: C_putc('!'); C_putc('='); out_state=normal; break;
-case and_and: C_putc('&'); C_putc('&'); out_state=normal; break;
-case or_or: C_putc('|'); C_putc('|'); out_state=normal; break;
-case dot_dot_dot: C_putc('.'); C_putc('.'); C_putc('.'); out_state=normal;
+case plus_plus: C_putc('+');@+C_putc('+'); out_state=normal; break;
+case minus_minus: C_putc('-');@+C_putc('-'); out_state=normal; break;
+case minus_gt: C_putc('-');@+C_putc('>'); out_state=normal; break;
+case gt_gt: C_putc('>');@+C_putc('>'); out_state=normal; break;
+case eq_eq: C_putc('=');@+C_putc('='); out_state=normal; break;
+case lt_lt: C_putc('<');@+C_putc('<'); out_state=normal; break;
+case gt_eq: C_putc('>');@+C_putc('='); out_state=normal; break;
+case lt_eq: C_putc('<');@+C_putc('='); out_state=normal; break;
+case non_eq: C_putc('!');@+C_putc('='); out_state=normal; break;
+case and_and: C_putc('&');@+C_putc('&'); out_state=normal; break;
+case or_or: C_putc('|');@+C_putc('|'); out_state=normal; break;
+case dot_dot_dot: C_putc('.');@+C_putc('.');@+C_putc('.'); out_state=normal;
break;
-case colon_colon: C_putc(':'); C_putc(':'); out_state=normal; break;
-case period_ast: C_putc('.'); C_putc('*'); out_state=normal; break;
-case minus_gt_ast: C_putc('-'); C_putc('>'); C_putc('*'); out_state=normal;
+case colon_colon: C_putc(':');@+C_putc(':'); out_state=normal; break;
+case period_ast: C_putc('.');@+C_putc('*'); out_state=normal; break;
+case minus_gt_ast: C_putc('-');@+C_putc('>');@+C_putc('*'); out_state=normal;
break;
@ When an identifier is output to the \CEE/ file, characters in the
@@ -713,7 +700,7 @@ char translit[128][translit_length];
@ @<Set init...@>=
{
int i;
- for (i=0;i<128;i++) sprintf(translit[i],"X%02X",(unsigned)(128+i));
+ for (i=0;i<128;i++) sprintf(translit[i],"X%02X",(unsigned int)(128+i));
}
@ @<Case of an identifier@>=
@@ -722,9 +709,9 @@ case identifier:
j=(cur_val+name_dir)->byte_start;
k=(cur_val+name_dir+1)->byte_start;
while (j<k) {
- if ((unsigned char)(*j)<0200) C_putc(*j);
+ if ((eight_bits)(*j)<0200) C_putc(*j);
@^high-bit character handling@>
- else C_printf("%s",translit[(unsigned char)(*j)-0200]);
+ else C_printf("%s",translit[(eight_bits)(*j)-0200]);
j++;
}
out_state=num_or_id; break;
@@ -810,9 +797,13 @@ eight_bits ccode[256]; /* meaning of a char following \.{@@} */
@ The |skip_ahead| procedure reads through the input at fairly high speed
until finding the next non-ignorable control code, which it returns.
-@c
-eight_bits
-skip_ahead() /* skip to next control code */
+@<Predecl...@>=
+static eight_bits skip_ahead(void);@/
+static boolean skip_comment(boolean);@/
+
+@ @c
+static eight_bits
+skip_ahead(void) /* skip to next control code */
{
eight_bits c; /* control code found */
while (1) {
@@ -846,8 +837,8 @@ No comment, long or short, is allowed to contain `\.{@@\ }' or `\.{@@*}'.
boolean comment_continues=0; /* are we scanning a comment? */
@ @c
-int skip_comment(is_long_comment) /* skips over comments */
-boolean is_long_comment;
+static boolean skip_comment(@t\1\1@> /* skips over comments */
+boolean is_long_comment@t\2\2@>)
{
char c; /* current character */
while (1) {
@@ -885,21 +876,20 @@ boolean is_long_comment;
name_pointer cur_section_name; /* name of section just scanned */
int no_where; /* suppress |print_where|? */
-@ @<Include...@>=
-#include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
-#include <stdlib.h> /* definition of |exit| */
-
@ As one might expect, |get_next| consists mostly of a big switch
that branches to the various special cases that can arise.
@d isxalpha(c) ((c)=='_' || (c)=='$')
/* non-alpha characters allowed in identifier */
-@d ishigh(c) ((unsigned char)(c)>0177)
+@d ishigh(c) ((eight_bits)(c)>0177)
@^high-bit character handling@>
-@c
-eight_bits
-get_next() /* produces the next input token */
+@<Predecl...@>=
+static eight_bits get_next(void);@/
+
+@ @c
+static eight_bits
+get_next(void) /* produces the next input token */
{
static int preprocessing=0;
eight_bits c; /* the current character */
@@ -909,7 +899,7 @@ get_next() /* produces the next input token */
if (get_line()==0) return(new_section);
else if (print_where && !no_where) {
print_where=0;
- @<Insert the line number into |tok_mem|@>;
+ @<Insert the line number into |tok_mem|@>@;
}
else return ('\n');
}
@@ -922,7 +912,9 @@ get_next() /* produces the next input token */
}
loc++;
if (xisdigit(c) || c=='.') @<Get a constant@>@;
- else if (c=='\'' || c=='"' || (c=='L'&&(*loc=='\'' || *loc=='"')))
+ else if (c=='\'' || c=='"'@|
+ || ((c=='L' || c=='u' || c=='U')&&(*loc=='\'' || *loc=='"'))@|
+ || ((c=='u' && *loc=='8')&&(*(loc+1)=='\'' || *(loc+1)=='"')))
@<Get a string@>@;
else if (isalpha(c) || isxalpha(c) || ishigh(c))
@<Get an identifier@>@;
@@ -951,8 +943,8 @@ treated as separate tokens.
switch(c) {
case '+': if (*loc=='+') compress(plus_plus); break;
case '-': if (*loc=='-') {compress(minus_minus);}
- else if (*loc=='>') if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
- else compress(minus_gt); break;
+ else { if (*loc=='>') { if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
+ else compress(minus_gt); } } break;
case '.': if (*loc=='*') {compress(period_ast);}
else if (*loc=='.' && *(loc+1)=='.') {
loc++; compress(dot_dot_dot);
@@ -966,12 +958,13 @@ switch(c) {
else if (*loc=='<') compress(lt_lt); break;
case '&': if (*loc=='&') compress(and_and); break;
case '|': if (*loc=='|') compress(or_or); break;
- case '!': if (*loc=='=') compress(not_eq); break;
+ case '!': if (*loc=='=') compress(non_eq); break;
}
@ @<Get an identifier@>= {
id_first=--loc;
- while (isalpha(*++loc) || isdigit(*loc) || isxalpha(*loc) || ishigh(*loc));
+ while (isalpha((eight_bits)*++loc) || isdigit((eight_bits)*loc) @|
+ || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc));
id_loc=loc; return(identifier);
}
@@ -1007,7 +1000,8 @@ convention, but do not allow the string to be longer than |longest_name|.
char delim = c; /* what started the string */
id_first = section_text+1;
id_loc = section_text; *++id_loc=delim;
- if (delim=='L') { /* wide character constant */
+ if (delim=='L' || delim=='u' || delim=='U') { /* wide character constant */
+ if (delim=='u' && *loc=='8') { *++id_loc=*loc++; }
delim=*loc++; *++id_loc=delim;
}
while (1) {
@@ -1035,7 +1029,7 @@ convention, but do not allow the string to be longer than |longest_name|.
if (++id_loc<=section_text_end) *id_loc=c;
}
if (id_loc>=section_text_end) {
- printf("\n! String too long: ");
+ fputs("\n! String too long: ",stdout);
@.String too long@>
term_write(section_text+1,25);
err_print("...");
@@ -1061,9 +1055,9 @@ whether there is more work to do.
continue;
case section_name:
cur_section_name_char=*(loc-1);
- @<Scan the section name and make |cur_section_name| point to it@>;
- case string: @<Scan a verbatim string@>;
- case ord: @<Scan an ASCII constant@>;
+ @<Scan the section name and make |cur_section_name| point to it@>@;
+ case string: @<Scan a verbatim string@>@;
+ case ord: @<Scan an ASCII constant@>@;
default: return(c);
}
}
@@ -1097,13 +1091,13 @@ thus, \.{@@'\\nopq'} gives the same result as \.{@@'\\n'}.
@ @<Scan the section name...@>= {
char *k; /* pointer into |section_text| */
- @<Put section name into |section_text|@>;
+ @<Put section name into |section_text|@>@;
if (k-section_text>3 && strncmp(k-2,"...",3)==0)
cur_section_name=section_lookup(section_text+1,k-3,1); /* 1 means is a prefix */
else cur_section_name=section_lookup(section_text+1,k,0);
if (cur_section_name_char=='(')
@<If it's not there, add |cur_section_name| to the output file stack, or
- complain we're out of room@>;
+ complain we're out of room@>@;
return(section_name);
}
@@ -1124,7 +1118,7 @@ while (1) {
loc=buffer+1; break;
}
c=*loc;
- @<If end of name or erroneous nesting, |break|@>;
+ @<If end of name or erroneous nesting, |break|@>@;
loc++; if (k<section_text_end) k++;
if (xisspace(c)) {
c=' '; if (*(k-1)==' ') k--;
@@ -1132,7 +1126,7 @@ while (1) {
*k=c;
}
if (k>=section_text_end) {
- printf("\n! Section name too long: ");
+ fputs("\n! Section name too long: ",stdout);
@.Section name too long@>
term_write(section_text+1,25);
printf("..."); mark_harmless;
@@ -1196,13 +1190,16 @@ acted, |cur_text| will point to the replacement text just generated, and
text_pointer cur_text; /* replacement text formed by |scan_repl| */
eight_bits next_control;
+@ @<Predecl...@>=
+static void scan_repl(eight_bits);@/
+
@ @c
-void
-scan_repl(t) /* creates a replacement text */
-eight_bits t;
+static void
+scan_repl(@t\1\1@> /* creates a replacement text */
+eight_bits t@t\2\2@>)
{
sixteen_bits a; /* the current token */
- if (t==section_name) {@<Insert the line number into |tok_mem|@>;}
+ if (t==section_name) {@<Insert the line number into |tok_mem|@>@;}
while (1) switch (a=get_next()) {
@<In cases that |a| is a non-|char| token (|identifier|,
|section_name|, etc.), either process it and change |a| to a byte
@@ -1232,8 +1229,8 @@ if (changing && include_depth==change_depth) { /* correction made Feb 2017 */
store_two_bytes((sixteen_bits)cur_line);
}
id_loc=id_first+strlen(id_first);
-{int a=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a / 0400)+0200);
- app_repl(a % 0400);}
+{int a_l=id_lookup(id_first,id_loc,0)-name_dir; app_repl((a_l / 0400)+0200);
+ app_repl(a_l % 0400);}
@ @<In cases that |a| is...@>=
case identifier: a=id_lookup(id_first,id_loc,0)-name_dir;
@@ -1241,11 +1238,11 @@ case identifier: a=id_lookup(id_first,id_loc,0)-name_dir;
app_repl(a % 0400); break;
case section_name: if (t!=section_name) goto done;
else {
- @<Was an `@@' missed here?@>;
+ @<Was an `@@' missed here?@>@;
a=cur_section_name-name_dir;
app_repl((a / 0400)+0250);
app_repl(a % 0400);
- @<Insert the line number into |tok_mem|@>; break;
+ @<Insert the line number into |tok_mem|@>@; break;
}
case output_defs_code: if (t!=section_name) err_print("! Misplaced @@h");
@.Misplaced @@h@>
@@ -1254,13 +1251,13 @@ case output_defs_code: if (t!=section_name) err_print("! Misplaced @@h");
a=output_defs_flag;
app_repl((a / 0400)+0200);
app_repl(a % 0400);
- @<Insert the line number into |tok_mem|@>;
+ @<Insert the line number into |tok_mem|@>@;
}
break;
case constant: case string:
- @<Copy a string or verbatim construction or numerical constant@>;
+ @<Copy a string or verbatim construction or numerical constant@>@;
case ord:
- @<Copy an ASCII constant@>;
+ @<Copy an ASCII constant@>@;
case definition: case format_code: case begin_C: if (t!=section_name) goto done;
else {
err_print("! @@d, @@f and @@c are ignored in C text"); continue;
@@ -1320,12 +1317,12 @@ code internally.
if (xisdigit(*(id_first+1))) c=*(++id_first)-'0';
else if (xisxdigit(*(id_first+1))) {
++id_first;
- c=toupper(*id_first)-'A'+10;
+ c=toupper((eight_bits)*id_first)-'A'+10;
}
if (xisdigit(*(id_first+1))) c=16*c+*(++id_first)-'0';
else if (xisxdigit(*(id_first+1))) {
++id_first;
- c=16*c+toupper(*id_first)-'A'+10;
+ c=16*c+toupper((eight_bits)*id_first)-'A'+10;
}
break;
case '\\':c='\\';@+break;
@@ -1357,9 +1354,12 @@ extern sixteen_bits section_count; /* the current section number */
that are significant to \.{CTANGLE}: those
that delimit a definition, the \CEE/ part of a module, or a new module.
-@c
-void
-scan_section()
+@<Predecl...@>=
+static void scan_section(void);@/
+
+@ @c
+static void
+scan_section(void)
{
name_pointer p; /* section name for the current section */
text_pointer q; /* text for the current section */
@@ -1371,7 +1371,7 @@ scan_section()
next_control=0;
while (1) {
@<Skip ahead until |next_control| corresponds to \.{@@d}, \.{@@<},
- \.{@@\ } or the like@>;
+ \.{@@\ } or the like@>@;
if (next_control == definition) { /* \.{@@d} */
@<Scan a definition@>@;
continue;
@@ -1381,13 +1381,13 @@ scan_section()
}
if (next_control == section_name) { /* \.{@@<} or \.{@@(} */
p=cur_section_name;
- @<If section is not being defined, |continue| @>;
+ @<If section is not being defined, |continue| @>@;
break;
}
return; /* \.{@@\ } or \.{@@*} */
}
no_where=print_where=0;
- @<Scan the \CEE/ part of the current section@>;
+ @<Scan the \CEE/ part of the current section@>@;
}
@ At the top of this loop, if |next_control==section_name|, the
@@ -1404,7 +1404,7 @@ while (next_control<definition)
}
@ @<Scan a definition@>= {
- while ((next_control=get_next())=='\n'); /*allow newline before definition */
+ while ((next_control=get_next())=='\n'); /* allow newline before definition */
if (next_control!=identifier) {
err_print("! Definition flushed, must start with identifier");
@.Definition flushed...@>
@@ -1434,9 +1434,9 @@ if (next_control!='=' && next_control!=eq_eq)
continue;
@ @<Scan the \CEE/...@>=
-@<Insert the section number into |tok_mem|@>;
+@<Insert the section number into |tok_mem|@>@;
scan_repl(section_name); /* now |cur_text| points to the replacement text */
-@<Update the data structure so that the replacement text is accessible@>;
+@<Update the data structure so that the replacement text is accessible@>@;
@ @<Insert the section number...@>=
store_two_bytes((sixteen_bits)(0150000+section_count));
@@ -1446,7 +1446,7 @@ store_two_bytes((sixteen_bits)(0150000+section_count));
if (p==name_dir||p==0) { /* unnamed section, or bad section name */
(last_unnamed)->text_link=cur_text-text_info; last_unnamed=cur_text;
}
-else if (p->equiv==(char *)text_info) p->equiv=(char *)cur_text;
+else if (p->equiv==(void *)text_info) p->equiv=(void *)cur_text;
/* first section of this name */
else {
q=(text_pointer)p->equiv;
@@ -1458,11 +1458,11 @@ cur_text->text_link=section_flag;
/* mark this replacement text as a nonmacro */
@ @<Predec...@>=
-void phase_one();
+static void phase_one(void);@/
@ @c
-void
-phase_one() {
+static void
+phase_one(void) {
phase=1;
section_count=0;
reset_input();
@@ -1476,11 +1476,11 @@ phase_one() {
processing is straightforward.
@<Predecl...@>=
-void skip_limbo();
+static void skip_limbo(void);@/
@ @c
-void
-skip_limbo()
+static void
+skip_limbo(void)
{
char c;
while (1) {
@@ -1491,7 +1491,7 @@ skip_limbo()
c=*loc++;
if (ccode[(eight_bits)c]==new_section) break;
switch (ccode[(eight_bits)c]) {
- case translit_code: @<Read in transliteration of a character@>; break;
+ case translit_code: @<Read in transliteration of a character@>@; break;
case format_code: case '@@': break;
case control_text: if (c=='q' || c=='Q') {
while ((c=skip_ahead())=='@@');
@@ -1515,7 +1515,7 @@ skip_limbo()
err_print("! Improper hex number following @@l");
@.Improper hex number...@>
else {
- unsigned i;
+ unsigned int i;
char *beg;
sscanf(loc-3,"%x",&i);
while(xisspace(*loc)&&loc<limit) loc++;
@@ -1525,26 +1525,26 @@ skip_limbo()
err_print("! Replacement string in @@l too long");
@.Replacement string in @@l...@>
else{
- strncpy(translit[i-0200],beg,loc-beg);
+ strncpy(translit[i-0200],beg,(size_t)(loc-beg));
translit[i-0200][loc-beg]='\0';
}
}
-@ Because on some systems the difference between two pointers is a |long|
+@ Because on some systems the difference between two pointers is a |ptrdiff_t|
but not an |int|, we use \.{\%ld} to print these quantities.
@c
void
-print_stats() {
- printf("\nMemory usage statistics:\n");
+print_stats(void) {
+ puts("\nMemory usage statistics:");
printf("%ld names (out of %ld)\n",
- (long)(name_ptr-name_dir),(long)max_names);
+ (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf("%ld replacement texts (out of %ld)\n",
- (long)(text_ptr-text_info),(long)max_texts);
+ (ptrdiff_t)(text_ptr-text_info),(long)max_texts);
printf("%ld bytes (out of %ld)\n",
- (long)(byte_ptr-byte_mem),(long)max_bytes);
+ (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
printf("%ld tokens (out of %ld)\n",
- (long)(tok_ptr-tok_mem),(long)max_toks);
+ (ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks);
}
@** Index.
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
index ccb04efb43a..410f270491b 100644
--- a/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
+++ b/Build/source/texk/web2c/cwebdir/ctwill-mini.ch
@@ -14,7 +14,7 @@ Section 1.
@z
@x
-@d banner "This is CTWILL, Version 3.64"
+@d banner "This is CTWILL, Version 4.0"
@y
\bigskip
{\font\itt=cmitt10 \font\bit=cmbxti10
@@ -35,10 +35,10 @@ be even more ``off'' from {\itt cweave.w}. Care has been taken to give a
faithful overall rendering of {\itt CTWILL}'s code, though. \hfill
---Enjoy!\bigskip}
-@d banner "This is CTWILL, Version 3.64"
+@d banner "This is CTWILL, Version 4.0"
@z
-Section 3.
+Section 2.
@x
@ Here is a sort of user manual for \.{CTWILL}---which is exactly like
@@ -55,7 +55,7 @@ give it the necessary hints in other places via your change file.
@-x@>
@z
-Section 4.
+Section 3.
@x
The current meaning of every identifier is initially `\.{\\uninitialized}'.
@@ -73,30 +73,23 @@ must have fewer than 50 characters.
@ If the \TeX\ part starts
@z
-Section 5.
+Section 4.
@x
@d max_tex_chars 50 /* limit on the \TeX\ part of a meaning */
@y
@z
-Section 7.
-
-@x
-you have to change them also in the file |"common.w"|.
-@y
-you have to change them also in file |"common.w"|.
-@z
-
-Section 8.
+Section 5.
@x
-@ The next few sections contain stuff from the file |"common.w"| that must
+@ \.{CWEAVE} has a fairly straightforward outline. It operates in
@y
-@r @ The next few sections contain stuff from the file |"common.w"| that must
+@* Introduction (continued). \.{CWEAVE} has a fairly straightforward outline.
+It operates in
@z
-Section 9.
+Section 7.
@x
internationalization.
@@ -107,7 +100,7 @@ internationalization.
@-S@>
@z
-Section 11.
+Section 9.
@x
@ Code related to input routines:
@@ -116,7 +109,7 @@ Section 11.
@-c@>
@z
-Section 12.
+Section 10.
@x
@ Code related to identifier and section name storage:
@@ -125,7 +118,7 @@ Section 12.
@-c@>
@z
-Section 13.
+Section 12.
@x
@ Code related to error handling:
@@ -134,17 +127,25 @@ Section 13.
@-s@>
@z
-Section 15.
+Section 16.
@x
@ Code related to section numbers:
@y
-@r @ Code related to section numbers:
+@ Code related to section numbers:
@z
Section 17.
@x
+extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */
+@y
+extern const char *use_language; /* prefix to \.{ctwimac.tex} in \TEX/ output */
+@z
+
+Section 18.
+
+@x
@ Code relating to output:
@y
@ Code relating to output:
@@ -153,7 +154,7 @@ Section 17.
@-c@>
@z
-Section 19.
+Section 23.
@x
@* Data structures exclusive to {\tt CWEAVE}.
@@ -162,7 +163,7 @@ Section 19.
@-a@>
@z
-Section 21.
+Section 25.
@x
@ The other large memory area in \.{CWEAVE} keeps the cross-reference data.
@@ -172,7 +173,7 @@ Section 21.
@-x@>
@z
-Section 23.
+Section 27.
@x
@ \.{CTWILL} also has special data structures to keep track of current
@@ -180,7 +181,7 @@ Section 23.
@r @ \.{CTWILL} also has special data structures to keep track of current
@z
-Section 28.
+Section 32.
@x
@ The |new_meaning| routine changes the current ``permanent meaning''
@@ -188,7 +189,7 @@ Section 28.
@r @ The |new_meaning| routine changes the current ``permanent meaning''
@z
-Section 31.
+Section 35.
@x
@ A new cross-reference for an identifier is formed by calling |new_xref|,
@@ -198,25 +199,24 @@ Section 31.
@-c@>
@z
-Section 39.
+Section 44.
@x
-id_lookup("do",NULL,do_like);
+@ We have to get \CEE/'s
@y
-@ @<Store all...@>=
-id_lookup("do",NULL,do_like);
+@r @ We have to get \CEE/'s
@z
-Section 40.
+Section 45.
@x
-id_lookup("undef",NULL,if_like);
+id_lookup("goto",NULL,case_like);
@y
@ @<Store all...@>=
-id_lookup("undef",NULL,if_like);
+id_lookup("goto",NULL,case_like);
@z
-Section 44.
+Section 49.
@x
@ Control codes are converted to \.{CWEAVE}'s internal
@@ -224,7 +224,7 @@ Section 44.
@r @ Control codes are converted to \.{CWEAVE}'s internal
@z
-Section 50.
+Section 55.
@x
\yskip\hang |xref_roman|, |xref_wildcard|, |xref_typewriter|, |TeX_string|,
@@ -249,7 +249,7 @@ The value of |cur_section_char| will be |'('| if the section name was
preceded by \.{@@(} instead of \.{@@<}.\par}
@z
-Section 52.
+Section 56.
@x
@ As one might expect, |get_next| consists mostly of a big switch
@@ -258,7 +258,7 @@ Section 52.
@-c@>
@z
-Section 59.
+Section 63.
@x
@ The following code assigns values to the combinations \.{++},
@@ -267,7 +267,7 @@ Section 59.
@-c@>
@z
-Section 62.
+Section 66.
@x
@<Get a string@>= {
@@ -275,7 +275,7 @@ Section 62.
@<Get a string@>= {@+
@z
-Section 66.
+Section 70.
@x
@ @<Put section name...@>=
@@ -283,7 +283,7 @@ Section 66.
@r @ @<Put section name...@>=
@z
-Section 80.
+Section 84.
@x
with |next_control!='|'| and ends with |next_control>=format_code|. Thus, it
@@ -292,7 +292,7 @@ with |next_control| |!='|'| and ends with |next_control>=format_code|.
Thus, it
@z
-Section 88.
+Section 91.
@x
@ Finally, when the \TEX/ and definition parts have been treated, we have
@@ -302,7 +302,7 @@ Section 88.
\hfil\break|next_control>=begin_C|.
@z
-Section 94.
+Section 97.
@x
@ The |flush_buffer| routine empties the buffer up to a given breakpoint,
@@ -311,7 +311,7 @@ Section 94.
@-c@>
@z
-Section 95.
+Section 99.
@x
@ When we are copying \TEX/ source material, we retain line breaks
@@ -319,7 +319,7 @@ Section 95.
@r @ When we are copying \TEX/ source material, we retain line breaks
@z
-Section 97.
+Section 101.
@x
@ When we wish to append one character |c| to the output buffer, we write
@@ -328,7 +328,7 @@ Section 97.
@-c@>
@z
-Section 101.
+Section 105.
@x
@ We get to this section only in the unusual case that the entire output line
@@ -336,7 +336,13 @@ Section 101.
@r @ We get to this section only in the unusual case that the entire output line
@z
-Section 105.
+Section 111.
+
+@x
+@ The |copy_TeX| routine processes the \TEX/ code at the beginning of a
+@y
+@r @ The |copy_TeX| routine processes the \TEX/ code at the beginning of a
+@z
@x
static eight_bits
@@ -348,7 +354,7 @@ copy_TeX(void)
{@+
@z
-Section 106.
+Section 112.
@x
@ The |copy_comment| function issues a warning if more braces are opened than
@@ -357,15 +363,17 @@ Section 106.
@-t@>
@z
-Section 109.
-
@x
-@ @<Copy special things when |c=='@@'...@>=
+int bal@t\2\2@>) /* brace balance */
+{
+ char c; /* current character being copied */
@y
-@r @ @<Copy special things when |c=='@@'...@>=
+int bal@t\2\2@>) /* brace balance */
+{@+
+ char c; /* current character being copied */
@z
-Section 112.
+Section 117.
@x
@ Here is a list of the category codes that scraps can have.
@@ -373,7 +381,7 @@ Section 112.
@r @ Here is a list of the category codes that scraps can have.
@z
-Section 115.
+Section 121.
@x
@ The token lists for translated \TEX/ output contain some special control
@@ -382,7 +390,7 @@ Section 115.
@-n@>
@z
-Section 116.
+Section 122.
@x
\yskip\noindent All of these tokens are removed from the \TEX/ output that
@@ -391,7 +399,7 @@ Section 116.
@-n@>
@z
-Section 117.
+Section 123.
@x
@ The raw input is converted into scraps according to the following table,
@@ -409,7 +417,7 @@ The raw input is converted into scraps according to the following table,
\yskip\halign{\quad#\hfil&\quad\hbox to11cm{#\hfil}&\quad\hfil#\hfil\cr
@z
-Section 118.
+Section 124.
@x
\.>&|prerangle|: \.{\\rangle}&yes\cr
@@ -419,10 +427,9 @@ Section 118.
@ Cont.
\yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr
-%\vskip\halign{\quad#\hfil&\quad\hbox to11cm{#\hfil}&\quad\hfil#\hfil\cr
@z
-Section 119.
+Section 125.
@x
\.{continue}&|case_like|: \stars&maybe\cr
@@ -432,10 +439,9 @@ Section 119.
@r @ Cont.
\yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr
-%\vskip\halign{\quad#\hfil&\quad\hbox to11cm{#\hfil}&\quad\hfil#\hfil\cr
@z
-Section 120.
+Section 126.
@x
\.{long}&|raw_int|: \stars&maybe\cr
@@ -445,10 +451,9 @@ Section 120.
@ Cont.
\yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr
-%\vskip\halign{\quad#\hfil&\quad\hbox to11cm{#\hfil}&\quad\hfil#\hfil\cr
@z
-Section 121.
+Section 127.
@x
\.{try}&|else_like|: \stars&maybe\cr
@@ -458,10 +463,9 @@ Section 121.
@r @ Cont.
\yskip\halign{\quad#\hfil&\quad#\hfil&\quad\hfil#\hfil\cr
-%\vskip\halign{\quad#\hfil&\quad\hbox to11cm{#\hfil}&\quad\hfil#\hfil\cr
@z
-Sections 122--129.
+Sections 128--135.
@x l.7 line numbers refer to 'prod.w'
@ Here is a table of all the productions. Each production that
@@ -696,7 +700,7 @@ TeX reports 'extra \fi' when running on twilled 'ctwill.w'.
@r @-any_other@>@-z@>@ \begingroup\dag{\bf Notes}
@z
-Section 130.
+Section 136.
@x
@* Implementing the productions.
@@ -711,7 +715,7 @@ the category codes |pp->cat,@,@,(pp+1)->cat|$,\,\,\ldots\,$
the category codes |pp->cat|, |(pp+1)->cat|, $\,\ldots\,$
@z
-Section 132.
+Section 138.
@x
@ @<Set init...@>=
@@ -719,7 +723,7 @@ Section 132.
@r @ @<Set init...@>=
@z
-Section 133.
+Section 139.
@x
@ Token lists in |@!tok_mem| are composed of the following kinds of
@@ -728,27 +732,7 @@ Section 133.
@-p@>
@z
-Section 134.
-
-@x
-#ifdef DEAD_CODE /* not used in |main| */
-@y
-@ Debugging routine, use at your own risk.
-@-DEAD_CODE@>
-
-@c
-#ifdef DEAD_CODE /* not used in |main| */
-@z
-
-Section 135.
-
-@x
-@ @<Print token |r|...@>=
-@y
-@r @ @<Print token |r|...@>=
-@z
-
-Section 136.
+Section 142.
@x
@ The production rules listed above are embedded directly into \.{CWEAVE},
@@ -763,7 +747,7 @@ Section 136.
@-pp@>
@z
-Section 137.
+Section 143.
@x
The code below is an exact translation of the production rules into
@@ -772,7 +756,7 @@ The code below is an exact translation of the production rules into
@-a@>
@z
-Section 139.
+Section 146.
@x
@ Let us consider the big switch for productions now, before looking
@@ -780,57 +764,57 @@ Section 139.
@r @ Let us consider the big switch for productions now, before looking
@z
-Section 140.
+Section 147.
@x
switch (pp->cat) {
- case exp: @<Cases for |exp|@>; @+break;
- case lpar: @<Cases for |lpar|@>; @+break;
- case unop: @<Cases for |unop|@>; @+break;
- case ubinop: @<Cases for |ubinop|@>; @+break;
- case binop: @<Cases for |binop|@>; @+break;
- case cast: @<Cases for |cast|@>; @+break;
- case sizeof_like: @<Cases for |sizeof_like|@>; @+break;
- case int_like: @<Cases for |int_like|@>; @+break;
- case public_like: @<Cases for |public_like|@>; @+break;
- case colcol: @<Cases for |colcol|@>; @+break;
- case decl_head: @<Cases for |decl_head|@>; @+break;
- case decl: @<Cases for |decl|@>; @+break;
- case base: @<Cases for |base|@>; @+break;
- case struct_like: @<Cases for |struct_like|@>; @+break;
- case struct_head: @<Cases for |struct_head|@>; @+break;
- case fn_decl: @<Cases for |fn_decl|@>; @+break;
- case function: @<Cases for |function|@>; @+break;
- case lbrace: @<Cases for |lbrace|@>; @+break;
- case if_like: @<Cases for |if_like|@>; @+break;
- case else_like: @<Cases for |else_like|@>; @+break;
- case else_head: @<Cases for |else_head|@>; @+break;
- case if_clause: @<Cases for |if_clause|@>; @+break;
- case if_head: @<Cases for |if_head|@>; @+break;
- case do_like: @<Cases for |do_like|@>; @+break;
- case case_like: @<Cases for |case_like|@>; @+break;
- case catch_like: @<Cases for |catch_like|@>; @+break;
- case tag: @<Cases for |tag|@>; @+break;
- case stmt: @<Cases for |stmt|@>; @+break;
- case semi: @<Cases for |semi|@>; @+break;
- case lproc: @<Cases for |lproc|@>; @+break;
- case section_scrap: @<Cases for |section_scrap|@>; @+break;
- case insert: @<Cases for |insert|@>; @+break;
- case prelangle: @<Cases for |prelangle|@>; @+break;
- case prerangle: @<Cases for |prerangle|@>; @+break;
- case langle: @<Cases for |langle|@>; @+break;
- case template_like: @<Cases for |template_like|@>; @+break;
- case new_like: @<Cases for |new_like|@>; @+break;
- case new_exp: @<Cases for |new_exp|@>; @+break;
- case ftemplate: @<Cases for |ftemplate|@>; @+break;
- case for_like: @<Cases for |for_like|@>; @+break;
- case raw_ubin: @<Cases for |raw_ubin|@>; @+break;
- case const_like: @<Cases for |const_like|@>; @+break;
- case raw_int: @<Cases for |raw_int|@>; @+break;
- case operator_like: @<Cases for |operator_like|@>; @+break;
- case typedef_like: @<Cases for |typedef_like|@>; @+break;
- case delete_like: @<Cases for |delete_like|@>; @+break;
- case question: @<Cases for |question|@>; @+break;
+ case exp: @<Cases for |exp|@>@; @+break;
+ case lpar: @<Cases for |lpar|@>@; @+break;
+ case unop: @<Cases for |unop|@>@; @+break;
+ case ubinop: @<Cases for |ubinop|@>@; @+break;
+ case binop: @<Cases for |binop|@>@; @+break;
+ case cast: @<Cases for |cast|@>@; @+break;
+ case sizeof_like: @<Cases for |sizeof_like|@>@; @+break;
+ case int_like: @<Cases for |int_like|@>@; @+break;
+ case public_like: @<Cases for |public_like|@>@; @+break;
+ case colcol: @<Cases for |colcol|@>@; @+break;
+ case decl_head: @<Cases for |decl_head|@>@; @+break;
+ case decl: @<Cases for |decl|@>@; @+break;
+ case base: @<Cases for |base|@>@; @+break;
+ case struct_like: @<Cases for |struct_like|@>@; @+break;
+ case struct_head: @<Cases for |struct_head|@>@; @+break;
+ case fn_decl: @<Cases for |fn_decl|@>@; @+break;
+ case function: @<Cases for |function|@>@; @+break;
+ case lbrace: @<Cases for |lbrace|@>@; @+break;
+ case if_like: @<Cases for |if_like|@>@; @+break;
+ case else_like: @<Cases for |else_like|@>@; @+break;
+ case else_head: @<Cases for |else_head|@>@; @+break;
+ case if_clause: @<Cases for |if_clause|@>@; @+break;
+ case if_head: @<Cases for |if_head|@>@; @+break;
+ case do_like: @<Cases for |do_like|@>@; @+break;
+ case case_like: @<Cases for |case_like|@>@; @+break;
+ case catch_like: @<Cases for |catch_like|@>@; @+break;
+ case tag: @<Cases for |tag|@>@; @+break;
+ case stmt: @<Cases for |stmt|@>@; @+break;
+ case semi: @<Cases for |semi|@>@; @+break;
+ case lproc: @<Cases for |lproc|@>@; @+break;
+ case section_scrap: @<Cases for |section_scrap|@>@; @+break;
+ case insert: @<Cases for |insert|@>@; @+break;
+ case prelangle: @<Cases for |prelangle|@>@; @+break;
+ case prerangle: @<Cases for |prerangle|@>@; @+break;
+ case langle: @<Cases for |langle|@>@; @+break;
+ case template_like: @<Cases for |template_like|@>@; @+break;
+ case new_like: @<Cases for |new_like|@>@; @+break;
+ case new_exp: @<Cases for |new_exp|@>@; @+break;
+ case ftemplate: @<Cases for |ftemplate|@>@; @+break;
+ case for_like: @<Cases for |for_like|@>@; @+break;
+ case raw_ubin: @<Cases for |raw_ubin|@>@; @+break;
+ case const_like: @<Cases for |const_like|@>@; @+break;
+ case raw_int: @<Cases for |raw_int|@>@; @+break;
+ case operator_like: @<Cases for |operator_like|@>@; @+break;
+ case typedef_like: @<Cases for |typedef_like|@>@; @+break;
+ case delete_like: @<Cases for |delete_like|@>@; @+break;
+ case question: @<Cases for |question|@>@; @+break;
}
pp++; /* if no match was found, we move to the right */
}
@@ -842,56 +826,56 @@ Section 140.
}
@ @<Cases for |pp->cat|@>=
- case exp: @<Cases for |exp|@>; @+break;
- case lpar: @<Cases for |lpar|@>; @+break;
- case unop: @<Cases for |unop|@>; @+break;
- case ubinop: @<Cases for |ubinop|@>; @+break;
- case binop: @<Cases for |binop|@>; @+break;
- case cast: @<Cases for |cast|@>; @+break;
- case sizeof_like: @<Cases for |sizeof_like|@>; @+break;
- case int_like: @<Cases for |int_like|@>; @+break;
- case public_like: @<Cases for |public_like|@>; @+break;
- case colcol: @<Cases for |colcol|@>; @+break;
- case decl_head: @<Cases for |decl_head|@>; @+break;
- case decl: @<Cases for |decl|@>; @+break;
- case base: @<Cases for |base|@>; @+break;
- case struct_like: @<Cases for |struct_like|@>; @+break;
- case struct_head: @<Cases for |struct_head|@>; @+break;
- case fn_decl: @<Cases for |fn_decl|@>; @+break;
- case function: @<Cases for |function|@>; @+break;
- case lbrace: @<Cases for |lbrace|@>; @+break;
- case if_like: @<Cases for |if_like|@>; @+break;
- case else_like: @<Cases for |else_like|@>; @+break;
- case else_head: @<Cases for |else_head|@>; @+break;
- case if_clause: @<Cases for |if_clause|@>; @+break;
- case if_head: @<Cases for |if_head|@>; @+break;
- case do_like: @<Cases for |do_like|@>; @+break;
- case case_like: @<Cases for |case_like|@>; @+break;
- case catch_like: @<Cases for |catch_like|@>; @+break;
- case tag: @<Cases for |tag|@>; @+break;
- case stmt: @<Cases for |stmt|@>; @+break;
- case semi: @<Cases for |semi|@>; @+break;
- case lproc: @<Cases for |lproc|@>; @+break;
- case section_scrap: @<Cases for |section_scrap|@>; @+break;
- case insert: @<Cases for |insert|@>; @+break;
- case prelangle: @<Cases for |prelangle|@>; @+break;
- case prerangle: @<Cases for |prerangle|@>; @+break;
- case langle: @<Cases for |langle|@>; @+break;
- case template_like: @<Cases for |template_like|@>; @+break;
- case new_like: @<Cases for |new_like|@>; @+break;
- case new_exp: @<Cases for |new_exp|@>; @+break;
- case ftemplate: @<Cases for |ftemplate|@>; @+break;
- case for_like: @<Cases for |for_like|@>; @+break;
- case raw_ubin: @<Cases for |raw_ubin|@>; @+break;
- case const_like: @<Cases for |const_like|@>; @+break;
- case raw_int: @<Cases for |raw_int|@>; @+break;
- case operator_like: @<Cases for |operator_like|@>; @+break;
- case typedef_like: @<Cases for |typedef_like|@>; @+break;
- case delete_like: @<Cases for |delete_like|@>; @+break;
- case question: @<Cases for |question|@>; @+break;
-@z
-
-Section 141.
+ case exp: @<Cases for |exp|@>@; @+break;
+ case lpar: @<Cases for |lpar|@>@; @+break;
+ case unop: @<Cases for |unop|@>@; @+break;
+ case ubinop: @<Cases for |ubinop|@>@; @+break;
+ case binop: @<Cases for |binop|@>@; @+break;
+ case cast: @<Cases for |cast|@>@; @+break;
+ case sizeof_like: @<Cases for |sizeof_like|@>@; @+break;
+ case int_like: @<Cases for |int_like|@>@; @+break;
+ case public_like: @<Cases for |public_like|@>@; @+break;
+ case colcol: @<Cases for |colcol|@>@; @+break;
+ case decl_head: @<Cases for |decl_head|@>@; @+break;
+ case decl: @<Cases for |decl|@>@; @+break;
+ case base: @<Cases for |base|@>@; @+break;
+ case struct_like: @<Cases for |struct_like|@>@; @+break;
+ case struct_head: @<Cases for |struct_head|@>@; @+break;
+ case fn_decl: @<Cases for |fn_decl|@>@; @+break;
+ case function: @<Cases for |function|@>@; @+break;
+ case lbrace: @<Cases for |lbrace|@>@; @+break;
+ case if_like: @<Cases for |if_like|@>@; @+break;
+ case else_like: @<Cases for |else_like|@>@; @+break;
+ case else_head: @<Cases for |else_head|@>@; @+break;
+ case if_clause: @<Cases for |if_clause|@>@; @+break;
+ case if_head: @<Cases for |if_head|@>@; @+break;
+ case do_like: @<Cases for |do_like|@>@; @+break;
+ case case_like: @<Cases for |case_like|@>@; @+break;
+ case catch_like: @<Cases for |catch_like|@>@; @+break;
+ case tag: @<Cases for |tag|@>@; @+break;
+ case stmt: @<Cases for |stmt|@>@; @+break;
+ case semi: @<Cases for |semi|@>@; @+break;
+ case lproc: @<Cases for |lproc|@>@; @+break;
+ case section_scrap: @<Cases for |section_scrap|@>@; @+break;
+ case insert: @<Cases for |insert|@>@; @+break;
+ case prelangle: @<Cases for |prelangle|@>@; @+break;
+ case prerangle: @<Cases for |prerangle|@>@; @+break;
+ case langle: @<Cases for |langle|@>@; @+break;
+ case template_like: @<Cases for |template_like|@>@; @+break;
+ case new_like: @<Cases for |new_like|@>@; @+break;
+ case new_exp: @<Cases for |new_exp|@>@; @+break;
+ case ftemplate: @<Cases for |ftemplate|@>@; @+break;
+ case for_like: @<Cases for |for_like|@>@; @+break;
+ case raw_ubin: @<Cases for |raw_ubin|@>@; @+break;
+ case const_like: @<Cases for |const_like|@>@; @+break;
+ case raw_int: @<Cases for |raw_int|@>@; @+break;
+ case operator_like: @<Cases for |operator_like|@>@; @+break;
+ case typedef_like: @<Cases for |typedef_like|@>@; @+break;
+ case delete_like: @<Cases for |delete_like|@>@; @+break;
+ case question: @<Cases for |question|@>@; @+break;
+@z
+
+Section 148.
@x
of identifiers in case labels.
@@ -902,7 +886,7 @@ of identifiers in case labels.
If the first identifier is the keyword `\&{operator}', we give up;
@z
-Section 142.
+Section 150.
@x
@ The scraps currently being parsed must be inspected for any
@@ -916,15 +900,15 @@ Section 142.
\hfil\break|make_reserved|, hence |tok_loc| has been set.
@z
-Section 147.
+Section 154.
@x
-{ token_pointer j;
+@ \.{CTWILL} needs the following procedure, which appends tokens of a
@y
-{@+ token_pointer j;
+@r @ \.{CTWILL} needs the following procedure, which appends tokens of a
@z
-Section 148.
+Section 155.
@x
@ The trickiest part of \.{CTWILL} is the procedure |make_ministring(l)|,
@@ -941,7 +925,7 @@ Section 148.
{@+
@z
-Section 152.
+Section 159.
@x
@ @<Cases for |lpar|@>=
@@ -949,15 +933,15 @@ Section 152.
@r @ @<Cases for |lpar|@>=
@z
-Section 166.
+Section 168.
@x
-@ Outdent after parameter declarations with option \.{-i}.
+@ @<Cases for |decl_head|@>=
@y
-@r @ Outdent after parameter declarations with option \.{-i}.
+@r @ @<Cases for |decl_head|@>=
@z
-Section 199.
+Section 208.
@x
@ Here's the |squash| procedure, which
@@ -965,7 +949,7 @@ Section 199.
@r @ Here's the |squash| procedure, which
@z
-Section 200.
+Section 220.
@x
@ The following macro is used to append a scrap whose tokens have just
@@ -975,15 +959,23 @@ Section 200.
@-c@>
@z
-Section 221.
+Section 229.
+
+@x
+@ The |outer_parse| routine is to |C_parse| as |outer_xref|
+@y
+@r @ The |outer_parse| routine is to |C_parse| as |outer_xref|
+@z
+
+Section 235.
@x
-@ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */
+@ To insert token-list |p| into the output, the |push_level| subroutine
@y
-@r @ @d cur_end cur_state.end_field /* current ending location in |tok_mem| */
+@r @ To insert token-list |p| into the output, the |push_level| subroutine
@z
-Section 224.
+Section 237.
@x
called when |stack_ptr==1|.
@@ -991,7 +983,7 @@ called when |stack_ptr==1|.
called when |stack_ptr| |==1|.
@z
-Section 227.
+Section 241.
@x
text_pointer save_text_ptr;
@@ -1002,15 +994,7 @@ Section 227.
sixteen_bits save_next_control; /* values to be restored */
@z
-Section 230.
-
-@x
-@ An identifier of length one does not have to be enclosed in braces, and it
-@y
-@r @ An identifier of length one does not have to be enclosed in braces, and it
-@z
-
-Section 231.
+Section 244.
@x
else @<Look ahead for strongest line break, |goto reswitch|@>
@@ -1018,7 +1002,7 @@ else @<Look ahead for strongest line break, |goto reswitch|@>
else {@<Look ahead for strongest line break, |goto reswitch|@>}
@z
-Section 232.
+Section 245.
@x
@<Look ahead for st...@>= {
@@ -1031,7 +1015,7 @@ Section 232.
@y
@z
-Section 233.
+Section 246.
@x
@ @<Output saved...@>=
@@ -1039,7 +1023,15 @@ Section 233.
@r @ @<Output saved...@>=
@z
-Section 243.
+Section 250.
+
+@x
+@ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters,
+@y
+@r @ The \CEE/ text enclosed in \pb\ should not contain `\.{\v}' characters,
+@z
+
+Section 256.
@x
@ The output file will contain the control sequence \.{\\Y} between non-null
@@ -1047,7 +1039,7 @@ Section 243.
@r @ The output file will contain the control sequence \.{\\Y} between non-null
@z
-Section 246.
+Section 259.
@x
@<Translate the \T...@>= do {
@@ -1055,7 +1047,7 @@ Section 246.
@<Translate the \T...@>= do {@+
@z
-Section 254.
+Section 267.
@x
|next_control>=begin_C|. We will make the global variable |this_section|
@@ -1063,7 +1055,7 @@ Section 254.
\hfil\break|next_control>=begin_C|. We will make the global variable |this_section|
@z
-Section 255.
+Section 268.
@x
@ @<Translate the \CEE/...@>=
@@ -1071,7 +1063,7 @@ Section 255.
@r @ @<Translate the \CEE/...@>=
@z
-Section 259.
+Section 272.
@x
@ The |footnote| procedure gives cross-reference information about
@@ -1079,15 +1071,7 @@ Section 259.
@r @ The |footnote| procedure gives cross-reference information about
@z
-Section 263.
-
-@x
-@ @<Flag the usage of this identifier, for the mini-index@>=
-@y
-@<Flag the usage of this identifier, for the mini-index@>=
-@z
-
-Section 264.
+Section 277.
@x
@ @<Output information about usage of id's defined in other sections@>=
@@ -1095,7 +1079,7 @@ Section 264.
@r @ @<Output information about usage of id's defined in other sections@>=
@z
-Section 270.
+Section 283.
@x
the index section itself---NOT!
@@ -1106,7 +1090,7 @@ sixteen_bits k_section; /* runs through the sections */
the index section itself---NOT!
@z
-Section 271.
+Section 284.
@x
@ A left-to-right radix sorting method is used, since this makes it easy to
@@ -1122,7 +1106,7 @@ name_pointer blink[max_names]; /* links in the buckets */
sixteen_bits k_section; /* runs through the sections */
@z
-Section 273.
+Section 286.
@x
@ During the sorting phase we shall use the |cat| and |trans| arrays from
@@ -1132,7 +1116,7 @@ Section 273.
@-k@>
@z
-Section 276.
+Section 289.
@x
$|collate|[0]<|collate|[1]<\cdots<|collate|[100]$.
@@ -1140,7 +1124,7 @@ $|collate|[0]<|collate|[1]<\cdots<|collate|[100]$.
|collate[0]| $<$|collate[1]|$<\cdots<$|collate[100]|.
@z
-Section 283.
+Section 296.
@x
else {char *j;
@@ -1148,15 +1132,17 @@ Section 283.
else {@+char *j;
@z
-Section 290.
+Section 303.
@x
-@ Because on some systems the difference between two pointers is a |long|
+@ Because on some systems the difference between two pointers is a |ptrdiff_t|
+rather than an |int|, we use \.{\%ld} to print these quantities.
@y
-@r @ Because on some systems the difference between two pointers is a |long|
+@r @ Because on some systems the difference between two pointers is a
+|ptrdiff_t| rather than an |int|, we use \.{\%ld} to print these quantities.
@z
-Section 291.
+Section 304.
@x
\bigskip
@@ -1167,24 +1153,7 @@ care for keeping the original section numbering intact.}
@y
@z
-Section 293.
-
-@x
-@* Function declarations. Here are declarations---conforming to
-@y
-@* Function declarations. Here are declarations---conforming to
-@-DEAD_CODE@>
-@z
-
-Section 294.
-
-@x
-extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */
-@y
-extern const char *use_language; /* prefix to \.{ctwimac.tex} in \TEX/ output */
-@z
-
-Section 300.
+Section 312.
@x
@** Index.
diff --git a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch
index 38472ec417e..4a20bd73f49 100644
--- a/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/ctwill-w2c.ch
@@ -1,19 +1,20 @@
-@q Changes for CWEB in TeX Live from numerous contributors. @>
-@q This file is in the Public Domain. @>
+@q Changes for CWEB in TeX Live from numerous contributors. @>
+@q This file is in the Public Domain. @>
-@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
-@q were merged with the set of change files of the CWEBbin project; @>
-@q see https://github.com/ascherer/cwebbin for the original parts. @>
+@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
+@q were merged with the set of change files of the CWEBbin project; @>
+@q see https://github.com/ascherer/cwebbin for the original parts. @>
-@q This stripped change file {comm,ctang,cweav,ctwill}-w2c.ch has been @>
-@q created from the set of change files {comm,ctang,cweav}-patch.ch, @>
-@q {comm,ctang,cweav}-ansi.ch, {comm,ctang,cweav}-extensions.ch, @>
-@q {comm,ctang,cweav}-output.ch, {comm,ctang,cweav}-i18n.ch, and @>
-@q cweav-twill.ch for CTWILL, and {comm,ctang,cweav,ctwill}-texlive.ch @>
-@q with the 'tie' processor and is used as a monolithic changefile for @>
-@q {common,ctangle,cweave}.w in TeX Live. @>
+@q This stripped change file {comm,ctang,cweav,ctwill,cwebman}-w2c.ch @>
+@q has been created from the elaborate set of change files @>
+@q {comm,ctang,cweav,cwebman}-patch.ch, @>
+@q {comm,cweav,cwebman}-extensions.ch, {comm,ctang,cweav}-output.ch, @>
+@q {comm,ctang,cweav}-i18n.ch, and cweav-twill.ch for CTWILL, and @>
+@q {comm,ctang,cweav,ctwill,cwebman}-texlive.ch with the 'tie' processor @>
+@q and is used as a monolithic changefile for {common,ctangle,cweave}.w @>
+@q and cwebman.tex in TeX Live. @>
-@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
+@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
@x
% This file is part of CWEB.
@@ -26,13 +27,6 @@
@z
@x
-% (essentially the same as version 3.6, which added
-% recently introduced features of standard C++ to version 3.4)
-% (In November 2016 I made minor adjustments but changed no code -- DEK)
-@y
-@z
-
-@x
% Here is TeX material that gets inserted after \input cwebmac
@y
% Here is TeX material that gets inserted after \input ctwimac
@@ -40,9 +34,9 @@
@z
@x
-\def\title{CWEAVE (Version 3.64)}
+\def\title{CWEAVE (Version 4.0)}
@y
-\def\title{CTWILL (Version 3.64 [\TeX~Live])}
+\def\title{CTWILL (Version 4.0 [\TeX~Live])}
@z
@x
@@ -52,9 +46,9 @@
@z
@x
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
@y
- \centerline{(Version 3.64 [\TeX~Live])}
+ \centerline{(Version 4.0 [\TeX~Live])}
@z
@x
@@ -66,13 +60,7 @@
@x
}
@y
-}}
-\datecontentspage
-@z
-
-@x
-@s not_eq normal @q unreserve a C++ keyword @>
-@y
+}}\datecontentspage
@z
@x
@@ -87,7 +75,7 @@ Crusius, and others who have contributed improvements.
The ``banner line'' defined here should be changed whenever \.{CWEAVE}
is modified.
-@d banner "This is CWEAVE (Version 3.64)\n"
+@d banner "This is CWEAVE (Version 4.0)"
@y
This is the \.{CTWILL} program by D. E. Knuth, based
on \.{CWEAVE} by Silvio Levy and D.~E. Knuth. It is also based on
@@ -106,30 +94,14 @@ reprinted in {\sl Digital Typography\/} (1999), 225--245.
The ``banner line'' defined here should be changed whenever \.{CTWILL} is
modified. The version number parallels the corresponding version of \.{CWEAVE}.
-@d banner "This is CTWILL, Version 3.64"
+@d banner "This is CTWILL, Version 4.0"
/* will be extended by the \TeX~Live |versionstring| */
@z
@x
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
+@<Predeclaration of procedures@>
@y
-@ For string handling we include the {\mc ANSI C} system header file instead
-of predeclaring the standard system functions |@!strlen|, |@!strcmp|,
-|@!strcpy|, |@!strncmp|, and |@!strncpy|.
-@^system dependencies@>
-
-@<Include files@>=
-#include <string.h>
+@<Predeclaration of procedures@>
@ Here is a sort of user manual for \.{CTWILL}---which is exactly like
\.{CWEAVE} except that it produces much better documentation, for which you
@@ -293,82 +265,18 @@ outbursts of new code.)
@z
@x
-int main (ac, av)
-int ac; /* argument count */
-char **av; /* argument values */
-@y
-int main (@t\1\1@>
-int ac, /* argument count */
-char **av@t\2\2@>) /* argument values */
-@z
-
-@x
program=cweave;
@y
program=ctwill;
@z
@x
- make_xrefs=force_lines=make_pb=1; /* controlled by command-line options */
- common_init();
- @<Set initial values@>;
-@y
- @<Set initial values@>;
- common_init();
- @<Start \TEX/ output@>;
-@z
-
-@x
- if (show_banner) printf(banner); /* print a ``banner line'' */
+ if (show_banner) puts(banner); /* print a ``banner line'' */
@y
if (show_banner) cb_show_banner(); /* print a ``banner line'' */
@z
@x
-@d max_bytes 90000 /* the number of bytes in identifiers,
-@y
-@d max_bytes 1000000 /* the number of bytes in identifiers,
-@z
-
-@x
-@d max_names 4000 /* number of identifiers, strings, section names;
-@y
-@d max_names 10239 /* number of identifiers, strings, section names;
-@z
-
-@x
-@d max_sections 2000 /* greater than the total number of sections */
-@d hash_size 353 /* should be prime */
-@d buf_size 100 /* maximum length of input line, plus one */
-@y
-@d max_sections 10239 /* greater than the total number of sections */
-@d hash_size 8501 /* should be prime */
-@d buf_size 1000 /* maximum length of input line, plus one */
-@z
-
-@x
-@d max_refs 20000 /* number of cross-references; must be less than 65536 */
-@d max_toks 20000 /* number of symbols in \CEE/ texts being parsed;
-@y
-@d max_refs 65535 /* number of cross-references; must be less than 65536 */
-@d max_toks 65535 /* number of symbols in \CEE/ texts being parsed;
-@z
-
-@x
-@d max_texts 4000 /* number of phrases in \CEE/ texts being parsed;
-@y
-@d max_texts 10239 /* number of phrases in \CEE/ texts being parsed;
-@z
-
-@x
-@d max_scraps 2000 /* number of tokens in \CEE/ texts being parsed */
-@d stack_size 400 /* number of simultaneous output levels */
-@y
-@d max_scraps 10000 /* number of tokens in \CEE/ texts being parsed */
-@d stack_size 2000 /* number of simultaneous output levels */
-@z
-
-@x
@i common.h
@y
@i comm-w2c.h
@@ -458,7 +366,7 @@ if (title_code_ptr==title_code) { /* no \.{\\def\\title} found in limbo */
char *saveloc=loc,*savelimit=limit;
loc=limit+1; limit=loc;
*limit++='{';
- strncpy(limit,tex_file_name,strlen(tex_file_name)-4);
+ memcpy(limit,tex_file_name,strlen(tex_file_name)-4);
limit+=strlen(tex_file_name)-4;
*limit++='}';
title_lookup();
@@ -501,118 +409,13 @@ new_meaning(
@z
@x
-xref_ptr=xmem; name_dir->xref=(char*)xmem; xref_switch=0; section_xref_switch=0;
-@y
-xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0;
-@z
-
-@x
@d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference");
@y
@d append_xref(c) if (xref_ptr==xmem_end) overflow(_("cross-reference"));
@z
@x
-@d no_xref (flags['x']==0)
-@d make_xrefs flags['x'] /* should cross references be output? */
-@y
-@d no_xref (!make_xrefs) /* should cross references be suppressed? */
-@z
-
-@x
-void
-new_xref(p)
-name_pointer p;
-@y
-static void
-new_xref(
-name_pointer p)
-@z
-
-@x
- append_xref(m); xref_ptr->xlink=q; p->xref=(char*)xref_ptr;
-@y
- append_xref(m); xref_ptr->xlink=q; update_node(p);
-@z
-
-@x
-void
-new_section_xref(p)
-name_pointer p;
-@y
-static void
-new_section_xref(
-name_pointer p)
-@z
-
-@x
- if (r==xmem) p->xref=(char*)xref_ptr;
-@y
- if (r==xmem) update_node(p);
-@z
-
-@x
-void
-set_file_flag(p)
-name_pointer p;
-@y
-static void
-set_file_flag(
-name_pointer p)
-@z
-
-@x
- p->xref = (char *)xref_ptr;
-@y
- update_node(p);
-@z
-
-@x
-further details about them will be explained later. A |text_pointer| variable
-is an index into |tok_start|.
-@y
-further details about them will be explained later. A \&{text\_pointer}
-variable is an index into |tok_start|.
-@z
-
-@x
-tok_ptr=tok_mem+1; text_ptr=tok_start+1; tok_start[0]=tok_mem+1;
-tok_start[1]=tok_mem+1;
-max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
-@y
-tok_ptr=max_tok_ptr=tok_mem+1;@/
-tok_start[0]=tok_start[1]=tok_mem+1;@/
-text_ptr=max_text_ptr=tok_start+1;
-@z
-
-@x
-int names_match(p,first,l,t)
-name_pointer p; /* points to the proposed match */
-char *first; /* position of first character of string */
-int l; /* length of identifier */
-eight_bits t; /* desired ilk */
-@y
-boolean names_match(@t\1\1@>
-name_pointer p, /* points to the proposed match */
-const char *first, /* position of first character of string */
-size_t l, /* length of identifier */
-eight_bits t@t\2\2@>) /* desired |ilk| */
-@z
-
-@x
-void
-init_p(p,t)
-name_pointer p;
-eight_bits t;
-@y
-void
-init_p(
-name_pointer p,
-eight_bits t)
-@z
-
-@x
- p->ilk=t; p->xref=(char*)xmem;
+ p->ilk=t; init_node(p);
@y
struct perm_meaning *q=p-name_dir+cur_meaning;
p->ilk=t; init_node(p);
@@ -624,31 +427,6 @@ eight_bits t)
@z
@x
-void
-init_node(p)
-name_pointer p;
-@y
-void
-init_node(
-name_pointer p)
-@z
-
-@x
- p->xref=(char*)xmem;
-}
-@y
- p->xref=(void *)xmem;
-}
-
-static void
-update_node(
-name_pointer p)
-{
- p->xref=(void *)xref_ptr;
-}
-@z
-
-@x
id_lookup("extern",NULL,int_like);
@y
ext_loc=id_lookup("extern",NULL,int_like)-name_dir;
@@ -722,11 +500,11 @@ ccode['r']=ccode['R']=right_start;
@z
@x
-void skip_limbo();
+static eight_bits skip_TeX(void);@/
@ @c
@y
-static void skip_limbo(void);@/
+static eight_bits skip_TeX(void);@/
@ We look for a clue about the program's title, because this will become
part of all meanings.
@@ -735,14 +513,6 @@ part of all meanings.
@z
@x
-void
-skip_limbo() {
-@y
-static void
-skip_limbo(void) {
-@z
-
-@x
if (loc>limit && get_line()==0) return;
@y
if (loc>limit && get_line()==0) return;
@@ -753,10 +523,8 @@ skip_limbo(void) {
@z
@x
-unsigned
-skip_TeX() /* skip past pure \TEX/ code */
+skip_TeX(void) /* skip past pure \TEX/ code */
@y
-static eight_bits
skip_TeX(void)
@z
@@ -768,75 +536,12 @@ skip_TeX(void)
@z
@x
-eight_bits get_next();
-@y
-static eight_bits get_next(void);@/
-@z
-
-@x
-eight_bits
-get_next() /* produces the next input token */
-{@+eight_bits c; /* the current character */
-@y
-static eight_bits
-get_next(void) /* produces the next input token */
-{
- eight_bits c; /* the current character */
-@z
-
-@x
- else if (c=='\'' || c=='"' || (c=='L'&&(*loc=='\'' || *loc=='"'))@|
-@y
- else if (c=='\'' || c=='"'@|
- || ((c=='L' || c=='u' || c=='U')&&(*loc=='\'' || *loc=='"'))@|
- || ((c=='u' && *loc=='8')&&(*(loc+1)=='\'' || *(loc+1)=='"'))@|
-@z
-
-@x
@d right_preproc 0217 /* ends a preprocessor command */
@y
@d right_preproc 0223 /* ends a preprocessor command */
@z
@x
- else if (*loc=='>') if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
- else compress(minus_gt); break;
-@y
- else { if (*loc=='>') { if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
- else compress(minus_gt); } } break;
-@z
-
-@x
- case '!': if (*loc=='=') compress(not_eq); break;
-@y
- case '!': if (*loc=='=') compress(non_eq); break;
-@z
-
-@x
- while (isalpha(*++loc) || isdigit(*loc) || isxalpha(*loc) || ishigh(*loc));
-@y
- while (isalpha((eight_bits)*++loc) || isdigit((eight_bits)*loc) @|
- || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc));
-@z
-
-@x
- *id_loc++='$'; *id_loc++=toupper(*loc); loc++;
-@y
- *id_loc++='$'; *id_loc++=toupper((eight_bits)*loc); loc++;
-@z
-
-@x
- if (delim=='L') { /* wide character constant */
- delim=*loc++; *++id_loc=delim;
- }
-@y
- if (delim=='L' || delim=='u' || delim=='U') { /* wide character constant */
- if (delim=='u' && *loc=='8') { *++id_loc=*loc++; }
- delim=*loc++; *++id_loc=delim;
- }
-@z
-
-@x
err_print("! String didn't end"); loc=limit; break;
@y
err_print(_("! String didn't end")); loc=limit; break;
@@ -849,19 +554,7 @@ get_next(void) /* produces the next input token */
@z
@x
- if (c=='\\') if (loc>=limit) continue;
- else if (++id_loc<=section_text_end) {
- *id_loc = '\\'; c=*loc++;
- }
-@y
- if (c=='\\') { if (loc>=limit) continue;
- else { if (++id_loc<=section_text_end) {
- *id_loc = '\\'; c=*loc++;
- } } }
-@z
-
-@x
- printf("\n! String too long: ");
+ fputs("\n! String too long: ",stdout);
@y
fputs(_("\n! String too long: "),stdout);
@z
@@ -881,12 +574,10 @@ get_next(void) /* produces the next input token */
@z
@x
- case xref_roman: case xref_wildcard: case xref_typewriter:
- case noop: case TeX_string: c=ccode[c]; skip_restricted(); return(c);
+ case xref_roman: case xref_wildcard: case xref_typewriter: case noop:
@y
case xref_roman: case xref_wildcard: case xref_typewriter: case noop:
case meaning: case suppress:
- case TeX_string: c=ccode[(eight_bits)c]; skip_restricted(); return(c);
@z
@x
@@ -896,7 +587,7 @@ get_next(void) /* produces the next input token */
@z
@x
- printf("\n! Section name too long: ");
+ fputs("\n! Section name too long: ",stdout);
@y
fputs(_("\n! Section name too long: "),stdout);
@z
@@ -914,17 +605,11 @@ get_next(void) /* produces the next input token */
@z
@x
-void skip_restricted();
-@y
-void skip_restricted(void);@/
-@z
-
-@x
-void
-skip_restricted()
+static void
+skip_restricted(void)
{
@y
-void
+static void
skip_restricted(void)
{ int c=ccode[(eight_bits)*(loc-1)];
@z
@@ -1007,20 +692,6 @@ skip_restricted(void)
@z
@x
-void phase_one();
-@y
-static void phase_one(void);@/
-@z
-
-@x
-void
-phase_one() {
-@y
-static void
-phase_one(void) {
-@z
-
-@x
skip_limbo(); change_exists=0;
@y
skip_limbo();
@@ -1051,36 +722,6 @@ phase_one(void) {
@z
@x
-void C_xref();
-@y
-static void C_xref(eight_bits);@/
-@z
-
-@x
-void
-C_xref( spec_ctrl ) /* makes cross-references for \CEE/ identifiers */
- eight_bits spec_ctrl;
-@y
-static void
-C_xref(@t\1\1@> /* makes cross-references for \CEE/ identifiers */
- eight_bits spec_ctrl@t\2\2@>)
-@z
-
-@x
-void outer_xref();
-@y
-static void outer_xref(void);@/
-@z
-
-@x
-void
-outer_xref() /* extension of |C_xref| */
-@y
-static void
-outer_xref(void) /* extension of |C_xref| */
-@z
-
-@x
case translit_code: err_print("! Use @@l in limbo only"); continue;
@y
case translit_code: err_print(_("! Use @@l in limbo only")); continue;
@@ -1094,12 +735,6 @@ outer_xref(void) /* extension of |C_xref| */
@z
@x
- else lhs->xref=(char*)q->xlink;
-@y
- else lhs->xref=(void *)q->xlink;
-@z
-
-@x
err_print("! Missing left identifier of @@s");
@y
err_print(_("! Missing left identifier of @@s"));
@@ -1112,81 +747,28 @@ outer_xref(void) /* extension of |C_xref| */
@z
@x
-void section_check();
-@y
-static void section_check(name_pointer);@/
-@z
-
-@x
-void
-section_check(p)
-name_pointer p; /* print anomalies in subtree |p| */
-@y
-static void
-section_check(
-name_pointer p) /* print anomalies in subtree |p| */
-@z
-
-@x
- printf("\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless;
+ fputs("\n! Never defined: <",stdout);
+ print_section_name(p); putchar('>'); mark_harmless;
@y
fputs(_("\n! Never defined: <"),stdout);
print_section_name(p); putchar('>'); mark_harmless;
@z
@x
- printf("\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless;
+ fputs("\n! Never used: <",stdout);
+ print_section_name(p); putchar('>'); mark_harmless;
@y
fputs(_("\n! Never used: <"),stdout);
print_section_name(p); putchar('>'); mark_harmless;
@z
@x
-If the |per_cent| parameter is 1 a |'%'| is appended to the line
-@y
-If the |per_cent| parameter is 1, a |'%'| is appended to the line
-@z
-
-@x
-@d tex_printf(c) fprintf(active_file,c)
-@y
-@d tex_printf(c) fprintf(active_file,"%s",c)
-@d tex_puts(c) fputs(c,active_file)
-@z
-
-@x
-void
-flush_buffer(b,per_cent,carryover)
-char *b; /* outputs from |out_buf+1| to |b|,where |b<=out_ptr| */
-boolean per_cent,carryover;
-@y
-static void
-flush_buffer(@t\1\1@>
-char *b, /* outputs from |out_buf+1| to |b|, where |b<=out_ptr| */
-boolean per_cent,boolean carryover@t\2\2@>)
-@z
-
-@x
- if (b<out_ptr) strncpy(out_buf+1,b+1,out_ptr-b);
-@y
- if (b<out_ptr) strncpy(out_buf+1,b+1,(size_t)(out_ptr-b));
-@z
-
-@x
-void
-finish_line() /* do this at the end of a line */
-@y
-static void
-finish_line(void) /* do this at the end of a line */
-@z
-
-@x
@ In particular, the |finish_line| procedure is called near the very
beginning of phase two. We initialize the output variables in a slightly
tricky way so that the first line of the output file will be
`\.{\\input cwebmac}'.
-@<Set init...@>=
+@<Start \TEX/...@>=
out_ptr=out_buf+1; out_line=1; active_file=tex_file;
*out_ptr='c'; tex_printf("\\input cwebma");
@y
@@ -1228,30 +810,6 @@ tex_puts(proofing?"ctproofma":"ctwima");
@z
@x
-void
-out_str(s) /* output characters from |s| to end of string */
-char *s;
-@y
-static void
-out_str(@t\1\1@> /* output characters from |s| to end of string */
-const char*s@t\2\2@>)
-@z
-
-@x
-void break_out();
-@y
-static void break_out(void);@/
-@z
-
-@x
-void
-break_out() /* finds a way to break the output line */
-@y
-static void
-break_out(void) /* finds a way to break the output line */
-@z
-
-@x
printf("\n! Line had to be broken (output l. %d):\n",out_line);
@y
printf(_("\n! Line had to be broken (output l. %d):\n"),out_line);
@@ -1265,42 +823,12 @@ the section is changed, we output `\.{\\*}' just after the number.
@z
@x
-void
-out_section(n)
-sixteen_bits n;
-@y
-static void
-out_section(
-sixteen_bits n)
-@z
-
-@x
if(changed_section[n]) out_str ("\\*");
@.\\*@>
@y
@z
@x
-void
-out_name(p,quote_xalpha)
-name_pointer p;
-boolean quote_xalpha;
-@y
-static void
-out_name(
-name_pointer p,
-boolean quote_xalpha)
-@z
-
-@x
-void
-copy_limbo()
-@y
-static void
-copy_limbo(void)
-@z
-
-@x
default: err_print("! Double @@ should be used in limbo");
@y
case right_start: right_start_switch=1; break;
@@ -1308,42 +836,12 @@ copy_limbo(void)
@z
@x
-@ @f copy_TeX TeX
-@y
-@f copy_TeX TeX
-@z
-
-@x
-eight_bits
-copy_TeX()
-@y
-static eight_bits
-copy_TeX(void)
-@z
-
-@x
@d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;}
@y
@d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow(_("token")); *(tok_ptr++)=c;}
@z
@x
-int copy_comment();
-@y
-static int copy_comment(boolean,int);@/
-@z
-
-@x
-int copy_comment(is_long_comment,bal) /* copies \TEX/ code in comments */
-boolean is_long_comment; /* is this a traditional \CEE/ comment? */
-int bal; /* brace balance */
-@y
-static int copy_comment(@t\1\1@> /* copies \TeX\ code in comments */
-boolean is_long_comment, /* is this a traditional \CEE/ comment? */
-int bal@t\2\2@>) /* brace balance */
-@z
-
-@x
err_print("! Input ended in mid-comment");
@y
err_print(_("! Input ended in mid-comment"));
@@ -1374,14 +872,6 @@ int bal@t\2\2@>) /* brace balance */
@z
@x
-else if (c=='\\' && *loc!='@@')
- if (phase==2) app_tok(*(loc++))@; else loc++;
-@y
-else { if (c=='\\' && *loc!='@@') {
- if (phase==2) app_tok(*(loc++))@; else loc++; } }
-@z
-
-@x
@d end_arg 62 /* \.{@@]} */
@y
@d end_arg 62 /* \.{@@]} */
@@ -1389,34 +879,6 @@ else { if (c=='\\' && *loc!='@@') {
@z
@x
-eight_bits cat_index;
-
-@ @<Set in...@>=
- for (cat_index=0;cat_index<255;cat_index++)
- strcpy(cat_name[cat_index],"UNKNOWN");
-@y
-
-@ @<Set in...@>=
-{int c; for (c=0;c<256;c++) strcpy(cat_name[c],"UNKNOWN");}
-@z
-
-@x
-void
-print_cat(c) /* symbolic printout of a category */
-eight_bits c;
-@y
-static void
-print_cat(@t\1\1@> /* symbolic printout of a category */
-eight_bits c@t\2\2@>)
-@z
-
-@x
- printf(cat_name[c]);
-@y
- fputs(cat_name[c],stdout);
-@z
-
-@x
@i prod.w
@y
@i prod-twill.w
@@ -1437,87 +899,33 @@ null_scrap.trans=&tok_start[0];
@z
@x
-void
-print_text(p) /* prints a token list for debugging; not used in |main| */
-text_pointer p;
-@y
-#ifdef DEAD_CODE /* not used in |main| */
-static void
-print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */
-text_pointer p@t\2\2@>)
-@z
-
-@x
- fflush(stdout);
-}
-@y
- printf("|\n"); update_terminal;
-}
-@#
-static void pr_txt(
- int k)
-{ print_text(&tok_start[k]); }
-#endif /* |DEAD_CODE| */
-@z
-
-@x
-@d app(a) *(tok_ptr++)=a
-@d app1(a) *(tok_ptr++)=tok_flag+(int)((a)->trans-tok_start)
-@y
-@d app(a) *(tok_ptr++)=(token)(a)
-@d app1(a) *(tok_ptr++)=(token)(tok_flag+(int)((a)->trans-tok_start))
-@z
-
-@x
-void
-app_str(s)
-char *s;
+static void print_text(text_pointer p);@/
@y
-static void
-app_str(
-const char *s)
+#if 0
+static void print_text(text_pointer p);@/
+#endif
@z
@x
-void
-big_app(a)
-token a;
-@y
static void
-big_app(
-token a)
-@z
-
-@x
-void
-big_app1(a)
-scrap_pointer a;
+print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */
@y
+#if 0
static void
-big_app1(
-scrap_pointer a)
-@z
-
-@x
- && pp->cat!=prerangle
-@y
- && pp->cat!=prerangle @|
+print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */
@z
@x
- && pp->cat!=ftemplate
+ update_terminal;
@y
- && pp->cat!=ftemplate @|
+ printf("|\n"); update_terminal;
@z
@x
-token_pointer
-find_first_ident(p)
-text_pointer p;
+}
@y
-static token_pointer
-find_first_ident(
-text_pointer p)
+}
+#endif
@z
@x
@@ -1536,16 +944,6 @@ static token_pointer tok_loc; /* where the first identifier appears */
@z
@x
-void
-make_reserved(p) /* make the first identifier in |p->trans| like |int| */
-scrap_pointer p;
-@y
-static void
-make_reserved(@t\1\1@> /* make the first identifier in |p->trans| like |int| */
-scrap_pointer p@t\2\2@>)
-@z
-
-@x
token_pointer tok_loc; /* pointer to |tok_value| */
if ((tok_loc=find_first_ident(p->trans))<=operator_found)
return; /* this should not happen */
@@ -1554,45 +952,11 @@ scrap_pointer p@t\2\2@>)
@z
@x
-void
-make_underlined(p)
-/* underline the entry for the first identifier in |p->trans| */
-scrap_pointer p;
-@y
-static void
-make_underlined(@t\1\1@>
-/* underline the entry for the first identifier in |p->trans| */
-scrap_pointer p@t\2\2@>)
-@z
-
-@x
token_pointer tok_loc; /* where the first identifier appears */
@y
@z
@x
-void underline_xref();
-@y
-static void underline_xref(name_pointer);@/
-@z
-
-@x
-void
-underline_xref(p)
-name_pointer p;
-@y
-static void
-underline_xref(
-name_pointer p)
-@z
-
-@x
- p->xref=(char*)xref_ptr;
-@y
- update_node(p);
-@z
-
-@x
r->num=m; /* everything from |q| on is left undisturbed */
@y
r->num=m; /* everything from |q| on is left undisturbed */
@@ -1722,12 +1086,6 @@ if (cat1==lbrace || cat1==int_like || cat1==decl) {
reduce(pp,1,fn_decl,0,1);
}
@y
-\.{CWEAVE} indents declarations after old-style function definitions.
-With the \.{-i} option they will come out flush left. You won't see
-any difference if you use ANSI-style function definitions.
-
-@d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */
-
@<Cases for |exp|@>=
if(cat1==lbrace || cat1==int_like || cat1==decl) {
make_underlined(pp);
@@ -1811,14 +1169,7 @@ else if (cat1==stmt || cat1==function) {
big_app1(pp+1); reduce(pp,2,cat1,-1,41);
}
@y
-@ The original manual described the \.{-o} option for \.{CWEAVE}, but this was
-not yet present. Here is a simple implementation. The purpose is to suppress
-the extra space between local variable declarations and the first statement in
-a function block.
-
-@d order_decl_stmt flags['o'] /* should declarations and statements be separated? */
-
-@<Cases for |decl|@>=
+@ @<Cases for |decl|@>=
if (cat1==decl) {
big_app1(pp); big_app(force); big_app1(pp+1);
reduce(pp,2,decl,-1,40);
@@ -1848,9 +1199,7 @@ else if (cat1==stmt) {
big_app1(pp+1); reduce(pp,2,function,-1,52);
}
@y
-@ Outdent after parameter declarations with option \.{-i}.
-
-@<Cases for |fn_decl|@>=
+@ @<Cases for |fn_decl|@>=
if (cat1==decl) {
big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51);
}
@@ -1931,34 +1280,6 @@ if (cat1==decl_head) {
@z
@x
-void
-reduce(j,k,c,d,n)
-scrap_pointer j;
-eight_bits c;
-short k, d, n;
-@y
-static void
-reduce(
-scrap_pointer j, short k,
-eight_bits c,
-short d, short n)
-@z
-
-@x
-void
-squash(j,k,c,d,n)
-scrap_pointer j;
-eight_bits c;
-short k, d, n;
-@y
-static void
-squash(
-scrap_pointer j, short k,
-eight_bits c,
-short d, short n)
-@z
-
-@x
overflow("token");
@y
overflow(_("token"));
@@ -1971,38 +1292,6 @@ short d, short n)
@z
@x
-{ scrap_pointer k; /* pointer into |scrap_info| */
- if (tracing==2) {
- printf("\n%d:",n);
- for (k=scrap_base; k<=lo_ptr; k++) {
- if (k==pp) putxchar('*'); else putxchar(' ');
- if (k->mathness %4 == yes_math) putchar('+');
- else if (k->mathness %4 == no_math) putchar('-');
- print_cat(k->cat);
- if (k->mathness /4 == yes_math) putchar('+');
- else if (k->mathness /4 == no_math) putchar('-');
-@y
-{ scrap_pointer k_l; /* pointer into |scrap_info| */
- if (tracing==2) {
- printf("\n%d:",n);
- for (k_l=scrap_base; k_l<=lo_ptr; k_l++) {
- if (k_l==pp) putxchar('*'); else putxchar(' ');
- if (k_l->mathness %4 == yes_math) putchar('+');
- else if (k_l->mathness %4 == no_math) putchar('-');
- print_cat(k_l->cat);
- if (k_l->mathness /4 == yes_math) putchar('+');
- else if (k_l->mathness /4 == no_math) putchar('-');
-@z
-
-@x
-text_pointer
-translate() /* converts a sequence of scraps */
-@y
-static text_pointer
-translate(void) /* converts a sequence of scraps */
-@z
-
-@x
if (tok_ptr+6>tok_mem_end) overflow("token");
@y
if (tok_ptr+6>tok_mem_end) overflow(_("token"));
@@ -2021,160 +1310,10 @@ translate(void) /* converts a sequence of scraps */
@z
@x
-void
-C_parse(spec_ctrl) /* creates scraps from \CEE/ tokens */
- eight_bits spec_ctrl;
-@y
-static void
-C_parse(@t\1\1@> /* creates scraps from \CEE/ tokens */
- eight_bits spec_ctrl@t\2\2@>)
-@z
-
-@x
-switch (next_control) {
- case section_name:
- app(section_flag+(int)(cur_section-name_dir));
- app_scrap(section_scrap,maybe_math);
- app_scrap(exp,yes_math);@+break;
- case string: case constant: case verbatim: @<Append a string or constant@>;
- @+break;
- case identifier: app_cur_id(1);@+break;
- case TeX_string: @<Append a \TEX/ string, without forming a scrap@>;@+break;
- case '/': case '.':
- app(next_control); app_scrap(binop,yes_math);@+break;
- case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break;
-@.\\langle@>
- case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break;
-@.\\rangle@>
- case '=': app_str("\\K"); app_scrap(binop,yes_math);@+break;
-@.\\K@>
- case '|': app_str("\\OR"); app_scrap(binop,yes_math);@+break;
-@.\\OR@>
- case '^': app_str("\\XOR"); app_scrap(binop,yes_math);@+break;
-@.\\XOR@>
- case '%': app_str("\\MOD"); app_scrap(binop,yes_math);@+break;
-@.\\MOD@>
- case '!': app_str("\\R"); app_scrap(unop,yes_math);@+break;
-@.\\R@>
- case '~': app_str("\\CM"); app_scrap(unop,yes_math);@+break;
-@.\\CM@>
- case '+': case '-': app(next_control); app_scrap(ubinop,yes_math);@+break;
- case '*': app(next_control); app_scrap(raw_ubin,yes_math);@+break;
- case '&': app_str("\\AND"); app_scrap(raw_ubin,yes_math);@+break;
-@.\\AND@>
- case '?': app_str("\\?"); app_scrap(question,yes_math);@+break;
-@.\\?@>
- case '#': app_str("\\#"); app_scrap(ubinop,yes_math);@+break;
-@.\\\#@>
case ignore: case xref_roman: case xref_wildcard:
- case xref_typewriter: case noop:@+break;
- case '(': case '[': app(next_control); app_scrap(lpar,maybe_math);@+break;
- case ')': case ']': app(next_control); app_scrap(rpar,maybe_math);@+break;
- case '{': app_str("\\{"@q}@>); app_scrap(lbrace,yes_math);@+break;
-@.\\\{@>@q}@>
- case '}': app_str(@q{@>"\\}"); app_scrap(rbrace,yes_math);@+break;
-@q{@>@.\\\}@>
- case ',': app(','); app_scrap(comma,yes_math);@+break;
- case ';': app(';'); app_scrap(semi,maybe_math);@+break;
- case ':': app(':'); app_scrap(colon,no_math);@+break;@/
- @t\4@> @<Cases involving nonstandard characters@>@;
- case thin_space: app_str("\\,"); app_scrap(insert,maybe_math);@+break;
-@.\\,@>
- case math_break: app(opt); app_str("0");
- app_scrap(insert,maybe_math);@+break;
- case line_break: app(force); app_scrap(insert,no_math);@+break;
- case left_preproc: app(force); app(preproc_line);
- app_str("\\#"); app_scrap(lproc,no_math);@+break;
-@.\\\#@>
- case right_preproc: app(force); app_scrap(rproc,no_math);@+break;
- case big_line_break: app(big_force); app_scrap(insert,no_math);@+break;
- case no_line_break: app(big_cancel); app(noop); app(break_space);
- app(noop); app(big_cancel);
- app_scrap(insert,no_math);@+break;
- case pseudo_semi: app_scrap(semi,maybe_math);@+break;
- case macro_arg_open: app_scrap(begin_arg,maybe_math);@+break;
- case macro_arg_close: app_scrap(end_arg,maybe_math);@+break;
- case join: app_str("\\J"); app_scrap(insert,no_math);@+break;
-@.\\J@>
- case output_defs_code: app(force); app_str("\\ATH"); app(force);
- app_scrap(insert,no_math);@+break;
-@.\\ATH@>
- default: app(inserted); app(next_control);
- app_scrap(insert,maybe_math);@+break;
-}
@y
-switch (next_control) {
- case section_name:
- app(section_flag+(int)(cur_section-name_dir));
- app_scrap(section_scrap,maybe_math);
- app_scrap(exp,yes_math);@+break;
- case string: case constant: case verbatim:
- @<Append a string or constant@>;@+break;
- case identifier: app_cur_id(1);@+break;
- case TeX_string:
- @<Append a \TEX/ string, without forming a scrap@>;@+break;
- case '/': case '.':
- app(next_control);@+app_scrap(binop,yes_math);@+break;
- case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break;
-@.\\langle@>
- case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break;
-@.\\rangle@>
- case '=': app_str("\\K");@+app_scrap(binop,yes_math);@+break;
-@.\\K@>
- case '|': app_str("\\OR");@+app_scrap(binop,yes_math);@+break;
-@.\\OR@>
- case '^': app_str("\\XOR");@+app_scrap(binop,yes_math);@+break;
-@.\\XOR@>
- case '%': app_str("\\MOD");@+app_scrap(binop,yes_math);@+break;
-@.\\MOD@>
- case '!': app_str("\\R");@+app_scrap(unop,yes_math);@+break;
-@.\\R@>
- case '~': app_str("\\CM");@+app_scrap(unop,yes_math);@+break;
-@.\\CM@>
- case '+': case '-': app(next_control);@+app_scrap(ubinop,yes_math);@+break;
- case '*': app(next_control);@+app_scrap(raw_ubin,yes_math);@+break;
- case '&': app_str("\\AND");@+app_scrap(raw_ubin,yes_math);@+break;
-@.\\AND@>
- case '?': app_str("\\?");@+app_scrap(question,yes_math);@+break;
-@.\\?@>
- case '#': app_str("\\#");@+app_scrap(ubinop,yes_math);@+break;
-@.\\\#@>
case ignore: case xref_roman: case xref_wildcard:
case meaning: case suppress:
- case xref_typewriter: case noop:@+break;
- case '(': case '[': app(next_control);@+app_scrap(lpar,maybe_math);@+break;
- case ')': case ']': app(next_control);@+app_scrap(rpar,maybe_math);@+break;
- case '{': app_str("\\{"@q}@>);@+app_scrap(lbrace,yes_math);@+break;
-@.\\\{@>@q}@>
- case '}': app_str(@q{@>"\\}");@+app_scrap(rbrace,yes_math);@+break;
-@q{@>@.\\\}@>
- case ',': app(',');@+app_scrap(comma,yes_math);@+break;
- case ';': app(';');@+app_scrap(semi,maybe_math);@+break;
- case ':': app(':');@+app_scrap(colon,no_math);@+break;@/
- @t\4@> @<Cases involving nonstandard characters@>@;
- case thin_space: app_str("\\,");@+app_scrap(insert,maybe_math);@+break;
-@.\\,@>
- case math_break: app(opt);@+app_str("0");@+
- app_scrap(insert,maybe_math);@+break;
- case line_break: app(force);@+app_scrap(insert,no_math);@+break;
- case left_preproc: app(force);@+app(preproc_line);@+app_str("\\#");
- app_scrap(lproc,no_math);@+break;
-@.\\\#@>
- case right_preproc: app(force);@+app_scrap(rproc,no_math);@+break;
- case big_line_break: app(big_force);@+app_scrap(insert,no_math);@+break;
- case no_line_break: app(big_cancel);@+app(noop);@+app(break_space);@+
- app(noop);@+app(big_cancel); app_scrap(insert,no_math);@+break;
- case pseudo_semi: app_scrap(semi,maybe_math);@+break;
- case macro_arg_open: app_scrap(begin_arg,maybe_math);@+break;
- case macro_arg_close: app_scrap(end_arg,maybe_math);@+break;
- case join: app_str("\\J");@+app_scrap(insert,no_math);@+break;
-@.\\J@>
- case output_defs_code: app(force);@+app_str("\\ATH");@+app(force);
- app_scrap(insert,no_math);@+break;
-@.\\ATH@>
- default: app(inserted);@+app(next_control);
- app_scrap(insert,maybe_math);@+break;
-}
@z
@x
@@ -2184,34 +1323,12 @@ switch (next_control) {
@z
@x
-case not_eq: app_str("\\I");@+app_scrap(binop,yes_math);@+break;
-@y
-case non_eq: app_str("\\I");@+app_scrap(binop,yes_math);@+break;
-@z
-
-@x
else err_print("! Double @@ should be used in strings");
@y
else err_print(_("! Double @@ should be used in strings"));
@z
@x
-void app_cur_id();
-@y
-void app_cur_id(boolean);@/
-@z
-
-@x
-void
-app_cur_id(scrapping)
-boolean scrapping; /* are we making this into a scrap? */
-@y
-void
-app_cur_id(@t\1\1@>
-boolean scrapping@t\2\2@>) /* are we making this into a scrap? */
-@z
-
-@x
else app_scrap(p->ilk,maybe_math);
}
}
@@ -2223,14 +1340,6 @@ boolean scrapping@t\2\2@>) /* are we making this into a scrap? */
@z
@x
-text_pointer
-C_translate()
-@y
-static text_pointer
-C_translate(void)
-@z
-
-@x
if (next_control!='|') err_print("! Missing '|' after C text");
@y
if (next_control!='|') err_print(_("! Missing '|' after C text"));
@@ -2245,14 +1354,6 @@ Although \.{ctwimac} ignores \.{\\PB}, other macro packages
@z
@x
-void
-outer_parse() /* makes scraps from \CEE/ tokens and comments */
-@y
-static void
-outer_parse(void) /* makes scraps from \CEE/ tokens and comments */
-@z
-
-@x
app(tok_flag+(int)(p-tok_start));
@y
app(tok_flag+(int)(p-tok_start));
@@ -2260,104 +1361,24 @@ outer_parse(void) /* makes scraps from \CEE/ tokens and comments */
@z
@x
-void
-push_level(p) /* suspends the current level */
-text_pointer p;
-@y
-static void
-push_level(@t\1\1@> /* suspends the current level */
-text_pointer p@t\2\2@>)
-@z
-
-@x
if (stack_ptr==stack_end) overflow("stack");
@y
if (stack_ptr==stack_end) overflow(_("stack"));
@z
@x
-void
-pop_level()
-@y
-static void
-pop_level(void)
-@z
-
-@x
-eight_bits
-get_output() /* returns the next token of output */
-@y
-static eight_bits
-get_output(void) /* returns the next token of output */
-@z
-
-@x
- return(a);
-@y
- return((eight_bits)a);
-@z
-
-@x
-void
-output_C() /* outputs the current token list */
-@y
-static void
-output_C(void) /* outputs the current token list */
-@z
-
-@x
-void make_output();
-@y
-static void make_output(void);@/
-@z
-
-@x
-void
-make_output() /* outputs the equivalents of tokens */
-{
- eight_bits a, /* current output byte */
-@y
-static void
-make_output(void) /* outputs the equivalents of tokens */
-{
- eight_bits a=0, /* current output byte */
-@z
-
-@x
- else if (b!='|') out(b)@;
-@y
- else { if (b!='|') out(b)@;
-@z
-
-@x
- }
-@y
- } }
-@z
-
-@x
- printf("\n! Illegal control code in section name: <");
+ fputs("\n! Illegal control code in section name: <",stdout);
@y
fputs(_("\n! Illegal control code in section name: <"),stdout);
@z
@x
- printf("\n! C text in section name didn't end: <");
+ fputs("\n! C text in section name didn't end: <",stdout);
@y
fputs(_("\n! C text in section name didn't end: <"),stdout);
@z
@x
- if (b=='\'' || b=='"')
- if (delim==0) delim=b;
- else if (delim==b) delim=0;
-@y
- if (b=='\'' || b=='"') {
- if (delim==0) delim=b;
- else if (delim==b) delim=0; }
-@z
-
-@x
if (j>buffer+long_buf_size-3) overflow("buffer");
@y
if (j>buffer+long_buf_size-3) overflow(_("buffer"));
@@ -2370,21 +1391,7 @@ make_output(void) /* outputs the equivalents of tokens */
@z
@x
-void phase_two();
-@y
-static void phase_two(void);@/
-@z
-
-@x
-void
-phase_two() {
-@y
-static void
-phase_two(void) {
-@z
-
-@x
-reset_input(); if (show_progress) printf("\nWriting the output file...");
+reset_input(); if (show_progress) fputs("\nWriting the output file...",stdout);
@y
reset_input(); if (show_progress) fputs(_("\nWriting the output file..."),stdout);
@z
@@ -2398,11 +1405,11 @@ section_count=0; format_visible=1; right_start_switch=0; copy_limbo();
@z
@x
-while (!input_has_ended) @<Translate the current section@>;
+while (!input_has_ended) @<Translate the current section@>@;
}
@y
-while (!input_has_ended) @<Translate the current section@>;
+while (!input_has_ended) @<Translate the current section@>@;
}
@ @<Glob...@>=
@@ -2410,7 +1417,7 @@ FILE *aux_file;
char aux_file_name[max_file_name_length]; /* name of \.{.aux} file */
@ @<Read the \.{.aux} file, if present; then open it for output@>=
-strncpy(aux_file_name,tex_file_name,strlen(tex_file_name)-4);
+memcpy(aux_file_name,tex_file_name,strlen(tex_file_name)-4);
strcat(aux_file_name,".bux");
include_depth=1; /* we simulate \.{@@i} */
strcpy(cur_file_name,aux_file_name); /* first in, third out */
@@ -2433,16 +1440,14 @@ if ((aux_file=fopen(aux_file_name,"wb"))==NULL)
@x
boolean group_found=0; /* has a starred section occurred? */
+
+@ @<Translate the current section@>= {
+ section_count++;
@y
boolean group_found=0; /* has a starred section occurred? */
boolean right_start_switch; /* has `\.{@@r}' occurred recently? */
boolean temp_switch; /* has `\.{@@\%}' occurred recently? */
-@z
-@x
-@ @<Translate the current section@>= {
- section_count++;
-@y
@ @d usage_sentinel (struct perm_meaning *)1
@<Translate the current section@>= {
section_count++;
@@ -2524,42 +1529,6 @@ name_pointer id_being_defined; /* the definee */
@z
@x
-void finish_C();
-@y
-static void finish_C(boolean);@/
-@z
-
-@x
-void
-finish_C(visible) /* finishes a definition or a \CEE/ part */
- boolean visible; /* nonzero if we should produce \TEX/ output */
-@y
-static void
-finish_C(@t\1\1@> /* finishes a definition or a \Cee\ part */
- boolean visible@t\2\2@>) /* nonzero if we should produce \TeX\ output */
-@z
-
-@x
- if (out_ptr>out_buf+1)
- if (*(out_ptr-1)=='\\')
-@.\\6@>
-@.\\7@>
-@.\\Y@>
- if (*out_ptr=='6') out_ptr-=2;
- else if (*out_ptr=='7') *out_ptr='Y';
-@y
- if (out_ptr>out_buf+1) {
- if (*(out_ptr-1)=='\\') {
-@.\\6@>
-@.\\7@>
-@.\\Y@>
- if (*out_ptr=='6') out_ptr-=2;
- else if (*out_ptr=='7') *out_ptr='Y';
- }
- }
-@z
-
-@x
@<Start a macro...@>= {
@y
@<Start a macro...@>= {
@@ -2635,22 +1604,6 @@ finish_C(@t\1\1@> /* finishes a definition or a \Cee\ part */
@z
@x
-void footnote();
-@y
-static void footnote(sixteen_bits);@/
-@z
-
-@x
-void
-footnote(flag) /* outputs section cross-references */
-sixteen_bits flag;
-@y
-static void
-footnote(@t\1\1@> /* outputs section cross-references */
-sixteen_bits flag@t\2\2@>)
-@z
-
-@x
out_str("\\fi"); finish_line();
@.\\fi@>
flush_buffer(out_buf,0,0); /* insert a blank line, it looks nice */
@@ -2670,7 +1623,7 @@ possible citation. A variable is on this list if and only if its
placed on the list, unless they are reserved and their current
\TeX\ meaning is uninitialized.
-@ @<Flag the usage of this identifier, for the mini-index@>=
+@<Flag the usage of this identifier, for the mini-index@>=
{ struct perm_meaning *q=p-name_dir+cur_meaning;
if (!(abnormal(p)) || strcmp(q->perm.tex_part,"\\uninitialized")!=0)
if (q->link==0) {
@@ -2749,20 +1702,6 @@ name_done:
@z
@x
-void phase_three();
-@y
-static void phase_three(void);@/
-@z
-
-@x
-void
-phase_three() {
-@y
-static void
-phase_three(void) {
-@z
-
-@x
if (no_xref) {
finish_line();
out_str("\\end");
@@ -2779,18 +1718,12 @@ if (no_xref) {
@z
@x
- phase=3; if (show_progress) printf("\nWriting the index...");
+ phase=3; if (show_progress) fputs("\nWriting the index...",stdout);
@y
phase=3; if (show_progress) fputs(_("\nWriting the index..."),stdout);
@z
@x
- if ((idx_file=fopen(idx_file_name,"w"))==NULL)
-@y
- if ((idx_file=fopen(idx_file_name,"wb"))==NULL)
-@z
-
-@x
fatal("! Cannot open index file ",idx_file_name);
@y
fatal(_("! Cannot open index file "),idx_file_name);
@@ -2798,38 +1731,18 @@ if (no_xref) {
@x
if (change_exists) {
- @<Tell about changed sections@>; finish_line(); finish_line();
+ @<Tell about changed sections@>@; finish_line(); finish_line();
}
@y
@z
@x
- @<Do the first pass of sorting@>;
- @<Sort and output the index@>;
-@y
- @<Do the first pass of sorting@>@;
- @<Sort and output the index@>@;
-@z
-
-@x
- if ((scn_file=fopen(scn_file_name,"w"))==NULL)
-@y
- if ((scn_file=fopen(scn_file_name,"wb"))==NULL)
-@z
-
-@x
fatal("! Cannot open section file ",scn_file_name);
@y
fatal(_("! Cannot open section file "),scn_file_name);
@z
@x
- @<Output all the section names@>;
-@y
- @<Output all the section names@>@;
-@z
-
-@x
@.\\end@>
finish_line();
fclose(active_file);
@@ -2842,12 +1755,9 @@ finish_line(); fclose(active_file); active_file=NULL;
@z
@x
-if (show_happiness) printf("\nDone.");
+ fputs("Done.",stdout);
@y
-if (show_happiness) {
- if (show_progress) new_line;
fputs(_("Done."),stdout);
-}
@z
@x
@@ -2875,106 +1785,6 @@ the index section itself---NOT!
@z
@x
-for (c=0; c<=255; c++) bucket[c]=NULL;
-@y
-for (c=0; c<256; c++) bucket[c]=NULL;
-@z
-
-@x
- if (cur_name->xref!=(char*)xmem) {
-@y
- if (cur_name->xref!=(void *)xmem) {
-@z
-
-@x
-@ @<Rest of |trans_plus| union@>=
-@y
-@<Rest of |trans_plus| union@>=
-@z
-
-@x
-collate[0]=0;
-strcpy(collate+1," \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17");
-/* 16 characters + 1 = 17 */
-strcpy(collate+17,"\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37");
-/* 16 characters + 17 = 33 */
-strcpy(collate+33,"!\42#$%&'()*+,-./:;<=>?@@[\\]^`{|}~_");
-/* 32 characters + 33 = 65 */
-strcpy(collate+65,"abcdefghijklmnopqrstuvwxyz0123456789");
-/* (26 + 10) characters + 65 = 101 */
-strcpy(collate+101,"\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217");
-/* 16 characters + 101 = 117 */
-strcpy(collate+117,"\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237");
-/* 16 characters + 117 = 133 */
-strcpy(collate+133,"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257");
-/* 16 characters + 133 = 149 */
-strcpy(collate+149,"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277");
-/* 16 characters + 149 = 165 */
-strcpy(collate+165,"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317");
-/* 16 characters + 165 = 181 */
-strcpy(collate+181,"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337");
-/* 16 characters + 181 = 197 */
-strcpy(collate+197,"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357");
-/* 16 characters + 197 = 213 */
-strcpy(collate+213,"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377");
-/* 16 characters + 213 = 229 */
-@y
-collate[0]=0;
-strcpy((char *)collate+1,
- " \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17");
-/* 16 characters + 1 = 17 */
-strcpy((char *)collate+17,
- "\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37");
-/* 16 characters + 17 = 33 */
-strcpy((char *)collate+33,
- "!\42#$%&'()*+,-./:;<=>?@@[\\]^`{|}~_");
-/* 32 characters + 33 = 65 */
-strcpy((char *)collate+65,
- "abcdefghijklmnopqrstuvwxyz0123456789");
-/* (26 + 10) characters + 65 = 101 */
-strcpy((char *)collate+101,
- "\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217");
-/* 16 characters + 101 = 117 */
-strcpy((char *)collate+117,
- "\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237");
-/* 16 characters + 117 = 133 */
-strcpy((char *)collate+133,
- "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257");
-/* 16 characters + 133 = 149 */
-strcpy((char *)collate+149,
- "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277");
-/* 16 characters + 149 = 165 */
-strcpy((char *)collate+165,
- "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317");
-/* 16 characters + 165 = 181 */
-strcpy((char *)collate+181,
- "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337");
-/* 16 characters + 181 = 197 */
-strcpy((char *)collate+197,
- "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357");
-/* 16 characters + 197 = 213 */
-strcpy((char *)collate+213,
- "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377");
-/* 16 characters + 213 = 229 */
-@z
-
-@x
-void unbucket();
-@y
-static void unbucket(eight_bits);@/
-@z
-
-@x
-void
-unbucket(d) /* empties buckets having depth |d| */
-eight_bits d;
-@y
-static void
-unbucket(@t\1\1@> /* empties buckets having depth |d| */
-eight_bits d@t\2\2@>)
-@z
-
-@x
if (sort_ptr>=scrap_info_end) overflow("sorting");
@y
if (sort_ptr>=scrap_info_end) overflow(_("sorting"));
@@ -3030,93 +1840,60 @@ else {
@z
@x
-void section_print();
-@y
-static void section_print(name_pointer);@/
-@z
-
-@x
-void
-section_print(p) /* print all section names in subtree |p| */
-name_pointer p;
-@y
-static void
-section_print(@t\1\1@> /* print all section names in subtree |p| */
-name_pointer p@t\2\2@>)
-@z
-
-@x
-@ @<Output all the section names@>=section_print(root)
-@y
-@ @<Output all the section names@>=section_print(root);
-@z
-
-@x
-void
-print_stats() {
-@y
-void
-print_stats(void) {
-@z
-
-@x
- printf("\nMemory usage statistics:\n");
+ puts("\nMemory usage statistics:");
@.Memory usage statistics:@>
printf("%ld names (out of %ld)\n",
- (long)(name_ptr-name_dir),(long)max_names);
+ (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf("%ld cross-references (out of %ld)\n",
- (long)(xref_ptr-xmem),(long)max_refs);
+ (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);
printf("%ld bytes (out of %ld)\n",
- (long)(byte_ptr-byte_mem),(long)max_bytes);
- printf("Parsing:\n");
+ (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
+ puts("Parsing:");
printf("%ld scraps (out of %ld)\n",
- (long)(max_scr_ptr-scrap_info),(long)max_scraps);
+ (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps);
printf("%ld texts (out of %ld)\n",
- (long)(max_text_ptr-tok_start),(long)max_texts);
+ (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts);
printf("%ld tokens (out of %ld)\n",
- (long)(max_tok_ptr-tok_mem),(long)max_toks);
+ (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks);
printf("%ld levels (out of %ld)\n",
- (long)(max_stack_ptr-stack),(long)stack_size);
- printf("Sorting:\n");
+ (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size);
+ puts("Sorting:");
printf("%ld levels (out of %ld)\n",
- (long)(max_sort_ptr-scrap_info),(long)max_scraps);
-}
+ (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps);
@y
puts(_("\nMemory usage statistics:"));
@.Memory usage statistics:@>
printf(_("%ld names (out of %ld)\n"),
- (long)(name_ptr-name_dir),(long)max_names);
+ (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf(_("%ld cross-references (out of %ld)\n"),
- (long)(xref_ptr-xmem),(long)max_refs);
+ (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);
printf(_("%ld bytes (out of %ld)\n"),
- (long)(byte_ptr-byte_mem),(long)max_bytes);
+ (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
printf(_("%ld temp meanings (out of %ld)\n"),
- (long)(max_temp_meaning_ptr-temp_meaning_stack),
+ (ptrdiff_t)(max_temp_meaning_ptr-temp_meaning_stack),
(long)max_meanings);
printf(_("%ld titles (out of %ld)\n"),
- (long)(title_code_ptr-title_code),(long)max_titles);
+ (ptrdiff_t)(title_code_ptr-title_code),(long)max_titles);
puts(_("Parsing:"));
printf(_("%ld scraps (out of %ld)\n"),
- (long)(max_scr_ptr-scrap_info),(long)max_scraps);
+ (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps);
printf(_("%ld texts (out of %ld)\n"),
- (long)(max_text_ptr-tok_start),(long)max_texts);
+ (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts);
printf(_("%ld tokens (out of %ld)\n"),
- (long)(max_tok_ptr-tok_mem),(long)max_toks);
+ (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks);
printf(_("%ld levels (out of %ld)\n"),
- (long)(max_stack_ptr-stack),(long)stack_size);
+ (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size);
puts(_("Sorting:"));
printf(_("%ld levels (out of %ld)\n"),
- (long)(max_sort_ptr-scrap_info),(long)max_scraps);
-}
+ (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps);
@z
@x
@** Index.
@y
-@** Extensions for modern {\tt CWEB}. The following sections introduce changes
-and extensions to the code that have been created by numerous contributors over
-the course of a quarter century. They make \.{CWEB} adhere to modern coding
-standards and introduce new or improved features.
+@** Extensions to \.{CWEB}. The following sections introduce new or improved
+features that have been created by numerous contributors over the course of a
+quarter century.
\bigskip
\font\itt=cmitt10
@@ -3124,57 +1901,25 @@ standards and introduce new or improved features.
modified material is incorporated all over the place, without taking special
care for keeping the original section numbering intact.}
-@* Set {\tt CWEAVE} flags.
-At least one of these is already used in \.{COMMON}.
+@* Formatting alternatives.
+\.{CWEAVE} indents declarations after old-style function definitions.
+With the \.{-i} option they will come out flush left. You won't see
+any difference if you use ANSI-style function definitions.
+
+@d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */
@<Set init...@>=
- make_xrefs=force_lines=make_pb=indent_param_decl=order_decl_stmt=1;
- /* controlled by command-line options */
+indent_param_decl=true;
+
+@ The original manual described the \.{-o} option for \.{CWEAVE}, but this was
+not yet present. Here is a simple implementation. The purpose is to suppress
+the extra space between local variable declarations and the first statement in
+a function block.
-@* Function declarations. Here are declarations---conforming to
-{\mc ANSI~C}---of all functions in this code, as far as they are
-not already in |"common.h"|. These are private to \.{CWEAVE} and \.{CTWILL}.
+@d order_decl_stmt flags['o'] /* should declarations and statements be separated? */
-@<Predecl...@>=
-static eight_bits copy_TeX(void);@/
-static eight_bits get_output(void);@/
-static eight_bits skip_TeX(void);@/
-static text_pointer C_translate(void);@/
-static text_pointer translate(void);@/
-static token_pointer find_first_ident(text_pointer);@/
-static void app_str(const char *);@/
-static void big_app(token);@/
-static void big_app1(scrap_pointer);@/
-static void copy_limbo(void);@/
-static void C_parse(eight_bits);@/
-static void finish_line(void);@/
-static void flush_buffer(char *,boolean,boolean);@/
-static void make_reserved(scrap_pointer);@/
-static void make_underlined(scrap_pointer);@/
-static void new_section_xref(name_pointer);@/
-static void new_xref(name_pointer);@/
-static void outer_parse(void);@/
-static void output_C(void);@/
-static void out_name(name_pointer,boolean);@/
-static void out_section(sixteen_bits);@/
-static void out_str(const char *);@/
-static void pop_level(void);@/
-static void print_cat(eight_bits);@/
-#ifdef DEAD_CODE
-static void print_text(text_pointer p);@/
-#endif
-static void push_level(text_pointer);@/
-static void reduce(scrap_pointer,short,eight_bits,short,short);@/
-static void set_file_flag(name_pointer);@/
-static void skip_limbo(void);@/
-static void squash(scrap_pointer,short,eight_bits,short,short);@/
-static void update_node(name_pointer p);@/
-
-@* Language setting. This global variable is defined and set in \.{COMMON} by
-the `\.{+l}' (or `\.{-l}') command-line option.
-
-@<Global var...@>=
-extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */
+@<Set init...@>=
+order_decl_stmt=true;
@* Output file update. Most \CEE/ projects are controlled by a
\.{Makefile} that automatically takes care of the temporal dependecies
diff --git a/Build/source/texk/web2c/cwebdir/ctwill.bux b/Build/source/texk/web2c/cwebdir/ctwill.bux
index a237a266023..d5a678dba53 100644
--- a/Build/source/texk/web2c/cwebdir/ctwill.bux
+++ b/Build/source/texk/web2c/cwebdir/ctwill.bux
@@ -1,90 +1,88 @@
-@$program {COMMON.W}2 \&{int}@>
-@$ctangle {COMMON.W}2 \&{int}@>
-@$ctwill {COMMON.W}2 \&{int}@>
-@$cweave {COMMON.W}2 \&{int}@>
-@$phase {COMMON.W}3 \&{int}@>
-@$common_init {COMMON.W}4 \&{void} (\,)@>
-@$id_first {COMMON.W}6 \&{char} ${*}$@>
-@$id_loc {COMMON.W}6 \&{char} ${*}$@>
-@$section_text {COMMON.W}6 \&{char} [\,][\,]@>
-@$section_text_end {COMMON.W}6 \&{char} ${*}$@>
-@$buffer {COMMON.W}7 \&{char} [\,]@>
-@$buffer_end {COMMON.W}7 \&{char} ${*}$@>
-@$limit {COMMON.W}7 \&{char} ${*}$@>
-@$loc {COMMON.W}7 \&{char} ${*}$@>
-
-@$include_depth {COMMON.W}10 \&{int}@>
-@$file {COMMON.W}10 \&{FILE} ${*}$ [\,]@>
-@$change_file {COMMON.W}10 \&{FILE} ${*}$@>
-@$file_name {COMMON.W}10 \&{char} [\,][\,]@>
-@$change_file_name {COMMON.W}10 \&{char} [\,]@>
-@$alt_file_name {COMMON.W}10 \&{char} [\,]@>
-@$line {COMMON.W}10 \&{int} [\,]@>
-@$change_line {COMMON.W}10 \&{int}@>
-@$change_depth {COMMON.W}10 \&{int}@>
-@$input_has_ended {COMMON.W}10 \&{boolean}@>
-@$changing {COMMON.W}10 \&{boolean}@>
-@$web_file_open {COMMON.W}10 \&{boolean}@>
-
-@$reset_input {COMMON.W}18 \&{void} (\,)@>
-
-@$section_count {COMMON.W}20 \&{sixteen\_bits}@>
-@$changed_section {COMMON.W}20 \&{boolean} [\,]@>
-@$change_pending {COMMON.W}20 \&{boolean}@>
-@$print_where {COMMON.W}20 \&{boolean}@>
-@$get_line {COMMON.W}21 \&{boolean} (\,)@>
-
-@$check_complete {COMMON.W}26 \&{void} (\,)@>
-@$byte_mem {COMMON.W}27 \&{char} [\,]@>
-@$byte_mem_end {COMMON.W}27 \&{char} ${*}$@>
-@$name_dir {COMMON.W}27 \&{name\_info} [\,]@>
-@$name_dir_end {COMMON.W}27 \&{name\_pointer}@>
-
-@$byte_ptr {COMMON.W}29 \&{char} ${*}$@>
-@$name_ptr {COMMON.W}29 \&{name\_pointer}@>
-
-@$h {COMMON.W}32 \&{hash\_pointer}@>
-@$hash {COMMON.W}32 \&{name\_pointer} [\,]@>
-@$hash_end {COMMON.W}32 \&{hash\_pointer}@>
-
-@$id_lookup {COMMON.W}35 \&{name\_pointer} (\,)@>
-
-@$print_section_name {COMMON.W}42 \&{void} (\,)@>
-@$sprint_section_name {COMMON.W}43 \&{void} (\,)@>
-@$print_prefix_name {COMMON.W}44 \&{void} (\,)@>
-
-@$section_lookup {COMMON.W}49 \&{name\_pointer} (\,)@>
-
-@$history {COMMON.W}56 \&{int}@>
-
-@$err_print {COMMON.W}58 \&{void} (\,)@>
-
-@$wrap_up {COMMON.W}60 \&{int} (\,)@>
-
-@$fatal {COMMON.W}64 \&{void} (\,)@>
-@$overflow {COMMON.W}65 \&{void} (\,)@>
-
-@$argc {COMMON.W}67 \&{int}@>
-@$argv {COMMON.W}67 \&{char} ${**}$@>
-@$C_file_name {COMMON.W}67 \&{char} [\,]@>
-@$tex_file_name {COMMON.W}67 \&{char} [\,]@>
-@$idx_file_name {COMMON.W}67 \&{char} [\,]@>
-@$scn_file_name {COMMON.W}67 \&{char} [\,]@>
-@$check_file_name {COMMON.W}67 \&{char} [\,]@>
-@$flags {COMMON.W}67 \&{boolean} [\,]@>
-@$use_language {COMMON.W}67 \&{const char} ${*}$@>
-
-@$C_file {COMMON.W}77 \&{FILE} ${*}$@>
-@$tex_file {COMMON.W}77 \&{FILE} ${*}$@>
-@$idx_file {COMMON.W}77 \&{FILE} ${*}$@>
-@$scn_file {COMMON.W}77 \&{FILE} ${*}$@>
-@$check_file {COMMON.W}77 \&{FILE} ${*}$@>
-@$active_file {COMMON.W}77 \&{FILE} ${*}$@>
-
-@$cb_banner {COMMON.W}86 \&{char} [\,]@>
-
-@$cb_show_banner {COMMON.W}95 \&{void} (\,)@>
+@$program {COMMON.W}18 \&{int}@>
+@$ctangle {COMMON.W}18 \&{int}@>
+@$ctwill {COMMON.W}18 \&{int}@>
+@$cweave {COMMON.W}18 \&{int}@>
+@$phase {COMMON.W}19 \&{int}@>
+@$common_init {COMMON.W}20 \&{void} (\,)@>
+@$id_first {COMMON.W}21 \&{char} ${*}$@>
+@$id_loc {COMMON.W}21 \&{char} ${*}$@>
+@$section_text {COMMON.W}21 \&{char} [\,][\,]@>
+@$section_text_end {COMMON.W}21 \&{char} ${*}$@>
+@$buffer {COMMON.W}22 \&{char} [\,]@>
+@$buffer_end {COMMON.W}22 \&{char} ${*}$@>
+@$limit {COMMON.W}22 \&{char} ${*}$@>
+@$loc {COMMON.W}22 \&{char} ${*}$@>
+
+@$include_depth {COMMON.W}25 \&{int}@>
+@$file {COMMON.W}25 \&{FILE} ${*}$ [\,]@>
+@$change_file {COMMON.W}25 \&{FILE} ${*}$@>
+@$file_name {COMMON.W}25 \&{char} [\,][\,]@>
+@$change_file_name {COMMON.W}25 \&{char} [\,]@>
+@$alt_web_file_name {COMMON.W}25 \&{char} [\,]@>
+@$line {COMMON.W}25 \&{int} [\,]@>
+@$change_line {COMMON.W}25 \&{int}@>
+@$change_depth {COMMON.W}25 \&{int}@>
+@$input_has_ended {COMMON.W}25 \&{boolean}@>
+@$changing {COMMON.W}25 \&{boolean}@>
+@$web_file_open {COMMON.W}25 \&{boolean}@>
+
+@$reset_input {COMMON.W}35 \&{void} (\,)@>
+
+@$section_count {COMMON.W}37 \&{sixteen\_bits}@>
+@$changed_section {COMMON.W}37 \&{boolean} [\,]@>
+@$change_pending {COMMON.W}37 \&{boolean}@>
+@$print_where {COMMON.W}37 \&{boolean}@>
+@$get_line {COMMON.W}38 \&{boolean} (\,)@>
+
+@$check_complete {COMMON.W}42 \&{void} (\,)@>
+@$byte_mem {COMMON.W}43 \&{char} [\,]@>
+@$byte_mem_end {COMMON.W}43 \&{char} ${*}$@>
+@$name_dir {COMMON.W}43 \&{name\_info} [\,]@>
+@$name_dir_end {COMMON.W}43 \&{name\_pointer}@>
+
+@$byte_ptr {COMMON.W}44 \&{char} ${*}$@>
+@$name_ptr {COMMON.W}44 \&{name\_pointer}@>
+
+@$h {COMMON.W}46 \&{hash\_pointer}@>
+@$hash {COMMON.W}46 \&{name\_pointer} [\,]@>
+@$hash_end {COMMON.W}46 \&{hash\_pointer}@>
+
+@$id_lookup {COMMON.W}48 \&{name\_pointer} (\,)@>
+
+@$print_section_name {COMMON.W}52 \&{void} (\,)@>
+@$sprint_section_name {COMMON.W}53 \&{void} (\,)@>
+@$print_prefix_name {COMMON.W}54 \&{void} (\,)@>
+
+@$section_lookup {COMMON.W}59 \&{name\_pointer} (\,)@>
+
+@$history {COMMON.W}65 \&{int}@>
+
+@$err_print {COMMON.W}66 \&{void} (\,)@>
+
+@$wrap_up {COMMON.W}68 \&{int} (\,)@>
+
+@$fatal {COMMON.W}70 \&{void} (\,)@>
+@$overflow {COMMON.W}71 \&{void} (\,)@>
+
+@$argc {COMMON.W}73 \&{int}@>
+@$argv {COMMON.W}73 \&{char} ${**}$@>
+@$C_file_name {COMMON.W}73 \&{char} [\,]@>
+@$tex_file_name {COMMON.W}73 \&{char} [\,]@>
+@$idx_file_name {COMMON.W}73 \&{char} [\,]@>
+@$scn_file_name {COMMON.W}73 \&{char} [\,]@>
+@$check_file_name {COMMON.W}73 \&{char} [\,]@>
+@$flags {COMMON.W}73 \&{boolean} [\,]@>
+@$use_language {COMMON.W}86 \&{const char} ${*}$@>
+
+@$C_file {COMMON.W}83 \&{FILE} ${*}$@>
+@$tex_file {COMMON.W}83 \&{FILE} ${*}$@>
+@$idx_file {COMMON.W}83 \&{FILE} ${*}$@>
+@$scn_file {COMMON.W}83 \&{FILE} ${*}$@>
+@$check_file {COMMON.W}83 \&{FILE} ${*}$@>
+@$active_file {COMMON.W}83 \&{FILE} ${*}$@>
+
+@$cb_banner {COMMON.W}87 \&{char} [\,]@>
+
+@$cb_show_banner {COMMON.W}99 \&{void} (\,)@>
@$versionstring "<lib/lib.h>" \zip@>
-
-@$skip_comment {}108 =\\{copy\_comment}@>
diff --git a/Build/source/texk/web2c/cwebdir/cweav-bs.ch b/Build/source/texk/web2c/cwebdir/cweav-bs.ch
index 8c4c1fe8ff3..f34372fd035 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-bs.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-bs.ch
@@ -20,16 +20,16 @@ This file contributed by Barry Schwartz, trashman@crud.mn.org, 28 Jun 94.
The ``banner line'' defined here should be changed whenever \.{CWEAVE}
is modified.
-@d banner "This is CWEAVE (Version 3.64)\n"
+@d banner "This is CWEAVE (Version 4.0)"
@y
The ``banner line'' defined here should be changed whenever \.{CWEAVE}
is modified.
-@d banner "This is CWEAVE (Version 3.64pc/big)\n"
+@d banner "This is CWEAVE (Version 4.0pc/big)"
@z
-@x Section 9.
+@x Section 7.
@d chunk_marker 0
@<Common code...@>=
@@ -41,7 +41,7 @@ typedef struct name_info {
names */
char Ilk; /* used by identifiers in \.{CWEAVE} only */
} dummy;
- char *equiv_or_xref; /* info corresponding to names */
+ void *equiv_or_xref; /* info corresponding to names */
} name_info; /* contains information about an identifier or section name */
typedef name_info *name_pointer; /* pointer into array of \&{name\_info}s */
typedef name_pointer *hash_pointer;
@@ -54,9 +54,6 @@ extern char *byte_ptr; /* first unused position in |byte_mem| */
extern name_pointer hash[]; /* heads of hash lists */
extern hash_pointer hash_end; /* end of |hash| */
extern hash_pointer h; /* index into hash-head array */
-extern name_pointer id_lookup(); /* looks up a string in the identifier table */
-extern name_pointer section_lookup(); /* finds section name */
-extern void print_section_name(), sprint_section_name();
@y
@d chunk_marker 0
@@ -87,13 +84,10 @@ extern char huge* byte_ptr; /* first unused position in |byte_mem| */
extern name_pointer hash[]; /* heads of hash lists */
extern hash_pointer hash_end; /* end of |hash| */
extern hash_pointer h; /* index into hash-head array */
-extern name_pointer id_lookup(); /* looks up a string in the identifier table */
-extern name_pointer section_lookup(); /* finds section name */
-extern void print_section_name(), sprint_section_name();
@z
-@x Section 18.
+@x Section 22.
typedef struct xref_info {
sixteen_bits num; /* section number plus zero or |def_flag| */
struct xref_info *xlink; /* pointer to the previous cross-reference */
@@ -108,7 +102,7 @@ typedef xref_info huge* xref_pointer;
@z
-@x Section 19.
+@x Section 23.
xref_info xmem[max_refs]; /* contains cross-reference information */
xref_pointer xmem_end = xmem+max_refs-1;
@y
@@ -117,52 +111,24 @@ xref_pointer xmem_end;
@z
-@x Section 20.
+@x Section 24.
@d xref equiv_or_xref
@y
@d xref ptr_union.xref_member
@z
-@x Section 20.
-xref_ptr=xmem; name_dir->xref=(char*)xmem; xref_switch=0; section_xref_switch=0;
+@x Section 24.
+xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0;
xmem->num=0; /* sentinel value */
@y
xmem_end = xmem + max_refs - 1;
-xref_ptr=xmem; name_dir->xref=(char*)xmem; xref_switch=0; section_xref_switch=0;
+xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0;
xmem->num=0; /* sentinel value */
@z
-@x Section 21.
- append_xref(m); xref_ptr->xlink=q; p->xref=(char*)xref_ptr;
-@y
- append_xref(m); xref_ptr->xlink=q; p->xref=(char huge*)xref_ptr;
-@z
-
-
-@x Section 22.
- if (r==xmem) p->xref=(char*)xref_ptr;
-@y
- if (r==xmem) p->xref=(char huge*)xref_ptr;
-@z
-
-
-@x Section 23.
- q=(xref_pointer)p->xref;
- if (q->num==file_flag) return;
- append_xref(file_flag);
- xref_ptr->xlink = q;
- p->xref = (char *)xref_ptr;
-@y
- q=(xref_pointer)p->xref;
- if (q->num==file_flag) return;
- append_xref(file_flag);
- xref_ptr->xlink = q;
- p->xref = (char huge*)xref_ptr;
-@z
-
-@x Section 25. (to please Borland's C++, version 4.02)
+@x Section 30. (to please Borland's C++, version 4.02)
token tok_mem[max_toks]; /* tokens */
token_pointer tok_mem_end = tok_mem+max_toks-1; /* end of |tok_mem| */
token_pointer tok_start[max_texts]; /* directory into |tok_mem| */
@@ -180,9 +146,10 @@ text_pointer tok_start_end; /* end of |tok_start| */
token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
@z
-@x Section 26. (goes with the previous change)
-tok_start[1]=tok_mem+1;
-max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
+@x Section 31. (goes with the previous change)
+tok_ptr=max_tok_ptr=tok_mem+1;@/
+tok_start[0]=tok_start[1]=tok_mem+1;@/
+text_ptr=max_text_ptr=tok_start+1;
@y
tok_start[1]=tok_mem+1;
tok_mem_end=tok_mem+max_toks-1;
@@ -191,27 +158,20 @@ max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
@z
-@x Section 27.
- p->ilk=t; p->xref=(char*)xmem;
+@x Section 32.
+ p->xref=(void *)xmem;
@y
- p->ilk=t; p->xref=(char huge*)xmem;
+ p->xref=(void huge*)xmem;
@z
-@x Section 27.
- p->xref=(char*)xmem;
-@y
- p->xref=(char huge*)xmem;
-@z
-
-
-@x Section 70.
+@x Section 74.
if (unindexed(lhs)) { /* retain only underlined entries */
xref_pointer q,r=NULL;
for (q=(xref_pointer)lhs->xref;q>xmem;q=q->xlink)
if (q->num<def_flag)
if (r) r->xlink=q->xlink;
- else lhs->xref=(char*)q->xlink;
+ else lhs->xref=(void *)q->xlink;
else r=q;
}
@y
@@ -220,13 +180,13 @@ max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
for (q=(xref_pointer)lhs->xref;q>xmem;q=q->xlink)
if (q->num<def_flag)
if (r) r->xlink=q->xlink;
- else lhs->xref=(char huge*)q->xlink;
+ else lhs->xref=(void huge*)q->xlink;
else r=q;
}
@z
-@x Section 87.
+@x Section 93.
char *k, *k_end=(p+1)->byte_start; /* pointers into |byte_mem| */
out('{');
for (k=p->byte_start; k<k_end; k++) {
@@ -237,66 +197,40 @@ max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
@z
-@x Section 116.
- append_xref(0); /* this number doesn't matter */
- xref_ptr->xlink=(xref_pointer)p->xref; r=xref_ptr;
- p->xref=(char*)xref_ptr;
- while (r->xlink!=q) {r->num=r->xlink->num; r=r->xlink;}
- r->num=m; /* everything from |q| on is left undisturbed */
-@y
- append_xref(0); /* this number doesn't matter */
- xref_ptr->xlink=(xref_pointer)p->xref; r=xref_ptr;
- p->xref=(char huge*)xref_ptr;
- while (r->xlink!=q) {r->num=r->xlink->num; r=r->xlink;}
- r->num=m; /* everything from |q| on is left undisturbed */
-@z
-
-
-@x Section 163.
-@ @<Change |pp| to $\max...@>=
-@y
-@ @<Change |pp| to $\max...@>=
-#ifdef __MSDOS__
-if (d<0 && pp+d>pp) pp=scrap_base; /* segmented architecture caused wrap */
-else
-#endif
-@z
-
-
-@x Section 194.
+@x Section 209.
char *p; /* index into |byte_mem| */
@y
char huge *p; /* index into |byte_mem| */
@z
-@x Section 229.
- if (cur_name->xref!=(char*)xmem) {
+@x Section 244.
+ if (cur_name->xref!=(void *)xmem) {
@y
- if (cur_name->xref!=(char huge*)xmem) {
+ if (cur_name->xref!=(void huge*)xmem) {
@z
-@x Section 232.
+@x Section 246.
char *cur_byte; /* index into |byte_mem| */
@y
char huge* cur_byte; /* index into |byte_mem| */
@z
-@x Section 241.
+@x Section 255.
switch (cur_name->ilk) {
- case normal: if (is_tiny(cur_name)) out_str("\\|");
+ case normal: case func_template: if (is_tiny(cur_name)) out_str("\\|");
else {char *j;
@y
switch (cur_name->ilk) {
- case normal: if (is_tiny(cur_name)) out_str("\\|");
+ case normal: case func_template: if (is_tiny(cur_name)) out_str("\\|");
else {char huge* j;
@z
-@x Section 241.
- case custom: case quoted: {char *j; out_str("$\\");
+@x Section 255.
+ case custom: {char *j; out_str("$\\");
@y
- case custom: case quoted: {char huge* j; out_str("$\\");
+ case custom: {char huge* j; out_str("$\\");
@z
diff --git a/Build/source/texk/web2c/cwebdir/cweav-man.ch b/Build/source/texk/web2c/cwebdir/cweav-man.ch
index 6cfcc8fe2d2..b72360944a2 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-man.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-man.ch
@@ -16,7 +16,7 @@ under the terms of a permission notice identical to this one.
}
@y
\def\botofcontents{\vfill\titlefalse}
-\def\contentspagenumber{109}
+\def\contentspagenumber{111}
\def\title{APPENDIX F: CWEAVE}
\let\K=\leftarrow
@z
diff --git a/Build/source/texk/web2c/cwebdir/cweav-pc.ch b/Build/source/texk/web2c/cwebdir/cweav-pc.ch
index 28cd94f5a3f..64508e23697 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-pc.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-pc.ch
@@ -11,29 +11,18 @@ that allows >64K arrays. (If you need lots more bytes, try the alternate
change files that have -bs in their name instead of -pc.)
@x section 1
-@d banner "This is CWEAVE (Version 3.64)\n"
+@d banner "This is CWEAVE (Version 4.0)"
@y
-@d banner "This is CWEAVE (Version 3.64pc)\n"
+@d banner "This is CWEAVE (Version 4.0pc)"
@z
@x section 4
-@d max_bytes 90000 /* the number of bytes in identifiers,
+@d max_bytes 1000000 /* the number of bytes in identifiers,
@y
@d max_bytes (unsigned)60000 /* the number of bytes in identifiers,
@z
@x
-@d max_refs 20000 /* number of cross-references; must be less than 65536 */
+@d max_refs 65535 /* number of cross-references; must be less than 65536 */
@y
@d max_refs 10000 /* number of cross-references; must be less than 65536 */
@z
-
-@x section 163
-@ @<Change |pp| to $\max...@>=
-@y
-@ @<Change |pp| to $\max...@>=
-#ifdef __MSDOS__
-if (d<0 && pp+d>pp) pp=scrap_base; /* segmented architecture caused wrap */
-else
-#endif
-@z
-
diff --git a/Build/source/texk/web2c/cwebdir/cweav-ql.ch b/Build/source/texk/web2c/cwebdir/cweav-ql.ch
index 3e37ba23522..b61e570c2c9 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-ql.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-ql.ch
@@ -7,15 +7,15 @@ ex <dev_>cc;"-v -h -c =500000 cweave_c"
@x
-\def\title{CWEAVE (Version 3.64)}
+\def\title{CWEAVE (Version 4.0)}
@y
-\def\title{CWEAVE (QL Version 3.64)}
+\def\title{CWEAVE (QL Version 4.0)}
@z
@x section 1
-@d banner "This is CWEAVE (Version 3.64)\n"
+@d banner "This is CWEAVE (Version 4.0)"
@y
-@d banner "This is CWEAVE (QL Version 3.64)\n"
+@d banner "This is CWEAVE (QL Version 4.0)"
@z
@x
diff --git a/Build/source/texk/web2c/cwebdir/cweav-vms.ch b/Build/source/texk/web2c/cwebdir/cweav-vms.ch
index b6f46559cc5..8f0535917d1 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-vms.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-vms.ch
@@ -13,25 +13,26 @@ modified:
(also modified by Don Knuth to keep version numbers uptodate)
@x section 1 (01-FEB-1992 ST)
-@d banner "This is CWEAVE (Version 3.64)\n"
+@d banner "This is CWEAVE (Version 4.0)"
@y
-@d banner "This is CWEAVE (VAX/VMS Version 3.64)\n"
+@d banner "This is CWEAVE (VAX/VMS Version 4.0)"
@z
-@x section 6 (from common.h) (01-FEB-1992 ST)
-#include <stdio.h>
+@x section 3 (01-FEB-1992 ST)
+#include <ctype.h> /* definition of |@!isalpha|, |@!isdigit| and so on */
+#include <stdbool.h> /* definition of |@!bool|, |@!true| and |@!false| */
+#include <stddef.h> /* definition of |@!ptrdiff_t| */
+#include <stdint.h> /* definition of |@!uint8_t| and |@!uint16_t| */
+#include <stdlib.h> /* definition of |@!getenv| and |@!exit| */
+#include <stdio.h> /* definition of |@!printf| and friends */
+#include <string.h> /* definition of |@!strlen|, |@!strcmp| and so on */
@y
-#include stdio /* VMS searches Textlibraries faster */
-@z
-
-@x section 38 (1991 JM) (01-FEB-1992 ST)
-#include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
-@y
-#include ctype /* VMS searches Textlibraries faster */
-@z
-
-@x section 39 (01-FEB-1992 ST)
-@d isxalpha(c) ((c)=='_') /* non-alpha character allowed in identifier */
-@y
-@d isxalpha(c) ((c)=='_' || (c)=='$') /* non-alpha characters allowed in id */
+#include ctype /* definition of |@!isalpha|, |@!isdigit| and so on */
+ /* VMS searches text libraries faster */
+#include stdbool /* definition of |@!bool|, |@!true| and |@!false| */
+#include stddef /* definition of |@!ptrdiff_t| */
+#include stdint /* definition of |@!uint8_t| and |@!uint16_t| */
+#include stdlib /* definition of |@!getenv| and |@!exit| */
+#include stdio /* definition of |@!printf| and friends */
+#include string /* definition of |@!strlen|, |@!strcmp| and so on */
@z
diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch
index 22e44e5a250..4ff1c15f3f0 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch
@@ -1,30 +1,31 @@
-@q Changes for CWEB in TeX Live from numerous contributors. @>
-@q This file is in the Public Domain. @>
+@q Changes for CWEB in TeX Live from numerous contributors. @>
+@q This file is in the Public Domain. @>
-@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
-@q were merged with the set of change files of the CWEBbin project; @>
-@q see https://github.com/ascherer/cwebbin for the original parts. @>
+@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
+@q were merged with the set of change files of the CWEBbin project; @>
+@q see https://github.com/ascherer/cwebbin for the original parts. @>
-@q This stripped change file {comm,ctang,cweav,ctwill}-w2c.ch has been @>
-@q created from the set of change files {comm,ctang,cweav}-patch.ch, @>
-@q {comm,ctang,cweav}-ansi.ch, {comm,ctang,cweav}-extensions.ch, @>
-@q {comm,ctang,cweav}-output.ch, {comm,ctang,cweav}-i18n.ch, and @>
-@q cweav-twill.ch for CTWILL, and {comm,ctang,cweav,ctwill}-texlive.ch @>
-@q with the 'tie' processor and is used as a monolithic changefile for @>
-@q {common,ctangle,cweave}.w in TeX Live. @>
+@q This stripped change file {comm,ctang,cweav,ctwill,cwebman}-w2c.ch @>
+@q has been created from the elaborate set of change files @>
+@q {comm,ctang,cweav,cwebman}-patch.ch, @>
+@q {comm,cweav,cwebman}-extensions.ch, {comm,ctang,cweav}-output.ch, @>
+@q {comm,ctang,cweav}-i18n.ch, and cweav-twill.ch for CTWILL, and @>
+@q {comm,ctang,cweav,ctwill,cwebman}-texlive.ch with the 'tie' processor @>
+@q and is used as a monolithic changefile for {common,ctangle,cweave}.w @>
+@q and cwebman.tex in TeX Live. @>
-@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
+@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
@x
-\def\title{CWEAVE (Version 3.64)}
+\def\title{CWEAVE (Version 4.0)}
@y
-\def\title{CWEAVE (Version 3.64 [\TeX~Live])}
+\def\title{CWEAVE (Version 4.0 [\TeX~Live])}
@z
@x
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
@y
- \centerline{(Version 3.64 [\TeX~Live])}
+ \centerline{(Version 4.0 [\TeX~Live])}
@z
@x
@@ -36,348 +37,35 @@
@x
}
@y
-}}
-\datecontentspage
+}}\datecontentspage
@z
@x
-@s not_eq normal @q unreserve a C++ keyword @>
+@d banner "This is CWEAVE (Version 4.0)"
@y
-@z
-
-@x
-@d banner "This is CWEAVE (Version 3.64)\n"
-@y
-@d banner "This is CWEAVE, Version 3.64"
+@d banner "This is CWEAVE, Version 4.0"
/* will be extended by the \TeX~Live |versionstring| */
@z
@x
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-@y
-@ For string handling we include the {\mc ANSI C} system header file instead
-of predeclaring the standard system functions |@!strlen|, |@!strcmp|,
-|@!strcpy|, |@!strncmp|, and |@!strncpy|.
-@^system dependencies@>
-
-@<Include files@>=
-#include <string.h>
-@z
-
-@x
-int main (ac, av)
-int ac; /* argument count */
-char **av; /* argument values */
-@y
-int main (@t\1\1@>
-int ac, /* argument count */
-char **av@t\2\2@>) /* argument values */
-@z
-
-@x
- make_xrefs=force_lines=make_pb=1; /* controlled by command-line options */
- common_init();
- @<Set initial values@>;
-@y
- @<Set initial values@>;
- common_init();
- @<Start \TEX/ output@>;
-@z
-
-@x
- if (show_banner) printf(banner); /* print a ``banner line'' */
+ if (show_banner) puts(banner); /* print a ``banner line'' */
@y
if (show_banner) cb_show_banner(); /* print a ``banner line'' */
@z
@x
-@d max_bytes 90000 /* the number of bytes in identifiers,
-@y
-@d max_bytes 1000000 /* the number of bytes in identifiers,
-@z
-
-@x
-@d max_names 4000 /* number of identifiers, strings, section names;
-@y
-@d max_names 10239 /* number of identifiers, strings, section names;
-@z
-
-@x
-@d max_sections 2000 /* greater than the total number of sections */
-@d hash_size 353 /* should be prime */
-@d buf_size 100 /* maximum length of input line, plus one */
-@y
-@d max_sections 10239 /* greater than the total number of sections */
-@d hash_size 8501 /* should be prime */
-@d buf_size 1000 /* maximum length of input line, plus one */
-@z
-
-@x
-@d max_refs 20000 /* number of cross-references; must be less than 65536 */
-@d max_toks 20000 /* number of symbols in \CEE/ texts being parsed;
-@y
-@d max_refs 65535 /* number of cross-references; must be less than 65536 */
-@d max_toks 65535 /* number of symbols in \CEE/ texts being parsed;
-@z
-
-@x
-@d max_texts 4000 /* number of phrases in \CEE/ texts being parsed;
-@y
-@d max_texts 10239 /* number of phrases in \CEE/ texts being parsed;
-@z
-
-@x
-@d max_scraps 2000 /* number of tokens in \CEE/ texts being parsed */
-@d stack_size 400 /* number of simultaneous output levels */
-@y
-@d max_scraps 10000 /* number of tokens in \CEE/ texts being parsed */
-@d stack_size 2000 /* number of simultaneous output levels */
-@z
-
-@x
@i common.h
@y
@i comm-w2c.h
@z
@x
-xref_ptr=xmem; name_dir->xref=(char*)xmem; xref_switch=0; section_xref_switch=0;
-@y
-xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0;
-@z
-
-@x
@d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference");
@y
@d append_xref(c) if (xref_ptr==xmem_end) overflow(_("cross-reference"));
@z
@x
-@d no_xref (flags['x']==0)
-@d make_xrefs flags['x'] /* should cross references be output? */
-@y
-@d no_xref (!make_xrefs) /* should cross references be suppressed? */
-@z
-
-@x
-void
-new_xref(p)
-name_pointer p;
-@y
-static void
-new_xref(
-name_pointer p)
-@z
-
-@x
- append_xref(m); xref_ptr->xlink=q; p->xref=(char*)xref_ptr;
-@y
- append_xref(m); xref_ptr->xlink=q; update_node(p);
-@z
-
-@x
-void
-new_section_xref(p)
-name_pointer p;
-@y
-static void
-new_section_xref(
-name_pointer p)
-@z
-
-@x
- if (r==xmem) p->xref=(char*)xref_ptr;
-@y
- if (r==xmem) update_node(p);
-@z
-
-@x
-void
-set_file_flag(p)
-name_pointer p;
-@y
-static void
-set_file_flag(
-name_pointer p)
-@z
-
-@x
- p->xref = (char *)xref_ptr;
-@y
- update_node(p);
-@z
-
-@x
-further details about them will be explained later. A |text_pointer| variable
-is an index into |tok_start|.
-@y
-further details about them will be explained later. A \&{text\_pointer}
-variable is an index into |tok_start|.
-@z
-
-@x
-tok_ptr=tok_mem+1; text_ptr=tok_start+1; tok_start[0]=tok_mem+1;
-tok_start[1]=tok_mem+1;
-max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
-@y
-tok_ptr=max_tok_ptr=tok_mem+1;@/
-tok_start[0]=tok_start[1]=tok_mem+1;@/
-text_ptr=max_text_ptr=tok_start+1;
-@z
-
-@x
-int names_match(p,first,l,t)
-name_pointer p; /* points to the proposed match */
-char *first; /* position of first character of string */
-int l; /* length of identifier */
-eight_bits t; /* desired ilk */
-@y
-boolean names_match(@t\1\1@>
-name_pointer p, /* points to the proposed match */
-const char *first, /* position of first character of string */
-size_t l, /* length of identifier */
-eight_bits t@t\2\2@>) /* desired |ilk| */
-@z
-
-@x
-void
-init_p(p,t)
-name_pointer p;
-eight_bits t;
-@y
-void
-init_p(
-name_pointer p,
-eight_bits t)
-@z
-
-@x
- p->ilk=t; p->xref=(char*)xmem;
-@y
- p->ilk=t; init_node(p);
-@z
-
-@x
-void
-init_node(p)
-name_pointer p;
-@y
-void
-init_node(
-name_pointer p)
-@z
-
-@x
- p->xref=(char*)xmem;
-}
-@y
- p->xref=(void *)xmem;
-}
-
-static void
-update_node(
-name_pointer p)
-{
- p->xref=(void *)xref_ptr;
-}
-@z
-
-@x
-void skip_limbo();
-@y
-static void skip_limbo(void);@/
-@z
-
-@x
-void
-skip_limbo() {
-@y
-static void
-skip_limbo(void) {
-@z
-
-@x
-unsigned
-skip_TeX() /* skip past pure \TEX/ code */
-@y
-static eight_bits
-skip_TeX(void) /* skip past pure \TEX/ code */
-@z
-
-@x
-eight_bits get_next();
-@y
-static eight_bits get_next(void);@/
-@z
-
-@x
-eight_bits
-get_next() /* produces the next input token */
-{@+eight_bits c; /* the current character */
-@y
-static eight_bits
-get_next(void) /* produces the next input token */
-{
- eight_bits c; /* the current character */
-@z
-
-@x
- else if (c=='\'' || c=='"' || (c=='L'&&(*loc=='\'' || *loc=='"'))@|
-@y
- else if (c=='\'' || c=='"'@|
- || ((c=='L' || c=='u' || c=='U')&&(*loc=='\'' || *loc=='"'))@|
- || ((c=='u' && *loc=='8')&&(*(loc+1)=='\'' || *(loc+1)=='"'))@|
-@z
-
-@x
- else if (*loc=='>') if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
- else compress(minus_gt); break;
-@y
- else { if (*loc=='>') { if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
- else compress(minus_gt); } } break;
-@z
-
-@x
- case '!': if (*loc=='=') compress(not_eq); break;
-@y
- case '!': if (*loc=='=') compress(non_eq); break;
-@z
-
-@x
- while (isalpha(*++loc) || isdigit(*loc) || isxalpha(*loc) || ishigh(*loc));
-@y
- while (isalpha((eight_bits)*++loc) || isdigit((eight_bits)*loc) @|
- || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc));
-@z
-
-@x
- *id_loc++='$'; *id_loc++=toupper(*loc); loc++;
-@y
- *id_loc++='$'; *id_loc++=toupper((eight_bits)*loc); loc++;
-@z
-
-@x
- if (delim=='L') { /* wide character constant */
- delim=*loc++; *++id_loc=delim;
- }
-@y
- if (delim=='L' || delim=='u' || delim=='U') { /* wide character constant */
- if (delim=='u' && *loc=='8') { *++id_loc=*loc++; }
- delim=*loc++; *++id_loc=delim;
- }
-@z
-
-@x
err_print("! String didn't end"); loc=limit; break;
@y
err_print(_("! String didn't end")); loc=limit; break;
@@ -390,19 +78,7 @@ get_next(void) /* produces the next input token */
@z
@x
- if (c=='\\') if (loc>=limit) continue;
- else if (++id_loc<=section_text_end) {
- *id_loc = '\\'; c=*loc++;
- }
-@y
- if (c=='\\') { if (loc>=limit) continue;
- else { if (++id_loc<=section_text_end) {
- *id_loc = '\\'; c=*loc++;
- } } }
-@z
-
-@x
- printf("\n! String too long: ");
+ fputs("\n! String too long: ",stdout);
@y
fputs(_("\n! String too long: "),stdout);
@z
@@ -414,21 +90,13 @@ get_next(void) /* produces the next input token */
@z
@x
- case xref_roman: case xref_wildcard: case xref_typewriter:
- case noop: case TeX_string: c=ccode[c]; skip_restricted(); return(c);
-@y
- case xref_roman: case xref_wildcard: case xref_typewriter: case noop:
- case TeX_string: c=ccode[(eight_bits)c]; skip_restricted(); return(c);
-@z
-
-@x
err_print("! Input ended in section name");
@y
err_print(_("! Input ended in section name"));
@z
@x
- printf("\n! Section name too long: ");
+ fputs("\n! Section name too long: ",stdout);
@y
fputs(_("\n! Section name too long: "),stdout);
@z
@@ -446,20 +114,6 @@ get_next(void) /* produces the next input token */
@z
@x
-void skip_restricted();
-@y
-void skip_restricted(void);@/
-@z
-
-@x
-void
-skip_restricted()
-@y
-void
-skip_restricted(void)
-@z
-
-@x
err_print("! Control text didn't end"); loc=limit;
@y
err_print(_("! Control text didn't end")); loc=limit;
@@ -478,68 +132,18 @@ skip_restricted(void)
@z
@x
-void phase_one();
-@y
-static void phase_one(void);@/
-@z
-
-@x
-void
-phase_one() {
-@y
-static void
-phase_one(void) {
-@z
-
-@x
if (++section_count==max_sections) overflow("section number");
@y
if (++section_count==max_sections) overflow(_("section number"));
@z
@x
-void C_xref();
-@y
-static void C_xref(eight_bits);@/
-@z
-
-@x
-void
-C_xref( spec_ctrl ) /* makes cross-references for \CEE/ identifiers */
- eight_bits spec_ctrl;
-@y
-static void
-C_xref(@t\1\1@> /* makes cross-references for \CEE/ identifiers */
- eight_bits spec_ctrl@t\2\2@>)
-@z
-
-@x
-void outer_xref();
-@y
-static void outer_xref(void);@/
-@z
-
-@x
-void
-outer_xref() /* extension of |C_xref| */
-@y
-static void
-outer_xref(void) /* extension of |C_xref| */
-@z
-
-@x
case translit_code: err_print("! Use @@l in limbo only"); continue;
@y
case translit_code: err_print(_("! Use @@l in limbo only")); continue;
@z
@x
- else lhs->xref=(char*)q->xlink;
-@y
- else lhs->xref=(void *)q->xlink;
-@z
-
-@x
err_print("! Missing left identifier of @@s");
@y
err_print(_("! Missing left identifier of @@s"));
@@ -552,81 +156,28 @@ outer_xref(void) /* extension of |C_xref| */
@z
@x
-void section_check();
-@y
-static void section_check(name_pointer);@/
-@z
-
-@x
-void
-section_check(p)
-name_pointer p; /* print anomalies in subtree |p| */
-@y
-static void
-section_check(
-name_pointer p) /* print anomalies in subtree |p| */
-@z
-
-@x
- printf("\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless;
+ fputs("\n! Never defined: <",stdout);
+ print_section_name(p); putchar('>'); mark_harmless;
@y
fputs(_("\n! Never defined: <"),stdout);
print_section_name(p); putchar('>'); mark_harmless;
@z
@x
- printf("\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless;
+ fputs("\n! Never used: <",stdout);
+ print_section_name(p); putchar('>'); mark_harmless;
@y
fputs(_("\n! Never used: <"),stdout);
print_section_name(p); putchar('>'); mark_harmless;
@z
@x
-If the |per_cent| parameter is 1 a |'%'| is appended to the line
-@y
-If the |per_cent| parameter is 1, a |'%'| is appended to the line
-@z
-
-@x
-@d tex_printf(c) fprintf(active_file,c)
-@y
-@d tex_printf(c) fprintf(active_file,"%s",c)
-@d tex_puts(c) fputs(c,active_file)
-@z
-
-@x
-void
-flush_buffer(b,per_cent,carryover)
-char *b; /* outputs from |out_buf+1| to |b|,where |b<=out_ptr| */
-boolean per_cent,carryover;
-@y
-static void
-flush_buffer(@t\1\1@>
-char *b, /* outputs from |out_buf+1| to |b|, where |b<=out_ptr| */
-boolean per_cent,boolean carryover@t\2\2@>)
-@z
-
-@x
- if (b<out_ptr) strncpy(out_buf+1,b+1,out_ptr-b);
-@y
- if (b<out_ptr) strncpy(out_buf+1,b+1,(size_t)(out_ptr-b));
-@z
-
-@x
-void
-finish_line() /* do this at the end of a line */
-@y
-static void
-finish_line(void) /* do this at the end of a line */
-@z
-
-@x
@ In particular, the |finish_line| procedure is called near the very
beginning of phase two. We initialize the output variables in a slightly
tricky way so that the first line of the output file will be
`\.{\\input cwebmac}'.
-@<Set init...@>=
+@<Start \TEX/...@>=
out_ptr=out_buf+1; out_line=1; active_file=tex_file;
*out_ptr='c'; tex_printf("\\input cwebma");
@y
@@ -649,102 +200,24 @@ tex_puts("cwebma");
@z
@x
-void
-out_str(s) /* output characters from |s| to end of string */
-char *s;
-@y
-static void
-out_str(@t\1\1@> /* output characters from |s| to end of string */
-const char*s@t\2\2@>)
-@z
-
-@x
-void break_out();
-@y
-static void break_out(void);@/
-@z
-
-@x
-void
-break_out() /* finds a way to break the output line */
-@y
-static void
-break_out(void) /* finds a way to break the output line */
-@z
-
-@x
printf("\n! Line had to be broken (output l. %d):\n",out_line);
@y
printf(_("\n! Line had to be broken (output l. %d):\n"),out_line);
@z
@x
-void
-out_section(n)
-sixteen_bits n;
-@y
-static void
-out_section(
-sixteen_bits n)
-@z
-
-@x
-void
-out_name(p,quote_xalpha)
-name_pointer p;
-boolean quote_xalpha;
-@y
-static void
-out_name(
-name_pointer p,
-boolean quote_xalpha)
-@z
-
-@x
-void
-copy_limbo()
-@y
-static void
-copy_limbo(void)
-@z
-
-@x
default: err_print("! Double @@ should be used in limbo");
@y
default: err_print(_("! Double @@ should be used in limbo"));
@z
@x
-eight_bits
-copy_TeX()
-@y
-static eight_bits
-copy_TeX(void)
-@z
-
-@x
@d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;}
@y
@d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow(_("token")); *(tok_ptr++)=c;}
@z
@x
-int copy_comment();
-@y
-static int copy_comment(boolean,int);@/
-@z
-
-@x
-int copy_comment(is_long_comment,bal) /* copies \TEX/ code in comments */
-boolean is_long_comment; /* is this a traditional \CEE/ comment? */
-int bal; /* brace balance */
-@y
-static int copy_comment(@t\1\1@> /* copies \TeX\ code in comments */
-boolean is_long_comment, /* is this a traditional \CEE/ comment? */
-int bal@t\2\2@>) /* brace balance */
-@z
-
-@x
err_print("! Input ended in mid-comment");
@y
err_print(_("! Input ended in mid-comment"));
@@ -775,163 +248,27 @@ int bal@t\2\2@>) /* brace balance */
@z
@x
-else if (c=='\\' && *loc!='@@')
- if (phase==2) app_tok(*(loc++))@; else loc++;
-@y
-else { if (c=='\\' && *loc!='@@') {
- if (phase==2) app_tok(*(loc++))@; else loc++; } }
-@z
-
-@x
-eight_bits cat_index;
-
-@ @<Set in...@>=
- for (cat_index=0;cat_index<255;cat_index++)
- strcpy(cat_name[cat_index],"UNKNOWN");
+static void print_text(text_pointer p);@/
@y
-
-@ @<Set in...@>=
-{int c; for (c=0;c<256;c++) strcpy(cat_name[c],"UNKNOWN");}
+#if 0
+static void print_text(text_pointer p);@/
+#endif
@z
@x
-void
-print_cat(c) /* symbolic printout of a category */
-eight_bits c;
-@y
static void
-print_cat(@t\1\1@> /* symbolic printout of a category */
-eight_bits c@t\2\2@>)
-@z
-
-@x
- printf(cat_name[c]);
-@y
- fputs(cat_name[c],stdout);
-@z
-
-@x
-void
-print_text(p) /* prints a token list for debugging; not used in |main| */
-text_pointer p;
+print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */
@y
-#ifdef DEAD_CODE /* not used in |main| */
+#if 0
static void
print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */
-text_pointer p@t\2\2@>)
@z
@x
- fflush(stdout);
}
@y
- update_terminal;
}
-#endif /* |DEAD_CODE| */
-@z
-
-@x
-@d app(a) *(tok_ptr++)=a
-@d app1(a) *(tok_ptr++)=tok_flag+(int)((a)->trans-tok_start)
-@y
-@d app(a) *(tok_ptr++)=(token)(a)
-@d app1(a) *(tok_ptr++)=(token)(tok_flag+(int)((a)->trans-tok_start))
-@z
-
-@x
-void
-app_str(s)
-char *s;
-@y
-static void
-app_str(
-const char *s)
-@z
-
-@x
-void
-big_app(a)
-token a;
-@y
-static void
-big_app(
-token a)
-@z
-
-@x
-void
-big_app1(a)
-scrap_pointer a;
-@y
-static void
-big_app1(
-scrap_pointer a)
-@z
-
-@x
- && pp->cat!=prerangle
-@y
- && pp->cat!=prerangle @|
-@z
-
-@x
- && pp->cat!=ftemplate
-@y
- && pp->cat!=ftemplate @|
-@z
-
-@x
-token_pointer
-find_first_ident(p)
-text_pointer p;
-@y
-static token_pointer
-find_first_ident(
-text_pointer p)
-@z
-
-@x
-void
-make_reserved(p) /* make the first identifier in |p->trans| like |int| */
-scrap_pointer p;
-@y
-static void
-make_reserved(@t\1\1@> /* make the first identifier in |p->trans| like |int| */
-scrap_pointer p@t\2\2@>)
-@z
-
-@x
-void
-make_underlined(p)
-/* underline the entry for the first identifier in |p->trans| */
-scrap_pointer p;
-@y
-static void
-make_underlined(@t\1\1@>
-/* underline the entry for the first identifier in |p->trans| */
-scrap_pointer p@t\2\2@>)
-@z
-
-@x
-void underline_xref();
-@y
-static void underline_xref(name_pointer);@/
-@z
-
-@x
-void
-underline_xref(p)
-name_pointer p;
-@y
-static void
-underline_xref(
-name_pointer p)
-@z
-
-@x
- p->xref=(char*)xref_ptr;
-@y
- update_node(p);
+#endif
@z
@x
@@ -941,12 +278,6 @@ if (cat1==lbrace || cat1==int_like || cat1==decl) {
reduce(pp,1,fn_decl,0,1);
}
@y
-\.{CWEAVE} indents declarations after old-style function definitions.
-With the \.{-i} option they will come out flush left. You won't see
-any difference if you use ANSI-style function definitions.
-
-@d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */
-
@<Cases for |exp|@>=
if(cat1==lbrace || cat1==int_like || cat1==decl) {
make_underlined(pp); big_app1(pp);
@@ -1014,14 +345,7 @@ else if (cat1==stmt || cat1==function) {
big_app1(pp+1); reduce(pp,2,cat1,-1,41);
}
@y
-@ The original manual described the \.{-o} option for \.{CWEAVE}, but this was
-not yet present. Here is a simple implementation. The purpose is to suppress
-the extra space between local variable declarations and the first statement in
-a function block.
-
-@d order_decl_stmt flags['o'] /* should declarations and statements be separated? */
-
-@<Cases for |decl|@>=
+@ @<Cases for |decl|@>=
if (cat1==decl) {
big_app1(pp); big_app(force); big_app1(pp+1);
reduce(pp,2,decl,-1,40);
@@ -1044,9 +368,7 @@ else if (cat1==stmt) {
big_app1(pp+1); reduce(pp,2,function,-1,52);
}
@y
-@ Outdent after parameter declarations with option \.{-i}.
-
-@<Cases for |fn_decl|@>=
+@ @<Cases for |fn_decl|@>=
if (cat1==decl) {
big_app1(pp); big_app(force); big_app1(pp+1); reduce(pp,2,fn_decl,0,51);
}
@@ -1061,34 +383,6 @@ else if (cat1==stmt) {
@z
@x
-void
-reduce(j,k,c,d,n)
-scrap_pointer j;
-eight_bits c;
-short k, d, n;
-@y
-static void
-reduce(
-scrap_pointer j, short k,
-eight_bits c,
-short d, short n)
-@z
-
-@x
-void
-squash(j,k,c,d,n)
-scrap_pointer j;
-eight_bits c;
-short k, d, n;
-@y
-static void
-squash(
-scrap_pointer j, short k,
-eight_bits c,
-short d, short n)
-@z
-
-@x
overflow("token");
@y
overflow(_("token"));
@@ -1101,38 +395,6 @@ short d, short n)
@z
@x
-{ scrap_pointer k; /* pointer into |scrap_info| */
- if (tracing==2) {
- printf("\n%d:",n);
- for (k=scrap_base; k<=lo_ptr; k++) {
- if (k==pp) putxchar('*'); else putxchar(' ');
- if (k->mathness %4 == yes_math) putchar('+');
- else if (k->mathness %4 == no_math) putchar('-');
- print_cat(k->cat);
- if (k->mathness /4 == yes_math) putchar('+');
- else if (k->mathness /4 == no_math) putchar('-');
-@y
-{ scrap_pointer k_l; /* pointer into |scrap_info| */
- if (tracing==2) {
- printf("\n%d:",n);
- for (k_l=scrap_base; k_l<=lo_ptr; k_l++) {
- if (k_l==pp) putxchar('*'); else putxchar(' ');
- if (k_l->mathness %4 == yes_math) putchar('+');
- else if (k_l->mathness %4 == no_math) putchar('-');
- print_cat(k_l->cat);
- if (k_l->mathness /4 == yes_math) putchar('+');
- else if (k_l->mathness /4 == no_math) putchar('-');
-@z
-
-@x
-text_pointer
-translate() /* converts a sequence of scraps */
-@y
-static text_pointer
-translate(void) /* converts a sequence of scraps */
-@z
-
-@x
if (tok_ptr+6>tok_mem_end) overflow("token");
@y
if (tok_ptr+6>tok_mem_end) overflow(_("token"));
@@ -1151,316 +413,42 @@ translate(void) /* converts a sequence of scraps */
@z
@x
-void
-C_parse(spec_ctrl) /* creates scraps from \CEE/ tokens */
- eight_bits spec_ctrl;
-@y
-static void
-C_parse(@t\1\1@> /* creates scraps from \CEE/ tokens */
- eight_bits spec_ctrl@t\2\2@>)
-@z
-
-@x
-switch (next_control) {
- case section_name:
- app(section_flag+(int)(cur_section-name_dir));
- app_scrap(section_scrap,maybe_math);
- app_scrap(exp,yes_math);@+break;
- case string: case constant: case verbatim: @<Append a string or constant@>;
- @+break;
- case identifier: app_cur_id(1);@+break;
- case TeX_string: @<Append a \TEX/ string, without forming a scrap@>;@+break;
- case '/': case '.':
- app(next_control); app_scrap(binop,yes_math);@+break;
- case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break;
-@.\\langle@>
- case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break;
-@.\\rangle@>
- case '=': app_str("\\K"); app_scrap(binop,yes_math);@+break;
-@.\\K@>
- case '|': app_str("\\OR"); app_scrap(binop,yes_math);@+break;
-@.\\OR@>
- case '^': app_str("\\XOR"); app_scrap(binop,yes_math);@+break;
-@.\\XOR@>
- case '%': app_str("\\MOD"); app_scrap(binop,yes_math);@+break;
-@.\\MOD@>
- case '!': app_str("\\R"); app_scrap(unop,yes_math);@+break;
-@.\\R@>
- case '~': app_str("\\CM"); app_scrap(unop,yes_math);@+break;
-@.\\CM@>
- case '+': case '-': app(next_control); app_scrap(ubinop,yes_math);@+break;
- case '*': app(next_control); app_scrap(raw_ubin,yes_math);@+break;
- case '&': app_str("\\AND"); app_scrap(raw_ubin,yes_math);@+break;
-@.\\AND@>
- case '?': app_str("\\?"); app_scrap(question,yes_math);@+break;
-@.\\?@>
- case '#': app_str("\\#"); app_scrap(ubinop,yes_math);@+break;
-@.\\\#@>
- case ignore: case xref_roman: case xref_wildcard:
- case xref_typewriter: case noop:@+break;
- case '(': case '[': app(next_control); app_scrap(lpar,maybe_math);@+break;
- case ')': case ']': app(next_control); app_scrap(rpar,maybe_math);@+break;
- case '{': app_str("\\{"@q}@>); app_scrap(lbrace,yes_math);@+break;
-@.\\\{@>@q}@>
- case '}': app_str(@q{@>"\\}"); app_scrap(rbrace,yes_math);@+break;
-@q{@>@.\\\}@>
- case ',': app(','); app_scrap(comma,yes_math);@+break;
- case ';': app(';'); app_scrap(semi,maybe_math);@+break;
- case ':': app(':'); app_scrap(colon,no_math);@+break;@/
- @t\4@> @<Cases involving nonstandard characters@>@;
- case thin_space: app_str("\\,"); app_scrap(insert,maybe_math);@+break;
-@.\\,@>
- case math_break: app(opt); app_str("0");
- app_scrap(insert,maybe_math);@+break;
- case line_break: app(force); app_scrap(insert,no_math);@+break;
- case left_preproc: app(force); app(preproc_line);
- app_str("\\#"); app_scrap(lproc,no_math);@+break;
-@.\\\#@>
- case right_preproc: app(force); app_scrap(rproc,no_math);@+break;
- case big_line_break: app(big_force); app_scrap(insert,no_math);@+break;
- case no_line_break: app(big_cancel); app(noop); app(break_space);
- app(noop); app(big_cancel);
- app_scrap(insert,no_math);@+break;
- case pseudo_semi: app_scrap(semi,maybe_math);@+break;
- case macro_arg_open: app_scrap(begin_arg,maybe_math);@+break;
- case macro_arg_close: app_scrap(end_arg,maybe_math);@+break;
- case join: app_str("\\J"); app_scrap(insert,no_math);@+break;
-@.\\J@>
- case output_defs_code: app(force); app_str("\\ATH"); app(force);
- app_scrap(insert,no_math);@+break;
-@.\\ATH@>
- default: app(inserted); app(next_control);
- app_scrap(insert,maybe_math);@+break;
-}
-@y
-switch (next_control) {
- case section_name:
- app(section_flag+(int)(cur_section-name_dir));
- app_scrap(section_scrap,maybe_math);
- app_scrap(exp,yes_math);@+break;
- case string: case constant: case verbatim:
- @<Append a string or constant@>;@+break;
- case identifier: app_cur_id(1);@+break;
- case TeX_string:
- @<Append a \TEX/ string, without forming a scrap@>;@+break;
- case '/': case '.':
- app(next_control);@+app_scrap(binop,yes_math);@+break;
- case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break;
-@.\\langle@>
- case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break;
-@.\\rangle@>
- case '=': app_str("\\K");@+app_scrap(binop,yes_math);@+break;
-@.\\K@>
- case '|': app_str("\\OR");@+app_scrap(binop,yes_math);@+break;
-@.\\OR@>
- case '^': app_str("\\XOR");@+app_scrap(binop,yes_math);@+break;
-@.\\XOR@>
- case '%': app_str("\\MOD");@+app_scrap(binop,yes_math);@+break;
-@.\\MOD@>
- case '!': app_str("\\R");@+app_scrap(unop,yes_math);@+break;
-@.\\R@>
- case '~': app_str("\\CM");@+app_scrap(unop,yes_math);@+break;
-@.\\CM@>
- case '+': case '-': app(next_control);@+app_scrap(ubinop,yes_math);@+break;
- case '*': app(next_control);@+app_scrap(raw_ubin,yes_math);@+break;
- case '&': app_str("\\AND");@+app_scrap(raw_ubin,yes_math);@+break;
-@.\\AND@>
- case '?': app_str("\\?");@+app_scrap(question,yes_math);@+break;
-@.\\?@>
- case '#': app_str("\\#");@+app_scrap(ubinop,yes_math);@+break;
-@.\\\#@>
- case ignore: case xref_roman: case xref_wildcard:
- case xref_typewriter: case noop:@+break;
- case '(': case '[': app(next_control);@+app_scrap(lpar,maybe_math);@+break;
- case ')': case ']': app(next_control);@+app_scrap(rpar,maybe_math);@+break;
- case '{': app_str("\\{"@q}@>);@+app_scrap(lbrace,yes_math);@+break;
-@.\\\{@>@q}@>
- case '}': app_str(@q{@>"\\}");@+app_scrap(rbrace,yes_math);@+break;
-@q{@>@.\\\}@>
- case ',': app(',');@+app_scrap(comma,yes_math);@+break;
- case ';': app(';');@+app_scrap(semi,maybe_math);@+break;
- case ':': app(':');@+app_scrap(colon,no_math);@+break;@/
- @t\4@> @<Cases involving nonstandard characters@>@;
- case thin_space: app_str("\\,");@+app_scrap(insert,maybe_math);@+break;
-@.\\,@>
- case math_break: app(opt);@+app_str("0");@+
- app_scrap(insert,maybe_math);@+break;
- case line_break: app(force);@+app_scrap(insert,no_math);@+break;
- case left_preproc: app(force);@+app(preproc_line);@+app_str("\\#");
- app_scrap(lproc,no_math);@+break;
-@.\\\#@>
- case right_preproc: app(force);@+app_scrap(rproc,no_math);@+break;
- case big_line_break: app(big_force);@+app_scrap(insert,no_math);@+break;
- case no_line_break: app(big_cancel);@+app(noop);@+app(break_space);@+
- app(noop);@+app(big_cancel); app_scrap(insert,no_math);@+break;
- case pseudo_semi: app_scrap(semi,maybe_math);@+break;
- case macro_arg_open: app_scrap(begin_arg,maybe_math);@+break;
- case macro_arg_close: app_scrap(end_arg,maybe_math);@+break;
- case join: app_str("\\J");@+app_scrap(insert,no_math);@+break;
-@.\\J@>
- case output_defs_code: app(force);@+app_str("\\ATH");@+app(force);
- app_scrap(insert,no_math);@+break;
-@.\\ATH@>
- default: app(inserted);@+app(next_control);
- app_scrap(insert,maybe_math);@+break;
-}
-@z
-
-@x
overflow("scrap/token/text");
@y
overflow(_("scrap/token/text"));
@z
@x
-case not_eq: app_str("\\I");@+app_scrap(binop,yes_math);@+break;
-@y
-case non_eq: app_str("\\I");@+app_scrap(binop,yes_math);@+break;
-@z
-
-@x
else err_print("! Double @@ should be used in strings");
@y
else err_print(_("! Double @@ should be used in strings"));
@z
@x
-void app_cur_id();
-@y
-void app_cur_id(boolean);@/
-@z
-
-@x
-void
-app_cur_id(scrapping)
-boolean scrapping; /* are we making this into a scrap? */
-@y
-void
-app_cur_id(@t\1\1@>
-boolean scrapping@t\2\2@>) /* are we making this into a scrap? */
-@z
-
-@x
-text_pointer
-C_translate()
-@y
-static text_pointer
-C_translate(void)
-@z
-
-@x
if (next_control!='|') err_print("! Missing '|' after C text");
@y
if (next_control!='|') err_print(_("! Missing '|' after C text"));
@z
@x
-void
-outer_parse() /* makes scraps from \CEE/ tokens and comments */
-@y
-static void
-outer_parse(void) /* makes scraps from \CEE/ tokens and comments */
-@z
-
-@x
-void
-push_level(p) /* suspends the current level */
-text_pointer p;
-@y
-static void
-push_level(@t\1\1@> /* suspends the current level */
-text_pointer p@t\2\2@>)
-@z
-
-@x
if (stack_ptr==stack_end) overflow("stack");
@y
if (stack_ptr==stack_end) overflow(_("stack"));
@z
@x
-void
-pop_level()
-@y
-static void
-pop_level(void)
-@z
-
-@x
-eight_bits
-get_output() /* returns the next token of output */
-@y
-static eight_bits
-get_output(void) /* returns the next token of output */
-@z
-
-@x
- return(a);
-@y
- return((eight_bits)a);
-@z
-
-@x
-void
-output_C() /* outputs the current token list */
-@y
-static void
-output_C(void) /* outputs the current token list */
-@z
-
-@x
-void make_output();
-@y
-static void make_output(void);@/
-@z
-
-@x
-void
-make_output() /* outputs the equivalents of tokens */
-{
- eight_bits a, /* current output byte */
-@y
-static void
-make_output(void) /* outputs the equivalents of tokens */
-{
- eight_bits a=0, /* current output byte */
-@z
-
-@x
- else if (b!='|') out(b)@;
-@y
- else { if (b!='|') out(b)@;
-@z
-
-@x
- }
-@y
- } }
-@z
-
-@x
- printf("\n! Illegal control code in section name: <");
+ fputs("\n! Illegal control code in section name: <",stdout);
@y
fputs(_("\n! Illegal control code in section name: <"),stdout);
@z
@x
- printf("\n! C text in section name didn't end: <");
+ fputs("\n! C text in section name didn't end: <",stdout);
@y
fputs(_("\n! C text in section name didn't end: <"),stdout);
@z
@x
- if (b=='\'' || b=='"')
- if (delim==0) delim=b;
- else if (delim==b) delim=0;
-@y
- if (b=='\'' || b=='"') {
- if (delim==0) delim=b;
- else if (delim==b) delim=0; }
-@z
-
-@x
if (j>buffer+long_buf_size-3) overflow("buffer");
@y
if (j>buffer+long_buf_size-3) overflow(_("buffer"));
@@ -1473,21 +461,7 @@ make_output(void) /* outputs the equivalents of tokens */
@z
@x
-void phase_two();
-@y
-static void phase_two(void);@/
-@z
-
-@x
-void
-phase_two() {
-@y
-static void
-phase_two(void) {
-@z
-
-@x
-reset_input(); if (show_progress) printf("\nWriting the output file...");
+reset_input(); if (show_progress) fputs("\nWriting the output file...",stdout);
@y
reset_input(); if (show_progress) fputs(_("\nWriting the output file..."),stdout);
@z
@@ -1505,42 +479,6 @@ reset_input(); if (show_progress) fputs(_("\nWriting the output file..."),stdout
@z
@x
-void finish_C();
-@y
-static void finish_C(boolean);@/
-@z
-
-@x
-void
-finish_C(visible) /* finishes a definition or a \CEE/ part */
- boolean visible; /* nonzero if we should produce \TEX/ output */
-@y
-static void
-finish_C(@t\1\1@> /* finishes a definition or a \Cee\ part */
- boolean visible@t\2\2@>) /* nonzero if we should produce \TeX\ output */
-@z
-
-@x
- if (out_ptr>out_buf+1)
- if (*(out_ptr-1)=='\\')
-@.\\6@>
-@.\\7@>
-@.\\Y@>
- if (*out_ptr=='6') out_ptr-=2;
- else if (*out_ptr=='7') *out_ptr='Y';
-@y
- if (out_ptr>out_buf+1) {
- if (*(out_ptr-1)=='\\') {
-@.\\6@>
-@.\\7@>
-@.\\Y@>
- if (*out_ptr=='6') out_ptr-=2;
- else if (*out_ptr=='7') *out_ptr='Y';
- }
- }
-@z
-
-@x
err_print("! Improper macro definition");
@y
err_print(_("! Improper macro definition"));
@@ -1571,36 +509,6 @@ finish_C(@t\1\1@> /* finishes a definition or a \Cee\ part */
@z
@x
-void footnote();
-@y
-static void footnote(sixteen_bits);@/
-@z
-
-@x
-void
-footnote(flag) /* outputs section cross-references */
-sixteen_bits flag;
-@y
-static void
-footnote(@t\1\1@> /* outputs section cross-references */
-sixteen_bits flag@t\2\2@>)
-@z
-
-@x
-void phase_three();
-@y
-static void phase_three(void);@/
-@z
-
-@x
-void
-phase_three() {
-@y
-static void
-phase_three(void) {
-@z
-
-@x
if (no_xref) {
finish_line();
out_str("\\end");
@@ -1617,56 +525,24 @@ if (no_xref) {
@z
@x
- phase=3; if (show_progress) printf("\nWriting the index...");
+ phase=3; if (show_progress) fputs("\nWriting the index...",stdout);
@y
phase=3; if (show_progress) fputs(_("\nWriting the index..."),stdout);
@z
@x
- if ((idx_file=fopen(idx_file_name,"w"))==NULL)
-@y
- if ((idx_file=fopen(idx_file_name,"wb"))==NULL)
-@z
-
-@x
fatal("! Cannot open index file ",idx_file_name);
@y
fatal(_("! Cannot open index file "),idx_file_name);
@z
@x
- @<Tell about changed sections@>; finish_line(); finish_line();
-@y
- @<Tell about changed sections@>@; finish_line(); finish_line();
-@z
-
-@x
- @<Do the first pass of sorting@>;
- @<Sort and output the index@>;
-@y
- @<Do the first pass of sorting@>@;
- @<Sort and output the index@>@;
-@z
-
-@x
- if ((scn_file=fopen(scn_file_name,"w"))==NULL)
-@y
- if ((scn_file=fopen(scn_file_name,"wb"))==NULL)
-@z
-
-@x
fatal("! Cannot open section file ",scn_file_name);
@y
fatal(_("! Cannot open section file "),scn_file_name);
@z
@x
- @<Output all the section names@>;
-@y
- @<Output all the section names@>@;
-@z
-
-@x
@.\\end@>
finish_line();
fclose(active_file);
@@ -1679,106 +555,9 @@ finish_line(); fclose(active_file); active_file=NULL;
@z
@x
-if (show_happiness) printf("\nDone.");
+ fputs("Done.",stdout);
@y
-if (show_happiness) {
- if (show_progress) new_line;
fputs(_("Done."),stdout);
-}
-@z
-
-@x
-for (c=0; c<=255; c++) bucket[c]=NULL;
-@y
-for (c=0; c<256; c++) bucket[c]=NULL;
-@z
-
-@x
- if (cur_name->xref!=(char*)xmem) {
-@y
- if (cur_name->xref!=(void *)xmem) {
-@z
-
-@x
-collate[0]=0;
-strcpy(collate+1," \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17");
-/* 16 characters + 1 = 17 */
-strcpy(collate+17,"\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37");
-/* 16 characters + 17 = 33 */
-strcpy(collate+33,"!\42#$%&'()*+,-./:;<=>?@@[\\]^`{|}~_");
-/* 32 characters + 33 = 65 */
-strcpy(collate+65,"abcdefghijklmnopqrstuvwxyz0123456789");
-/* (26 + 10) characters + 65 = 101 */
-strcpy(collate+101,"\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217");
-/* 16 characters + 101 = 117 */
-strcpy(collate+117,"\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237");
-/* 16 characters + 117 = 133 */
-strcpy(collate+133,"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257");
-/* 16 characters + 133 = 149 */
-strcpy(collate+149,"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277");
-/* 16 characters + 149 = 165 */
-strcpy(collate+165,"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317");
-/* 16 characters + 165 = 181 */
-strcpy(collate+181,"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337");
-/* 16 characters + 181 = 197 */
-strcpy(collate+197,"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357");
-/* 16 characters + 197 = 213 */
-strcpy(collate+213,"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377");
-/* 16 characters + 213 = 229 */
-@y
-collate[0]=0;
-strcpy((char *)collate+1,
- " \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17");
-/* 16 characters + 1 = 17 */
-strcpy((char *)collate+17,
- "\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37");
-/* 16 characters + 17 = 33 */
-strcpy((char *)collate+33,
- "!\42#$%&'()*+,-./:;<=>?@@[\\]^`{|}~_");
-/* 32 characters + 33 = 65 */
-strcpy((char *)collate+65,
- "abcdefghijklmnopqrstuvwxyz0123456789");
-/* (26 + 10) characters + 65 = 101 */
-strcpy((char *)collate+101,
- "\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217");
-/* 16 characters + 101 = 117 */
-strcpy((char *)collate+117,
- "\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237");
-/* 16 characters + 117 = 133 */
-strcpy((char *)collate+133,
- "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257");
-/* 16 characters + 133 = 149 */
-strcpy((char *)collate+149,
- "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277");
-/* 16 characters + 149 = 165 */
-strcpy((char *)collate+165,
- "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317");
-/* 16 characters + 165 = 181 */
-strcpy((char *)collate+181,
- "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337");
-/* 16 characters + 181 = 197 */
-strcpy((char *)collate+197,
- "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357");
-/* 16 characters + 197 = 213 */
-strcpy((char *)collate+213,
- "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377");
-/* 16 characters + 213 = 229 */
-@z
-
-@x
-void unbucket();
-@y
-static void unbucket(eight_bits);@/
-@z
-
-@x
-void
-unbucket(d) /* empties buckets having depth |d| */
-eight_bits d;
-@y
-static void
-unbucket(@t\1\1@> /* empties buckets having depth |d| */
-eight_bits d@t\2\2@>)
@z
@x
@@ -1788,144 +567,78 @@ eight_bits d@t\2\2@>)
@z
@x
-void section_print();
-@y
-static void section_print(name_pointer);@/
-@z
-
-@x
-void
-section_print(p) /* print all section names in subtree |p| */
-name_pointer p;
-@y
-static void
-section_print(@t\1\1@> /* print all section names in subtree |p| */
-name_pointer p@t\2\2@>)
-@z
-
-@x
-@ @<Output all the section names@>=section_print(root)
-@y
-@ @<Output all the section names@>=section_print(root);
-@z
-
-@x
-void
-print_stats() {
-@y
-void
-print_stats(void) {
-@z
-
-@x
- printf("\nMemory usage statistics:\n");
+ puts("\nMemory usage statistics:");
@.Memory usage statistics:@>
printf("%ld names (out of %ld)\n",
- (long)(name_ptr-name_dir),(long)max_names);
+ (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf("%ld cross-references (out of %ld)\n",
- (long)(xref_ptr-xmem),(long)max_refs);
+ (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);
printf("%ld bytes (out of %ld)\n",
- (long)(byte_ptr-byte_mem),(long)max_bytes);
- printf("Parsing:\n");
+ (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
+ puts("Parsing:");
printf("%ld scraps (out of %ld)\n",
- (long)(max_scr_ptr-scrap_info),(long)max_scraps);
+ (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps);
printf("%ld texts (out of %ld)\n",
- (long)(max_text_ptr-tok_start),(long)max_texts);
+ (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts);
printf("%ld tokens (out of %ld)\n",
- (long)(max_tok_ptr-tok_mem),(long)max_toks);
+ (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks);
printf("%ld levels (out of %ld)\n",
- (long)(max_stack_ptr-stack),(long)stack_size);
- printf("Sorting:\n");
+ (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size);
+ puts("Sorting:");
printf("%ld levels (out of %ld)\n",
- (long)(max_sort_ptr-scrap_info),(long)max_scraps);
-}
+ (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps);
@y
puts(_("\nMemory usage statistics:"));
@.Memory usage statistics:@>
printf(_("%ld names (out of %ld)\n"),
- (long)(name_ptr-name_dir),(long)max_names);
+ (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf(_("%ld cross-references (out of %ld)\n"),
- (long)(xref_ptr-xmem),(long)max_refs);
+ (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);
printf(_("%ld bytes (out of %ld)\n"),
- (long)(byte_ptr-byte_mem),(long)max_bytes);
+ (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
puts(_("Parsing:"));
printf(_("%ld scraps (out of %ld)\n"),
- (long)(max_scr_ptr-scrap_info),(long)max_scraps);
+ (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps);
printf(_("%ld texts (out of %ld)\n"),
- (long)(max_text_ptr-tok_start),(long)max_texts);
+ (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts);
printf(_("%ld tokens (out of %ld)\n"),
- (long)(max_tok_ptr-tok_mem),(long)max_toks);
+ (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks);
printf(_("%ld levels (out of %ld)\n"),
- (long)(max_stack_ptr-stack),(long)stack_size);
+ (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size);
puts(_("Sorting:"));
printf(_("%ld levels (out of %ld)\n"),
- (long)(max_sort_ptr-scrap_info),(long)max_scraps);
-}
+ (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps);
@z
@x
@** Index.
@y
-@** Extensions for modern {\tt CWEB}. The following sections introduce changes
-and extensions to the code that have been created by numerous contributors over
-the course of a quarter century. They make \.{CWEB} adhere to modern coding
-standards and introduce new or improved features.
+@** Extensions to \.{CWEB}. The following sections introduce new or improved
+features that have been created by numerous contributors over the course of a
+quarter century.
Care has been taken to keep the original section numbering intact, so this new
-section should have the same number as the original ``\&{250.~Index},'' and
-additional material follows below.
+material should nicely integrate with the original ``\&{263.~Index}.''
-@* Set {\tt CWEAVE} flags.
-At least one of these is already used in \.{COMMON}.
+@* Formatting alternatives.
+\.{CWEAVE} indents declarations after old-style function definitions.
+With the \.{-i} option they will come out flush left. You won't see
+any difference if you use ANSI-style function definitions.
+
+@d indent_param_decl flags['i'] /* should formal parameter declarations be indented? */
@<Set init...@>=
- make_xrefs=force_lines=make_pb=indent_param_decl=order_decl_stmt=1;
- /* controlled by command-line options */
-
-@* Function declarations. Here are declarations---conforming to
-{\mc ANSI~C}---of all functions in this code, as far as they are
-not already in |"common.h"|. These are private to \.{CWEAVE}.
-
-@<Predecl...@>=
-static eight_bits copy_TeX(void);@/
-static eight_bits get_output(void);@/
-static eight_bits skip_TeX(void);@/
-static text_pointer C_translate(void);@/
-static text_pointer translate(void);@/
-static token_pointer find_first_ident(text_pointer);@/
-static void app_str(const char *);@/
-static void big_app(token);@/
-static void big_app1(scrap_pointer);@/
-static void copy_limbo(void);@/
-static void C_parse(eight_bits);@/
-static void finish_line(void);@/
-static void flush_buffer(char *,boolean,boolean);@/
-static void make_reserved(scrap_pointer);@/
-static void make_underlined(scrap_pointer);@/
-static void new_section_xref(name_pointer);@/
-static void new_xref(name_pointer);@/
-static void outer_parse(void);@/
-static void output_C(void);@/
-static void out_name(name_pointer,boolean);@/
-static void out_section(sixteen_bits);@/
-static void out_str(const char *);@/
-static void pop_level(void);@/
-static void print_cat(eight_bits);@/
-#ifdef DEAD_CODE
-static void print_text(text_pointer p);@/
-#endif
-static void push_level(text_pointer);@/
-static void reduce(scrap_pointer,short,eight_bits,short,short);@/
-static void set_file_flag(name_pointer);@/
-static void skip_limbo(void);@/
-static void squash(scrap_pointer,short,eight_bits,short,short);@/
-static void update_node(name_pointer p);@/
-
-@* Language setting. This global variable is defined and set in \.{COMMON} by
-the `\.{+l}' (or `\.{-l}') command-line option.
-
-@<Global var...@>=
-extern const char *use_language; /* prefix to \.{cwebmac.tex} in \TEX/ output */
+indent_param_decl=true;
+
+@ The original manual described the \.{-o} option for \.{CWEAVE}, but this was
+not yet present. Here is a simple implementation. The purpose is to suppress
+the extra space between local variable declarations and the first statement in
+a function block.
+
+@d order_decl_stmt flags['o'] /* should declarations and statements be separated? */
+
+@<Set init...@>=
+order_decl_stmt=true;
@* Output file update. Most \CEE/ projects are controlled by a
\.{Makefile} that automatically takes care of the temporal dependecies
diff --git a/Build/source/texk/web2c/cwebdir/cweav-w32.ch b/Build/source/texk/web2c/cwebdir/cweav-w32.ch
index 26825b0bfd1..c993cb39f4a 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-w32.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-w32.ch
@@ -2,51 +2,33 @@ This is the change file for CWEB's CWEAVE under Win32
(Contributed by Fabrice Popineau, February 2002)
@x section 1
-@d banner "This is CWEAVE (Version 3.64)\n"
+@d banner "This is CWEAVE (Version 4.0)"
@y
-@d banner "This is CWEAVE (Version 3.64win32)\n"
+@d banner "This is CWEAVE (Version 4.0win32)"
@z
@x
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-@y
-@z
-
-@x
-int names_match(p,first,l,t)
-name_pointer p; /* points to the proposed match */
+boolean names_match(@t\1\1@>
+name_pointer p, /* points to the proposed match */
+const char *first, /* position of first character of string */
+size_t l, /* length of identifier */
+eight_bits t@t\2\2@>) /* desired |ilk| */
@y
-int __cdecl names_match(p,first,l,t)
-name_pointer p; /* points to the proposed match */
+boolean __cdecl names_match(@t\1\1@>
+name_pointer p, /* points to the proposed match */
+const char *first, /* position of first character of string */
+size_t l, /* length of identifier */
+eight_bits t@t\2\2@>) /* desired |ilk| */
@z
@x
void
-init_p(p,t)
-name_pointer p;
+init_p(
+name_pointer p,
+eight_bits t)
@y
void __cdecl
-init_p(p,t)
-name_pointer p;
-@z
-
-@x
-@ @<Include...@>=
-#include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
-#include <stdlib.h> /* definition of |exit| */
-@y
-@ @<Include...@>=
-#include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
-#include <stdlib.h> /* definition of |exit| */
-#include <string.h> /* definition of |strncmp| and |strncpy| */
+init_p(
+name_pointer p,
+eight_bits t)
@z
diff --git a/Build/source/texk/web2c/cwebdir/cweave.w b/Build/source/texk/web2c/cwebdir/cweave.w
index e06762b1fc3..8b9ec49cb45 100644
--- a/Build/source/texk/web2c/cwebdir/cweave.w
+++ b/Build/source/texk/web2c/cwebdir/cweave.w
@@ -2,10 +2,7 @@
% This program by Silvio Levy and Donald E. Knuth
% is based on a program by Knuth.
% It is distributed WITHOUT ANY WARRANTY, express or implied.
-% Version 3.64 --- February 2002
-% (essentially the same as version 3.6, which added
-% recently introduced features of standard C++ to version 3.4)
-% (In November 2016 I made minor adjustments but changed no code -- DEK)
+% Version 4.0--- February 2021
% Copyright (C) 1987,1990,1993,2000 Silvio Levy and Donald E. Knuth
@@ -18,6 +15,11 @@
% entire resulting derived work is given a different name and distributed
% under the terms of a permission notice identical to this one.
+% Amendments to 'cweave.w' resulting in this updated version were created
+% by numerous collaborators over the course of many years.
+
+% Please send comments, suggestions, etc. to tex-k@@tug.org.
+
% Here is TeX material that gets inserted after \input cwebmac
\def\hang{\hangindent 3em\indent\ignorespaces}
\def\pb{$\.|\ldots\.|$} % C brackets (|...|)
@@ -30,11 +32,11 @@
\def\skipxTeX{\\{skip\_\TEX/}}
\def\copyxTeX{\\{copy\_\TEX/}}
-\def\title{CWEAVE (Version 3.64)}
+\def\title{CWEAVE (Version 4.0)}
\def\topofcontents{\null\vfill
\centerline{\titlefont The {\ttitlefont CWEAVE} processor}
\vskip 15pt
- \centerline{(Version 3.64)}
+ \centerline{(Version 4.0)}
\vfill}
\def\botofcontents{\vfill
\noindent
@@ -52,7 +54,6 @@ under the terms of a permission notice identical to this one.
}
\pageno=\contentspagenumber \advance\pageno by 1
\let\maybe=\iftrue
-@s not_eq normal @q unreserve a C++ keyword @>
@** Introduction.
This is the \.{CWEAVE} program by Silvio Levy and Donald E. Knuth,
@@ -66,7 +67,7 @@ Crusius, and others who have contributed improvements.
The ``banner line'' defined here should be changed whenever \.{CWEAVE}
is modified.
-@d banner "This is CWEAVE (Version 3.64)\n"
+@d banner "This is CWEAVE (Version 4.0)"
@c @<Include files@>@/
@h
@@ -75,18 +76,6 @@ is modified.
@<Global variables@>@/
@<Predeclaration of procedures@>
-@ We predeclare several standard system functions here instead of including
-their system header files, because the names of the header files are not as
-standard as the names of the functions. (For example, some \CEE/ environments
-have \.{<string.h>} where others have \.{<strings.h>}.)
-
-@<Predecl...@>=
-extern int strlen(); /* length of string */
-extern int strcmp(); /* compare strings lexicographically */
-extern char* strcpy(); /* copy one string to another */
-extern int strncmp(); /* compare up to $n$ string characters */
-extern char* strncpy(); /* copy up to $n$ string characters */
-
@ \.{CWEAVE} has a fairly straightforward outline. It operates in
three phases: First it inputs the source file and stores cross-reference
data, then it inputs the source once again and produces the \TEX/ output
@@ -96,52 +85,41 @@ Please read the documentation for \.{common}, the set of routines common
to \.{CTANGLE} and \.{CWEAVE}, before proceeding further.
@c
-int main (ac, av)
-int ac; /* argument count */
-char **av; /* argument values */
+int main (@t\1\1@>
+int ac, /* argument count */
+char **av@t\2\2@>) /* argument values */
{
argc=ac; argv=av;
program=cweave;
- make_xrefs=force_lines=make_pb=1; /* controlled by command-line options */
+ @<Set initial values@>@;
common_init();
- @<Set initial values@>;
- if (show_banner) printf(banner); /* print a ``banner line'' */
- @<Store all the reserved words@>;
+ @<Start \TEX/ output@>@;
+ if (show_banner) puts(banner); /* print a ``banner line'' */
+ @<Store all the reserved words@>@;
phase_one(); /* read all the user's text and store the cross-references */
phase_two(); /* read all the text again and translate it to \TEX/ form */
phase_three(); /* output the cross-reference index */
return wrap_up(); /* and exit gracefully */
}
+@ The next few sections contain stuff from the file |"common.w"| that must
+be included in both |"ctangle.w"| and |"cweave.w"|. It appears in
+file |"common.h"|, which is also included in |"common.w"| to propagate
+possible changes from this \.{COMMON} interface consistently.
+
+First comes general stuff:
+
+@i common.h
+
@ The following parameters were sufficient in the original \.{WEAVE} to
handle \TEX/, so they should be sufficient for most applications of \.{CWEAVE}.
-If you change |max_bytes|, |max_names|, |hash_size|, or |buf_size|
-you have to change them also in the file |"common.w"|.
-
-@d max_bytes 90000 /* the number of bytes in identifiers,
- index entries, and section names */
-@d max_names 4000 /* number of identifiers, strings, section names;
- must be less than 10240; used in |"common.w"| */
-@d max_sections 2000 /* greater than the total number of sections */
-@d hash_size 353 /* should be prime */
-@d buf_size 100 /* maximum length of input line, plus one */
-@d longest_name 10000 /* section names and strings shouldn't be longer than this */
-@d long_buf_size (buf_size+longest_name)
+
@d line_length 80 /* lines of \TEX/ output have at most this many characters;
should be less than 256 */
-@d max_refs 20000 /* number of cross-references; must be less than 65536 */
-@d max_toks 20000 /* number of symbols in \CEE/ texts being parsed;
- must be less than 65536 */
-@d max_texts 4000 /* number of phrases in \CEE/ texts being parsed;
+@d max_refs 65535 /* number of cross-references; must be less than 65536 */
+@d max_texts 10239 /* number of phrases in \CEE/ texts being parsed;
must be less than 10240 */
-@d max_scraps 2000 /* number of tokens in \CEE/ texts being parsed */
-@d stack_size 400 /* number of simultaneous output levels */
-
-@ The next few sections contain stuff from the file |"common.w"| that must
-be included in both |"ctangle.w"| and |"cweave.w"|. It appears in
-file |"common.h"|, which needs to be updated when |"common.w"| changes.
-
-@i common.h
+@d max_scraps 10000 /* number of tokens in \CEE/ texts being parsed */
@* Data structures exclusive to {\tt CWEAVE}.
As explained in \.{common.w}, the field of a |name_info| structure
@@ -252,7 +230,7 @@ has a special first cross-reference whose |num| field is |file_flag|.
@d xref equiv_or_xref
@<Set init...@>=
-xref_ptr=xmem; name_dir->xref=(char*)xmem; xref_switch=0; section_xref_switch=0;
+xref_ptr=xmem; init_node(name_dir); xref_switch=0; section_xref_switch=0;
xmem->num=0; /* sentinel value */
@ A new cross-reference for an identifier is formed by calling |new_xref|,
@@ -266,16 +244,20 @@ If one were careful, one could probably make more changes around section
@d append_xref(c) if (xref_ptr==xmem_end) overflow("cross-reference");
else (++xref_ptr)->num=c;
-@d no_xref (flags['x']==0)
-@d make_xrefs flags['x'] /* should cross references be output? */
+@d no_xref (!make_xrefs)
@d is_tiny(p) ((p+1)->byte_start==(p)->byte_start+1)
@d unindexed(a) (a<res_wd_end && a->ilk>=custom)
/* tells if uses of a name are to be indexed */
-@c
-void
-new_xref(p)
-name_pointer p;
+@<Predecl...@>=
+static void new_xref(name_pointer);@/
+static void new_section_xref(name_pointer);@/
+static void set_file_flag(name_pointer);@/
+
+@ @c
+static void
+new_xref(
+name_pointer p)
{
xref_pointer q; /* pointer to previous cross-reference */
sixteen_bits m, n; /* new and previous cross-reference value */
@@ -289,7 +271,7 @@ name_pointer p;
q->num=m; return;
}
}
- append_xref(m); xref_ptr->xlink=q; p->xref=(char*)xref_ptr;
+ append_xref(m); xref_ptr->xlink=q; update_node(p);
}
@ The cross-reference lists for section names are slightly different.
@@ -304,9 +286,9 @@ the length of the list, under foreseeable uses of \.{CWEAVE} this inefficiency
is insignificant.
@c
-void
-new_section_xref(p)
-name_pointer p;
+static void
+new_section_xref(
+name_pointer p)
{
xref_pointer q,r; /* pointers to previous cross-references */
q=(xref_pointer)p->xref; r=xmem;
@@ -316,7 +298,7 @@ name_pointer p;
return; /* don't duplicate entries */
append_xref(section_count+section_xref_switch);
xref_ptr->xlink=q; section_xref_switch=0;
- if (r==xmem) p->xref=(char*)xref_ptr;
+ if (r==xmem) update_node(p);
else r->xlink=xref_ptr;
}
@@ -324,23 +306,23 @@ name_pointer p;
|file_flag|. Here's how that flag gets put~in.
@c
-void
-set_file_flag(p)
-name_pointer p;
+static void
+set_file_flag(
+name_pointer p)
{
xref_pointer q;
q=(xref_pointer)p->xref;
if (q->num==file_flag) return;
append_xref(file_flag);
xref_ptr->xlink = q;
- p->xref = (char *)xref_ptr;
+ update_node(p);
}
@ A third large area of memory is used for sixteen-bit `tokens', which appear
in short lists similar to the strings of characters in |byte_mem|. Token lists
are used to contain the result of \CEE/ code translated into \TEX/ form;
-further details about them will be explained later. A |text_pointer| variable
-is an index into |tok_start|.
+further details about them will be explained later. A \&{text\_pointer}
+variable is an index into |tok_start|.
@<Typed...@>=
typedef sixteen_bits token;
@@ -363,17 +345,17 @@ token_pointer max_tok_ptr; /* largest value of |tok_ptr| */
text_pointer max_text_ptr; /* largest value of |text_ptr| */
@ @<Set init...@>=
-tok_ptr=tok_mem+1; text_ptr=tok_start+1; tok_start[0]=tok_mem+1;
-tok_start[1]=tok_mem+1;
-max_tok_ptr=tok_mem+1; max_text_ptr=tok_start+1;
+tok_ptr=max_tok_ptr=tok_mem+1;@/
+tok_start[0]=tok_start[1]=tok_mem+1;@/
+text_ptr=max_text_ptr=tok_start+1;
@ Here are the three procedures needed to complete |id_lookup|:
@c
-int names_match(p,first,l,t)
-name_pointer p; /* points to the proposed match */
-char *first; /* position of first character of string */
-int l; /* length of identifier */
-eight_bits t; /* desired ilk */
+boolean names_match(@t\1\1@>
+name_pointer p, /* points to the proposed match */
+const char *first, /* position of first character of string */
+size_t l, /* length of identifier */
+eight_bits t@t\2\2@>) /* desired |ilk| */
{
if (length(p)!=l) return 0;
if (p->ilk!=t && !(t==normal && abnormal(p))) return 0;
@@ -381,20 +363,30 @@ eight_bits t; /* desired ilk */
}
void
-init_p(p,t)
-name_pointer p;
-eight_bits t;
+init_p(
+name_pointer p,
+eight_bits t)
{
- p->ilk=t; p->xref=(char*)xmem;
+ p->ilk=t; init_node(p);
}
void
-init_node(p)
-name_pointer p;
+init_node(
+name_pointer p)
{
- p->xref=(char*)xmem;
+ p->xref=(void *)xmem;
}
+static void
+update_node(
+name_pointer p)
+{
+ p->xref=(void *)xref_ptr;
+}
+
+@ @<Predecl...@>=
+static void update_node(name_pointer p);@/
+
@ We have to get \CEE/'s
reserved words into the hash table, and the simplest way to do this is
to insert them every time \.{CWEAVE} is run. Fortunately there are relatively
@@ -598,11 +590,12 @@ operation appears in limbo, we want to use it to adjust the default
interpretation of identifiers.
@<Predec...@>=
-void skip_limbo();
+static void skip_limbo(void);@/
+static eight_bits skip_TeX(void);@/
@ @c
-void
-skip_limbo() {
+static void
+skip_limbo(void) {
while(1) {
if (loc>limit && get_line()==0) return;
*(limit+1)='@@';
@@ -610,7 +603,7 @@ skip_limbo() {
if (loc++ <=limit) { int c=ccode[(eight_bits)*loc++];
if (c==new_section) return;
if (c==noop) skip_restricted();
- else if (c==format_code) @<Process simple format in limbo@>;
+ else if (c==format_code) @<Process simple format in limbo@>@;
}
}
}
@@ -623,8 +616,8 @@ assumed to exist at the very end of the file.
@f skip_TeX TeX
@c
-unsigned
-skip_TeX() /* skip past pure \TEX/ code */
+static eight_bits
+skip_TeX(void) /* skip past pure \TEX/ code */
{
while (1) {
if (loc>limit && get_line()==0) return(new_section);
@@ -679,10 +672,6 @@ it sets |xref_switch| to |def_flag| and goes on to the next token.
name_pointer cur_section; /* name of section just scanned */
char cur_section_char; /* the character just before that name */
-@ @<Include...@>=
-#include <ctype.h> /* definition of |isalpha|, |isdigit| and so on */
-#include <stdlib.h> /* definition of |exit| */
-
@ As one might expect, |get_next| consists mostly of a big switch
that branches to the various special cases that can arise.
\CEE/ allows underscores to appear in identifiers, and some \CEE/
@@ -694,25 +683,28 @@ compilers even allow the dollar sign.
@^high-bit character handling@>
@<Predecl...@>=
-eight_bits get_next();
+static eight_bits get_next(void);@/
@ @c
-eight_bits
-get_next() /* produces the next input token */
-{@+eight_bits c; /* the current character */
+static eight_bits
+get_next(void) /* produces the next input token */
+{
+ eight_bits c; /* the current character */
while (1) {
- @<Check if we're at the end of a preprocessor command@>;
+ @<Check if we're at the end of a preprocessor command@>@;
if (loc>limit && get_line()==0) return(new_section);
c=*(loc++);
if (xisdigit(c) || c=='.') @<Get a constant@>@;
- else if (c=='\'' || c=='"' || (c=='L'&&(*loc=='\'' || *loc=='"'))@|
+ else if (c=='\'' || c=='"'@|
+ || ((c=='L' || c=='u' || c=='U')&&(*loc=='\'' || *loc=='"'))@|
+ || ((c=='u' && *loc=='8')&&(*(loc+1)=='\'' || *(loc+1)=='"'))@|
|| (c=='<' && sharp_include_line==1))
@<Get a string@>@;
else if (xisalpha(c) || isxalpha(c) || ishigh(c))
@<Get an identifier@>@;
else if (c=='@@') @<Get control code and possible section name@>@;
else if (xisspace(c)) continue; /* ignore spaces and tabs */
- if (c=='#' && loc==buffer+1) @<Raise preprocessor flag@>;
+ if (c=='#' && loc==buffer+1) @<Raise preprocessor flag@>@;
mistake: @<Compress two-symbol operator@>@;
return(c);
}
@@ -736,7 +728,7 @@ boolean preprocessing=0; /* are we scanning a preprocessor command? */
@ @<Raise prep...@>= {
preprocessing=1;
- @<Check if next token is |include|@>;
+ @<Check if next token is |include|@>@;
return (left_preproc);
}
@@ -778,8 +770,8 @@ switch(c) {
else if (*loc=='/') compress(begin_short_comment); break;
case '+': if (*loc=='+') compress(plus_plus); break;
case '-': if (*loc=='-') {compress(minus_minus);}
- else if (*loc=='>') if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
- else compress(minus_gt); break;
+ else { if (*loc=='>') { if (*(loc+1)=='*') {loc++; compress(minus_gt_ast);}
+ else compress(minus_gt); } } break;
case '.': if (*loc=='*') {compress(period_ast);}
else if (*loc=='.' && *(loc+1)=='.') {
loc++; compress(dot_dot_dot);
@@ -793,12 +785,13 @@ switch(c) {
else if (*loc=='<') compress(lt_lt); break;
case '&': if (*loc=='&') compress(and_and); break;
case '|': if (*loc=='|') compress(or_or); break;
- case '!': if (*loc=='=') compress(not_eq); break;
+ case '!': if (*loc=='=') compress(non_eq); break;
}
@ @<Get an identifier@>= {
id_first=--loc;
- while (isalpha(*++loc) || isdigit(*loc) || isxalpha(*loc) || ishigh(*loc));
+ while (isalpha((eight_bits)*++loc) || isdigit((eight_bits)*loc) @|
+ || isxalpha((eight_bits)*loc) || ishigh((eight_bits)*loc));
id_loc=loc; return(identifier);
}
@@ -833,7 +826,7 @@ are pointers into the array |section_text|, not into |buffer|.
}
while (*loc=='u' || *loc=='U' || *loc=='l' || *loc=='L'
|| *loc=='f' || *loc=='F') {
- *id_loc++='$'; *id_loc++=toupper(*loc); loc++;
+ *id_loc++='$'; *id_loc++=toupper((eight_bits)*loc); loc++;
}
return(constant);
}
@@ -849,7 +842,8 @@ convention, but do not allow the string to be longer than |longest_name|.
id_loc = section_text;
if (delim=='\'' && *(loc-2)=='@@') {*++id_loc='@@'; *++id_loc='@@';}
*++id_loc=delim;
- if (delim=='L') { /* wide character constant */
+ if (delim=='L' || delim=='u' || delim=='U') { /* wide character constant */
+ if (delim=='u' && *loc=='8') { *++id_loc=*loc++; }
delim=*loc++; *++id_loc=delim;
}
if (delim=='<') delim='>'; /* for file names in |#include| lines */
@@ -868,14 +862,14 @@ convention, but do not allow the string to be longer than |longest_name|.
if (++id_loc<=section_text_end) *id_loc=c;
break;
}
- if (c=='\\') if (loc>=limit) continue;
- else if (++id_loc<=section_text_end) {
+ if (c=='\\') { if (loc>=limit) continue;
+ else { if (++id_loc<=section_text_end) {
*id_loc = '\\'; c=*loc++;
- }
+ } } }
if (++id_loc<=section_text_end) *id_loc=c;
}
if (id_loc>=section_text_end) {
- printf("\n! String too long: ");
+ fputs("\n! String too long: ",stdout);
@.String too long@>
term_write(section_text+1,25);
printf("..."); mark_error;
@@ -894,12 +888,12 @@ whether there is more work to do.
@.Use @@l in limbo...@>
case underline: xref_switch=def_flag; continue;
case trace: tracing=c-'0'; continue;
- case xref_roman: case xref_wildcard: case xref_typewriter:
- case noop: case TeX_string: c=ccode[c]; skip_restricted(); return(c);
+ case xref_roman: case xref_wildcard: case xref_typewriter: case noop:
+ case TeX_string: c=ccode[(eight_bits)c]; skip_restricted(); return(c);
case section_name:
- @<Scan the section name and make |cur_section| point to it@>;
- case verbatim: @<Scan a verbatim string@>;
- case ord: @<Get a string@>;
+ @<Scan the section name and make |cur_section| point to it@>@;
+ case verbatim: @<Scan a verbatim string@>@;
+ case ord: @<Get a string@>@;
default: return(ccode[(eight_bits)c]);
}
}
@@ -910,7 +904,7 @@ because the section name might (for example) follow \&{int}.
@<Scan the section name...@>= {
char *k; /* pointer into |section_text| */
cur_section_char=*(loc-1);
- @<Put section name into |section_text|@>;
+ @<Put section name into |section_text|@>@;
if (k-section_text>3 && strncmp(k-2,"...",3)==0)
cur_section=section_lookup(section_text+1,k-3,1); /* 1 indicates a prefix */
else cur_section=section_lookup(section_text+1,k,0);
@@ -934,7 +928,7 @@ while (1) {
loc=buffer+1; break;
}
c=*loc;
- @<If end of name or erroneous control code, |break|@>;
+ @<If end of name or erroneous control code, |break|@>@;
loc++; if (k<section_text_end) k++;
if (xisspace(c)) {
c=' '; if (*(k-1)==' ') k--;
@@ -942,7 +936,7 @@ while (1) {
*k=c;
}
if (k>=section_text_end) {
- printf("\n! Section name too long: ");
+ fputs("\n! Section name too long: ",stdout);
@.Section name too long@>
term_write(section_text+1,25);
printf("..."); mark_harmless;
@@ -969,11 +963,11 @@ if (c=='@@') {
@ This function skips over a restricted context at relatively high speed.
@<Predecl...@>=
-void skip_restricted();
+static void skip_restricted(void);@/
@ @c
-void
-skip_restricted()
+static void
+skip_restricted(void)
{
id_first=loc; *(limit+1)='@@';
false_alarm:
@@ -1022,19 +1016,19 @@ eight_bits next_control; /* control code waiting to be acting upon */
straightforward outline.
@<Predecl...@>=
-void phase_one();
+static void phase_one(void);@/
@ @c
-void
-phase_one() {
+static void
+phase_one(void) {
phase=1; reset_input(); section_count=0;
skip_limbo(); change_exists=0;
while (!input_has_ended)
- @<Store cross-reference data for the current section@>;
+ @<Store cross-reference data for the current section@>@;
changed_section[section_count]=change_exists;
/* the index changes if anything does */
phase=2; /* prepare for second phase */
- @<Print error messages about unused or undefined section names@>;
+ @<Print error messages about unused or undefined section names@>@;
}
@ @<Store cross-reference data...@>=
@@ -1046,9 +1040,9 @@ phase_one() {
printf("*%d",section_count);
update_terminal; /* print a progress report */
}
- @<Store cross-references in the \TEX/ part of a section@>;
- @<Store cross-references in the definition part of a section@>;
- @<Store cross-references in the \CEE/ part of a section@>;
+ @<Store cross-references in the \TEX/ part of a section@>@;
+ @<Store cross-references in the definition part of a section@>@;
+ @<Store cross-references in the \CEE/ part of a section@>@;
if (changed_section[section_count]) change_exists=1;
}
@@ -1074,12 +1068,13 @@ the relations |xref_roman==identifier+roman| and |xref_wildcard==identifier
as well as |normal==0|.
@<Predecl...@>=
-void C_xref();
+static void C_xref(eight_bits);@/
+static void outer_xref(void);@/
@ @c
-void
-C_xref( spec_ctrl ) /* makes cross-references for \CEE/ identifiers */
- eight_bits spec_ctrl;
+static void
+C_xref(@t\1\1@> /* makes cross-references for \CEE/ identifiers */
+ eight_bits spec_ctrl@t\2\2@>)
{
name_pointer p; /* a referenced name */
while (next_control<format_code || next_control==spec_ctrl) {
@@ -1101,12 +1096,9 @@ C_xref( spec_ctrl ) /* makes cross-references for \CEE/ identifiers */
with |next_control!='|'| and ends with |next_control>=format_code|. Thus, it
handles \CEE/ text with embedded comments.
-@<Predecl...@>=
-void outer_xref();
-
-@ @c
-void
-outer_xref() /* extension of |C_xref| */
+@c
+static void
+outer_xref(void) /* extension of |C_xref| */
{
int bal; /* brace level in comment */
while (next_control<format_code)
@@ -1182,7 +1174,7 @@ while (next_control<=definition) { /* |format_code| or |definition| */
if (next_control==definition) {
xref_switch=def_flag; /* implied \.{@@!} */
next_control=get_next();
- } else @<Process a format definition@>;
+ } else @<Process a format definition@>@;
outer_xref();
}
@@ -1205,7 +1197,7 @@ discover should be unindexed.
for (q=(xref_pointer)lhs->xref;q>xmem;q=q->xlink)
if (q->num<def_flag)
if (r) r->xlink=q->xlink;
- else lhs->xref=(char*)q->xlink;
+ else lhs->xref=(void *)q->xlink;
else r=q;
}
next_control=get_next();
@@ -1264,12 +1256,12 @@ walks through the tree of section names and prints out anomalies.
@^recursion@>
@<Predecl...@>=
-void section_check();
+static void section_check(name_pointer);@/
@ @c
-void
-section_check(p)
-name_pointer p; /* print anomalies in subtree |p| */
+static void
+section_check(
+name_pointer p) /* print anomalies in subtree |p| */
{
if (p) {
section_check(p->llink);
@@ -1277,19 +1269,21 @@ name_pointer p; /* print anomalies in subtree |p| */
if (cur_xref->num==file_flag) {an_output=1; cur_xref=cur_xref->xlink;}
else an_output=0;
if (cur_xref->num <def_flag) {
- printf("\n! Never defined: <"); print_section_name(p); putchar('>'); mark_harmless;
+ fputs("\n! Never defined: <",stdout);
+ print_section_name(p); putchar('>'); mark_harmless;
@.Never defined: <section name>@>
}
while (cur_xref->num >=cite_flag) cur_xref=cur_xref->xlink;
if (cur_xref==xmem && !an_output) {
- printf("\n! Never used: <"); print_section_name(p); putchar('>'); mark_harmless;
+ fputs("\n! Never used: <",stdout);
+ print_section_name(p); putchar('>'); mark_harmless;
@.Never used: <section name>@>
}
section_check(p->rlink);
}
}
-@ @<Print error messages about un...@>=section_check(root)
+@ @<Print error messages about un...@>=section_check(root);
@* Low-level output routines.
The \TEX/ output is supposed to appear in lines at most |line_length|
@@ -1305,7 +1299,7 @@ int out_line; /* number of next line to be output */
@ The |flush_buffer| routine empties the buffer up to a given breakpoint,
and moves any remaining characters to the beginning of the next line.
-If the |per_cent| parameter is 1 a |'%'| is appended to the line
+If the |per_cent| parameter is 1, a |'%'| is appended to the line
that is being output; in this case the breakpoint |b| should be strictly
less than |out_buf_end|. If the |per_cent| parameter is |0|,
trailing blanks are suppressed.
@@ -1317,13 +1311,18 @@ of commented-out text).
@d c_line_write(c) fflush(active_file),fwrite(out_buf+1,sizeof(char),c,active_file)
@d tex_putc(c) putc(c,active_file)
@d tex_new_line putc('\n',active_file)
-@d tex_printf(c) fprintf(active_file,c)
+@d tex_printf(c) fprintf(active_file,"%s",c)
+@d tex_puts(c) fputs(c,active_file)
-@c
-void
-flush_buffer(b,per_cent,carryover)
-char *b; /* outputs from |out_buf+1| to |b|,where |b<=out_ptr| */
-boolean per_cent,carryover;
+@<Predecl...@>=
+static void flush_buffer(char *,boolean,boolean);@/
+static void finish_line(void);@/
+
+@ @c
+static void
+flush_buffer(@t\1\1@>
+char *b, /* outputs from |out_buf+1| to |b|, where |b<=out_ptr| */
+boolean per_cent,boolean carryover@t\2\2@>)
{
char *j; j=b; /* pointer into |out_buf| */
if (! per_cent) /* remove trailing blanks */
@@ -1336,7 +1335,7 @@ boolean per_cent,carryover;
if (*j--=='%' && (j==out_buf || *j!='\\')) {
*b--='%'; break;
}
- if (b<out_ptr) strncpy(out_buf+1,b+1,out_ptr-b);
+ if (b<out_ptr) strncpy(out_buf+1,b+1,(size_t)(out_ptr-b));
out_ptr-=b-out_buf;
}
@@ -1349,8 +1348,8 @@ will not be copied. The |finish_line| routine is called just before
been emitted during the output of translated \CEE/ text.
@c
-void
-finish_line() /* do this at the end of a line */
+static void
+finish_line(void) /* do this at the end of a line */
{
char *k; /* pointer into |buffer| */
if (out_ptr>out_buf) flush_buffer(out_ptr,0,0);
@@ -1366,7 +1365,7 @@ beginning of phase two. We initialize the output variables in a slightly
tricky way so that the first line of the output file will be
`\.{\\input cwebmac}'.
-@<Set init...@>=
+@<Start \TEX/...@>=
out_ptr=out_buf+1; out_line=1; active_file=tex_file;
*out_ptr='c'; tex_printf("\\input cwebma");
@@ -1380,10 +1379,14 @@ A line break will occur at a space or after a single-nonletter
@d out(c) {if (out_ptr>=out_buf_end) break_out(); *(++out_ptr)=c;}
-@c
-void
-out_str(s) /* output characters from |s| to end of string */
-char *s;
+@<Predecl...@>=
+static void out_str(const char *);@/
+static void break_out(void);@/
+
+@ @c
+static void
+out_str(@t\1\1@> /* output characters from |s| to end of string */
+const char*s@t\2\2@>)
{
while (*s) out(*s++);
}
@@ -1399,16 +1402,13 @@ out_buf[0]='\\';
preceded by another backslash. In the latter case, a |'%'| is output at
the break.
-@<Predecl...@>=
-void break_out();
-
-@ @c
-void
-break_out() /* finds a way to break the output line */
+@c
+static void
+break_out(void) /* finds a way to break the output line */
{
char *k=out_ptr; /* pointer into |out_buf| */
while (1) {
- if (k==out_buf) @<Print warning message, break the line, |return|@>;
+ if (k==out_buf) @<Print warning message, break the line, |return|@>@;
if (*k==' ') {
flush_buffer(k,0,1); return;
}
@@ -1437,10 +1437,14 @@ The number to be converted by |out_section| is known to be less than
|def_flag|, so it cannot have more than five decimal digits. If
the section is changed, we output `\.{\\*}' just after the number.
-@c
-void
-out_section(n)
-sixteen_bits n;
+@<Predecl...@>=
+static void out_section(sixteen_bits);@/
+static void out_name(name_pointer,boolean);@/
+
+@ @c
+static void
+out_section(
+sixteen_bits n)
{
char s[6];
sprintf(s,"%d",n); out_str(s);
@@ -1452,10 +1456,10 @@ sixteen_bits n;
entry, enclosing it in braces.
@c
-void
-out_name(p,quote_xalpha)
-name_pointer p;
-boolean quote_xalpha;
+static void
+out_name(
+name_pointer p,
+boolean quote_xalpha)
{
char *k, *k_end=(p+1)->byte_start; /* pointers into |byte_mem| */
out('{');
@@ -1469,11 +1473,9 @@ boolean quote_xalpha;
}
@* Routines that copy \TEX/ material.
-During phase two, we use subroutines |copy_limbo|, |copy_TeX|, and
-|copy_comment| in place of the analogous |skip_limbo|, |skip_TeX|, and
-|skip_comment| that were used in phase one. (Well, |copy_comment|
-was actually written in such a way that it functions as |skip_comment|
-in phase one.)
+During phase two, we use the subroutines |copy_limbo| and |copy_TeX| (and
+|copy_comment|) in place of the analogous |skip_limbo| and |skip_TeX|
+that were used in phase one.
The |copy_limbo| routine, for example, takes \TEX/ material that is not
part of any section and transcribes it almost verbatim to the output file.
@@ -1481,9 +1483,14 @@ The use of `\.{@@}' signs is severely restricted in such material:
`\.{@@@@}' pairs are replaced by singletons; `\.{@@l}' and `\.{@@q}' and
`\.{@@s}' are interpreted.
-@c
-void
-copy_limbo()
+@<Predecl...@>=
+static void copy_limbo(void);@/
+static eight_bits copy_TeX(void);@/
+static int copy_comment(boolean,int);@/
+
+@ @c
+static void
+copy_limbo(void)
{
char c;
while (1) {
@@ -1515,10 +1522,10 @@ way. It returns the next control code or `\.{\v}' found in the input.
We don't copy spaces or tab marks into the beginning of a line. This
makes the test for empty lines in |finish_line| work.
-@ @f copy_TeX TeX
+@f copy_TeX TeX
@c
-eight_bits
-copy_TeX()
+static eight_bits
+copy_TeX(void)
{
char c; /* current character being copied */
while (1) {
@@ -1545,13 +1552,10 @@ one further token without overflow.
@d app_tok(c) {if (tok_ptr+2>tok_mem_end) overflow("token"); *(tok_ptr++)=c;}
-@<Predec...@>=
-int copy_comment();
-
-@ @c
-int copy_comment(is_long_comment,bal) /* copies \TEX/ code in comments */
-boolean is_long_comment; /* is this a traditional \CEE/ comment? */
-int bal; /* brace balance */
+@c
+static int copy_comment(@t\1\1@> /* copies \TeX\ code in comments */
+boolean is_long_comment, /* is this a traditional \CEE/ comment? */
+int bal@t\2\2@>) /* brace balance */
{
char c; /* current character being copied */
while (1) {
@@ -1571,12 +1575,12 @@ int bal; /* brace balance */
}
c=*(loc++);
if (c=='|') return(bal);
- if (is_long_comment) @<Check for end of comment@>;
+ if (is_long_comment) @<Check for end of comment@>@;
if (phase==2) {
if (ishigh(c)) app_tok(quoted_char);
app_tok(c);
}
- @<Copy special things when |c=='@@', '\\'|@>;
+ @<Copy special things when |c=='@@', '\\'|@>@;
if (c=='{') bal++;
else if (c=='}') {
if(bal>1) bal--;
@@ -1586,7 +1590,7 @@ int bal; /* brace balance */
}
}
}
-done:@<Clear |bal| and |return|@>;
+done:@<Clear |bal| and |return|@>@;
}
@ @<Check for end of comment@>=
@@ -1605,8 +1609,8 @@ if (c=='@@') {
loc-=2; if (phase==2) *(tok_ptr-1)=' '; goto done;
}
}
-else if (c=='\\' && *loc!='@@')
- if (phase==2) app_tok(*(loc++))@; else loc++;
+else { if (c=='\\' && *loc!='@@') {
+ if (phase==2) app_tok(*(loc++))@; else loc++; } }
@ We output
enough right braces to keep \TEX/ happy.
@@ -1660,9 +1664,12 @@ In the \TEX/ file, this will specify an optional line break after the
comma, with penalty 90.
At each opportunity the longest possible production is applied. For
-example, if the current sequence of scraps is |int_like| |cast|
-|lbrace|, rule 31 is applied; but if the sequence is |int_like| |cast|
-followed by anything other than |lbrace|, rule 32 takes effect.
+example, if the current sequence of scraps is |if_clause| |stmt|
+|else_like| |if_like|, rule 63 is applied; but if the sequence is
+|if_clause| |stmt| |else_like| followed by anything other than
+|if_like|, rule 64 takes effect; and if the sequence is |if_clause|
+|stmt| followed by anything other than |else_like|, rule 65 takes
+effect.
Translation rules such as `$E_1C\,\\{opt}9\,E_2$' above use subscripts
to distinguish between translations of scraps whose categories have the
@@ -1713,11 +1720,9 @@ same initial letter; these subscripts are assigned from left to right.
@<Glo...@>=
char cat_name[256][12];
-eight_bits cat_index;
@ @<Set in...@>=
- for (cat_index=0;cat_index<255;cat_index++)
- strcpy(cat_name[cat_index],"UNKNOWN");
+{int c; for (c=0;c<256;c++) strcpy(cat_name[c],"UNKNOWN");}
@.UNKNOWN@>
strcpy(cat_name[exp],"exp");
strcpy(cat_name[unop],"unop");
@@ -1780,12 +1785,15 @@ eight_bits cat_index;
@ This code allows \.{CWEAVE} to display its parsing steps.
-@c
-void
-print_cat(c) /* symbolic printout of a category */
-eight_bits c;
+@<Predecl...@>=
+static void print_cat(eight_bits);@/
+
+@ @c
+static void
+print_cat(@t\1\1@> /* symbolic printout of a category */
+eight_bits c@t\2\2@>)
{
- printf(cat_name[c]);
+ fputs(cat_name[c],stdout);
}
@ The token lists for translated \TEX/ output contain some special control
@@ -2135,10 +2143,13 @@ translated without line-break controls.
@d tok_flag 4*id_flag /* signifies a token list */
@d inner_tok_flag 5*id_flag /* signifies a token list in `\pb' */
-@c
-void
-print_text(p) /* prints a token list for debugging; not used in |main| */
-text_pointer p;
+@<Predecl...@>=
+static void print_text(text_pointer p);@/
+
+@ @c
+static void
+print_text(@t\1\1@> /* prints a token list for debugging; not used in |main| */
+text_pointer p@t\2\2@>)
{
token_pointer j; /* index into |tok_mem| */
sixteen_bits r; /* remainder of token after the flag has been stripped off */
@@ -2154,10 +2165,10 @@ text_pointer p;
break; /* |section_flag| */
case 4: printf("[[%d]]",r); break; /* |tok_flag| */
case 5: printf("|[[%d]]|",r); break; /* |inner_tok_flag| */
- default: @<Print token |r| in symbolic form@>;
+ default: @<Print token |r| in symbolic form@>@;
}
}
- fflush(stdout);
+ update_terminal;
}
@ @<Print token |r|...@>=
@@ -2173,7 +2184,7 @@ switch (r) {
case force: printf("[force]"); break;
case big_force: printf("[fforce]"); break;
case preproc_line: printf("[preproc]"); break;
- case quoted_char: j++; printf("[%o]",(unsigned)*j); break;
+ case quoted_char: j++; printf("[%o]",(unsigned int)*j); break;
case end_translation: printf("[quit]"); break;
case inserted: printf("[inserted]"); break;
default: putxchar(r);
@@ -2254,23 +2265,28 @@ productions as they were listed earlier.
@d big_app2(a) big_app1(a);big_app1(a+1)
@d big_app3(a) big_app2(a);big_app1(a+2)
@d big_app4(a) big_app3(a);big_app1(a+3)
-@d app(a) *(tok_ptr++)=a
-@d app1(a) *(tok_ptr++)=tok_flag+(int)((a)->trans-tok_start)
+@d app(a) *(tok_ptr++)=(token)(a)
+@d app1(a) *(tok_ptr++)=(token)(tok_flag+(int)((a)->trans-tok_start))
@<Global...@>=
int cur_mathness, init_mathness;
+@ @<Predecl...@>=
+static void app_str(const char *);@/
+static void big_app(token);@/
+static void big_app1(scrap_pointer);@/
+
@ @c
-void
-app_str(s)
-char *s;
+static void
+app_str(
+const char *s)
{
while (*s) app_tok(*(s++));
}
-void
-big_app(a)
-token a;
+static void
+big_app(
+token a)
{
if (a==' ' || (a>=big_cancel && a<=big_force)) /* non-math token */ {
if (cur_mathness==maybe_math) init_mathness=no_math;
@@ -2285,9 +2301,9 @@ token a;
app(a);
}
-void
-big_app1(a)
-scrap_pointer a;
+static void
+big_app1(
+scrap_pointer a)
{
switch (a->mathness % 4) { /* left boundary */
case (no_math):
@@ -2316,11 +2332,11 @@ code needs to be provided with a proper environment.
@d lhs_not_simple (pp->cat!=public_like
&& pp->cat!=semi
&& pp->cat!=prelangle
- && pp->cat!=prerangle
+ && pp->cat!=prerangle @|
&& pp->cat!=template_like
&& pp->cat!=new_like
&& pp->cat!=new_exp
- && pp->cat!=ftemplate
+ && pp->cat!=ftemplate @|
&& pp->cat!=raw_ubin
&& pp->cat!=const_like
&& pp->cat!=raw_int
@@ -2336,53 +2352,53 @@ code needs to be provided with a proper environment.
else if (cat3==insert) squash(pp+2,2,(pp+2)->cat,0,0);
else
switch (pp->cat) {
- case exp: @<Cases for |exp|@>; @+break;
- case lpar: @<Cases for |lpar|@>; @+break;
- case unop: @<Cases for |unop|@>; @+break;
- case ubinop: @<Cases for |ubinop|@>; @+break;
- case binop: @<Cases for |binop|@>; @+break;
- case cast: @<Cases for |cast|@>; @+break;
- case sizeof_like: @<Cases for |sizeof_like|@>; @+break;
- case int_like: @<Cases for |int_like|@>; @+break;
- case public_like: @<Cases for |public_like|@>; @+break;
- case colcol: @<Cases for |colcol|@>; @+break;
- case decl_head: @<Cases for |decl_head|@>; @+break;
- case decl: @<Cases for |decl|@>; @+break;
- case base: @<Cases for |base|@>; @+break;
- case struct_like: @<Cases for |struct_like|@>; @+break;
- case struct_head: @<Cases for |struct_head|@>; @+break;
- case fn_decl: @<Cases for |fn_decl|@>; @+break;
- case function: @<Cases for |function|@>; @+break;
- case lbrace: @<Cases for |lbrace|@>; @+break;
- case if_like: @<Cases for |if_like|@>; @+break;
- case else_like: @<Cases for |else_like|@>; @+break;
- case else_head: @<Cases for |else_head|@>; @+break;
- case if_clause: @<Cases for |if_clause|@>; @+break;
- case if_head: @<Cases for |if_head|@>; @+break;
- case do_like: @<Cases for |do_like|@>; @+break;
- case case_like: @<Cases for |case_like|@>; @+break;
- case catch_like: @<Cases for |catch_like|@>; @+break;
- case tag: @<Cases for |tag|@>; @+break;
- case stmt: @<Cases for |stmt|@>; @+break;
- case semi: @<Cases for |semi|@>; @+break;
- case lproc: @<Cases for |lproc|@>; @+break;
- case section_scrap: @<Cases for |section_scrap|@>; @+break;
- case insert: @<Cases for |insert|@>; @+break;
- case prelangle: @<Cases for |prelangle|@>; @+break;
- case prerangle: @<Cases for |prerangle|@>; @+break;
- case langle: @<Cases for |langle|@>; @+break;
- case template_like: @<Cases for |template_like|@>; @+break;
- case new_like: @<Cases for |new_like|@>; @+break;
- case new_exp: @<Cases for |new_exp|@>; @+break;
- case ftemplate: @<Cases for |ftemplate|@>; @+break;
- case for_like: @<Cases for |for_like|@>; @+break;
- case raw_ubin: @<Cases for |raw_ubin|@>; @+break;
- case const_like: @<Cases for |const_like|@>; @+break;
- case raw_int: @<Cases for |raw_int|@>; @+break;
- case operator_like: @<Cases for |operator_like|@>; @+break;
- case typedef_like: @<Cases for |typedef_like|@>; @+break;
- case delete_like: @<Cases for |delete_like|@>; @+break;
- case question: @<Cases for |question|@>; @+break;
+ case exp: @<Cases for |exp|@>@; @+break;
+ case lpar: @<Cases for |lpar|@>@; @+break;
+ case unop: @<Cases for |unop|@>@; @+break;
+ case ubinop: @<Cases for |ubinop|@>@; @+break;
+ case binop: @<Cases for |binop|@>@; @+break;
+ case cast: @<Cases for |cast|@>@; @+break;
+ case sizeof_like: @<Cases for |sizeof_like|@>@; @+break;
+ case int_like: @<Cases for |int_like|@>@; @+break;
+ case public_like: @<Cases for |public_like|@>@; @+break;
+ case colcol: @<Cases for |colcol|@>@; @+break;
+ case decl_head: @<Cases for |decl_head|@>@; @+break;
+ case decl: @<Cases for |decl|@>@; @+break;
+ case base: @<Cases for |base|@>@; @+break;
+ case struct_like: @<Cases for |struct_like|@>@; @+break;
+ case struct_head: @<Cases for |struct_head|@>@; @+break;
+ case fn_decl: @<Cases for |fn_decl|@>@; @+break;
+ case function: @<Cases for |function|@>@; @+break;
+ case lbrace: @<Cases for |lbrace|@>@; @+break;
+ case if_like: @<Cases for |if_like|@>@; @+break;
+ case else_like: @<Cases for |else_like|@>@; @+break;
+ case else_head: @<Cases for |else_head|@>@; @+break;
+ case if_clause: @<Cases for |if_clause|@>@; @+break;
+ case if_head: @<Cases for |if_head|@>@; @+break;
+ case do_like: @<Cases for |do_like|@>@; @+break;
+ case case_like: @<Cases for |case_like|@>@; @+break;
+ case catch_like: @<Cases for |catch_like|@>@; @+break;
+ case tag: @<Cases for |tag|@>@; @+break;
+ case stmt: @<Cases for |stmt|@>@; @+break;
+ case semi: @<Cases for |semi|@>@; @+break;
+ case lproc: @<Cases for |lproc|@>@; @+break;
+ case section_scrap: @<Cases for |section_scrap|@>@; @+break;
+ case insert: @<Cases for |insert|@>@; @+break;
+ case prelangle: @<Cases for |prelangle|@>@; @+break;
+ case prerangle: @<Cases for |prerangle|@>@; @+break;
+ case langle: @<Cases for |langle|@>@; @+break;
+ case template_like: @<Cases for |template_like|@>@; @+break;
+ case new_like: @<Cases for |new_like|@>@; @+break;
+ case new_exp: @<Cases for |new_exp|@>@; @+break;
+ case ftemplate: @<Cases for |ftemplate|@>@; @+break;
+ case for_like: @<Cases for |for_like|@>@; @+break;
+ case raw_ubin: @<Cases for |raw_ubin|@>@; @+break;
+ case const_like: @<Cases for |const_like|@>@; @+break;
+ case raw_int: @<Cases for |raw_int|@>@; @+break;
+ case operator_like: @<Cases for |operator_like|@>@; @+break;
+ case typedef_like: @<Cases for |typedef_like|@>@; @+break;
+ case delete_like: @<Cases for |delete_like|@>@; @+break;
+ case question: @<Cases for |question|@>@; @+break;
}
pp++; /* if no match was found, we move to the right */
}
@@ -2411,10 +2427,16 @@ more properly alphebetized,
@d case_found (token_pointer)1 /* likewise */
@d operator_found (token_pointer)2 /* likewise */
-@c
-token_pointer
-find_first_ident(p)
-text_pointer p;
+@<Predecl...@>=
+static token_pointer find_first_ident(text_pointer);@/
+static void make_reserved(scrap_pointer);@/
+static void make_underlined(scrap_pointer);@/
+static void underline_xref(name_pointer);@/
+
+@ @c
+static token_pointer
+find_first_ident(
+text_pointer p)
{
token_pointer q; /* token to be returned */
token_pointer j; /* token being looked at */
@@ -2444,11 +2466,11 @@ occurrence of the identifier that we're making reserved; hence
the |for| loop below.
@c
-void
-make_reserved(p) /* make the first identifier in |p->trans| like |int| */
-scrap_pointer p;
+static void
+make_reserved(@t\1\1@> /* make the first identifier in |p->trans| like |int| */
+scrap_pointer p@t\2\2@>)
{
- sixteen_bits tok_value; /* the name of this identifier, plus its flag*/
+ sixteen_bits tok_value; /* the name of this identifier, plus its flag */
token_pointer tok_loc; /* pointer to |tok_value| */
if ((tok_loc=find_first_ident(p->trans))<=operator_found)
return; /* this should not happen */
@@ -2475,10 +2497,10 @@ of a function, we find out that the identifier is being defined only after
it has been swallowed up by an |exp|.
@c
-void
-make_underlined(p)
+static void
+make_underlined(@t\1\1@>
/* underline the entry for the first identifier in |p->trans| */
-scrap_pointer p;
+scrap_pointer p@t\2\2@>)
{
token_pointer tok_loc; /* where the first identifier appears */
if ((tok_loc=find_first_ident(p->trans))<=operator_found)
@@ -2492,13 +2514,10 @@ because this would just make a new cross-reference at the end of the list.
We actually have to search through the list for the existing
cross-reference.
-@<Predecl...@>=
-void underline_xref();
-
-@ @c
-void
-underline_xref(p)
-name_pointer p;
+@c
+static void
+underline_xref(
+name_pointer p)
{
xref_pointer q=(xref_pointer)p->xref; /* pointer to cross-reference being examined */
xref_pointer r; /* temporary pointer for permuting cross-references */
@@ -2515,7 +2534,7 @@ name_pointer p;
else if (n>=def_flag && n<m) break;
q=q->xlink;
}
- @<Insert new cross-reference at |q|, not at beginning of list@>;
+ @<Insert new cross-reference at |q|, not at beginning of list@>@;
}
@ We get to this section only when the identifier is one letter long,
@@ -2528,7 +2547,7 @@ to insert the new cross-reference not at the beginning of the list
@<Insert new cross-reference at |q|...@>=
append_xref(0); /* this number doesn't matter */
xref_ptr->xlink=(xref_pointer)p->xref; r=xref_ptr;
- p->xref=(char*)xref_ptr;
+ update_node(p);
while (r->xlink!=q) {r->num=r->xlink->num; r=r->xlink;}
r->num=m; /* everything from |q| on is left undisturbed */
@@ -2818,7 +2837,11 @@ else if (cat1==stmt||cat1==decl||cat1==function) {
grouped together on the same line.
@d force_lines flags['f'] /* should each statement be on its own line? */
-@<Cases for |stmt|@>=
+
+@<Set init...@>=
+force_lines=true;
+
+@ @<Cases for |stmt|@>=
if (cat1==stmt||cat1==decl||cat1==function) {
big_app1(pp);
if (cat1==function) big_app(big_force);
@@ -3000,12 +3023,16 @@ too large, since it is assumed that this test was done beforehand.
@d freeze_text *(++text_ptr)=tok_ptr
-@c
-void
-reduce(j,k,c,d,n)
-scrap_pointer j;
-eight_bits c;
-short k, d, n;
+@<Predecl...@>=
+static void reduce(scrap_pointer,short,eight_bits,short,short);@/
+static void squash(scrap_pointer,short,eight_bits,short,short);@/
+
+@ @c
+static void
+reduce(
+scrap_pointer j, short k,
+eight_bits c,
+short d, short n)
{
scrap_pointer i, i1; /* pointers into scrap memory */
j->cat=c; j->trans=text_ptr;
@@ -3019,7 +3046,7 @@ short k, d, n;
lo_ptr=lo_ptr-k+1;
}
pp=(pp+d<scrap_base? scrap_base: pp+d);
- @<Print a snapshot of the scrap list if debugging @>;
+ @<Print a snapshot of the scrap list if debugging @>@;
pp--; /* we next say |pp++| */
}
@@ -3027,16 +3054,16 @@ short k, d, n;
takes advantage of the simplification that occurs when |k==1|.
@c
-void
-squash(j,k,c,d,n)
-scrap_pointer j;
-eight_bits c;
-short k, d, n;
+static void
+squash(
+scrap_pointer j, short k,
+eight_bits c,
+short d, short n)
{
scrap_pointer i; /* pointers into scrap memory */
if (k==1) {
j->cat=c; pp=(pp+d<scrap_base? scrap_base: pp+d);
- @<Print a snapshot...@>;
+ @<Print a snapshot...@>@;
pp--; /* we next say |pp++| */
return;
}
@@ -3059,7 +3086,7 @@ than to squeeze the last bit of space from the memory arrays.
@<Reduce the scraps using the productions until no more rules apply@>=
while (1) {
- @<Make sure the entries |pp| through |pp+3| of |cat| are defined@>;
+ @<Make sure the entries |pp| through |pp+3| of |cat| are defined@>@;
if (tok_ptr+safe_tok_incr>tok_mem_end) {
if (tok_ptr>max_tok_ptr) max_tok_ptr=tok_ptr;
overflow("token");
@@ -3070,7 +3097,7 @@ while (1) {
}
if (pp>lo_ptr) break;
init_mathness=cur_mathness=maybe_math;
- @<Match a production...@>;
+ @<Match a production...@>@;
}
@ If we get to the end of the scrap list, category codes equal to zero are
@@ -3094,18 +3121,18 @@ a sequence of two or more irreducible scraps will be printed out when
int tracing; /* can be used to show parsing details */
@ @<Print a snapsh...@>=
-{ scrap_pointer k; /* pointer into |scrap_info| */
+{ scrap_pointer k_l; /* pointer into |scrap_info| */
if (tracing==2) {
printf("\n%d:",n);
- for (k=scrap_base; k<=lo_ptr; k++) {
- if (k==pp) putxchar('*'); else putxchar(' ');
- if (k->mathness %4 == yes_math) putchar('+');
- else if (k->mathness %4 == no_math) putchar('-');
- print_cat(k->cat);
- if (k->mathness /4 == yes_math) putchar('+');
- else if (k->mathness /4 == no_math) putchar('-');
+ for (k_l=scrap_base; k_l<=lo_ptr; k_l++) {
+ if (k_l==pp) putxchar('*'); else putxchar(' ');
+ if (k_l->mathness %4 == yes_math) putchar('+');
+ else if (k_l->mathness %4 == no_math) putchar('-');
+ print_cat(k_l->cat);
+ if (k_l->mathness /4 == yes_math) putchar('+');
+ else if (k_l->mathness /4 == no_math) putchar('-');
}
- if (hi_ptr<=scrap_ptr) printf("..."); /* indicate that more is coming */
+ if (hi_ptr<=scrap_ptr) fputs("...",stdout); /* indicate that more is coming */
}
}
@@ -3122,16 +3149,19 @@ lists with up to six tokens without checking for overflow. Before calling
since |translate| might add a new text and a new scrap before it checks
for overflow.
-@c
-text_pointer
-translate() /* converts a sequence of scraps */
+@<Predecl...@>=
+static text_pointer translate(void);@/
+
+@ @c
+static text_pointer
+translate(void) /* converts a sequence of scraps */
{
scrap_pointer i, /* index into |cat| */
j; /* runs through final scraps */
pp=scrap_base; lo_ptr=pp-1; hi_ptr=pp;
- @<If tracing, print an indication of where we are@>;
- @<Reduce the scraps...@>;
- @<Combine the irreducible scraps that remain@>;
+ @<If tracing, print an indication of where we are@>@;
+ @<Reduce the scraps...@>@;
+ @<Combine the irreducible scraps that remain@>@;
}
@ If the initial sequence of scraps does not reduce to a single scrap,
@@ -3140,7 +3170,7 @@ blank spaces, with dollar signs surrounding the translations of scraps
where appropriate.
@<Combine the irreducible...@>= {
- @<If semi-tracing, show the irreducible scraps@>;
+ @<If semi-tracing, show the irreducible scraps@>@;
for (j=scrap_base; j<=lo_ptr; j++) {
if (j!=scrap_base) app(' ');
if (j->mathness % 4 == yes_math) app('$');
@@ -3187,14 +3217,17 @@ repeatedly to read \CEE/ text until encountering the next `\.{\v}' or
what it reads are appended into the |cat| and |trans| arrays, and |scrap_ptr|
is advanced.
-@c
-void
-C_parse(spec_ctrl) /* creates scraps from \CEE/ tokens */
- eight_bits spec_ctrl;
+@<Predecl...@>=
+static void C_parse(eight_bits);@/
+
+@ @c
+static void
+C_parse(@t\1\1@> /* creates scraps from \CEE/ tokens */
+ eight_bits spec_ctrl@t\2\2@>)
{
int count; /* characters remaining before string break */
while (next_control<format_code || next_control==spec_ctrl) {
- @<Append the scrap appropriate to |next_control|@>;
+ @<Append the scrap appropriate to |next_control|@>@;
next_control=get_next();
if (next_control=='|' || next_control==begin_comment ||
next_control==begin_short_comment) return;
@@ -3211,76 +3244,77 @@ been appended:
}
@ @<Append the scr...@>=
-@<Make sure that there is room for the new scraps, tokens, and texts@>;
+@<Make sure that there is room for the new scraps, tokens, and texts@>@;
switch (next_control) {
case section_name:
app(section_flag+(int)(cur_section-name_dir));
app_scrap(section_scrap,maybe_math);
app_scrap(exp,yes_math);@+break;
- case string: case constant: case verbatim: @<Append a string or constant@>;
- @+break;
+ case string: case constant: case verbatim:
+ @<Append a string or constant@>@;@+break;
case identifier: app_cur_id(1);@+break;
- case TeX_string: @<Append a \TEX/ string, without forming a scrap@>;@+break;
+ case TeX_string:
+ @<Append a \TEX/ string, without forming a scrap@>@;@+break;
case '/': case '.':
- app(next_control); app_scrap(binop,yes_math);@+break;
+ app(next_control);@+app_scrap(binop,yes_math);@+break;
case '<': app_str("\\langle");@+app_scrap(prelangle,yes_math);@+break;
@.\\langle@>
case '>': app_str("\\rangle");@+app_scrap(prerangle,yes_math);@+break;
@.\\rangle@>
- case '=': app_str("\\K"); app_scrap(binop,yes_math);@+break;
+ case '=': app_str("\\K");@+app_scrap(binop,yes_math);@+break;
@.\\K@>
- case '|': app_str("\\OR"); app_scrap(binop,yes_math);@+break;
+ case '|': app_str("\\OR");@+app_scrap(binop,yes_math);@+break;
@.\\OR@>
- case '^': app_str("\\XOR"); app_scrap(binop,yes_math);@+break;
+ case '^': app_str("\\XOR");@+app_scrap(binop,yes_math);@+break;
@.\\XOR@>
- case '%': app_str("\\MOD"); app_scrap(binop,yes_math);@+break;
+ case '%': app_str("\\MOD");@+app_scrap(binop,yes_math);@+break;
@.\\MOD@>
- case '!': app_str("\\R"); app_scrap(unop,yes_math);@+break;
+ case '!': app_str("\\R");@+app_scrap(unop,yes_math);@+break;
@.\\R@>
- case '~': app_str("\\CM"); app_scrap(unop,yes_math);@+break;
+ case '~': app_str("\\CM");@+app_scrap(unop,yes_math);@+break;
@.\\CM@>
- case '+': case '-': app(next_control); app_scrap(ubinop,yes_math);@+break;
- case '*': app(next_control); app_scrap(raw_ubin,yes_math);@+break;
- case '&': app_str("\\AND"); app_scrap(raw_ubin,yes_math);@+break;
+ case '+': case '-': app(next_control);@+app_scrap(ubinop,yes_math);@+break;
+ case '*': app(next_control);@+app_scrap(raw_ubin,yes_math);@+break;
+ case '&': app_str("\\AND");@+app_scrap(raw_ubin,yes_math);@+break;
@.\\AND@>
- case '?': app_str("\\?"); app_scrap(question,yes_math);@+break;
+ case '?': app_str("\\?");@+app_scrap(question,yes_math);@+break;
@.\\?@>
- case '#': app_str("\\#"); app_scrap(ubinop,yes_math);@+break;
+ case '#': app_str("\\#");@+app_scrap(ubinop,yes_math);@+break;
@.\\\#@>
case ignore: case xref_roman: case xref_wildcard:
case xref_typewriter: case noop:@+break;
- case '(': case '[': app(next_control); app_scrap(lpar,maybe_math);@+break;
- case ')': case ']': app(next_control); app_scrap(rpar,maybe_math);@+break;
- case '{': app_str("\\{"@q}@>); app_scrap(lbrace,yes_math);@+break;
+ case '(': case '[': app(next_control);@+app_scrap(lpar,maybe_math);@+break;
+ case ')': case ']': app(next_control);@+app_scrap(rpar,maybe_math);@+break;
+ case '{': app_str("\\{"@q}@>);@+app_scrap(lbrace,yes_math);@+break;
@.\\\{@>@q}@>
- case '}': app_str(@q{@>"\\}"); app_scrap(rbrace,yes_math);@+break;
+ case '}': app_str(@q{@>"\\}");@+app_scrap(rbrace,yes_math);@+break;
@q{@>@.\\\}@>
- case ',': app(','); app_scrap(comma,yes_math);@+break;
- case ';': app(';'); app_scrap(semi,maybe_math);@+break;
- case ':': app(':'); app_scrap(colon,no_math);@+break;@/
+ case ',': app(',');@+app_scrap(comma,yes_math);@+break;
+ case ';': app(';');@+app_scrap(semi,maybe_math);@+break;
+ case ':': app(':');@+app_scrap(colon,no_math);@+break;@/
@t\4@> @<Cases involving nonstandard characters@>@;
- case thin_space: app_str("\\,"); app_scrap(insert,maybe_math);@+break;
+ case thin_space: app_str("\\,");@+app_scrap(insert,maybe_math);@+break;
@.\\,@>
- case math_break: app(opt); app_str("0");
+ case math_break: app(opt);@+app_str("0");@+
app_scrap(insert,maybe_math);@+break;
- case line_break: app(force); app_scrap(insert,no_math);@+break;
- case left_preproc: app(force); app(preproc_line);
- app_str("\\#"); app_scrap(lproc,no_math);@+break;
+ case line_break: app(force);@+app_scrap(insert,no_math);@+break;
+ case left_preproc: app(force);@+app(preproc_line);@+app_str("\\#");
+ app_scrap(lproc,no_math);@+break;
@.\\\#@>
- case right_preproc: app(force); app_scrap(rproc,no_math);@+break;
- case big_line_break: app(big_force); app_scrap(insert,no_math);@+break;
- case no_line_break: app(big_cancel); app(noop); app(break_space);
- app(noop); app(big_cancel);
+ case right_preproc: app(force);@+app_scrap(rproc,no_math);@+break;
+ case big_line_break: app(big_force);@+app_scrap(insert,no_math);@+break;
+ case no_line_break: app(big_cancel);@+app(noop);@+app(break_space);@+
+ app(noop);@+app(big_cancel);
app_scrap(insert,no_math);@+break;
case pseudo_semi: app_scrap(semi,maybe_math);@+break;
case macro_arg_open: app_scrap(begin_arg,maybe_math);@+break;
case macro_arg_close: app_scrap(end_arg,maybe_math);@+break;
- case join: app_str("\\J"); app_scrap(insert,no_math);@+break;
+ case join: app_str("\\J");@+app_scrap(insert,no_math);@+break;
@.\\J@>
- case output_defs_code: app(force); app_str("\\ATH"); app(force);
+ case output_defs_code: app(force);@+app_str("\\ATH");@+app(force);
app_scrap(insert,no_math);@+break;
@.\\ATH@>
- default: app(inserted); app(next_control);
+ default: app(inserted);@+app(next_control);
app_scrap(insert,maybe_math);@+break;
}
@@ -3299,7 +3333,7 @@ standard ones. They are converted to \TEX/ control sequences so that it is
possible to keep \.{CWEAVE} from outputting unusual |char| codes.
@<Cases involving nonstandard...@>=
-case not_eq: app_str("\\I");@+app_scrap(binop,yes_math);@+break;
+case non_eq: app_str("\\I");@+app_scrap(binop,yes_math);@+break;
@.\\I@>
case lt_eq: app_str("\\Z");@+app_scrap(binop,yes_math);@+break;
@.\\Z@>
@@ -3419,12 +3453,14 @@ app(@q{@>'}');
token list; it also builds a new scrap if |scrapping==1|.
@<Predec...@>=
-void app_cur_id();
+static void app_cur_id(boolean);@/
+static text_pointer C_translate(void);@/
+static void outer_parse(void);@/
@ @c
-void
-app_cur_id(scrapping)
-boolean scrapping; /* are we making this into a scrap? */
+static void
+app_cur_id(@t\1\1@>
+boolean scrapping@t\2\2@>) /* are we making this into a scrap? */
{
name_pointer p=id_lookup(id_first,id_loc,normal);
if (p->ilk<=custom) { /* not a reserved word */
@@ -3447,8 +3483,8 @@ that text. If scraps exist in |scrap_info|, they are
unaffected by this translation process.
@c
-text_pointer
-C_translate()
+static text_pointer
+C_translate(void)
{
text_pointer p; /* points to the translation */
scrap_pointer save_base; /* holds original value of |scrap_base| */
@@ -3476,9 +3512,12 @@ program text.
@d make_pb flags['e']
-@c
-void
-outer_parse() /* makes scraps from \CEE/ tokens and comments */
+@<Set init...@>=
+make_pb=true;
+
+@ @c
+static void
+outer_parse(void) /* makes scraps from \CEE/ tokens and comments */
{
int bal; /* brace level in comment */
text_pointer p, q; /* partial comments */
@@ -3487,7 +3526,7 @@ outer_parse() /* makes scraps from \CEE/ tokens and comments */
C_parse(ignore);
else {
boolean is_long_comment=(next_control==begin_comment);
- @<Make sure that there is room for the new...@>;
+ @<Make sure that there is room for the new...@>@;
app(cancel); app(inserted);
if (is_long_comment) app_str("\\C{"@q}@>);
@.\\C@>
@@ -3582,10 +3621,14 @@ max_stack_ptr=stack;
is called; it saves the old level of output and gets a new one going.
The value of |cur_mode| is not changed.
-@c
-void
-push_level(p) /* suspends the current level */
-text_pointer p;
+@<Predecl...@>=
+static void push_level(text_pointer);@/
+static void pop_level(void);@/
+
+@ @c
+static void
+push_level(@t\1\1@> /* suspends the current level */
+text_pointer p@t\2\2@>)
{
if (stack_ptr==stack_end) overflow("stack");
if (stack_ptr>stack) { /* save current state */
@@ -3603,8 +3646,8 @@ force when the current level was begun. This subroutine will never be
called when |stack_ptr==1|.
@c
-void
-pop_level()
+static void
+pop_level(void)
{
cur_end=(--stack_ptr)->end_field;
cur_tok=stack_ptr->tok_field; cur_mode=stack_ptr->mode_field;
@@ -3624,9 +3667,14 @@ name_pointer cur_name;
@ @d res_word 0201 /* returned by |get_output| for reserved words */
@d section_code 0200 /* returned by |get_output| for section names */
-@c
-eight_bits
-get_output() /* returns the next token of output */
+@<Predecl...@>=
+static eight_bits get_output(void);@/
+static void output_C(void);@/
+static void make_output(void);@/
+
+@ @c
+static eight_bits
+get_output(void) /* returns the next token of output */
{
sixteen_bits a; /* current item read from |tok_mem| */
restart: while (cur_tok==cur_end) pop_level();
@@ -3643,7 +3691,7 @@ get_output() /* returns the next token of output */
default: return(identifier); /* |a==id_flag+cur_name| */
}
}
- return(a);
+ return((eight_bits)a);
}
@ The real work associated with token output is done by |make_output|.
@@ -3662,8 +3710,8 @@ while outputting the name of a section.
@^recursion@>
@c
-void
-output_C() /* outputs the current token list */
+static void
+output_C(void) /* outputs the current token list */
{
token_pointer save_tok_ptr;
text_pointer save_text_ptr;
@@ -3684,17 +3732,14 @@ output_C() /* outputs the current token list */
@ Here is \.{CWEAVE}'s major output handler.
-@<Predecl...@>=
-void make_output();
-
-@ @c
-void
-make_output() /* outputs the equivalents of tokens */
+@c
+static void
+make_output(void) /* outputs the equivalents of tokens */
{
- eight_bits a, /* current output byte */
+ eight_bits a=0, /* current output byte */
b; /* next output byte */
int c; /* count of |indent| and |outdent| tokens */
- char scratch[longest_name]; /* scratch area for section names */
+ char scratch[longest_name+1]; /* scratch area for section names */
char *k, *k_limit; /* indices into |scratch| */
char *j; /* index into |buffer| */
char *p; /* index into |byte_mem| */
@@ -3708,8 +3753,8 @@ make_output() /* outputs the equivalents of tokens */
a=get_output();
reswitch: switch(a) {
case end_translation: return;
- case identifier: case res_word: @<Output an identifier@>; break;
- case section_code: @<Output a section name@>; break;
+ case identifier: case res_word: @<Output an identifier@>@; break;
+ case section_code: @<Output a section name@>@; break;
case math_rel: out_str("\\MRL{"@q}@>);
@.\\MRL@>
case noop: case inserted: break;
@@ -3721,11 +3766,11 @@ make_output() /* outputs the equivalents of tokens */
if (a==indent) c++; else if (a==outdent) c--;
else if (a==opt) a=get_output();
}
- @<Output saved |indent| or |outdent| tokens@>;
+ @<Output saved |indent| or |outdent| tokens@>@;
goto reswitch;
case indent: case outdent: case opt: case backup: case break_space:
case force: case big_force: case preproc_line: @<Output a control,
- look ahead in case of line breaks, possibly |goto reswitch|@>; break;
+ look ahead in case of line breaks, possibly |goto reswitch|@>@; break;
case quoted_char: out(*(cur_tok++));
case qualifier: break;
default: out(a); /* otherwise |a| is an ordinary character */
@@ -3802,14 +3847,14 @@ is suppressed (i.e., a line break that follows `\.{\\Y\\B}').
a=get_output();
if (a==inserted) continue;
if (a==cancel || a==big_cancel) {
- @<Output saved |indent| or |outdent| tokens@>;
+ @<Output saved |indent| or |outdent| tokens@>@;
goto reswitch; /* |cancel| overrides everything */
}
if ((a!=' ' && a<indent) || a==backup || a>big_force) {
if (save_mode==outer) {
if (out_ptr>out_buf+3 && strncmp(out_ptr-3,"\\Y\\B",4)==0)
goto reswitch;
- @<Output saved |indent| or |outdent| tokens@>;
+ @<Output saved |indent| or |outdent| tokens@>@;
out('\\'); out(b-cancel+'0');
@.\\5@>
@.\\6@>
@@ -3860,7 +3905,7 @@ input buffer and the translation process uses the end of the active
out(':');
if (an_output) out_str("\\.{"@q}@>);
@.\\.@>
- @<Output the text of the section name@>;
+ @<Output the text of the section name@>@;
if (an_output) out_str(@q{@>" }");
out_str("\\X");
}
@@ -3872,7 +3917,7 @@ k_limit=scratch+strlen(scratch);
cur_section_name=cur_name;
while (k<k_limit) {
b=*(k++);
- if (b=='@@') @<Skip next character, give error if not `\.{@@}'@>;
+ if (b=='@@') @<Skip next character, give error if not `\.{@@}'@>@;
if (an_output)
switch (b) {
case ' ':case '\\':case '#':case '%':case '$':case '^':
@@ -3891,18 +3936,18 @@ while (k<k_limit) {
@.\\\_@>
default: out(b);
}
- else if (b!='|') out(b)@;
+ else { if (b!='|') out(b)@;
else {
- @<Copy the \CEE/ text into the |buffer| array@>;
+ @<Copy the \CEE/ text into the |buffer| array@>@;
save_loc=loc; save_limit=limit; loc=limit+2; limit=j+1;
*limit='|'; output_C();
loc=save_loc; limit=save_limit;
- }
+ } }
}
@ @<Skip next char...@>=
if (*k++!='@@') {
- printf("\n! Illegal control code in section name: <");
+ fputs("\n! Illegal control code in section name: <",stdout);
@.Illegal control code...@>
print_section_name(cur_section_name); printf("> "); mark_error;
}
@@ -3917,7 +3962,7 @@ equals the delimiter that began the string being copied.
j=limit+1; *j='|'; delim=0;
while (1) {
if (k>=k_limit) {
- printf("\n! C text in section name didn't end: <");
+ fputs("\n! C text in section name didn't end: <",stdout);
@.C text...didn't end@>
print_section_name(cur_section_name); printf("> "); mark_error; break;
}
@@ -3925,9 +3970,9 @@ while (1) {
if (b=='@@' || (b=='\\' && delim!=0))
@<Copy a quoted character into the buffer@>@;
else {
- if (b=='\'' || b=='"')
+ if (b=='\'' || b=='"') {
if (delim==0) delim=b;
- else if (delim==b) delim=0;
+ else if (delim==b) delim=0; }
if (b!='|' || delim!=0) {
if (j>buffer+long_buf_size-3) overflow("buffer");
*(++j)=b;
@@ -3949,16 +3994,16 @@ actually output the \TEX/ material instead of merely looking at the
\.{CWEB} specifications.
@<Predecl...@>=
-void phase_two();
+static void phase_two(void);@/
@ @c
-void
-phase_two() {
-reset_input(); if (show_progress) printf("\nWriting the output file...");
+static void
+phase_two(void) {
+reset_input(); if (show_progress) fputs("\nWriting the output file...",stdout);
@.Writing the output file...@>
section_count=0; format_visible=1; copy_limbo();
finish_line(); flush_buffer(out_buf,0,0); /* insert a blank line, it looks nice */
-while (!input_has_ended) @<Translate the current section@>;
+while (!input_has_ended) @<Translate the current section@>@;
}
@ The output file will contain the control sequence \.{\\Y} between non-null
@@ -3986,13 +4031,13 @@ boolean group_found=0; /* has a starred section occurred? */
@ @<Translate the current section@>= {
section_count++;
- @<Output the code for the beginning of a new section@>;
+ @<Output the code for the beginning of a new section@>@;
save_position;
- @<Translate the \TEX/ part of the current section@>;
- @<Translate the definition part of the current section@>;
- @<Translate the \CEE/ part of the current section@>;
- @<Show cross-references to this section@>;
- @<Output the code for the end of a section@>;
+ @<Translate the \TEX/ part of the current section@>@;
+ @<Translate the definition part of the current section@>@;
+ @<Translate the \CEE/ part of the current section@>@;
+ @<Show cross-references to this section@>@;
+ @<Output the code for the end of a section@>@;
}
@ Sections beginning with the \.{CWEB} control sequence `\.{@@\ }' start in the
@@ -4056,7 +4101,7 @@ space_checked=0;
while (next_control<=definition) { /* |format_code| or |definition| */
init_stack;
if (next_control==definition) @<Start a macro definition@>@;
- else @<Start a format definition@>;
+ else @<Start a format definition@>@;
outer_parse(); finish_C(format_visible); format_visible=1;
doing_format=0;
}
@@ -4072,12 +4117,12 @@ takes place, so that the translation will normally end with \.{\\6} or
\.{\\7} is replaced by the concluding \.{\\par} or by \.{\\Y\\par}.
@<Predecl...@>=
-void finish_C();
+static void finish_C(boolean);@/
@ @c
-void
-finish_C(visible) /* finishes a definition or a \CEE/ part */
- boolean visible; /* nonzero if we should produce \TEX/ output */
+static void
+finish_C(@t\1\1@> /* finishes a definition or a \Cee\ part */
+ boolean visible@t\2\2@>) /* nonzero if we should produce \TeX\ output */
{
text_pointer p; /* translation of the scraps */
if (visible) {
@@ -4085,13 +4130,15 @@ finish_C(visible) /* finishes a definition or a \CEE/ part */
p=translate();
@.\\B@>
app(tok_flag+(int)(p-tok_start)); make_output(); /* output the list */
- if (out_ptr>out_buf+1)
- if (*(out_ptr-1)=='\\')
+ if (out_ptr>out_buf+1) {
+ if (*(out_ptr-1)=='\\') {
@.\\6@>
@.\\7@>
@.\\Y@>
if (*out_ptr=='6') out_ptr-=2;
else if (*out_ptr=='7') *out_ptr='Y';
+ }
+ }
out_str("\\par"); finish_line();
}
if (text_ptr>max_text_ptr) max_text_ptr=text_ptr;
@@ -4169,11 +4216,11 @@ if (next_control<=section_name) {
else {
this_section=cur_section;
@<Check that '=' or '==' follows this section name, and
- emit the scraps to start the section definition@>;
+ emit the scraps to start the section definition@>@;
}
while (next_control<=section_name) {
outer_parse();
- @<Emit the scrap for a section name if present@>;
+ @<Emit the scrap for a section name if present@>@;
}
finish_C(1);
}
@@ -4196,8 +4243,8 @@ cur_xref=(xref_pointer)this_section->xref;
if(cur_xref->num==file_flag) cur_xref=cur_xref->xlink;
app_str("${}");
if (cur_xref->num!=section_count+def_flag) {
- app_str("\\mathrel+"); /*section name is multiply defined*/
- this_section=name_dir; /*so we won't give cross-reference info here*/
+ app_str("\\mathrel+"); /* section name is multiply defined */
+ this_section=name_dir; /* so we won't give cross-reference info here */
}
app_str("\\E"); /* output an equivalence sign */
@.\\E@>
@@ -4243,12 +4290,12 @@ Note that the output of \.{CWEAVE} is not English-specific; users may
supply new definitions for the macros \.{\\A}, \.{\\As}, etc.
@<Predecl...@>=
-void footnote();
+static void footnote(sixteen_bits);@/
@ @c
-void
-footnote(flag) /* outputs section cross-references */
-sixteen_bits flag;
+static void
+footnote(@t\1\1@> /* outputs section cross-references */
+sixteen_bits flag@t\2\2@>)
{
xref_pointer q; /* cross-reference pointer variable */
if (cur_xref->num<=flag) return;
@@ -4257,7 +4304,7 @@ sixteen_bits flag;
@.\\Q@>
@.\\U@>
out(flag==0? 'U': flag==cite_flag? 'Q': 'A');
- @<Output all the section numbers on the reference list |cur_xref|@>;
+ @<Output all the section numbers on the reference list |cur_xref|@>@;
out('.');
}
@@ -4292,11 +4339,11 @@ just finish off the page, omitting the index, section name list, and table of
contents.
@<Predecl...@>=
-void phase_three();
+static void phase_three(void);@/
@ @c
-void
-phase_three() {
+static void
+phase_three(void) {
if (no_xref) {
finish_line();
out_str("\\end");
@@ -4304,29 +4351,29 @@ if (no_xref) {
finish_line();
}
else {
- phase=3; if (show_progress) printf("\nWriting the index...");
+ phase=3; if (show_progress) fputs("\nWriting the index...",stdout);
@.Writing the index...@>
finish_line();
- if ((idx_file=fopen(idx_file_name,"w"))==NULL)
+ if ((idx_file=fopen(idx_file_name,"wb"))==NULL)
fatal("! Cannot open index file ",idx_file_name);
@.Cannot open index file@>
if (change_exists) {
- @<Tell about changed sections@>; finish_line(); finish_line();
+ @<Tell about changed sections@>@; finish_line(); finish_line();
}
out_str("\\inx"); finish_line();
@.\\inx@>
active_file=idx_file; /* change active file to the index file */
- @<Do the first pass of sorting@>;
- @<Sort and output the index@>;
+ @<Do the first pass of sorting@>@;
+ @<Sort and output the index@>@;
finish_line(); fclose(active_file); /* finished with |idx_file| */
active_file=tex_file; /* switch back to |tex_file| for a tic */
out_str("\\fin"); finish_line();
@.\\fin@>
- if ((scn_file=fopen(scn_file_name,"w"))==NULL)
+ if ((scn_file=fopen(scn_file_name,"wb"))==NULL)
fatal("! Cannot open section file ",scn_file_name);
@.Cannot open section file@>
active_file=scn_file; /* change active file to section listing file */
- @<Output all the section names@>;
+ @<Output all the section names@>@;
finish_line(); fclose(active_file); /* finished with |scn_file| */
active_file=tex_file;
if (group_found) out_str("\\con");@+else out_str("\\end");
@@ -4335,7 +4382,10 @@ else {
finish_line();
fclose(active_file);
}
-if (show_happiness) printf("\nDone.");
+if (show_happiness) {
+ if (show_progress) new_line;
+ fputs("Done.",stdout);
+}
check_complete(); /* was all of the change file used? */
}
@@ -4362,7 +4412,7 @@ sixteen_bits k_section; /* runs through the sections */
@ A left-to-right radix sorting method is used, since this makes it easy to
adjust the collating sequence and since the running time will be at worst
proportional to the total length of all entries in the index. We put the
-identifiers into 102 different lists based on their first characters.
+identifiers into different lists based on their first characters.
(Uppercase letters are put into the same list as the corresponding lowercase
letters, since we want to have `$t<\\{TeX}<\&{to}$'.) The
list for character |c| begins at location |bucket[c]| and continues through
@@ -4378,12 +4428,12 @@ having a nonempty cross-reference list into the proper bucket.
@<Do the first pass...@>= {
int c;
-for (c=0; c<=255; c++) bucket[c]=NULL;
+for (c=0; c<256; c++) bucket[c]=NULL;
for (h=hash; h<=hash_end; h++) {
next_name=*h;
while (next_name) {
cur_name=next_name; next_name=cur_name->link;
- if (cur_name->xref!=(char*)xmem) {
+ if (cur_name->xref!=(void *)xmem) {
c=(eight_bits)((cur_name->byte_start)[0]);
if (xisupper(c)) c=tolower(c);
blink[cur_name-name_dir]=bucket[c]; bucket[c]=cur_name;
@@ -4401,7 +4451,7 @@ present; the lists are output in reverse order (first |sort_ptr|, then
|k| characters of all entries on this list are known to be equal we have
|depth[j]==k|.
-@ @<Rest of |trans_plus| union@>=
+@<Rest of |trans_plus| union@>=
name_pointer Head;
@ @d depth cat /* reclaims memory that is no longer needed for parsing */
@@ -4424,7 +4474,7 @@ max_sort_ptr=scrap_info;
$|collate|[0]<|collate|[1]<\cdots<|collate|[100]$.
@<Global...@>=
-eight_bits collate[102+128]; /* collation order */
+eight_bits collate[101+128]; /* collation order */
@^high-bit character handling@>
@ We use the order $\hbox{null}<\.\ <\hbox{other characters}<{}$\.\_${}<
@@ -4438,29 +4488,41 @@ some \CEE/ compilers choke on long strings.
@<Set init...@>=
collate[0]=0;
-strcpy(collate+1," \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17");
+memcpy((char *)collate+1,
+ " \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17",16);
/* 16 characters + 1 = 17 */
-strcpy(collate+17,"\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37");
+memcpy((char *)collate+17,
+ "\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37",16);
/* 16 characters + 17 = 33 */
-strcpy(collate+33,"!\42#$%&'()*+,-./:;<=>?@@[\\]^`{|}~_");
+memcpy((char *)collate+33,
+ "!\42#$%&'()*+,-./:;<=>?@@[\\]^`{|}~_",32);
/* 32 characters + 33 = 65 */
-strcpy(collate+65,"abcdefghijklmnopqrstuvwxyz0123456789");
+memcpy((char *)collate+65,
+ "abcdefghijklmnopqrstuvwxyz0123456789",36);
/* (26 + 10) characters + 65 = 101 */
-strcpy(collate+101,"\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217");
+memcpy((char *)collate+101,
+ "\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217",16);
/* 16 characters + 101 = 117 */
-strcpy(collate+117,"\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237");
+memcpy((char *)collate+117,
+ "\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237",16);
/* 16 characters + 117 = 133 */
-strcpy(collate+133,"\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257");
+memcpy((char *)collate+133,
+ "\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257",16);
/* 16 characters + 133 = 149 */
-strcpy(collate+149,"\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277");
+memcpy((char *)collate+149,
+ "\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277",16);
/* 16 characters + 149 = 165 */
-strcpy(collate+165,"\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317");
+memcpy((char *)collate+165,
+ "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317",16);
/* 16 characters + 165 = 181 */
-strcpy(collate+181,"\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337");
+memcpy((char *)collate+181,
+ "\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337",16);
/* 16 characters + 181 = 197 */
-strcpy(collate+197,"\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357");
+memcpy((char *)collate+197,
+ "\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357",16);
/* 16 characters + 197 = 213 */
-strcpy(collate+213,"\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377");
+memcpy((char *)collate+213,
+ "\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377",16);
/* 16 characters + 213 = 229 */
@ Procedure |unbucket| goes through the buckets and adds nonempty lists
@@ -4472,15 +4534,15 @@ regarded as identical.
@d infinity 255 /* $\infty$ (approximately) */
@<Predecl...@>=
-void unbucket();
+static void unbucket(eight_bits);@/
@ @c
-void
-unbucket(d) /* empties buckets having depth |d| */
-eight_bits d;
+static void
+unbucket(@t\1\1@> /* empties buckets having depth |d| */
+eight_bits d@t\2\2@>)
{
int c; /* index into |bucket|; cannot be a simple |char| because of sign
- comparison below*/
+ comparison below */
for (c=100+128; c>= 0; c--) if (bucket[collate[c]]) {
@^high-bit character handling@>
if (sort_ptr>=scrap_info_end) overflow("sorting");
@@ -4498,7 +4560,7 @@ while (sort_ptr>scrap_info) {
cur_depth=sort_ptr->depth;
if (blink[sort_ptr->head-name_dir]==0 || cur_depth==infinity)
@<Output index entries for the list at |sort_ptr|@>@;
- else @<Split the list at |sort_ptr| into further lists@>;
+ else @<Split the list at |sort_ptr| into further lists@>@;
}
@ @<Split the list...@>= {
@@ -4522,8 +4584,8 @@ while (sort_ptr>scrap_info) {
do {
out_str("\\I");
@.\\I@>
- @<Output the name at |cur_name|@>;
- @<Output the cross-references at |cur_name|@>;
+ @<Output the name at |cur_name|@>@;
+ @<Output the cross-references at |cur_name|@>@;
cur_name=blink[cur_name-name_dir];
} while (cur_name);
--sort_ptr;
@@ -4563,7 +4625,7 @@ name_done:@;
`\.{\\[}$\,\ldots\,$\.]'.
@<Output the cross-references...@>=
-@<Invert the cross-reference list at |cur_name|, making |cur_xref| the head@>;
+@<Invert the cross-reference list at |cur_name|, making |cur_xref| the head@>@;
do {
out_str(", "); cur_val=cur_xref->num;
if (cur_val<def_flag) out_section(cur_val);
@@ -4592,12 +4654,12 @@ prints them.
@^recursion@>
@<Predecl...@>=
-void section_print();
+static void section_print(name_pointer);@/
@ @c
-void
-section_print(p) /* print all section names in subtree |p| */
-name_pointer p;
+static void
+section_print(@t\1\1@> /* print all section names in subtree |p| */
+name_pointer p@t\2\2@>)
{
if (p) {
section_print(p->llink); out_str("\\I");
@@ -4611,34 +4673,34 @@ name_pointer p;
}
}
-@ @<Output all the section names@>=section_print(root)
+@ @<Output all the section names@>=section_print(root);
-@ Because on some systems the difference between two pointers is a |long|
+@ Because on some systems the difference between two pointers is a |ptrdiff_t|
rather than an |int|, we use \.{\%ld} to print these quantities.
@c
void
-print_stats() {
- printf("\nMemory usage statistics:\n");
+print_stats(void) {
+ puts("\nMemory usage statistics:");
@.Memory usage statistics:@>
printf("%ld names (out of %ld)\n",
- (long)(name_ptr-name_dir),(long)max_names);
+ (ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf("%ld cross-references (out of %ld)\n",
- (long)(xref_ptr-xmem),(long)max_refs);
+ (ptrdiff_t)(xref_ptr-xmem),(long)max_refs);
printf("%ld bytes (out of %ld)\n",
- (long)(byte_ptr-byte_mem),(long)max_bytes);
- printf("Parsing:\n");
+ (ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
+ puts("Parsing:");
printf("%ld scraps (out of %ld)\n",
- (long)(max_scr_ptr-scrap_info),(long)max_scraps);
+ (ptrdiff_t)(max_scr_ptr-scrap_info),(long)max_scraps);
printf("%ld texts (out of %ld)\n",
- (long)(max_text_ptr-tok_start),(long)max_texts);
+ (ptrdiff_t)(max_text_ptr-tok_start),(long)max_texts);
printf("%ld tokens (out of %ld)\n",
- (long)(max_tok_ptr-tok_mem),(long)max_toks);
+ (ptrdiff_t)(max_tok_ptr-tok_mem),(long)max_toks);
printf("%ld levels (out of %ld)\n",
- (long)(max_stack_ptr-stack),(long)stack_size);
- printf("Sorting:\n");
+ (ptrdiff_t)(max_stack_ptr-stack),(long)stack_size);
+ puts("Sorting:");
printf("%ld levels (out of %ld)\n",
- (long)(max_sort_ptr-scrap_info),(long)max_scraps);
+ (ptrdiff_t)(max_sort_ptr-scrap_info),(long)max_scraps);
}
@** Index.
diff --git a/Build/source/texk/web2c/cwebdir/cweb.1 b/Build/source/texk/web2c/cwebdir/cweb.1
index ad41c427ead..a9aa69bf433 100644
--- a/Build/source/texk/web2c/cwebdir/cweb.1
+++ b/Build/source/texk/web2c/cwebdir/cweb.1
@@ -1,4 +1,4 @@
-.TH CWEB 1L 2002-Apr-13
+.TH CWEB 1 2018-Dec-16
.
.SH NAME
ctangle, cweave \- translate CWEB to C and/or TeX
@@ -10,14 +10,14 @@ ctangle, cweave \- translate CWEB to C and/or TeX
.B \-bhp
] [
.B +s
-] webfile[.w] [changefile[.ch]] [outputfile[.c]]
+] webfile[.w] [{changefile[.ch]|-} [outputfile[.c]]]
.br
.B cweave
[
.B \-befhpx
] [
.B +s
-] webfile[.w] [changefile[.ch]] [outputfile[.tex]]
+] webfile[.w] [{changefile[.ch]|-} [outputfile[.tex]]]
.ad
.
.SH DESCRIPTION
@@ -78,8 +78,7 @@ If you say -bhp, you get nothing but error messages.
.PP
The
.B +s
-option prints statistics about memory usage at the end of a run
-(assuming that the programs have been compiled with the -DSTAT switch).
+option prints statistics about memory usage at the end of a run.
.PP
There are three other options applicable to
.I cweave
@@ -99,20 +98,15 @@ and similar programs.
means omit the index and table of contents.
.
.SH FILES
+The location of the files mentioned below varies from system to system.
.TP
-/usr/local/lib/tex/inputs/cwebmac.tex
+cwebmac.tex
TeX macros used by cweave output.
.TP
-/usr/local/src/cweb/cwebman.tex
+cwebman.tex
The user manual.
.TP
-/usr/local/src/cweb/examples/wc.w
-An introductory example.
-.TP
-/usr/local/src/cweb/examples/wmerge.w
-Patch program based on CWEB-style change files.
-.TP
-/usr/local/lib/cweb
+/usr/lib/cweb
Directory for cweb "include" files.
.
.SH "SEE ALSO"
diff --git a/Build/source/texk/web2c/cwebdir/cwebmac.tex b/Build/source/texk/web2c/cwebdir/cwebmac.tex
index 60f86ce5a9a..228de239bf9 100644
--- a/Build/source/texk/web2c/cwebdir/cwebmac.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebmac.tex
@@ -1,13 +1,14 @@
% standard macros for CWEB listings (in addition to plain.tex)
-% Version 3.70 --- July 2017
+% Version 4.0 --- February 2021
\ifx\renewenvironment\undefined\else\endinput\fi % LaTeX will use other macros
-\xdef\fmtversion{\fmtversion+CWEB3.70}
-\chardef\cwebversion=3 \chardef\cwebrevision=70
+\xdef\fmtversion{\fmtversion+CWEB4.0}
+\chardef\cwebversion=4 \chardef\cwebrevision=0
\newif\ifpdf
\ifx\pdf+\pdftrue\fi
% Uncomment the following line if you want PDF goodies to be the default
%\ifx\pdf-\else\pdftrue\fi
\def\pdflinkcolor{0 0 1} % the RGB values for hyperlink color
+\ifx\undefined\XeTeXrevision\else\pdftrue\fi % XeTeX produces PDF output
\newif\ifpdftex
\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse
%\else \pdftextrue \pdfoutput=1 \input pdfcolor \let\setcolor\pdfsetcolor \fi\fi
diff --git a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch
index 1be766fe7a3..3f8a3ff9335 100644
--- a/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/cwebman-w2c.ch
@@ -1,25 +1,25 @@
-@q Changes for CWEB in TeX Live from numerous contributors. @>
-@q This file is in the Public Domain. @>
+@q Changes for CWEB in TeX Live from numerous contributors. @>
+@q This file is in the Public Domain. @>
-@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
-@q were merged with the set of change files of the CWEBbin project; @>
-@q see https://github.com/ascherer/cwebbin for the original parts. @>
+@q Most of the original Kpathsea changes by Wlodek Bzyl and Olaf Weber @>
+@q were merged with the set of change files of the CWEBbin project; @>
+@q see https://github.com/ascherer/cwebbin for the original parts. @>
-@q This stripped change file {comm,ctang,cweav,ctwill}-w2c.ch has been @>
-@q created from the set of change files {comm,ctang,cweav}-patch.ch, @>
-@q {comm,ctang,cweav}-ansi.ch, {comm,ctang,cweav}-extensions.ch, @>
-@q {comm,ctang,cweav}-output.ch, {comm,ctang,cweav}-i18n.ch, and @>
-@q cweav-twill.ch for CTWILL, and {comm,ctang,cweav,ctwill}-texlive.ch @>
-@q with the 'tie' processor and is used as a monolithic changefile for @>
-@q {common,ctangle,cweave}.w in TeX Live. @>
+@q This stripped change file {comm,ctang,cweav,ctwill,cwebman}-w2c.ch @>
+@q has been created from the elaborate set of change files @>
+@q {comm,ctang,cweav,cwebman}-patch.ch, @>
+@q {comm,cweav,cwebman}-extensions.ch, {comm,ctang,cweav}-output.ch, @>
+@q {comm,ctang,cweav}-i18n.ch, and cweav-twill.ch for CTWILL, and @>
+@q {comm,ctang,cweav,ctwill,cwebman}-texlive.ch with the 'tie' processor @>
+@q and is used as a monolithic changefile for {common,ctangle,cweave}.w @>
+@q and cwebman.tex in TeX Live. @>
-@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
+@q Please send comments, suggestions, etc. to tex-k@@tug.org. @>
@x
\input cwebmac
\acrofalse\pdffalse\pdftexfalse
@y
-\ifx\undefined\XeTeXrevision\else\let\pdf+\fi % XeTeX produces PDF output
\input cwebmac
@z
@@ -93,32 +93,49 @@
@z
@x
-\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 3.64)}
+\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.0)}
@y
\def\Kpathsea/{{\mc KPATHSEA\spacefactor1000}}
-\def\runninghead{{\tentt CWEB} USER MANUAL (3.64 [\TeX~Live])}
+\def\runninghead{{\tentt CWEB} USER MANUAL (4.0 [\TeX~Live])}
@z
@x
-\vskip 18pt\centerline{(Version 3.64 --- February 2002)}
+\vskip 18pt\centerline{(Version 4.0 --- February 2021)}
@y
-\vskip 18pt\centerline{(Version 3.64 --- February 2002)%
-\footnote*{This document describes the extended \.{CWEB} (3.64 [\TeX~Live]).}}
+\vskip 18pt\centerline{(Version 4.0 --- February 2021)%
+\footnote*{This document describes the extended \.{CWEB} (4.0 [\TeX~Live]).}}
@z
@x
-should be sent to Levy (\.{levy@math.berkeley.edu}).
+Internet page \.{http://www-cs-faculty.stanford.edu/\char`\~knuth/cweb.html}
@y
-should be sent to Levy (\.{levy@math.berkeley.edu}).%
-\cwebfootnote{Or rather to the ``\TeX~Live''-related mailing list
-\.{tex-k@tug.org}.}
+Internet page
+\pdfURL{\.{http://www-cs-faculty.stanford.edu/\char`\~knuth/cweb.html}}%
+ {http://www-cs-faculty.stanford.edu/\TILDE/knuth/cweb.html}
@z
@x
-email address in a \.{CWEB} file (e.g., \.{levy@@math.berkeley.edu}).
+\.{https://github.com/ascherer/cweb} with the really current news.
@y
-email address in a \.{CWEB} file (e.g., \.{levy@@math.berkeley.edu}%
-\cwebfootnote{Or rather \.{tex-k@@tug.org}.}).
+\pdfURL{\.{https://github.com/ascherer/cweb}}%
+ {https://github.com/ascherer/cweb}
+with the really current news.
+@z
+
+@x
+should be sent to the \TeX-related mailing list \.{tex-k@tug.org}.
+@y
+should be sent to the \TeX-related mailing list
+\pdfURL{\.{tex-k@tug.org}}%
+ {mailto:tex-k@tug.org}.
+@z
+
+@x
+email address in a \.{CWEB} file (e.g., \.{tex-k@@tug.org}).
+@y
+email address in a \.{CWEB} file (e.g.,
+\pdfURL{\.{tex-k@@tug.org}}%
+ {mailto:tex-k@tug.org}).
@z
@x
@@ -127,7 +144,7 @@ it cannot find them in the current directory.
it cannot find them in the current directory.%
\cwebfootnote{\acrofalse In this extended implementation, if an \.{@i}nclude
file can not be found in the current directory, \.{CWEB} will use the
-conventions of the \Kpathsea/ library as outlined in section~\X90:File lookup
+conventions of the \Kpathsea/ library as outlined in section~\X91:File lookup
with \Kpathsea/\X~of \pdfURL{appendix~D}{common-changes.pdf} to look for it.
% FIXME
(This is true for any other input or change file lookup.)}
@@ -141,7 +158,7 @@ output by \.{CWEAVE}. (On by default.) (Has no effect on \.{CTANGLE}.)%
to the list:
\hfil\smallskip
\option d Set the debugging variable \\{kpathsea\_debug} to the numeric
-value $N\in[0,127]$ of this option. See section~92 % FIXME
+value $N\in[0,127]$ of this option. See section~93 % FIXME
of \pdfURL{appendix~D}{common-changes.pdf} for details.
\hfil\vskip\normallineskip
\option i Indent parameters in function declarations. This causes the
@@ -173,9 +190,9 @@ Sometimes things don't work as smoothly, and you get a bunch of
@z
@x
-`\.{main(argc,argv)}'.
+`$\\{main}(\\{argc},\39\\{argv}{}$)'.
@y
-`\.{main(argc,argv)}'.
+`$\\{main}(\\{argc},\39\\{argv}{}$)'.
\ifx\pdf+\pdftrue\fi
\ifx\pdfoutput\undefined \pdftexfalse \else\ifnum\pdfoutput=0 \pdftexfalse
\else \pdftextrue \pdfoutput=1\fi\fi
@@ -183,17 +200,20 @@ Sometimes things don't work as smoothly, and you get a bunch of
@z
@x
-saying `\.{pdftex}~\.{cob}'.
+\section Hypertext and hyperdocumentation.
@y
-saying `\.{pdftex}~\.{cob}'.%
-\cwebfootnote{A third way to create PDF output from \.{CWEB} input is the
-use of \.{XeTeX}, which uses `\.{[x]dvipdfm[x]}' in the background, but the
-``plain \TeX'' macros from \.{cwebmac.tex} otherwise. The process works with
-a small trick in the first step:
-$$\vbox{\halign{\.{#}\hfil\cr
-cweave -lp+ cob\cr
-xetex cob\cr
-acroread cob.pdf\cr}}$$}
+\vfill\eject
+\section Hypertext and hyperdocumentation.
+@z
+
+@x
+the program sources at \.{ftp://ftp.cs.stanford.edu/pub/ctwill}.
+@y
+the program sources at
+\pdfURL{\.{ftp://ftp.cs.stanford.edu/pub/ctwill}}%
+ {ftp://ftp.cs.stanford.edu/pub/ctwill}.%
+\cwebfootnote{\TeX~Live comes with an up-to-date \.{ctwill} executable -- and
+its associated helpers -- out of the box.}
@z
@x
@@ -219,8 +239,8 @@ appendices D, E, and~F, which exhibit the complete source code for
appendices \pdfURL{D}{common.pdf}, \pdfURL{E}{ctangle.pdf},
and~\pdfURL{F}{cweave.pdf}, which exhibit the complete source code for
\.{CTANGLE} and \.{CWEAVE}.%
-\cwebfootnote{Actually, \pdfURL{appendix~D}{common.pdf} contains the source
-code for \.{COMMON}, and the additional \pdfURL{appendix~G}{ctwill.pdf}
+\cwebfootnote{Actually, \pdfURL{Appendix~D}{common.pdf} contains the source
+code for \.{COMMON}, and the additional \pdfURL{Appendix~G}{ctwill.pdf}
exhibits the source code for \.{CTWILL}, which is based on \.{CWEAVE}.}
\eject\titletrue
@@ -235,6 +255,13 @@ exhibits the source code for \.{CTWILL}, which is based on \.{CWEAVE}.}
@z
@x
+generated sections 27--31 of the file \.{common.w}, which contains
+@y
+generated sections 27--31 of the file
+\pdfURL{\.{common.w}}{common.pdf}, which contains
+@z
+
+@x
\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}}
@y
\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}}
@@ -252,12 +279,17 @@ exhibits the source code for \.{CTWILL}, which is based on \.{CWEAVE}.}
\def\runninghead{APPENDIX A --- FINAL DOCUMENT}
And here's what the same excerpt looks like when typeset.
+(Can you spot the typographical nicety used in the \.{CWEB} code?)
+\let\K=\leftarrow
@y
\def\runninghead{APPENDIX A --- FINAL DOCUMENT}
\subsection Final document.
\acrofalse\pdftexfalse\pdffalse
And here's what the same excerpt looks like when typeset.
+(Can you spot the typographical niceties used in the \.{CWEB} code?)
+\let\K=\leftarrow
+\def\C#1{\5\5\quad$\triangleright\,${\cmntfont#1}$\,\triangleleft$}
@z
@x
@@ -271,9 +303,9 @@ And here's what the same excerpt looks like when typeset.
@z
@x
- \.{ { }\\vskip 15pt \\centerline\{(Version 3.64)\}{ }\\vfill\}}\cr}$$
+ \.{ { }\\vskip 15pt \\centerline\{(Version 4.0)\}{ }\\vfill\}}\cr}$$
@y
- \.{ { }\\vskip 15pt \\centerline\{(Version 3.64)\}{ }\\vfill\}}\cr}$$
+ \.{ { }\\vskip 15pt \\centerline\{(Version 4.0)\}{ }\\vfill\}}\cr}$$
@z
@x
@@ -285,14 +317,9 @@ if you have a duplex printer. Appendices \pdfURL{D}{common.pdf},
@z
@x
-or the \CEE/ comments of a \.{CWEB} file:
+\point 20. Furthermore, group titles can be converted to an arbitrary
@y
-or the \CEE/ comments of a \.{CWEB} file:%
-\cwebfootnote{Be careful to make that $$\vbox{\halign{\.{#}\hfil\cr
-You can send email to
- \\pdfURL\{the author\}\{mailto:andreas\\UNDER/github@@freenet.de\}\cr
-or visit
- \\pdfURL\{his home page\}\{https://github.com/ascherer\}\cr}}$$ in
-the $21^{\rm st}$ century.}
+\vfill\eject
+\point 20. Furthermore, group titles can be converted to an arbitrary
@z
diff --git a/Build/source/texk/web2c/cwebdir/cwebman.tex b/Build/source/texk/web2c/cwebdir/cwebman.tex
index 2e4ec65ea57..46c4a6db0fd 100644
--- a/Build/source/texk/web2c/cwebdir/cwebman.tex
+++ b/Build/source/texk/web2c/cwebdir/cwebman.tex
@@ -36,7 +36,7 @@
\def\lheader{\mainfont\the\pageno\hfill\sc\runninghead\hfill}
\def\rheader{\hfill\sc\runninghead\hfill\mainfont\the\pageno}
-\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 3.64)}
+\def\runninghead{{\tentt CWEB} USER MANUAL (VERSION 4.0)}
% This verbatim mode assumes that ! marks are !! in the text being copied.
\def\verbatim{\begingroup
@@ -50,7 +50,7 @@
\null\vfill
\centerline{\titlefont The {\ttitlefont CWEB} System of
Structured Documentation}
-\vskip 18pt\centerline{(Version 3.64 --- February 2002)}
+\vskip 18pt\centerline{(Version 4.0 --- February 2021)}
\vskip 24pt
\centerline{\authorfont Donald E. Knuth and Silvio Levy}
\vfill
@@ -87,6 +87,10 @@ for their own personal use.
Internet page \.{http://www-cs-faculty.stanford.edu/\char`\~knuth/cweb.html}
contains current info about \.{CWEB} and related topics.
+\smallskip\noindent
+From there you can also reach the \.{CWEB} development page
+\.{https://github.com/ascherer/cweb} with the really current news.
+
\pageno=0 \titletrue\eject
\titletrue
@@ -103,7 +107,7 @@ adapted to \CEE/ by Silvio Levy. Since its creation in 1987, \.{CWEB}
has been revised and enhanced in various ways, by both Knuth and Levy.
We now believe that its evolution is near an end; however, bug
reports, suggestions and comments are still welcome, and
-should be sent to Levy (\.{levy@math.berkeley.edu}).
+should be sent to the \TeX-related mailing list \.{tex-k@tug.org}.
Readers who are familiar with Knuth's memo ``The \.{WEB} System of Structured
Documentation'' will be able
@@ -521,7 +525,7 @@ specifically below.
\@@ [LTMCrc] A double \.@ denotes the single character `\.@'. This is
the only control code that is legal everywhere.
Note that you must use this convention if you are giving an internet
-email address in a \.{CWEB} file (e.g., \.{levy@@math.berkeley.edu}).
+email address in a \.{CWEB} file (e.g., \.{tex-k@@tug.org}).
\subsec
Here are the codes that introduce the \TEX/ part of a section.
@@ -1151,6 +1155,8 @@ for the macros that make this work.)
Alternatively, thanks to H\`an Th\^e\kern-.3em\raise.3ex\hbox{\'{}} Th\`anh
and Andreas Scherer, you can generate \.{cob.pdf} in one step by simply
saying `\.{pdftex}~\.{cob}'.
+A third way to create PDF output from \.{CWEB} input is to say
+`\.{xetex}~\.{cob}'.
A more elaborate system called \.{CTWILL}, which extends the usual cross
references of \.{CWEAVE} by preparing links from the uses of identifiers
@@ -1184,17 +1190,16 @@ appendices D, E, and~F, which exhibit the complete source code for
This appendix consists
of four listings. The first shows the \.{CWEB} input that
-generated sections 12--15 of the file \.{common.w}, which contains
+generated sections 27--31 of the file \.{common.w}, which contains
routines common to \.{CWEAVE} and \.{CTANGLE}.
Note that some of the lines are indented to show the program structure;
the indentation is ignored by \.{CWEAVE} and \.{CTANGLE}, but users find
that \.{CWEB} files are quite readable if they have some such indentation.
-The second and third listings
-show corresponding parts
-of the \CEE/ code output by \.{CTANGLE} and of
-the corresponding \TEX/ code output by \.{CWEAVE}, when run on \.{common.w}.
-The fourth listing shows how that output looks when printed out.
+The second and third listings show corresponding parts of
+the \CEE/ code output by \.{CTANGLE} and of
+the \TEX/ code output by \.{CWEAVE}, when run on \.{common.w}.
+The fourth listing shows how that output looks in print.
\vskip 6pt
\begingroup \def\tt{\eighttt} \baselineskip9pt
@@ -1206,14 +1211,17 @@ Since blank lines in the change file are not used for matching, we have
the change file is exhausted. This procedure is called only when
|changing| is 1; hence error messages will be reported correctly.
-@c
-void
-prime_the_change_buffer()
+@<Predecl...@>=
+static void prime_the_change_buffer(void);@/
+
+@ @c
+static void
+prime_the_change_buffer(void)
{
change_limit=change_buffer; /* this value is used if the change file ends */
- @<Skip over comment lines in the change file; |return| if end of file@>;
- @<Skip to the next nonblank line; |return| if end of file@>;
- @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>;
+ @<Skip over comment lines in the change file; |return| if end of file@>@;
+ @<Skip to the next nonblank line; |return| if end of file@>@;
+ @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>@;
}
@ While looking for a line that begins with \.{@@x} in the change file, we
@@ -1226,7 +1234,7 @@ while(1) {
if (!!input_ln(change_file)) return;
if (limit<buffer+2) continue;
if (buffer[0]!!='@@') continue;
- if (xisupper(buffer[1])) buffer[1]=tolower(buffer[1]);
+ if (xisupper(buffer[1])) buffer[1]=tolower((eight_bits)buffer[1]);
if (buffer[1]=='x') break;
if (buffer[1]=='y' || buffer[1]=='z' || buffer[1]=='i') {
loc=buffer+2;
@@ -1249,8 +1257,8 @@ do {
@ @<Move |buffer| and |limit| to |change_buffer| and |change_limit|@>=
{
- change_limit=change_buffer-buffer+limit;
- strncpy(change_buffer,buffer,limit-buffer+1);
+ change_limit=change_buffer+(ptrdiff_t)(limit-buffer);
+ strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
}
!endgroup
@@ -1260,28 +1268,28 @@ do {
\def\runninghead{APPENDIX A --- TRANSLATION BY {\tentt CTANGLE}}
Here's the portion of the \CEE/ code generated by \.{CTANGLE} that corresponds
-to the source on the preceding page. Notice that sections~13, 14 and~15
-have been tangled into section~12.
+to the source on the preceding page. Notice that sections~29, 30 and~31
+have been tangled into section~28.
\vskip6pt
\begingroup \def\tt{\eighttt} \baselineskip9pt
\verbatim
-/*:9*//*12:*/
-#line 247 "common.w"
+/*:24*//*28:*/
+#line 236 "common.w"
-void
-prime_the_change_buffer()
+static void
+prime_the_change_buffer(void)
{
change_limit= change_buffer;
-/*13:*/
-#line 261 "common.w"
+/*29:*/
+#line 250 "common.w"
while(1){
change_line++;
if(!!input_ln(change_file))return;
if(limit<buffer+2)continue;
if(buffer[0]!!='@')continue;
-if(xisupper(buffer[1]))buffer[1]= tolower(buffer[1]);
+if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]);
if(buffer[1]=='x')break;
if(buffer[1]=='y'||buffer[1]=='z'||buffer[1]=='i'){
loc= buffer+2;
@@ -1290,11 +1298,11 @@ err_print("!! Missing @x in change file");
}
}
-/*:13*/
-#line 252 "common.w"
-;
-/*14:*/
-#line 278 "common.w"
+/*:29*/
+#line 241 "common.w"
+
+/*30:*/
+#line 267 "common.w"
do{
change_line++;
@@ -1305,23 +1313,23 @@ return;
}
}while(limit==buffer);
-/*:14*/
-#line 253 "common.w"
-;
-/*15:*/
-#line 288 "common.w"
+/*:30*/
+#line 242 "common.w"
+
+/*31:*/
+#line 277 "common.w"
{
-change_limit= change_buffer-buffer+limit;
-strncpy(change_buffer,buffer,limit-buffer+1);
+change_limit= change_buffer+(ptrdiff_t)(limit-buffer);
+strncpy(change_buffer,buffer,(size_t)(limit-buffer+1));
}
-/*:15*/
-#line 254 "common.w"
-;
+/*:31*/
+#line 243 "common.w"
+
}
-/*:12*//*16:*/
+/*:28*//*33:*/
!endgroup
\endgroup
\vfill\eject
@@ -1333,31 +1341,35 @@ Here is the corresponding excerpt from \.{common.tex}.
\vskip6pt
\begingroup \def\tt{\eighttt} \baselineskip9pt
\verbatim
-\M{12}Procedure \PB{\\{prime\_the\_change\_buffer}}
+\M{27}Procedure \PB{\\{prime\_the\_change\_buffer}}
sets \PB{\\{change\_buffer}} in preparation for the next matching operation.
Since blank lines in the change file are not used for matching, we have
\PB{$(\\{change\_limit}\E\\{change\_buffer}\W\R\\{changing})$} if and only if
the change file is exhausted. This procedure is called only when
\PB{\\{changing}} is 1; hence error messages will be reported correctly.
-!vskip-.5!baselineskip
-\Y\B\&{void} \\{prime\_the\_change\_buffer}(\,)\1\1\2\2\6
+
+\Y\B\4\X7:Predeclaration of procedures\X${}\mathrel+\E{}$\6
+\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void});\par
+\fi
+
+\M{28}\B\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void})\1\1\2\2\6
${}\{{}$\1\6
${}\\{change\_limit}\K\\{change\_buffer}{}$;\C{ this value is used if the
change file ends }\6
-\X13:Skip over comment lines in the change file; \PB{\&{return}} if end of file%
-\X;\6
-\X14:Skip to the next nonblank line; \PB{\&{return}} if end of file\X;\6
-\X15:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}} and %
-\PB{\\{change\_limit}}\X;\6
+\X29:Skip over comment lines in the change file; \PB{\&{return}} if end of file%
+\X\6
+\X30:Skip to the next nonblank line; \PB{\&{return}} if end of file\X\6
+\X31:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}} and %
+\PB{\\{change\_limit}}\X\6
\4${}\}{}$\2\par
\fi
-!vskip-.5!baselineskip
-\M{13}While looking for a line that begins with \.{@x} in the change file, we
+
+\M{29}While looking for a line that begins with \.{@x} in the change file, we
allow lines that begin with \.{@}, as long as they don't begin with \.{@y},
\.{@z}, or \.{@i} (which would probably mean that the change file is fouled
up).
-!vskip-.5!baselineskip
-\Y\B\4\X13:Skip over comment lines in the change file; \PB{\&{return}} if end
+
+\Y\B\4\X29:Skip over comment lines in the change file; \PB{\&{return}} if end
of file\X${}\E{}$\6
\&{while} (\T{1})\5
${}\{{}$\1\6
@@ -1369,7 +1381,7 @@ ${}\\{change\_line}\PP;{}$\6
\&{if} ${}(\\{buffer}[\T{0}]\I\.{'@'}){}$\1\5
\&{continue};\2\6
\&{if} (\\{xisupper}(\\{buffer}[\T{1}]))\1\5
-${}\\{buffer}[\T{1}]\K\\{tolower}(\\{buffer}[\T{1}]);{}$\2\6
+${}\\{buffer}[\T{1}]\K\\{tolower}{}$((\&{eight\_bits}) \\{buffer}[\T{1}]);\2\6
\&{if} ${}(\\{buffer}[\T{1}]\E\.{'x'}){}$\1\5
\&{break};\2\6
\&{if} ${}(\\{buffer}[\T{1}]\E\.{'y'}\V\\{buffer}[\T{1}]\E\.{'z'}\V\\{buffer}[%
@@ -1379,11 +1391,11 @@ ${}\\{loc}\K\\{buffer}+\T{2};{}$\6
\\{err\_print}(\.{"!!\ Missing\ @x\ in\ cha}\)\.{nge\ file"});\6
\4${}\}{}$\2\6
\4${}\}{}$\2\par
-\U12.\fi
-!vskip-.5!baselineskip
-\M{14}Here we are looking at lines following the \.{@x}.
-!vskip-.5!baselineskip
-\Y\B\4\X14:Skip to the next nonblank line; \PB{\&{return}} if end of file\X${}%
+\U28.\fi
+
+\M{30}Here we are looking at lines following the \.{@x}.
+
+\Y\B\4\X30:Skip to the next nonblank line; \PB{\&{return}} if end of file\X${}%
\E{}$\6
\&{do}\5
${}\{{}$\1\6
@@ -1395,48 +1407,48 @@ ${}\{{}$\1\6
\4${}\}{}$\2\6
\4${}\}{}$\2\5
\&{while} ${}(\\{limit}\E\\{buffer}){}$;\par
-\U12.\fi
-!vskip-.5!baselineskip
-\M{15}\B\X15:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}}
-and \PB{\\{change\_limit}}\X${}\E{}$\6
-${}\{{}$\1\6
-${}\\{change\_limit}\K\\{change\_buffer}-\\{buffer}+\\{limit};{}$\6
-${}\\{strncpy}(\\{change\_buffer},\39\\{buffer},\39\\{limit}-\\{buffer}+%
-\T{1});{}$\6
-\4${}\}{}$\2\par
-\Us12\ET16.\fi
+\U28.\fi
!endgroup
\endgroup
+\medskip
+(Code for section 31 omitted for space reasons.)
\vfil\eject
\def\runninghead{APPENDIX A --- FINAL DOCUMENT}
And here's what the same excerpt looks like when typeset.
+(Can you spot the typographical nicety used in the \.{CWEB} code?)
+\let\K=\leftarrow
-\M{12}Procedure \PB{\\{prime\_the\_change\_buffer}}
+\M{27}Procedure \PB{\\{prime\_the\_change\_buffer}}
sets \PB{\\{change\_buffer}} in preparation for the next matching operation.
Since blank lines in the change file are not used for matching, we have
\PB{$(\\{change\_limit}\E\\{change\_buffer}\W\R\\{changing})$} if and only if
the change file is exhausted. This procedure is called only when
\PB{\\{changing}} is 1; hence error messages will be reported correctly.
-\Y\B\&{void} \\{prime\_the\_change\_buffer}(\,)\1\1\2\2\6
+\Y\B\4\X7:Predeclaration of procedures\X${}\mathrel+\E{}$\6
+\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void});\par
+\fi
+
+\M{28}\B\&{static} \&{void} \\{prime\_the\_change\_buffer}(\&{void})\1\1\2\2\6
${}\{{}$\1\6
${}\\{change\_limit}\K\\{change\_buffer}{}$;\C{ this value is used if the
change file ends }\6
-\X13:Skip over comment lines in the change file; \PB{\&{return}} if end of file%
-\X;\6
-\X14:Skip to the next nonblank line; \PB{\&{return}} if end of file\X;\6
-\X15:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}} and %
-\PB{\\{change\_limit}}\X;\6
+\X29:Skip over comment lines in the change file; \PB{\&{return}} if end of file%
+\X\6
+\X30:Skip to the next nonblank line; \PB{\&{return}} if end of file\X\6
+\X31:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}} and %
+\PB{\\{change\_limit}}\X\6
\4${}\}{}$\2\par
\fi
-\M{13}While looking for a line that begins with \.{@x} in the change file, we
+\M{29}While looking for a line that begins with \.{@x} in the change file, we
allow lines that begin with \.{@}, as long as they don't begin with \.{@y},
-\.{@z}, or \.{@i} (which would probably mean that the change file is fouled up).
+\.{@z}, or \.{@i} (which would probably mean that the change file is fouled
+up).
-\Y\B\4\X13:Skip over comment lines in the change file; \PB{\&{return}} if end
+\Y\B\4\X29:Skip over comment lines in the change file; \PB{\&{return}} if end
of file\X${}\E{}$\6
\&{while} (\T{1})\5
${}\{{}$\1\6
@@ -1448,7 +1460,7 @@ ${}\\{change\_line}\PP;{}$\6
\&{if} ${}(\\{buffer}[\T{0}]\I\.{'@'}){}$\1\5
\&{continue};\2\6
\&{if} (\\{xisupper}(\\{buffer}[\T{1}]))\1\5
-${}\\{buffer}[\T{1}]\K\\{tolower}(\\{buffer}[\T{1}]);{}$\2\6
+${}\\{buffer}[\T{1}]\K\\{tolower}{}$((\&{eight\_bits}) \\{buffer}[\T{1}]);\2\6
\&{if} ${}(\\{buffer}[\T{1}]\E\.{'x'}){}$\1\5
\&{break};\2\6
\&{if} ${}(\\{buffer}[\T{1}]\E\.{'y'}\V\\{buffer}[\T{1}]\E\.{'z'}\V\\{buffer}[%
@@ -1458,11 +1470,11 @@ ${}\\{loc}\K\\{buffer}+\T{2};{}$\6
\\{err\_print}(\.{"!\ Missing\ @x\ in\ cha}\)\.{nge\ file"});\6
\4${}\}{}$\2\6
\4${}\}{}$\2\par
-\U12.\fi
+\U28.\fi
-\M{14}Here we are looking at lines following the \.{@x}.
+\M{30}Here we are looking at lines following the \.{@x}.
-\Y\B\4\X14:Skip to the next nonblank line; \PB{\&{return}} if end of file\X${}%
+\Y\B\4\X30:Skip to the next nonblank line; \PB{\&{return}} if end of file\X${}%
\E{}$\6
\&{do}\5
${}\{{}$\1\6
@@ -1474,16 +1486,17 @@ ${}\{{}$\1\6
\4${}\}{}$\2\6
\4${}\}{}$\2\5
\&{while} ${}(\\{limit}\E\\{buffer}){}$;\par
-\U12.\fi
+\U28.\fi
-\M{15}\B\X15:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}}
+\M{31}\B\X31:Move \PB{\\{buffer}} and \PB{\\{limit}} to \PB{\\{change\_buffer}}
and \PB{\\{change\_limit}}\X${}\E{}$\6
${}\{{}$\1\6
-${}\\{change\_limit}\K\\{change\_buffer}-\\{buffer}+\\{limit};{}$\6
-${}\\{strncpy}(\\{change\_buffer},\39\\{buffer},\39\\{limit}-\\{buffer}+%
-\T{1});{}$\6
+${}\\{change\_limit}\K\\{change\_buffer}+(\&{ptrdiff\_t})(\\{limit}-%
+\\{buffer});{}$\6
+${}\\{strncpy}(\\{change\_buffer},\39\\{buffer},\39(\&{size\_t})(\\{limit}-%
+\\{buffer}+\T{1}));{}$\6
\4${}\}{}$\2\par
-\Us12\ET16.\fi
+\Us28\ET33.\fi
\vfil\eject\titletrue
\rightskip=0pt % get out of C mode (cf. \B)
@@ -1579,7 +1592,7 @@ $$\lpile{\.{\\def\\topofcontents\{\\null\\vfill}\cr
\.{ { }\\titlefalse \% include headline on the contents page}\cr
\.{ { }\\def\\rheader\{\\mainfont The \{\\tt CWEAVE\}{ }processor\\hfil\}}\cr
\.{ { }\\centerline\{\\titlefont The \{\\ttitlefont CWEAVE\}{ }processor\}}\cr
- \.{ { }\\vskip 15pt \\centerline\{(Version 3.64)\}{ }\\vfill\}}\cr}$$
+ \.{ { }\\vskip 15pt \\centerline\{(Version 4.0)\}{ }\\vfill\}}\cr}$$
Redefining \.{\\rheader}, which is the headline for right-hand pages,
suffices in this case to put the desired information at the top of the
contents page.
@@ -1704,9 +1717,8 @@ with which one can say things like the following, anywhere in the \TeX\ parts
or the \CEE/ comments of a \.{CWEB} file:
$$\vbox{\halign{\.{#}\hfil\cr
You can send email to
- \\pdfURL\{the author\}\{mailto:andreas.scherer@@pobox.com\}\cr
-or visit \\pdfURL\{his home page\}\{http://www.pobox.com/%
- \\TILDE/scherer\}.\cr}}$$
+ \\pdfURL\{the author\}\{mailto:andreas\\UNDER/github@@freenet.de\}\cr
+or visit \\pdfURL\{his home page\}\{https://github.com/ascherer\}\cr}}$$
In a {\mc PDF} document, the first argument will appear in blue as
clickable text; the Acrobat reader, if correctly configured, will then
redirect those links to the user's browser and open either the
diff --git a/Build/source/texk/web2c/cwebdir/examples/wmerge.w b/Build/source/texk/web2c/cwebdir/examples/wmerge.w
index 55cc559a873..616172d042f 100644
--- a/Build/source/texk/web2c/cwebdir/examples/wmerge.w
+++ b/Build/source/texk/web2c/cwebdir/examples/wmerge.w
@@ -85,7 +85,7 @@ It turns out \.{CWEAVE} knows that |FILE| is a reserved word (after all,
|FILE| is almost as common as |int|); indeed, \.{CWEAVE} knows all
the types of the ISO standard \CEE/ library. But
if you're using other types like {\bf caddr\_t},
-@:caddr_t}{\bf caddr_t@>
+@:caddr_t}{\bf caddr\_t@>
which is defined in \.{/usr/include/sys/types.h}, you should let
\.{WEAVE} know that this is a type, either by including the \.{.h} file
at \.{WEB} time (saying \.{@@i /usr/include/sys/types.h}), or by
diff --git a/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot
index 00408e394ab..21d2b91c078 100644
--- a/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot
+++ b/Build/source/texk/web2c/cwebdir/po/cweb-tl.pot
@@ -1,14 +1,14 @@
# International version of CWEB (CWEBbin, TeXLive).
-# Copyright (C) 2019 Andreas Scherer et al.
+# Copyright (C) 2021 Andreas Scherer et al.
# This file is distributed under the same license as the CWEB package.
-# Andreas Scherer <https://ascherer.github.io>, 2019.
+# Andreas Scherer <https://ascherer.github.io>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: CWEBbin 2019\n"
+"Project-Id-Version: CWEBbin 2021\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-01-15 09:55+0100\n"
+"POT-Creation-Date: 2021-02-06 15:43+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,31 +17,31 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: comm-texlive.ch:494
+#: comm-texlive.ch:531
#, c-format
-msgid "%s: Need one to three file arguments.\n"
+msgid ""
+"\n"
+"Email bug reports to %s.\n"
msgstr ""
-#: comm-texlive.ch:495
+#: comm-texlive.ch:511
#, c-format
-msgid "Try `%s --help' for more information.\n"
+msgid "%s: Need one to three file arguments.\n"
msgstr ""
-#: comm-texlive.ch:514
-#, c-format
-msgid ""
-"\n"
-"Email bug reports to %s.\n"
+#: ctang-texlive.ch:39
+msgid "This is CTANGLE, Version 4.0"
msgstr ""
-#: ctang-texlive.ch:29
-msgid "This is CTANGLE, Version 3.64"
+#: ctwill-texlive.ch:39
+msgid "This is CTWILL, Version 4.0"
msgstr ""
-#: cweav-texlive.ch:29
-msgid "This is CWEAVE, Version 3.64"
+#: cweav-texlive.ch:39
+msgid "This is CWEAVE, Version 4.0"
msgstr ""
-#: ctwill-texlive.ch:29
-msgid "This is CTWILL, Version 3.64"
+#: comm-texlive.ch:512
+#, c-format
+msgid "Try `%s --help' for more information.\n"
msgstr ""
diff --git a/Build/source/texk/web2c/cwebdir/po/cweb.pot b/Build/source/texk/web2c/cwebdir/po/cweb.pot
index 108fc09b0ae..812dbf3f72e 100644
--- a/Build/source/texk/web2c/cwebdir/po/cweb.pot
+++ b/Build/source/texk/web2c/cwebdir/po/cweb.pot
@@ -1,14 +1,14 @@
# International version of CWEB (CWEBbin).
-# Copyright (C) 2019 Andreas Scherer et al.
+# Copyright (C) 2021 Andreas Scherer et al.
# This file is distributed under the same license as the CWEB package.
-# Andreas Scherer <https://ascherer.github.io>, 2019.
+# Andreas Scherer <https://ascherer/github.io>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: CWEBbin 2019\n"
+"Project-Id-Version: CWEBbin 2021\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-01-18 16:57+0100\n"
+"POT-Creation-Date: 2021-02-06 15:25+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: comm-i18n.ch:182
+#: comm-i18n.ch:176
msgid ""
"\n"
"! Ambiguous prefix: matches <"
@@ -35,32 +35,32 @@ msgid ""
"! Illegal control code in section name: <"
msgstr ""
-#: cweav-i18n.ch:157
+#: cweav-i18n.ch:159
#, c-format
msgid ""
"\n"
"! Line had to be broken (output l. %d):\n"
msgstr ""
-#: cweav-i18n.ch:141
+#: cweav-i18n.ch:142
msgid ""
"\n"
"! Never defined: <"
msgstr ""
-#: cweav-i18n.ch:148
+#: cweav-i18n.ch:150
msgid ""
"\n"
"! Never used: <"
msgstr ""
-#: comm-i18n.ch:202
+#: comm-i18n.ch:196
msgid ""
"\n"
"! New name extends <"
msgstr ""
-#: comm-i18n.ch:196
+#: comm-i18n.ch:190
msgid ""
"\n"
"! New name is a prefix of <"
@@ -78,26 +78,26 @@ msgid ""
"! Not present: <"
msgstr ""
-#: comm-i18n.ch:208
+#: comm-i18n.ch:202
msgid ""
"\n"
"! Section name incompatible with <"
msgstr ""
-#: ctang-i18n.ch:167 cweav-i18n.ch:67
+#: ctang-i18n.ch:173 cweav-i18n.ch:67
msgid ""
"\n"
"! Section name too long: "
msgstr ""
-#: comm-i18n.ch:254
+#: comm-i18n.ch:248
#, c-format
msgid ""
"\n"
"! Sorry, %s capacity exceeded"
msgstr ""
-#: ctang-i18n.ch:125 cweav-i18n.ch:45
+#: ctang-i18n.ch:131 cweav-i18n.ch:45
msgid ""
"\n"
"! String too long: "
@@ -110,7 +110,7 @@ msgid ""
"Irreducible scrap sequence in section %d:"
msgstr ""
-#: ctang-i18n.ch:292 cweav-i18n.ch:431
+#: ctang-i18n.ch:300 cweav-i18n.ch:430
msgid ""
"\n"
"Memory usage statistics:"
@@ -148,23 +148,23 @@ msgid ""
"Writing the output files:"
msgstr ""
-#: ctang-i18n.ch:217
+#: ctang-i18n.ch:225
msgid "! @d, @f and @c are ignored in C text"
msgstr ""
-#: comm-i18n.ch:60
+#: comm-i18n.ch:56
msgid "! CWEB file ended during a change"
msgstr ""
-#: cweav-twill.ch:1033
+#: cweav-twill.ch:1029
msgid "! Cannot open aux output file "
msgstr ""
-#: comm-i18n.ch:88
+#: comm-i18n.ch:84
msgid "! Cannot open change file "
msgstr ""
-#: comm-i18n.ch:118
+#: comm-i18n.ch:112
msgid "! Cannot open include file"
msgstr ""
@@ -172,12 +172,13 @@ msgstr ""
msgid "! Cannot open index file "
msgstr ""
-#: comm-i18n.ch:82
+#: comm-i18n.ch:78
msgid "! Cannot open input file "
msgstr ""
-#: comm-i18n.ch:300 comm-i18n.ch:308 ctang-i18n.ch:83 ctang-i18n.ch:307
-#: cweav-i18n.ch:457
+#: comm-i18n.ch:300 comm-i18n.ch:306 comm-i18n.ch:312 comm-i18n.ch:318
+#: ctang-i18n.ch:83 ctang-i18n.ch:89 ctang-i18n.ch:315 ctang-i18n.ch:321
+#: cweav-i18n.ch:455
msgid "! Cannot open output file "
msgstr ""
@@ -185,19 +186,19 @@ msgstr ""
msgid "! Cannot open section file "
msgstr ""
-#: comm-i18n.ch:46
+#: comm-i18n.ch:42
msgid "! Change file ended after @x"
msgstr ""
-#: comm-i18n.ch:54
+#: comm-i18n.ch:50
msgid "! Change file ended before @y"
msgstr ""
-#: comm-i18n.ch:126
+#: comm-i18n.ch:120
msgid "! Change file ended without @z"
msgstr ""
-#: comm-i18n.ch:140
+#: comm-i18n.ch:134
msgid "! Change file entry did not match"
msgstr ""
@@ -213,23 +214,23 @@ msgstr ""
msgid "! Control text didn't end"
msgstr ""
-#: ctang-i18n.ch:249
+#: ctang-i18n.ch:257
msgid "! Definition flushed, must start with identifier"
msgstr ""
-#: ctang-i18n.ch:147
+#: ctang-i18n.ch:153
msgid "! Double @ should be used in ASCII constant"
msgstr ""
-#: ctang-i18n.ch:139 ctang-i18n.ch:257
+#: ctang-i18n.ch:145 ctang-i18n.ch:265
msgid "! Double @ should be used in control text"
msgstr ""
-#: ctang-i18n.ch:263 cweav-i18n.ch:165
+#: ctang-i18n.ch:271 cweav-i18n.ch:167 cweav-twill.ch:661 cweav-twill.ch:664
msgid "! Double @ should be used in limbo"
msgstr ""
-#: ctang-i18n.ch:233
+#: ctang-i18n.ch:241
msgid "! Double @ should be used in string"
msgstr ""
@@ -241,11 +242,11 @@ msgstr ""
msgid "! Extra } in comment"
msgstr ""
-#: comm-i18n.ch:300
+#: comm-i18n.ch:292
msgid "! Filename too long\n"
msgstr ""
-#: cweav-twill.ch:550
+#: cweav-twill.ch:541
msgid "! Identifier in meaning should be followed by space"
msgstr ""
@@ -257,7 +258,7 @@ msgstr ""
msgid "! Improper format definition"
msgstr ""
-#: ctang-i18n.ch:271
+#: ctang-i18n.ch:279
msgid "! Improper hex number following @l"
msgstr ""
@@ -265,39 +266,39 @@ msgstr ""
msgid "! Improper macro definition"
msgstr ""
-#: comm-i18n.ch:96
+#: comm-i18n.ch:92
msgid "! Include file name not given"
msgstr ""
-#: comm-i18n.ch:110
+#: comm-i18n.ch:106
msgid "! Include file name too long"
msgstr ""
-#: comm-i18n.ch:320
+#: comm-i18n.ch:324
msgid "! Include path too long"
msgstr ""
-#: ctang-i18n.ch:99 cweav-i18n.ch:181
+#: ctang-i18n.ch:105 cweav-i18n.ch:181
msgid "! Input ended in mid-comment"
msgstr ""
-#: ctang-i18n.ch:119 cweav-i18n.ch:39
+#: ctang-i18n.ch:125 cweav-i18n.ch:39
msgid "! Input ended in middle of string"
msgstr ""
-#: ctang-i18n.ch:161 cweav-i18n.ch:61
+#: ctang-i18n.ch:167 cweav-i18n.ch:61
msgid "! Input ended in section name"
msgstr ""
-#: comm-i18n.ch:30
+#: comm-i18n.ch:26
msgid "! Input line too long"
msgstr ""
-#: cweav-twill.ch:550
+#: cweav-twill.ch:548
msgid "! Location in meaning should be followed by space"
msgstr ""
-#: ctang-i18n.ch:211
+#: ctang-i18n.ch:219
msgid "! Misplaced @h"
msgstr ""
@@ -305,11 +306,11 @@ msgstr ""
msgid "! Missing '|' after C text"
msgstr ""
-#: comm-i18n.ch:38
+#: comm-i18n.ch:34
msgid "! Missing @x in change file"
msgstr ""
-#: ctang-i18n.ch:225
+#: ctang-i18n.ch:233
msgid "! Missing `@ ' before a named section"
msgstr ""
@@ -325,27 +326,27 @@ msgstr ""
msgid "! Missing } in comment"
msgstr ""
-#: ctang-i18n.ch:181
+#: ctang-i18n.ch:187
msgid "! Nesting of section names not allowed"
msgstr ""
-#: cweav-twill.ch:1029
+#: cweav-twill.ch:1025
msgid "! Only @$ is allowed in aux and bux files"
msgstr ""
-#: ctang-i18n.ch:277
+#: ctang-i18n.ch:285
msgid "! Replacement string in @l too long"
msgstr ""
-#: ctang-i18n.ch:175 cweav-i18n.ch:75
+#: ctang-i18n.ch:181 cweav-i18n.ch:75
msgid "! Section name didn't end"
msgstr ""
-#: ctang-i18n.ch:99
+#: ctang-i18n.ch:111
msgid "! Section name ended in mid-comment"
msgstr ""
-#: ctang-i18n.ch:113 ctang-i18n.ch:153 cweav-i18n.ch:33
+#: ctang-i18n.ch:119 ctang-i18n.ch:159 cweav-i18n.ch:33
msgid "! String didn't end"
msgstr ""
@@ -353,54 +354,54 @@ msgstr ""
msgid "! TeX string should be in C text only"
msgstr ""
-#: comm-i18n.ch:262 comm-i18n.hch:33
+#: comm-i18n.hch:42
msgid "! This can't happen: "
msgstr ""
-#: cweav-twill.ch:316
+#: cweav-twill.ch:307
msgid "! Title name didn't end"
msgstr ""
-#: cweav-twill.ch:314
+#: cweav-twill.ch:305
msgid "! Title should be enclosed in braces or doublequotes"
msgstr ""
-#: comm-i18n.ch:102
+#: comm-i18n.ch:98
msgid "! Too many nested includes"
msgstr ""
-#: ctang-i18n.ch:241
+#: ctang-i18n.ch:249
msgid "! Unrecognized escape sequence"
msgstr ""
-#: comm-i18n.ch:283
+#: comm-i18n.ch:272
msgid ""
"! Usage: ctangle [options] webfile[.w] [{changefile[.ch]|-} [outfile[.c]]]\n"
msgstr ""
-#: comm-i18n.ch:287
+#: comm-i18n.ch:281
msgid ""
-"! Usage: cweave [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
+"! Usage: ctwill [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
msgstr ""
-#: comm-i18n.ch:290
+#: comm-i18n.ch:277
msgid ""
-"! Usage: ctwill [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
+"! Usage: cweave [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
msgstr ""
-#: ctang-i18n.ch:131 cweav-i18n.ch:53 cweav-i18n.ch:119
+#: ctang-i18n.ch:139 cweav-i18n.ch:53 cweav-i18n.ch:119
msgid "! Use @l in limbo only"
msgstr ""
-#: ctang-i18n.ch:189 cweav-i18n.ch:103
+#: ctang-i18n.ch:195 cweav-i18n.ch:103
msgid "! Verbatim string didn't end"
msgstr ""
-#: comm-i18n.ch:68
+#: comm-i18n.ch:64
msgid "! Where is the matching @y?"
msgstr ""
-#: comm-i18n.ch:132
+#: comm-i18n.ch:126
msgid "! Where is the matching @z?"
msgstr ""
@@ -416,89 +417,94 @@ msgstr ""
msgid "! You need an = sign after the section name"
msgstr ""
-#: ctang-i18n.ch:297 cweav-i18n.ch:437
+#: ctang-i18n.ch:305 cweav-i18n.ch:436 cweav-twill.ch:1335 cweav-twill.ch:1338
#, c-format
msgid "%ld bytes (out of %ld)\n"
msgstr ""
-#: cweav-i18n.ch:435
+#: cweav-i18n.ch:434
#, c-format
msgid "%ld cross-references (out of %ld)\n"
msgstr ""
-#: cweav-i18n.ch:446 cweav-i18n.ch:449
+#: cweav-i18n.ch:445 cweav-i18n.ch:448
#, c-format
msgid "%ld levels (out of %ld)\n"
msgstr ""
-#: ctang-i18n.ch:293 cweav-i18n.ch:433
+#: ctang-i18n.ch:301 cweav-i18n.ch:432
#, c-format
msgid "%ld names (out of %ld)\n"
msgstr ""
-#: ctang-i18n.ch:295
+#: ctang-i18n.ch:303
#, c-format
msgid "%ld replacement texts (out of %ld)\n"
msgstr ""
-#: cweav-i18n.ch:440
+#: cweav-i18n.ch:439
#, c-format
msgid "%ld scraps (out of %ld)\n"
msgstr ""
-#: cweav-twill.ch:1346
+#: cweav-twill.ch:1340
#, c-format
msgid "%ld temp meanings (out of %ld)\n"
msgstr ""
-#: cweav-i18n.ch:442
+#: cweav-i18n.ch:441
#, c-format
msgid "%ld texts (out of %ld)\n"
msgstr ""
-#: ctang-i18n.ch:299 cweav-i18n.ch:444
+#: cweav-twill.ch:1343
+#, c-format
+msgid "%ld titles (out of %ld)\n"
+msgstr ""
+
+#: ctang-i18n.ch:307 cweav-i18n.ch:443
#, c-format
msgid "%ld tokens (out of %ld)\n"
msgstr ""
-#: comm-i18n.ch:242
+#: comm-i18n.ch:236
msgid "(Did you see the warning message above?)"
msgstr ""
-#: comm-i18n.ch:240
+#: comm-i18n.ch:234
msgid "(No errors were found.)"
msgstr ""
-#: comm-i18n.ch:244
+#: comm-i18n.ch:238
msgid "(Pardon me, but I think I spotted something wrong.)"
msgstr ""
-#: comm-i18n.ch:246
+#: comm-i18n.ch:240
msgid "(That was a fatal error, my friend.)"
msgstr ""
-#: comm-i18n.ch:224
+#: comm-i18n.ch:218
#, c-format
msgid ". (l. %d of change file)\n"
msgstr ""
-#: comm-i18n.ch:226
+#: comm-i18n.ch:220
#, c-format
msgid ". (l. %d of include file %s)\n"
msgstr ""
-#: comm-i18n.ch:225
+#: comm-i18n.ch:219
#, c-format
msgid ". (l. %d)\n"
msgstr ""
-#: comm-i18n.ch:188
+#: comm-i18n.ch:182
msgid ""
">\n"
" and <"
msgstr ""
-#: comm-i18n.ch:214
+#: comm-i18n.ch:208
msgid ""
">,\n"
" which abbreviates <"
@@ -508,31 +514,31 @@ msgstr ""
msgid "Done."
msgstr ""
-#: cweav-i18n.ch:439
+#: cweav-i18n.ch:438
msgid "Parsing:"
msgstr ""
-#: cweav-i18n.ch:448
+#: cweav-i18n.ch:447
msgid "Sorting:"
msgstr ""
#: ctang-i18n.ch:17
-msgid "This is CTANGLE (Version 3.64 [CWEBbin 2020])"
+msgid "This is CTANGLE (Version 4.0 [CWEBbin 2021])"
msgstr ""
-#: cweav-i18n.ch:17
-msgid "This is CWEAVE (Version 3.64 [CWEBbin 2020])"
+#: cweav-twill.ch:61
+msgid "This is CTWILL (Version 4.0 [CWEBbin 2021])"
msgstr ""
-#: cweav-twill.ch:68
-msgid "This is CTWILL (Version 3.64 [CWEBbin 2020])"
+#: cweav-i18n.ch:17 cweav-twill.ch:42
+msgid "This is CWEAVE (Version 4.0 [CWEBbin 2021])"
msgstr ""
#: cweav-i18n.ch:301 cweav-i18n.ch:309
msgid "buffer"
msgstr ""
-#: comm-i18n.ch:149 comm-i18n.ch:159 comm-i18n.ch:174
+#: comm-i18n.ch:143 comm-i18n.ch:153 comm-i18n.ch:168
msgid "byte memory"
msgstr ""
@@ -540,23 +546,23 @@ msgstr ""
msgid "cross-reference"
msgstr ""
-#: cweav-twill.ch:822
+#: cweav-twill.ch:818
msgid "find type"
msgstr ""
-#: cweav-twill.ch:761
+#: cweav-twill.ch:757
msgid "inner"
msgstr ""
-#: ctang-i18n.ch:91
+#: ctang-i18n.ch:97
msgid "macro defs have strange char"
msgstr ""
-#: comm-i18n.ch:150 comm-i18n.ch:160 comm-i18n.ch:168
+#: comm-i18n.ch:144 comm-i18n.ch:154 comm-i18n.ch:162
msgid "name"
msgstr ""
-#: comm-i18n.ch:74
+#: comm-i18n.ch:70
msgid "of the preceding lines failed to match"
msgstr ""
@@ -580,19 +586,19 @@ msgstr ""
msgid "stack"
msgstr ""
-#: cweav-twill.ch:570
+#: cweav-twill.ch:561
msgid "temp meanings"
msgstr ""
-#: ctang-i18n.ch:203 cweav-i18n.ch:223
+#: ctang-i18n.ch:211 cweav-i18n.ch:223
msgid "text"
msgstr ""
-#: cweav-twill.ch:317
+#: cweav-twill.ch:308
msgid "titles"
msgstr ""
-#: ctang-i18n.ch:25 ctang-i18n.ch:197
-#: cweav-i18n.ch:173 cweav-i18n.ch:217 cweav-i18n.ch:231
+#: ctang-i18n.ch:25 ctang-i18n.ch:203 cweav-i18n.ch:175 cweav-i18n.ch:217
+#: cweav-i18n.ch:231
msgid "token"
msgstr ""
diff --git a/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po b/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po
index 61fbaacf10a..25324153f30 100644
--- a/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po
+++ b/Build/source/texk/web2c/cwebdir/po/de/cweb-tl.po
@@ -1,14 +1,14 @@
# International version of CWEB (CWEBbin, TeXLive).
-# Copyright (C) 2018 Andreas Scherer et al.
+# Copyright (C) 2021 Andreas Scherer et al.
# This file is distributed under the same license as the CWEB package.
-# Andreas Scherer <https://ascherer.github.io>, 2018.
+# Andreas Scherer <https://ascherer.github.io>, 2021.
#
msgid ""
msgstr ""
-"Project-Id-Version: CWEBbin 2018\n"
+"Project-Id-Version: CWEBbin 2021\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-01-15 09:55+0100\n"
-"PO-Revision-Date: 2019-01-15 09:55+0100\n"
+"POT-Creation-Date: 2021-02-06 15:43+0100\n"
+"PO-Revision-Date: 2021-02-06 15:58+0100\n"
"Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n"
"Language-Team: German\n"
"Language: de\n"
@@ -17,17 +17,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: comm-texlive.ch:494
-#, c-format
-msgid "%s: Need one to three file arguments.\n"
-msgstr "%s: Benötige ein bis drei Dateiargumente.\n"
-
-#: comm-texlive.ch:495
-#, c-format
-msgid "Try `%s --help' for more information.\n"
-msgstr "Versuche `%s --help' für weitere Informationen.\n"
-
-#: comm-texlive.ch:514
+#: comm-texlive.ch:531
#, c-format
msgid ""
"\n"
@@ -36,14 +26,24 @@ msgstr ""
"\n"
"Sende Fehler per Email an %s.\n"
-#: ctang-texlive.ch:29
-msgid "This is CTANGLE, Version 3.64"
-msgstr "Dies ist CTANGLE, Version 3.64"
+#: comm-texlive.ch:511
+#, c-format
+msgid "%s: Need one to three file arguments.\n"
+msgstr "%s: Benötige ein bis drei Dateiargumente.\n"
+
+#: ctang-texlive.ch:39
+msgid "This is CTANGLE, Version 4.0"
+msgstr "Dies ist CTANGLE, Version 4.0"
-#: cweav-texlive.ch:29
-msgid "This is CWEAVE, Version 3.64"
-msgstr "Dies ist CWEAVE, Version 3.64"
+#: ctwill-texlive.ch:39
+msgid "This is CTWILL, Version 4.0"
+msgstr "Dies ist CTWILL, Version 4.0"
-#: ctwill-texlive.ch:29
-msgid "This is CTWILL, Version 3.64"
-msgstr "Dies ist CTWILL, Version 3.64"
+#: cweav-texlive.ch:39
+msgid "This is CWEAVE, Version 4.0"
+msgstr "Dies ist CWEAVE, Version 4.0"
+
+#: comm-texlive.ch:512
+#, c-format
+msgid "Try `%s --help' for more information.\n"
+msgstr "Versuche `%s --help' für weitere Informationen.\n"
diff --git a/Build/source/texk/web2c/cwebdir/po/de/cweb.po b/Build/source/texk/web2c/cwebdir/po/de/cweb.po
index 7665a113ad6..d421cbf8a81 100644
--- a/Build/source/texk/web2c/cwebdir/po/de/cweb.po
+++ b/Build/source/texk/web2c/cwebdir/po/de/cweb.po
@@ -1,14 +1,14 @@
# International version of CWEB (CWEBbin, TeXLive).
-# Copyright (C) 2019 Andreas Scherer et al.
+# Copyright (C) 2021 Andreas Scherer et al.
# This file is distributed under the same license as the CWEB package.
-# Andreas Scherer <https://ascherer.github.io>, 2019.
+# Andreas Scherer <https://ascherer/github.io>, 2021.
#
msgid ""
msgstr ""
-"Project-Id-Version: CWEBbin 2019\n"
+"Project-Id-Version: CWEBbin 2021\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-01-18 16:57+0100\n"
-"PO-Revision-Date: 2019-01-18 16:57+0100\n"
+"POT-Creation-Date: 2021-02-06 15:25+0100\n"
+"PO-Revision-Date: 2021-02-06 15:57+0100\n"
"Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n"
"Language-Team: German\n"
"Language: de\n"
@@ -17,7 +17,7 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-#: comm-i18n.ch:182
+#: comm-i18n.ch:176
msgid ""
"\n"
"! Ambiguous prefix: matches <"
@@ -31,7 +31,7 @@ msgid ""
"! C text in section name didn't end: <"
msgstr ""
"\n"
-"! C-Text in Abschnittname nicht beendet: <"
+"! C-Text in Abschnittnamen nicht beendet: <"
#: cweav-i18n.ch:287
msgid ""
@@ -39,9 +39,9 @@ msgid ""
"! Illegal control code in section name: <"
msgstr ""
"\n"
-"! Unerlaubtes Kontrollzeichen in Abschnittname: <"
+"! Unerlaubtes Kontrollzeichen in Abschnittnamen: <"
-#: cweav-i18n.ch:157
+#: cweav-i18n.ch:159
#, c-format
msgid ""
"\n"
@@ -50,7 +50,7 @@ msgstr ""
"\n"
"! Zeile musste umbrochen werden (Ausgabezeile %d):\n"
-#: cweav-i18n.ch:141
+#: cweav-i18n.ch:142
msgid ""
"\n"
"! Never defined: <"
@@ -58,7 +58,7 @@ msgstr ""
"\n"
"! Nicht definiert: <"
-#: cweav-i18n.ch:148
+#: cweav-i18n.ch:150
msgid ""
"\n"
"! Never used: <"
@@ -66,7 +66,7 @@ msgstr ""
"\n"
"! Nicht benutzt: <"
-#: comm-i18n.ch:202
+#: comm-i18n.ch:196
msgid ""
"\n"
"! New name extends <"
@@ -74,7 +74,7 @@ msgstr ""
"\n"
"! Neuer Name erweitert <"
-#: comm-i18n.ch:196
+#: comm-i18n.ch:190
msgid ""
"\n"
"! New name is a prefix of <"
@@ -98,7 +98,7 @@ msgstr ""
"\n"
"! Nicht vorhanden: <"
-#: comm-i18n.ch:208
+#: comm-i18n.ch:202
msgid ""
"\n"
"! Section name incompatible with <"
@@ -106,15 +106,15 @@ msgstr ""
"\n"
"! Abschnittname passt nicht zu <"
-#: ctang-i18n.ch:167 cweav-i18n.ch:67
+#: ctang-i18n.ch:173 cweav-i18n.ch:67
msgid ""
"\n"
"! Section name too long: "
msgstr ""
"\n"
-"! Abschnittname zu lang: "
+"! Abschnittname ist zu lang: "
-#: comm-i18n.ch:254
+#: comm-i18n.ch:248
#, c-format
msgid ""
"\n"
@@ -123,13 +123,13 @@ msgstr ""
"\n"
"! Tut mir leid, Kapazität für %s überschritten"
-#: ctang-i18n.ch:125 cweav-i18n.ch:45
+#: ctang-i18n.ch:131 cweav-i18n.ch:45
msgid ""
"\n"
"! String too long: "
msgstr ""
"\n"
-"! Zeichenkette zu lang: "
+"! Zeichenkette ist zu lang: "
#: cweav-i18n.ch:239
#, c-format
@@ -138,9 +138,9 @@ msgid ""
"Irreducible scrap sequence in section %d:"
msgstr ""
"\n"
-"Nichtreduzierbare Scrap-Folge in Abschnitt %d:"
+"Nicht reduzierbare Scrap-Folge in Abschnitt %d:"
-#: ctang-i18n.ch:292 cweav-i18n.ch:431
+#: ctang-i18n.ch:300 cweav-i18n.ch:430
msgid ""
"\n"
"Memory usage statistics:"
@@ -190,36 +190,37 @@ msgstr ""
"\n"
"Schreibe die Ausgabedateien:"
-#: ctang-i18n.ch:217
+#: ctang-i18n.ch:225
msgid "! @d, @f and @c are ignored in C text"
msgstr "! @d, @f und @c werden im C-Text ignoriert"
-#: comm-i18n.ch:60
+#: comm-i18n.ch:56
msgid "! CWEB file ended during a change"
msgstr "! CWEB-Datei endete während einer Änderung"
-#: cweav-twill.ch:1033
+#: cweav-twill.ch:1029
msgid "! Cannot open aux output file "
msgstr "! Kann aux-Ausgabedatei nicht öffnen: "
-#: comm-i18n.ch:88
+#: comm-i18n.ch:84
msgid "! Cannot open change file "
msgstr "! Kann Änderungsdatei nicht öffnen: "
-#: comm-i18n.ch:118
+#: comm-i18n.ch:112
msgid "! Cannot open include file"
msgstr "! Kann Einfügedatei nicht öffnen"
#: cweav-i18n.ch:383
msgid "! Cannot open index file "
-msgstr "! Kann die Indexdatei nicht öffnen: "
+msgstr "! Kann Indexdatei nicht öffnen: "
-#: comm-i18n.ch:82
+#: comm-i18n.ch:78
msgid "! Cannot open input file "
msgstr "! Kann Eingabedatei nicht öffnen: "
-#: comm-i18n.ch:300 comm-i18n.ch:308 ctang-i18n.ch:83 ctang-i18n.ch:307
-#: cweav-i18n.ch:457
+#: comm-i18n.ch:300 comm-i18n.ch:306 comm-i18n.ch:312 comm-i18n.ch:318
+#: ctang-i18n.ch:83 ctang-i18n.ch:89 ctang-i18n.ch:315 ctang-i18n.ch:321
+#: cweav-i18n.ch:455
msgid "! Cannot open output file "
msgstr "! Kann Ausgabedatei nicht öffnen: "
@@ -227,19 +228,19 @@ msgstr "! Kann Ausgabedatei nicht öffnen: "
msgid "! Cannot open section file "
msgstr "! Kann die Abschnittdatei nicht öffnen: "
-#: comm-i18n.ch:46
+#: comm-i18n.ch:42
msgid "! Change file ended after @x"
msgstr "! Änderungsdatei endete nach @x"
-#: comm-i18n.ch:54
+#: comm-i18n.ch:50
msgid "! Change file ended before @y"
msgstr "! Änderungsdatei endete vor @y"
-#: comm-i18n.ch:126
+#: comm-i18n.ch:120
msgid "! Change file ended without @z"
msgstr "! Änderungsdatei endete ohne @z"
-#: comm-i18n.ch:140
+#: comm-i18n.ch:134
msgid "! Change file entry did not match"
msgstr "! Eintrag in der Änderungsdatei stimmt nicht überein"
@@ -255,23 +256,23 @@ msgstr "! Kontrollzeichen sind in Abschnittnamen verboten"
msgid "! Control text didn't end"
msgstr "! Kontrolltext nicht beendet"
-#: ctang-i18n.ch:249
+#: ctang-i18n.ch:257
msgid "! Definition flushed, must start with identifier"
msgstr "! Definition übergangen, muss mit einem Bezeichner anfangen"
-#: ctang-i18n.ch:147
+#: ctang-i18n.ch:153
msgid "! Double @ should be used in ASCII constant"
msgstr "! In ASCII Konstanten sollten doppelte @ verwendet werden"
-#: ctang-i18n.ch:139 ctang-i18n.ch:257
+#: ctang-i18n.ch:145 ctang-i18n.ch:265
msgid "! Double @ should be used in control text"
msgstr "! In Kontrolltexten sollten doppelte @ verwendet werden"
-#: ctang-i18n.ch:263 cweav-i18n.ch:165
+#: ctang-i18n.ch:271 cweav-i18n.ch:167 cweav-twill.ch:661 cweav-twill.ch:664
msgid "! Double @ should be used in limbo"
msgstr "! Im Einführungsteil sollten doppelte @ verwendet werden"
-#: ctang-i18n.ch:233
+#: ctang-i18n.ch:241
msgid "! Double @ should be used in string"
msgstr "! In einer Zeichenkette sollten doppelte @ verwendet werden"
@@ -283,11 +284,11 @@ msgstr "! In Zeichenketten sollten doppelte @ verwendet werden"
msgid "! Extra } in comment"
msgstr "! Zusätzliche } in Kommentar"
-#: comm-i18n.ch:300
+#: comm-i18n.ch:292
msgid "! Filename too long\n"
msgstr "! Dateiname zu lang\n"
-#: cweav-twill.ch:550
+#: cweav-twill.ch:541
msgid "! Identifier in meaning should be followed by space"
msgstr "! Bezeichner in Bedeutung sollte Leerzeichen folgen"
@@ -299,7 +300,7 @@ msgstr "! Unerlaubte Verwendung von @ in Kommentar"
msgid "! Improper format definition"
msgstr "! Ungültige Formatdefinition"
-#: ctang-i18n.ch:271
+#: ctang-i18n.ch:279
msgid "! Improper hex number following @l"
msgstr "! Ungültige Hexadezimalzahl nach @l"
@@ -307,39 +308,39 @@ msgstr "! Ungültige Hexadezimalzahl nach @l"
msgid "! Improper macro definition"
msgstr "! Ungültige Makrodefinition"
-#: comm-i18n.ch:96
+#: comm-i18n.ch:92
msgid "! Include file name not given"
msgstr "! Name der Einfügedatei nicht angegeben"
-#: comm-i18n.ch:110
+#: comm-i18n.ch:106
msgid "! Include file name too long"
msgstr "! Name der Einfügedatei zu lang"
-#: comm-i18n.ch:320
+#: comm-i18n.ch:324
msgid "! Include path too long"
msgstr "! Einfügepfad zu lang"
-#: ctang-i18n.ch:99 cweav-i18n.ch:181
+#: ctang-i18n.ch:105 cweav-i18n.ch:181
msgid "! Input ended in mid-comment"
msgstr "! Eingabe endete mitten in einem Kommentar"
-#: ctang-i18n.ch:119 cweav-i18n.ch:39
+#: ctang-i18n.ch:125 cweav-i18n.ch:39
msgid "! Input ended in middle of string"
msgstr "! Eingabe endete mitten in einer Zeichenkette"
-#: ctang-i18n.ch:161 cweav-i18n.ch:61
+#: ctang-i18n.ch:167 cweav-i18n.ch:61
msgid "! Input ended in section name"
msgstr "! Eingabe endete in einem Abschnittnamen"
-#: comm-i18n.ch:30
+#: comm-i18n.ch:26
msgid "! Input line too long"
msgstr "! Eingabezeile zu lang"
-#: cweav-twill.ch:550
+#: cweav-twill.ch:548
msgid "! Location in meaning should be followed by space"
msgstr "! Herkunftsort in Bedeutung sollte Leerzeichen folgen"
-#: ctang-i18n.ch:211
+#: ctang-i18n.ch:219
msgid "! Misplaced @h"
msgstr "! Falsch platziertes @h"
@@ -347,11 +348,11 @@ msgstr "! Falsch platziertes @h"
msgid "! Missing '|' after C text"
msgstr "! Fehlendes `|' nach C-Text"
-#: comm-i18n.ch:38
+#: comm-i18n.ch:34
msgid "! Missing @x in change file"
msgstr "! Fehlendes @x in der Änderungsdatei"
-#: ctang-i18n.ch:225
+#: ctang-i18n.ch:233
msgid "! Missing `@ ' before a named section"
msgstr "! Fehlendes `@ ' vor einem Abschnittnamen"
@@ -367,27 +368,27 @@ msgstr "! Fehlender rechter Bezeichner von @s"
msgid "! Missing } in comment"
msgstr "! Fehlende } in Kommentar"
-#: ctang-i18n.ch:181
+#: ctang-i18n.ch:187
msgid "! Nesting of section names not allowed"
msgstr "! Verschachtelung von Abschnittnamen nicht erlaubt"
-#: cweav-twill.ch:1029
+#: cweav-twill.ch:1025
msgid "! Only @$ is allowed in aux and bux files"
msgstr "! Nur @$ ist in aux- und bux-Dateien erlaubt"
-#: ctang-i18n.ch:277
+#: ctang-i18n.ch:285
msgid "! Replacement string in @l too long"
msgstr "! Ersetzungstext in @l zu lang"
-#: ctang-i18n.ch:175 cweav-i18n.ch:75
+#: ctang-i18n.ch:181 cweav-i18n.ch:75
msgid "! Section name didn't end"
msgstr "! Abschnittname nicht beendet"
-#: ctang-i18n.ch:99
+#: ctang-i18n.ch:111
msgid "! Section name ended in mid-comment"
msgstr "! Abschnittname endete mitten in einem Kommentar"
-#: ctang-i18n.ch:113 ctang-i18n.ch:153 cweav-i18n.ch:33
+#: ctang-i18n.ch:119 ctang-i18n.ch:159 cweav-i18n.ch:33
msgid "! String didn't end"
msgstr "! Zeichenkette nicht beendet"
@@ -395,27 +396,27 @@ msgstr "! Zeichenkette nicht beendet"
msgid "! TeX string should be in C text only"
msgstr "! TeX-Zeichenkette sollte nur in C-Text stehen"
-#: comm-i18n.ch:262 comm-i18n.hch:33
+#: comm-i18n.hch:42
msgid "! This can't happen: "
msgstr "! Das kann nicht sein: "
-#: cweav-twill.ch:316
+#: cweav-twill.ch:307
msgid "! Title name didn't end"
msgstr "! Titel nicht beendet"
-#: cweav-twill.ch:314
+#: cweav-twill.ch:305
msgid "! Title should be enclosed in braces or doublequotes"
msgstr "! Titel sollte in geschweiften Klammern oder Anführungszeichen stehen"
-#: comm-i18n.ch:102
+#: comm-i18n.ch:98
msgid "! Too many nested includes"
msgstr "! Zu viele verschachtelte Einfügungen"
-#: ctang-i18n.ch:241
+#: ctang-i18n.ch:249
msgid "! Unrecognized escape sequence"
msgstr "! Unbekannte Escape-Sequenz"
-#: comm-i18n.ch:283
+#: comm-i18n.ch:272
msgid ""
"! Usage: ctangle [options] webfile[.w] [{changefile[.ch]|-} [outfile[.c]]]\n"
msgstr ""
@@ -427,11 +428,11 @@ msgstr ""
"s [-] Melde die Verbrauchsstatistik\n"
"t [+] Vergleiche temporäre Ausgabe nach Änderungen\n"
-#: comm-i18n.ch:287
+#: comm-i18n.ch:281
msgid ""
-"! Usage: cweave [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
+"! Usage: ctwill [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
msgstr ""
-"! Aufruf: cweave [Optionen] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
+"! Aufruf: ctwill [Optionen] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
"Optionen sind (+ schaltet ein, - schaltet aus, Vorgabe in Klammern):\n"
"b [+] Gib eine Startmeldung aus\n"
"h [+] Bestätige einen fehlerfreien Lauf\n"
@@ -441,15 +442,16 @@ msgstr ""
"i [+] Rücke Parameterdeklarationen ein\n"
"o [+] Trenne Deklarationen und Anweisungen\n"
"x [+] Füge Indexe und Inhaltsverzeichnisse ein\n"
-"lX [] Verwende die Makros für Sprache X aus Xcwebmac.tex\n"
+"P [-] Benutze 'proofmac.tex' statt 'ctwimac.tex'\n"
+"lX [] Verwende die Makros für Sprache X aus X{ctwimac|proofmac}.tex\n"
"s [-] Melde die Verbrauchsstatistik\n"
"t [+] Vergleiche temporäre Ausgabe nach Änderungen\n"
-#: comm-i18n.ch:290
+#: comm-i18n.ch:277
msgid ""
-"! Usage: ctwill [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
+"! Usage: cweave [options] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
msgstr ""
-"! Aufruf: ctwill [Optionen] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
+"! Aufruf: cweave [Optionen] webfile[.w] [{changefile[.ch]|-} [outfile[.tex]]]\n"
"Optionen sind (+ schaltet ein, - schaltet aus, Vorgabe in Klammern):\n"
"b [+] Gib eine Startmeldung aus\n"
"h [+] Bestätige einen fehlerfreien Lauf\n"
@@ -459,24 +461,23 @@ msgstr ""
"i [+] Rücke Parameterdeklarationen ein\n"
"o [+] Trenne Deklarationen und Anweisungen\n"
"x [+] Füge Indexe und Inhaltsverzeichnisse ein\n"
-"P [-] Benutze 'proofmac.tex' statt 'ctwimac.tex'\n"
-"lX [] Verwende die Makros für Sprache X aus X{ctwimac|proofmac}.tex\n"
+"lX [] Verwende die Makros für Sprache X aus Xcwebmac.tex\n"
"s [-] Melde die Verbrauchsstatistik\n"
"t [+] Vergleiche temporäre Ausgabe nach Änderungen\n"
-#: ctang-i18n.ch:131 cweav-i18n.ch:53 cweav-i18n.ch:119
+#: ctang-i18n.ch:139 cweav-i18n.ch:53 cweav-i18n.ch:119
msgid "! Use @l in limbo only"
msgstr "! Verwende @l ausschließlich im Einführungsteil"
-#: ctang-i18n.ch:189 cweav-i18n.ch:103
+#: ctang-i18n.ch:195 cweav-i18n.ch:103
msgid "! Verbatim string didn't end"
msgstr "! Verbatim-Zeichenkette nicht beendet"
-#: comm-i18n.ch:68
+#: comm-i18n.ch:64
msgid "! Where is the matching @y?"
msgstr "! Wo ist das zugehörige @y?"
-#: comm-i18n.ch:132
+#: comm-i18n.ch:126
msgid "! Where is the matching @z?"
msgstr "! Wo ist das zugehörige @z?"
@@ -492,83 +493,88 @@ msgstr "! Das geht nicht im TeX-Text"
msgid "! You need an = sign after the section name"
msgstr "! Hinter dem Abschnittnamen muss ein = Zeichen stehen"
-#: ctang-i18n.ch:297 cweav-i18n.ch:437
+#: ctang-i18n.ch:305 cweav-i18n.ch:436 cweav-twill.ch:1335 cweav-twill.ch:1338
#, c-format
msgid "%ld bytes (out of %ld)\n"
msgstr "%ld Bytes (von %ld)\n"
-#: cweav-i18n.ch:435
+#: cweav-i18n.ch:434
#, c-format
msgid "%ld cross-references (out of %ld)\n"
msgstr "%ld Querverweise (von %ld)\n"
-#: cweav-i18n.ch:446 cweav-i18n.ch:449
+#: cweav-i18n.ch:445 cweav-i18n.ch:448
#, c-format
msgid "%ld levels (out of %ld)\n"
msgstr "%ld Ebenen (von %ld)\n"
-#: ctang-i18n.ch:293 cweav-i18n.ch:433
+#: ctang-i18n.ch:301 cweav-i18n.ch:432
#, c-format
msgid "%ld names (out of %ld)\n"
msgstr "%ld Namen (von %ld)\n"
-#: ctang-i18n.ch:295
+#: ctang-i18n.ch:303
#, c-format
msgid "%ld replacement texts (out of %ld)\n"
msgstr "%ld Ersetzungstexte (von %ld)\n"
-#: cweav-i18n.ch:440
+#: cweav-i18n.ch:439
#, c-format
msgid "%ld scraps (out of %ld)\n"
msgstr "%ld Scraps (von %ld)\n"
-#: cweav-twill.ch:1346
+#: cweav-twill.ch:1340
#, c-format
msgid "%ld temp meanings (out of %ld)\n"
msgstr "%ld temporäre Bedeutungen (von %ld)\n"
-#: cweav-i18n.ch:442
+#: cweav-i18n.ch:441
#, c-format
msgid "%ld texts (out of %ld)\n"
msgstr "%ld Texte (von %ld)\n"
-#: ctang-i18n.ch:299 cweav-i18n.ch:444
+#: cweav-twill.ch:1343
+#, c-format
+msgid "%ld titles (out of %ld)\n"
+msgstr "%ld Titel (von %ld)\n"
+
+#: ctang-i18n.ch:307 cweav-i18n.ch:443
#, c-format
msgid "%ld tokens (out of %ld)\n"
msgstr "%ld Token (von %ld)\n"
-#: comm-i18n.ch:242
+#: comm-i18n.ch:236
msgid "(Did you see the warning message above?)"
msgstr "(Hast du die obige Warnung gesehen?)"
-#: comm-i18n.ch:240
+#: comm-i18n.ch:234
msgid "(No errors were found.)"
msgstr "(Keine Fehler gefunden.)"
-#: comm-i18n.ch:244
+#: comm-i18n.ch:238
msgid "(Pardon me, but I think I spotted something wrong.)"
msgstr "(Entschuldige bitte, aber ich glaube, etwas stimmt nicht.)"
-#: comm-i18n.ch:246
+#: comm-i18n.ch:240
msgid "(That was a fatal error, my friend.)"
msgstr "(Mensch, das war ein böser Fehler.)"
-#: comm-i18n.ch:224
+#: comm-i18n.ch:218
#, c-format
msgid ". (l. %d of change file)\n"
msgstr ". (Zeile %d der Änderungsdatei)\n"
-#: comm-i18n.ch:226
+#: comm-i18n.ch:220
#, c-format
msgid ". (l. %d of include file %s)\n"
msgstr ". (Zeile %d der Einfügedatei %s)\n"
-#: comm-i18n.ch:225
+#: comm-i18n.ch:219
#, c-format
msgid ". (l. %d)\n"
msgstr ". (Zeile %d)\n"
-#: comm-i18n.ch:188
+#: comm-i18n.ch:182
msgid ""
">\n"
" and <"
@@ -576,7 +582,7 @@ msgstr ""
">\n"
" und <"
-#: comm-i18n.ch:214
+#: comm-i18n.ch:208
msgid ""
">,\n"
" which abbreviates <"
@@ -588,31 +594,31 @@ msgstr ""
msgid "Done."
msgstr "Fertig."
-#: cweav-i18n.ch:439
+#: cweav-i18n.ch:438
msgid "Parsing:"
msgstr "Parsen:"
-#: cweav-i18n.ch:448
+#: cweav-i18n.ch:447
msgid "Sorting:"
msgstr "Sortieren:"
#: ctang-i18n.ch:17
-msgid "This is CTANGLE (Version 3.64 [CWEBbin 2020])"
-msgstr "Dies ist CTANGLE (Version 3.64 [CWEBbin 2020])"
+msgid "This is CTANGLE (Version 4.0 [CWEBbin 2021])"
+msgstr "Dies ist CTANGLE (Version 4.0 [CWEBbin 2021])"
-#: cweav-i18n.ch:17
-msgid "This is CWEAVE (Version 3.64 [CWEBbin 2020])"
-msgstr "Dies ist CWEAVE (Version 3.64 [CWEBbin 2020])"
+#: cweav-twill.ch:61
+msgid "This is CTWILL (Version 4.0 [CWEBbin 2021])"
+msgstr "Dies ist CTWILL (Version 4.0 [CWEBbin 2021])"
-#: cweav-twill.ch:68
-msgid "This is CTWILL (Version 3.64 [CWEBbin 2020])"
-msgstr "Dies ist CTWILL (Version 3.64 [CWEBbin 2020])"
+#: cweav-i18n.ch:17 cweav-twill.ch:42
+msgid "This is CWEAVE (Version 4.0 [CWEBbin 2021])"
+msgstr "Dies ist CWEAVE (Version 4.0 [CWEBbin 2021])"
#: cweav-i18n.ch:301 cweav-i18n.ch:309
msgid "buffer"
msgstr "Puffer"
-#: comm-i18n.ch:149 comm-i18n.ch:159 comm-i18n.ch:174
+#: comm-i18n.ch:143 comm-i18n.ch:153 comm-i18n.ch:168
msgid "byte memory"
msgstr "Byte-Speicher"
@@ -620,23 +626,23 @@ msgstr "Byte-Speicher"
msgid "cross-reference"
msgstr "Querverweise"
-#: cweav-twill.ch:822
+#: cweav-twill.ch:818
msgid "find type"
msgstr "Auffindetyp"
-#: cweav-twill.ch:761
+#: cweav-twill.ch:757
msgid "inner"
msgstr "inner"
-#: ctang-i18n.ch:91
+#: ctang-i18n.ch:97
msgid "macro defs have strange char"
msgstr "Unpassendes Zeichen in einer Makrodefinition"
-#: comm-i18n.ch:150 comm-i18n.ch:160 comm-i18n.ch:168
+#: comm-i18n.ch:144 comm-i18n.ch:154 comm-i18n.ch:162
msgid "name"
msgstr "Bezeichner"
-#: comm-i18n.ch:74
+#: comm-i18n.ch:70
msgid "of the preceding lines failed to match"
msgstr "der vorangegangenen Zeilen stimmen nicht überein"
@@ -660,19 +666,19 @@ msgstr "Sortieren"
msgid "stack"
msgstr "Stack"
-#: cweav-twill.ch:570
+#: cweav-twill.ch:561
msgid "temp meanings"
msgstr "Temporäre Bedeutung"
-#: ctang-i18n.ch:203 cweav-i18n.ch:223
+#: ctang-i18n.ch:211 cweav-i18n.ch:223
msgid "text"
msgstr "Text"
-#: cweav-twill.ch:317
+#: cweav-twill.ch:308
msgid "titles"
msgstr "Titel"
-#: ctang-i18n.ch:25 ctang-i18n.ch:197 cweav-i18n.ch:173 cweav-i18n.ch:217
+#: ctang-i18n.ch:25 ctang-i18n.ch:203 cweav-i18n.ch:175 cweav-i18n.ch:217
#: cweav-i18n.ch:231
msgid "token"
msgstr "Token"
diff --git a/Build/source/texk/web2c/cwebdir/po/de/web2c-help.po b/Build/source/texk/web2c/cwebdir/po/de/web2c-help.po
index 1bfd32161bb..45bc6a54f99 100644
--- a/Build/source/texk/web2c/cwebdir/po/de/web2c-help.po
+++ b/Build/source/texk/web2c/cwebdir/po/de/web2c-help.po
@@ -1,14 +1,14 @@
# International version of CWEB (CWEBbin, TeXLive).
-# Copyright (C) 2020 Andreas Scherer et al.
+# Copyright (C) 2021 Andreas Scherer et al.
# This file is distributed under the same license as the CWEB package.
-# Andreas Scherer <https://ascherer.github.io>, 2020.
+# Andreas Scherer <https://ascherer.github.io>, 2021.
#
msgid ""
msgstr ""
-"Project-Id-Version: CWEBbin 2020\n"
+"Project-Id-Version: CWEBbin 2021\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-08 15:10+0200\n"
-"PO-Revision-Date: 2020-07-08 15:10+0200\n"
+"POT-Creation-Date: 2021-02-06 15:10+0200\n"
+"PO-Revision-Date: 2021-02-06 15:58+0100\n"
"Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n"
"Language-Team: German\n"
"Language: de\n"
@@ -18,8 +18,10 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: help.h:52
-msgid "Usage: ctangle [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.c]]]"
-msgstr "Aufruf: ctangle [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.c]]]"
+msgid ""
+"Usage: ctangle [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.c]]]"
+msgstr ""
+"Aufruf: ctangle [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.c]]]"
#: help.h:53
msgid " Tangle WEBFILE with CHANGEFILE into a C/C++ program."
@@ -73,17 +75,19 @@ msgstr "+s melde die Verbrauchsstatistik"
msgid "-t ignore temporary output irrespective of changes"
msgstr "-t ignoriere temporäre Ausgabe unabhängig von Änderungen"
-#: help.h:65 help.h:91 help.h:118
+#: help.h:66 help.h:92 help.h:119
msgid "--help display this help and exit"
msgstr "--help zeige diesen Hilfetext und ende"
-#: help.h:66 help.h:92 help.h:119
+#: help.h:67 help.h:93 help.h:120
msgid "--version output version information and exit"
msgstr "--version zeige die Versionsinformation und ende"
#: help.h:72
-msgid "Usage: cweave [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]"
-msgstr "Aufruf: cweave [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]"
+msgid ""
+"Usage: cweave [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]"
+msgstr ""
+"Aufruf: cweave [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]"
#: help.h:73
msgid " Weave WEBFILE with CHANGEFILE into a TeX document."
@@ -118,8 +122,10 @@ msgid "+lX use macros for language X as of Xcwebmac.tex"
msgstr "+lX benutze Macros für Sprache X aus Xcwebmac.tex"
#: help.h:98
-msgid "Usage: ctwill [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]"
-msgstr "Aufruf: ctwill [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]"
+msgid ""
+"Usage: ctwill [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]"
+msgstr ""
+"Aufruf: ctwill [OPTIONS] WEBFILE[.w] [{CHANGEFILE[.ch]|-} [OUTFILE[.tex]]]"
#: help.h:99
msgid " Weave WEBFILE with CHANGEFILE into a TeX document with mini-indexes."
diff --git a/Build/source/texk/web2c/cwebdir/po/it/cweb.po b/Build/source/texk/web2c/cwebdir/po/it/cweb.po
index 104253110f4..defb988831f 100644
--- a/Build/source/texk/web2c/cwebdir/po/it/cweb.po
+++ b/Build/source/texk/web2c/cwebdir/po/it/cweb.po
@@ -1,14 +1,14 @@
# International version of CWEB (CWEBbin, TeXLive).
-# Copyright (C) 2019 Andreas Scherer et al.
+# Copyright (C) 2021 Andreas Scherer et al.
# This file is distributed under the same license as the CWEB package.
-# Andreas Scherer <https://ascherer.github.io>, 2019.
+# Andreas Scherer <https://ascherer/github.io>, 2021.
#
msgid ""
msgstr ""
-"Project-Id-Version: CWEBbin 2020\n"
+"Project-Id-Version: CWEBbin 2021\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-01-18 16:57+0100\n"
-"PO-Revision-Date: 2019-09-22 17:08+0200\n"
+"POT-Creation-Date: 2021-02-06 15:25+0100\n"
+"PO-Revision-Date: 2021-02-06 15:57+0100\n"
"Last-Translator: Andreas Scherer <andreas_github@freenet.de>\n"
"Language-Team: Italian\n"
"Language: it\n"
@@ -598,16 +598,16 @@ msgid "Sorting:"
msgstr "Ordinamento:"
#: ctang-i18n.ch:17
-msgid "This is CTANGLE (Version 3.64 [CWEBbin 2020])"
-msgstr "Questo è CTANGLE (Versione 3.64 [CWEBbin 2020])"
+msgid "This is CTANGLE (Version 4.0 [CWEBbin 2021])"
+msgstr "Questo è CTANGLE (Versione 4.0 [CWEBbin 2021])"
#: cweav-i18n.ch:17
-msgid "This is CWEAVE (Version 3.64 [CWEBbin 2020])"
-msgstr "Questo è CWEAVE (Versione 3.64 [CWEBbin 2020])"
+msgid "This is CWEAVE (Version 4.0 [CWEBbin 2021])"
+msgstr "Questo è CWEAVE (Versione 4.0 [CWEBbin 2021])"
#: cweav-twill.ch:68
-msgid "This is CTWILL (Version 3.64 [CWEBbin 2020])"
-msgstr "Questo è CTWILL (Versione 3.64 [CWEBbin 2020])"
+msgid "This is CTWILL (Version 4.0 [CWEBbin 2021])"
+msgstr "Questo è CTWILL (Versione 4.0 [CWEBbin 2021])"
#: cweav-i18n.ch:301 cweav-i18n.ch:309
msgid "buffer"
diff --git a/Build/source/texk/web2c/cwebdir/po/web2c-help.pot b/Build/source/texk/web2c/cwebdir/po/web2c-help.pot
index 315f93f2034..87444595f4a 100644
--- a/Build/source/texk/web2c/cwebdir/po/web2c-help.pot
+++ b/Build/source/texk/web2c/cwebdir/po/web2c-help.pot
@@ -1,14 +1,14 @@
# International version of CWEB (CWEBbin, TeXLive).
-# Copyright (C) 2020 Andreas Scherer et al.
+# Copyright (C) 2021 Andreas Scherer et al.
# This file is distributed under the same license as the CWEB package.
-# Andreas Scherer <https://ascherer.github.io>, 2020.
+# Andreas Scherer <https://ascherer.github.io>, 2021.
#
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: CWEBbin 2020\n"
+"Project-Id-Version: CWEBbin 2021\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2020-07-08 15:10+0200\n"
+"POT-Creation-Date: 2021-02-06 15:10+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
diff --git a/Build/source/texk/web2c/cwebdir/system.bux b/Build/source/texk/web2c/cwebdir/system.bux
index 9cc9d2ff227..8a895b161b5 100644
--- a/Build/source/texk/web2c/cwebdir/system.bux
+++ b/Build/source/texk/web2c/cwebdir/system.bux
@@ -1,4 +1,5 @@
@$memcmp "<string.h>" \zip@>
+@$memcpy "<string.h>" \zip@>
@$strcat "<string.h>" \zip@>
@$strcmp "<string.h>" \zip@>
@$strcpy "<string.h>" \zip@>
@@ -24,6 +25,7 @@
@$sprintf "<stdio.h>" \zip@>
@$stdout "<stdio.h>" \zip@>
+@$getenv "<stdlib.h>" \zip@>
@$exit "<stdlib.h>" \zip@>
@$isalpha "<ctype.h>" \zip@>
diff --git a/Build/source/texk/web2c/cwebdir/texinputs/p+cwebmac.tex b/Build/source/texk/web2c/cwebdir/texinputs/p+cwebmac.tex
deleted file mode 100644
index a7da7a8193b..00000000000
--- a/Build/source/texk/web2c/cwebdir/texinputs/p+cwebmac.tex
+++ /dev/null
@@ -1,5 +0,0 @@
-% 'Language' to switch on PDF creation with standard 'tex' and 'xetex'
-% created by Andreas Scherer in June 2020. Used with 'cweave -lp+'.
-% This file is not copyrighted and can be used freely.
-\ifx\undefined\botofcontents \let\pdf+ \input cwebmac % switch on PDF
-\else\endinput\fi % too late, baby!
diff --git a/Build/source/texk/web2c/man/ctwill.man b/Build/source/texk/web2c/man/ctwill.man
index 07f13516a35..5efb9c7026e 100644
--- a/Build/source/texk/web2c/man/ctwill.man
+++ b/Build/source/texk/web2c/man/ctwill.man
@@ -1,6 +1,6 @@
-.\" Automatically generated by Pandoc 2.10.1
+.\" Automatically generated by Pandoc 2.11.4
.\"
-.TH "CTWILL" "1" "September 23, 2020" "Web2c @VERSION@" "General Commands Manual"
+.TH "CTWILL" "1" "February 6, 2021" "Web2c @VERSION@" "General Commands Manual"
.hy
.SH NAME
.PP
@@ -106,7 +106,7 @@ The present incarnation of \f[B]ctwill\f[R] and its utilities tries hard
to be a drop-in replacement for the original package.
There are, however, a few differences worth noting:
.IP \[bu] 2
-This version is based on the most recent version of CWEB (3.64c).
+This version is based on the most recent version of CWEB (4.0).
.IP \[bu] 2
In TeX\ Live the utility programs are prefixed with \f[B]ctwill-\f[R]
and the macro files with \f[B]ct\f[R] for technical reasons.
diff --git a/Build/source/texk/web2c/man/cweb.man b/Build/source/texk/web2c/man/cweb.man
index db6b5ef4d2b..1786b698e8a 100644
--- a/Build/source/texk/web2c/man/cweb.man
+++ b/Build/source/texk/web2c/man/cweb.man
@@ -1,4 +1,4 @@
-.\" Automatically generated by Pandoc 2.10.1
+.\" Automatically generated by Pandoc 2.11.4
.\"
.TH "CWEB" "1" "September 23, 2020" "Web2c @VERSION@" "General Commands Manual"
.hy