summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/ctang-w2c.ch')
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-w2c.ch514
1 files changed, 42 insertions, 472 deletions
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