summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebboot.cin
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/source/texk/web2c/cwebboot.cin
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/source/texk/web2c/cwebboot.cin')
-rw-r--r--Build/source/texk/web2c/cwebboot.cin1183
1 files changed, 585 insertions, 598 deletions
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*/