summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/ctangleboot.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/ctangleboot.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/ctangleboot.cin')
-rw-r--r--Build/source/texk/web2c/ctangleboot.cin1078
1 files changed, 514 insertions, 564 deletions
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*/