summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/ctangle.c
diff options
context:
space:
mode:
authorAndreas Scherer <andreas_tex@freenet.de>2021-05-02 13:12:20 +0000
committerAndreas Scherer <andreas_tex@freenet.de>2021-05-02 13:12:20 +0000
commitd28619b4358aaa5c7ae210ce855df17e80b042a5 (patch)
tree96141dd0510f9501c56e1b3b0f5331179bd3fff9 /Build/source/texk/web2c/cwebdir/ctangle.c
parentac2076a1c1574e8973c41270faf9064b46fd5130 (diff)
Revert "[CWEB] New release 4.3."
This reverts commit 3ccac2a7d0f4a19dde861c6f4c178e853d90f0cc. CWEB 4.3 is seriously broken. git-svn-id: svn://tug.org/texlive/trunk@59048 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/cwebdir/ctangle.c')
-rw-r--r--Build/source/texk/web2c/cwebdir/ctangle.c384
1 files changed, 182 insertions, 202 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c
index 5f3f9e1b76d..d955da9d573 100644
--- a/Build/source/texk/web2c/cwebdir/ctangle.c
+++ b/Build/source/texk/web2c/cwebdir/ctangle.c
@@ -2,7 +2,7 @@
#line 66 "ctangle.w"
/*4:*/
-#line 44 "common.h"
+#line 46 "common.h"
#include <ctype.h>
#include <stdbool.h>
@@ -15,7 +15,7 @@
/*:4*/
#line 67 "ctangle.w"
-#define banner "This is CTANGLE (Version 4.3)" \
+#define banner "This is CTANGLE (Version 4.2)" \
#define ctangle false
#define cweave true \
@@ -36,18 +36,12 @@
#define period_ast 026
#define minus_gt_ast 027 \
-#define compress(c) if(loc++<=limit) return c \
-
-#define xisalpha(c) (isalpha((eight_bits) (c) ) &&((eight_bits) (c) <0200) )
-#define xisdigit(c) (isdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) )
-#define xisspace(c) (isspace((eight_bits) (c) ) &&((eight_bits) (c) <0200) )
-#define xislower(c) (islower((eight_bits) (c) ) &&((eight_bits) (c) <0200) )
-#define xisupper(c) (isupper((eight_bits) (c) ) &&((eight_bits) (c) <0200) )
-#define xisxdigit(c) (isxdigit((eight_bits) (c) ) &&((eight_bits) (c) <0200) )
-#define isxalpha(c) ((c) =='_'||(c) =='$') \
-
-#define ishigh(c) ((eight_bits) (c) > 0177) \
- \
+#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) )
+#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
#define max_include_depth 10 \
@@ -82,7 +76,10 @@
#define update_terminal fflush(stdout)
#define new_line putchar('\n')
-#define term_write(a,b) fflush(stdout) ,fwrite(a,sizeof(char) ,b,stdout) \
+#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 \
@@ -98,11 +95,9 @@
#define equiv equiv_or_xref \
-#define macro 0
#define section_flag max_texts \
#define string 02
-#define constant 03
#define join 0177
#define output_defs_flag (2*024000-1) \
@@ -122,12 +117,9 @@
#define verbatim 4 \
#define max_files 256
-#define C_printf(c,a) fprintf(C_file,c,a)
-#define C_putc(c) putc(c,C_file) \
-
#define translit_length 10 \
-#define ignore 00
+#define ignore 0
#define ord 0302
#define control_text 0303
#define translit_code 0304
@@ -138,15 +130,23 @@
#define section_name 0311
#define new_section 0312 \
-#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \
+#define constant 03 \
-#define keep_digit_separators flags['k'] \
+#define isxalpha(c) ((c) =='_'||(c) =='$') \
+
+#define ishigh(c) ((eight_bits) (c) > 0177) \
+ \
+
+#define compress(c) if(loc++<=limit) return c \
+
+#define macro 0
+#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \
#line 68 "ctangle.w"
/*3:*/
-#line 35 "common.h"
+#line 37 "common.h"
typedef bool boolean;
typedef uint8_t eight_bits;
@@ -163,7 +163,7 @@ extern char*id_first;
extern char*id_loc;
/*:5*//*6:*/
-#line 92 "common.h"
+#line 88 "common.h"
extern char buffer[];
extern char*buffer_end;
@@ -171,7 +171,7 @@ extern char*loc;
extern char*limit;
/*:6*//*7:*/
-#line 109 "common.h"
+#line 105 "common.h"
extern int include_depth;
extern FILE*file[];
@@ -187,7 +187,7 @@ extern boolean changing;
extern boolean web_file_open;
/*:7*//*9:*/
-#line 129 "common.h"
+#line 125 "common.h"
extern sixteen_bits section_count;
extern boolean changed_section[];
@@ -195,7 +195,7 @@ extern boolean change_pending;
extern boolean print_where;
/*:9*//*10:*/
-#line 143 "common.h"
+#line 139 "common.h"
typedef struct name_info{
char*byte_start;
@@ -220,12 +220,12 @@ extern hash_pointer hash_end;
extern hash_pointer h;
/*:10*//*12:*/
-#line 187 "common.h"
+#line 183 "common.h"
extern int history;
/*:12*//*14:*/
-#line 203 "common.h"
+#line 199 "common.h"
extern int argc;
extern char**argv;
@@ -236,7 +236,7 @@ extern char scn_file_name[];
extern boolean flags[];
/*:14*//*15:*/
-#line 217 "common.h"
+#line 215 "common.h"
extern FILE*C_file;
extern FILE*tex_file;
@@ -257,7 +257,7 @@ sixteen_bits text_link;
typedef text*text_pointer;
/*:19*//*31:*/
-#line 273 "ctangle.w"
+#line 269 "ctangle.w"
typedef struct{
eight_bits*end_field;
@@ -282,12 +282,12 @@ static eight_bits*tok_mem_end= tok_mem+max_toks-1;
static eight_bits*tok_ptr;
/*:20*//*26:*/
-#line 199 "ctangle.w"
+#line 198 "ctangle.w"
static text_pointer last_unnamed;
/*:26*//*32:*/
-#line 289 "ctangle.w"
+#line 285 "ctangle.w"
static output_state cur_state;
@@ -296,18 +296,18 @@ static stack_pointer stack_end= stack+stack_size;
static stack_pointer stack_ptr;
/*:32*//*37:*/
-#line 365 "ctangle.w"
+#line 361 "ctangle.w"
static int cur_val;
/*:37*//*42:*/
-#line 456 "ctangle.w"
+#line 452 "ctangle.w"
static eight_bits out_state;
static boolean protect;
/*:42*//*45:*/
-#line 487 "ctangle.w"
+#line 483 "ctangle.w"
static name_pointer output_files[max_files];
static name_pointer*cur_out_file,*end_output_files,*an_output_file;
@@ -315,33 +315,33 @@ static char cur_section_name_char;
static char output_file_name[longest_name+1];
/*:45*//*52:*/
-#line 584 "ctangle.w"
+#line 582 "ctangle.w"
static boolean output_defs_seen= false;
/*:52*//*57:*/
-#line 696 "ctangle.w"
+#line 691 "ctangle.w"
static char translit[128][translit_length];
/*:57*//*62:*/
-#line 775 "ctangle.w"
+#line 770 "ctangle.w"
static eight_bits ccode[256];
/*:62*//*66:*/
-#line 835 "ctangle.w"
+#line 830 "ctangle.w"
static boolean comment_continues= false;
/*:66*//*68:*/
-#line 872 "ctangle.w"
+#line 869 "ctangle.w"
static name_pointer cur_section_name;
static boolean no_where;
/*:68*//*82:*/
-#line 1189 "ctangle.w"
+#line 1182 "ctangle.w"
static text_pointer cur_text;
static eight_bits next_control;
@@ -350,19 +350,19 @@ static eight_bits next_control;
#line 71 "ctangle.w"
/*8:*/
-#line 123 "common.h"
+#line 119 "common.h"
extern boolean get_line(void);
extern void check_complete(void);
extern void reset_input(void);
/*:8*//*11:*/
-#line 166 "common.h"
+#line 162 "common.h"
extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
extern name_pointer id_lookup(const char*,const char*,char);
-extern name_pointer section_lookup(char*,char*,boolean);
+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);
@@ -370,7 +370,7 @@ extern void print_section_name(name_pointer);
extern void sprint_section_name(char*,name_pointer);
/*:11*//*13:*/
-#line 190 "common.h"
+#line 186 "common.h"
extern int wrap_up(void);
extern void err_print(const char*);
@@ -378,63 +378,63 @@ extern void fatal(const char*,const char*);
extern void overflow(const char*);
/*:13*//*16:*/
-#line 225 "common.h"
+#line 223 "common.h"
extern void common_init(void);
extern void print_stats(void);
/*:16*//*30:*/
-#line 245 "ctangle.w"
+#line 241 "ctangle.w"
static void store_two_bytes(sixteen_bits);
/*:30*//*35:*/
-#line 328 "ctangle.w"
+#line 324 "ctangle.w"
static void push_level(name_pointer);
static void pop_level(boolean);
/*:35*//*39:*/
-#line 401 "ctangle.w"
+#line 397 "ctangle.w"
static void get_output(void);
/*:39*//*44:*/
-#line 477 "ctangle.w"
+#line 473 "ctangle.w"
static void flush_buffer(void);
/*:44*//*49:*/
-#line 551 "ctangle.w"
+#line 549 "ctangle.w"
static void phase_two(void);
/*:49*//*53:*/
-#line 587 "ctangle.w"
+#line 585 "ctangle.w"
static void output_defs(void);
static void out_char(eight_bits);
/*:53*//*65:*/
-#line 815 "ctangle.w"
+#line 810 "ctangle.w"
static eight_bits skip_ahead(void);
static boolean skip_comment(boolean);
/*:65*//*70:*/
-#line 922 "ctangle.w"
+#line 924 "ctangle.w"
static eight_bits get_next(void);
/*:70*//*84:*/
-#line 1215 "ctangle.w"
+#line 1208 "ctangle.w"
static void scan_repl(eight_bits);
/*:84*//*91:*/
-#line 1396 "ctangle.w"
+#line 1379 "ctangle.w"
static void scan_section(void);
/*:91*//*99:*/
-#line 1477 "ctangle.w"
+#line 1460 "ctangle.w"
static void phase_one(void);
/*:99*//*101:*/
-#line 1511 "ctangle.w"
+#line 1494 "ctangle.w"
static void skip_limbo(void);
/*:101*/
@@ -463,16 +463,16 @@ text_ptr= text_info+1;text_ptr->tok_start= tok_mem;
init_node(name_dir);
/*:23*//*27:*/
-#line 202 "ctangle.w"
-last_unnamed= text_info;text_info->text_link= macro;
+#line 201 "ctangle.w"
+last_unnamed= text_info;text_info->text_link= 0;
/*:27*//*46:*/
-#line 497 "ctangle.w"
+#line 493 "ctangle.w"
cur_out_file= end_output_files= output_files+max_files;
/*:46*//*58:*/
-#line 699 "ctangle.w"
+#line 694 "ctangle.w"
{
int i;
@@ -480,7 +480,7 @@ for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i));
}
/*:58*//*63:*/
-#line 778 "ctangle.w"
+#line 773 "ctangle.w"
{
int c;
for(c= 0;c<256;c++)ccode[c]= ignore;
@@ -500,7 +500,7 @@ ccode['\'']= ord;
}
/*:63*//*78:*/
-#line 1111 "ctangle.w"
+#line 1103 "ctangle.w"
section_text[0]= ' ';
/*:78*/
@@ -539,7 +539,7 @@ void
init_p(name_pointer p,eight_bits t){(void)p;(void)t;}
/*:25*//*29:*/
-#line 235 "ctangle.w"
+#line 231 "ctangle.w"
static void
store_two_bytes(
@@ -551,7 +551,7 @@ if(tok_ptr+2> tok_mem_end)overflow("token");
}
/*:29*//*34:*/
-#line 313 "ctangle.w"
+#line 309 "ctangle.w"
static void
push_level(
@@ -568,7 +568,7 @@ cur_section= 0;
}
/*:34*//*36:*/
-#line 336 "ctangle.w"
+#line 332 "ctangle.w"
static void
pop_level(
@@ -584,7 +584,7 @@ if(stack_ptr> stack)cur_state= *stack_ptr;
}
/*:36*//*38:*/
-#line 372 "ctangle.w"
+#line 368 "ctangle.w"
static void
get_output(void)
@@ -607,7 +607,7 @@ switch(a/024000){
case 0:cur_val= a;out_char(identifier);break;
case 1:if(a==output_defs_flag)output_defs();
else/*40:*/
-#line 406 "ctangle.w"
+#line 402 "ctangle.w"
{
a-= 024000;
@@ -621,7 +621,7 @@ goto restart;
}
/*:40*/
-#line 393 "ctangle.w"
+#line 389 "ctangle.w"
break;
default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val;
@@ -631,14 +631,14 @@ out_char(section_number);
}
/*:38*//*43:*/
-#line 464 "ctangle.w"
+#line 460 "ctangle.w"
static void
flush_buffer(void)
{
C_putc('\n');
if(cur_line%100==0&&show_progress){
-putchar('.');
+printf(".");
if(cur_line%500==0)printf("%d",cur_line);
update_terminal;
}
@@ -646,31 +646,31 @@ cur_line++;
}
/*:43*//*48:*/
-#line 516 "ctangle.w"
+#line 514 "ctangle.w"
static void
phase_two(void){
web_file_open= false;
cur_line= 1;
/*33:*/
-#line 302 "ctangle.w"
+#line 298 "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;
/*:33*/
-#line 521 "ctangle.w"
+#line 519 "ctangle.w"
/*51:*/
-#line 580 "ctangle.w"
+#line 578 "ctangle.w"
if(!output_defs_seen)
output_defs();
/*:51*/
-#line 522 "ctangle.w"
+#line 520 "ctangle.w"
-if(text_info->text_link==macro&&cur_out_file==end_output_files){
+if(text_info->text_link==0&&cur_out_file==end_output_files){
fputs("\n! No program text was specified.",stdout);mark_harmless;
}
@@ -686,19 +686,19 @@ fputs("\nWriting the output files:",stdout);
printf(" (%s)",C_file_name);
update_terminal;
}
-if(text_info->text_link==macro)goto writeloop;
+if(text_info->text_link==0)goto writeloop;
}
while(stack_ptr> stack)get_output();
flush_buffer();
writeloop:/*50:*/
-#line 557 "ctangle.w"
+#line 555 "ctangle.w"
for(an_output_file= end_output_files;an_output_file> cur_out_file;){
an_output_file--;
sprint_section_name(output_file_name,*an_output_file);
fclose(C_file);
-if((C_file= fopen(output_file_name,"wb"))==NULL)
-fatal("! Cannot open output file ",output_file_name);
+C_file= fopen(output_file_name,"wb");
+if(C_file==0)fatal("! Cannot open output file ",output_file_name);
if(show_progress){printf("\n(%s)",output_file_name);update_terminal;}
cur_line= 1;
@@ -712,7 +712,7 @@ flush_buffer();
}
/*:50*/
-#line 543 "ctangle.w"
+#line 541 "ctangle.w"
if(show_happiness){
if(show_progress)new_line;
@@ -722,7 +722,7 @@ fputs("Done.",stdout);
}
/*:48*//*54:*/
-#line 594 "ctangle.w"
+#line 589 "ctangle.w"
static void
output_defs(void)
@@ -730,7 +730,7 @@ output_defs(void)
sixteen_bits a;
push_level(NULL);
for(cur_text= text_info+1;cur_text<text_ptr;cur_text++)
-if(cur_text->text_link==macro){
+if(cur_text->text_link==0){
cur_byte= cur_text->tok_start;
cur_end= (cur_text+1)->tok_start;
C_printf("%s","#define ");
@@ -748,7 +748,7 @@ a= (a-0200)*0400+*cur_byte++;
if(a<024000){
cur_val= a;out_char(identifier);
}
-else if(a<050000)confusion("macro defs have strange char");
+else if(a<050000){confusion("macro defs have strange char");}
else{
cur_val= a-050000;cur_section= cur_val;out_char(section_number);
}
@@ -762,7 +762,7 @@ pop_level(false);
}
/*:54*//*55:*/
-#line 637 "ctangle.w"
+#line 632 "ctangle.w"
static void
out_char(
@@ -775,7 +775,7 @@ 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;
/*59:*/
-#line 705 "ctangle.w"
+#line 700 "ctangle.w"
case identifier:
if(out_state==num_or_id)C_putc(' ');
@@ -790,10 +790,10 @@ j++;
out_state= num_or_id;break;
/*:59*/
-#line 648 "ctangle.w"
+#line 643 "ctangle.w"
/*60:*/
-#line 718 "ctangle.w"
+#line 713 "ctangle.w"
case section_number:
if(cur_val> 0)C_printf("/*%d:*/",cur_val);
@@ -815,15 +815,15 @@ j<k;j++){
if(*j=='\\'||*j=='"')C_putc('\\');
C_putc(*j);
}
-C_putc('"');C_putc('\n');
+C_printf("%s","\"\n");
}
break;
/*:60*/
-#line 649 "ctangle.w"
+#line 644 "ctangle.w"
/*56:*/
-#line 667 "ctangle.w"
+#line 662 "ctangle.w"
case plus_plus:C_putc('+');C_putc('+');out_state= normal;break;
case minus_minus:C_putc('-');C_putc('-');out_state= normal;break;
@@ -844,7 +844,7 @@ case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal;
break;
/*:56*/
-#line 650 "ctangle.w"
+#line 645 "ctangle.w"
case'=':case'>':C_putc(cur_char);C_putc(' ');
out_state= normal;break;
@@ -863,7 +863,7 @@ default:C_putc(cur_char);out_state= normal;break;
}
/*:55*//*64:*/
-#line 799 "ctangle.w"
+#line 794 "ctangle.w"
static eight_bits
skip_ahead(void)
@@ -881,7 +881,7 @@ if(c!=ignore||*(loc-1)=='>')return c;
}
/*:64*//*67:*/
-#line 838 "ctangle.w"
+#line 833 "ctangle.w"
static boolean skip_comment(
boolean is_long_comment)
@@ -915,23 +915,22 @@ else loc++;
}
/*:67*//*69:*/
-#line 879 "ctangle.w"
+#line 881 "ctangle.w"
static eight_bits
get_next(void)
{
-static boolean preprocessing= false;
+static int preprocessing= 0;
eight_bits c;
while(true){
if(loc> limit){
-if(preprocessing&&*(limit-1)!='\\')preprocessing= false;
+if(preprocessing&&*(limit-1)!='\\')preprocessing= 0;
if(get_line()==false)return new_section;
else if(print_where&&!no_where){
print_where= false;
/*85:*/
-#line 1221 "ctangle.w"
+#line 1214 "ctangle.w"
-{
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
id_first= change_file_name;
@@ -943,10 +942,9 @@ store_two_bytes((sixteen_bits)cur_line);
id_loc= id_first+strlen(id_first);
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
-}
/*:85*/
-#line 891 "ctangle.w"
+#line 893 "ctangle.w"
}
else return'\n';
@@ -960,32 +958,23 @@ else continue;
}
loc++;
if(xisdigit(c)||c=='.')/*73:*/
-#line 963 "ctangle.w"
+#line 964 "ctangle.w"
{
-boolean hex_flag= false;
id_first= loc-1;
if(*id_first=='.'&&!xisdigit(*loc))goto mistake;
if(*id_first=='0'){
if(*loc=='x'||*loc=='X'){
-hex_flag= true;
-loc++;while(xisxdigit(*loc)||*loc=='\'')loc++;
+loc++;while(xisxdigit(*loc))loc++;goto found;
}
-else if(*loc=='b'||*loc=='B'){
-loc++;while(*loc=='0'||*loc=='1'||*loc=='\'')loc++;goto found;
}
-}
-while(xisdigit(*loc)||*loc=='\'')loc++;
+while(xisdigit(*loc))loc++;
if(*loc=='.'){
loc++;
-while((hex_flag&&xisxdigit(*loc))||xisdigit(*loc)||*loc=='\'')loc++;
+while(xisdigit(*loc))loc++;
}
if(*loc=='e'||*loc=='E'){
if(*++loc=='+'||*loc=='-')loc++;
-while(xisdigit(*loc)||*loc=='\'')loc++;
-}
-else if(hex_flag&&(*loc=='p'||*loc=='P')){
-if(*++loc=='+'||*loc=='-')loc++;
-while(xisxdigit(*loc)||*loc=='\'')loc++;
+while(xisdigit(*loc))loc++;
}
found:while(*loc=='u'||*loc=='U'||*loc=='l'||*loc=='L'
||*loc=='f'||*loc=='F')loc++;
@@ -994,19 +983,19 @@ return constant;
}
/*:73*/
-#line 903 "ctangle.w"
+#line 905 "ctangle.w"
else if(c=='\''||c=='"'
||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"'))
||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"')))
/*74:*/
-#line 1000 "ctangle.w"
+#line 992 "ctangle.w"
{
char delim= c;
id_first= section_text+1;
id_loc= section_text;*++id_loc= delim;
if(delim=='L'||delim=='u'||delim=='U'){
-if(delim=='u'&&*loc=='8')*++id_loc= *loc++;
+if(delim=='u'&&*loc=='8'){*++id_loc= *loc++;}
delim= *loc++;*++id_loc= delim;
}
while(true){
@@ -1044,27 +1033,26 @@ return string;
}
/*:74*/
-#line 907 "ctangle.w"
+#line 909 "ctangle.w"
else if(isalpha(c)||isxalpha(c)||ishigh(c))
/*72:*/
-#line 954 "ctangle.w"
+#line 957 "ctangle.w"
{
id_first= --loc;
-do{
-++loc;
-}while(isalpha((eight_bits)*loc)||isdigit((eight_bits)*loc)
+while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc)
||isxalpha((eight_bits)*loc)||ishigh((eight_bits)*loc));
id_loc= loc;return identifier;
}
/*:72*/
-#line 909 "ctangle.w"
+#line 911 "ctangle.w"
else if(c=='@')/*75:*/
-#line 1045 "ctangle.w"
+#line 1037 "ctangle.w"
{
-switch(c= ccode[(eight_bits)*loc++]){
+c= ccode[(eight_bits)*loc++];
+switch(c){
case ignore:continue;
case translit_code:err_print("! Use @l in limbo only");continue;
@@ -1077,11 +1065,11 @@ continue;
case section_name:
cur_section_name_char= *(loc-1);
/*77:*/
-#line 1091 "ctangle.w"
+#line 1085 "ctangle.w"
{
char*k;
/*79:*/
-#line 1113 "ctangle.w"
+#line 1105 "ctangle.w"
k= section_text;
while(true){
@@ -1092,7 +1080,7 @@ loc= buffer+1;break;
}
c= *loc;
/*80:*/
-#line 1137 "ctangle.w"
+#line 1129 "ctangle.w"
if(c=='@'){
c= *(loc+1);
@@ -1111,7 +1099,7 @@ err_print("! Nesting of section names not allowed");break;
}
/*:80*/
-#line 1122 "ctangle.w"
+#line 1114 "ctangle.w"
loc++;if(k<section_text_end)k++;
if(xisspace(c)){
@@ -1128,16 +1116,14 @@ printf("...");mark_harmless;
if(*k==' '&&k> section_text)k--;
/*:79*/
-#line 1093 "ctangle.w"
+#line 1087 "ctangle.w"
if(k-section_text> 3&&strncmp(k-2,"...",3)==0)
-cur_section_name= section_lookup(section_text+1,k-3,true);
-
-else cur_section_name= section_lookup(section_text+1,k,false);
-
+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=='(')
/*47:*/
-#line 501 "ctangle.w"
+#line 497 "ctangle.w"
{
for(an_output_file= cur_out_file;
@@ -1146,21 +1132,23 @@ if(*an_output_file==cur_section_name)break;
if(an_output_file==end_output_files){
if(cur_out_file> output_files)
*--cur_out_file= cur_section_name;
-else overflow("output files");
+else{
+overflow("output files");
+}
}
}
/*:47*/
-#line 1101 "ctangle.w"
+#line 1093 "ctangle.w"
return section_name;
}
/*:77*/
-#line 1058 "ctangle.w"
+#line 1051 "ctangle.w"
case string:/*81:*/
-#line 1159 "ctangle.w"
+#line 1151 "ctangle.w"
{
id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';
while(*loc!='@'||*(loc+1)!='>')loc++;
@@ -1171,14 +1159,15 @@ return string;
}
/*:81*/
-#line 1059 "ctangle.w"
+#line 1052 "ctangle.w"
case ord:/*76:*/
-#line 1071 "ctangle.w"
+#line 1064 "ctangle.w"
id_first= loc;
-if(*loc=='\\')
+if(*loc=='\\'){
if(*++loc=='\'')loc++;
+}
while(*loc!='\''){
if(*loc=='@'){
if(*(loc+1)!='@')
@@ -1196,35 +1185,34 @@ loc++;
return ord;
/*:76*/
-#line 1060 "ctangle.w"
+#line 1053 "ctangle.w"
default:return c;
}
}
/*:75*/
-#line 910 "ctangle.w"
+#line 912 "ctangle.w"
else if(xisspace(c)){
if(!preprocessing||loc> limit)continue;
else return' ';
}
-else if(c=='#'&&loc==buffer+1)preprocessing= true;
+else if(c=='#'&&loc==buffer+1)preprocessing= 1;
mistake:/*71:*/
-#line 931 "ctangle.w"
+#line 935 "ctangle.w"
switch(c){
case'+':if(*loc=='+')compress(plus_plus);break;
case'-':if(*loc=='-'){compress(minus_minus);}
-else if(*loc=='>'){
-if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);}
-else compress(minus_gt);
-}break;
+else{if(*loc=='>'){if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);}
+else compress(minus_gt);}}break;
case'.':if(*loc=='*'){compress(period_ast);}
else if(*loc=='.'&&*(loc+1)=='.'){
loc++;compress(dot_dot_dot);
-}break;
+}
+break;
case':':if(*loc==':')compress(colon_colon);break;
case'=':if(*loc=='=')compress(eq_eq);break;
case'>':if(*loc=='='){compress(gt_eq);}
@@ -1237,24 +1225,23 @@ case'!':if(*loc=='=')compress(non_eq);break;
}
/*:71*/
-#line 917 "ctangle.w"
+#line 919 "ctangle.w"
return c;
}
}
/*:69*//*83:*/
-#line 1193 "ctangle.w"
+#line 1186 "ctangle.w"
static void
scan_repl(
eight_bits t)
{
sixteen_bits a;
-if(t==section_name)/*85:*/
-#line 1221 "ctangle.w"
+if(t==section_name){/*85:*/
+#line 1214 "ctangle.w"
-{
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
id_first= change_file_name;
@@ -1266,14 +1253,13 @@ store_two_bytes((sixteen_bits)cur_line);
id_loc= id_first+strlen(id_first);
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
-}
/*:85*/
-#line 1199 "ctangle.w"
-
+#line 1192 "ctangle.w"
+}
while(true)switch(a= get_next()){
/*86:*/
-#line 1236 "ctangle.w"
+#line 1227 "ctangle.w"
case identifier:a= id_lookup(id_first,id_loc,0)-name_dir;
app_repl((a/0400)+0200);
@@ -1281,7 +1267,7 @@ app_repl(a%0400);break;
case section_name:if(t!=section_name)goto done;
else{
/*87:*/
-#line 1269 "ctangle.w"
+#line 1260 "ctangle.w"
{
char*try_loc= loc;
while(*try_loc==' '&&try_loc<limit)try_loc++;
@@ -1294,15 +1280,14 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section");
}
/*:87*/
-#line 1242 "ctangle.w"
+#line 1233 "ctangle.w"
a= cur_section_name-name_dir;
app_repl((a/0400)+0250);
app_repl(a%0400);
/*85:*/
-#line 1221 "ctangle.w"
+#line 1214 "ctangle.w"
-{
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
id_first= change_file_name;
@@ -1314,10 +1299,9 @@ store_two_bytes((sixteen_bits)cur_line);
id_loc= id_first+strlen(id_first);
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
-}
/*:85*/
-#line 1246 "ctangle.w"
+#line 1237 "ctangle.w"
break;
}
case output_defs_code:if(t!=section_name)err_print("! Misplaced @h");
@@ -1328,9 +1312,8 @@ a= output_defs_flag;
app_repl((a/0400)+0200);
app_repl(a%0400);
/*85:*/
-#line 1221 "ctangle.w"
+#line 1214 "ctangle.w"
-{
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
id_first= change_file_name;
@@ -1342,16 +1325,15 @@ store_two_bytes((sixteen_bits)cur_line);
id_loc= id_first+strlen(id_first);
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
-}
/*:85*/
-#line 1255 "ctangle.w"
+#line 1246 "ctangle.w"
}
break;
case constant:case string:
/*88:*/
-#line 1286 "ctangle.w"
+#line 1271 "ctangle.w"
app_repl(a);
while(id_first<id_loc){
@@ -1360,18 +1342,16 @@ if(*(id_first+1)=='@')id_first++;
else err_print("! Double @ should be used in string");
}
-else if(a==constant&&*id_first=='\''&&!keep_digit_separators)
-id_first++;
app_repl(*id_first++);
}
app_repl(a);break;
/*:88*/
-#line 1259 "ctangle.w"
+#line 1250 "ctangle.w"
case ord:
/*89:*/
-#line 1304 "ctangle.w"
+#line 1287 "ctangle.w"
{
int c= (eight_bits)*id_first;
if(c=='\\'){
@@ -1422,7 +1402,7 @@ app_repl(constant);
break;
/*:89*/
-#line 1261 "ctangle.w"
+#line 1252 "ctangle.w"
case definition:case format_code:case begin_C:if(t!=section_name)goto done;
else{
@@ -1432,7 +1412,7 @@ err_print("! @d, @f and @c are ignored in C text");continue;
case new_section:goto done;
/*:86*/
-#line 1204 "ctangle.w"
+#line 1197 "ctangle.w"
case')':app_repl(a);
if(t==macro)app_repl(' ');
@@ -1445,7 +1425,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr;
}
/*:83*//*90:*/
-#line 1363 "ctangle.w"
+#line 1346 "ctangle.w"
static void
scan_section(void)
@@ -1457,10 +1437,10 @@ section_count++;no_where= true;
if(*(loc-1)=='*'&&show_progress){
printf("*%d",section_count);update_terminal;
}
-next_control= ignore;
+next_control= 0;
while(true){
/*92:*/
-#line 1404 "ctangle.w"
+#line 1387 "ctangle.w"
while(next_control<definition)
@@ -1469,11 +1449,11 @@ loc-= 2;next_control= get_next();
}
/*:92*/
-#line 1377 "ctangle.w"
+#line 1360 "ctangle.w"
if(next_control==definition){
/*93:*/
-#line 1411 "ctangle.w"
+#line 1394 "ctangle.w"
{
while((next_control= get_next())=='\n');
if(next_control!=identifier){
@@ -1492,7 +1472,7 @@ cur_text->text_link= macro;
}
/*:93*/
-#line 1379 "ctangle.w"
+#line 1362 "ctangle.w"
continue;
}
@@ -1502,14 +1482,14 @@ p= name_dir;break;
if(next_control==section_name){
p= cur_section_name;
/*94:*/
-#line 1436 "ctangle.w"
+#line 1419 "ctangle.w"
while((next_control= get_next())=='+');
if(next_control!='='&&next_control!=eq_eq)
continue;
/*:94*/
-#line 1387 "ctangle.w"
+#line 1370 "ctangle.w"
break;
}
@@ -1517,22 +1497,22 @@ return;
}
no_where= print_where= false;
/*95:*/
-#line 1441 "ctangle.w"
+#line 1424 "ctangle.w"
/*96:*/
-#line 1446 "ctangle.w"
+#line 1429 "ctangle.w"
store_two_bytes((sixteen_bits)(0150000+section_count));
/*:96*/
-#line 1442 "ctangle.w"
+#line 1425 "ctangle.w"
scan_repl(section_name);
/*97:*/
-#line 1450 "ctangle.w"
+#line 1433 "ctangle.w"
-if(p==name_dir||p==NULL){
+if(p==name_dir||p==0){
(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;
}
else if(p->equiv==(void*)text_info)p->equiv= (void*)cur_text;
@@ -1547,16 +1527,16 @@ cur_text->text_link= section_flag;
/*:97*/
-#line 1444 "ctangle.w"
+#line 1427 "ctangle.w"
/*:95*/
-#line 1393 "ctangle.w"
+#line 1376 "ctangle.w"
}
/*:90*//*98:*/
-#line 1465 "ctangle.w"
+#line 1448 "ctangle.w"
static void
phase_one(void){
@@ -1570,7 +1550,7 @@ phase= 2;
}
/*:98*//*100:*/
-#line 1482 "ctangle.w"
+#line 1465 "ctangle.w"
static void
skip_limbo(void)
@@ -1585,7 +1565,7 @@ c= *loc++;
if(ccode[(eight_bits)c]==new_section)break;
switch(ccode[(eight_bits)c]){
case translit_code:/*102:*/
-#line 1513 "ctangle.w"
+#line 1496 "ctangle.w"
while(xisspace(*loc)&&loc<limit)loc++;
loc+= 3;
@@ -1610,7 +1590,7 @@ translit[i-0200][loc-beg]= '\0';
}
/*:102*/
-#line 1495 "ctangle.w"
+#line 1478 "ctangle.w"
break;
case format_code:case'@':break;
case control_text:if(c=='q'||c=='Q'){
@@ -1628,7 +1608,7 @@ default:err_print("! Double @ should be used in limbo");
}
/*:100*//*103:*/
-#line 1539 "ctangle.w"
+#line 1522 "ctangle.w"
void
print_stats(void){