summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/cwebdir/ctangle.c
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/cwebdir/ctangle.c
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/cwebdir/ctangle.c')
-rw-r--r--Build/source/texk/web2c/cwebdir/ctangle.c908
1 files changed, 485 insertions, 423 deletions
diff --git a/Build/source/texk/web2c/cwebdir/ctangle.c b/Build/source/texk/web2c/cwebdir/ctangle.c
index b7a1b553cee..3c8b2649da0 100644
--- a/Build/source/texk/web2c/cwebdir/ctangle.c
+++ b/Build/source/texk/web2c/cwebdir/ctangle.c
@@ -1,32 +1,21 @@
/*1:*/
-#line 64 "ctangle.w"
-
-/*6:*/
-#line 35 "common.h"
-
-#include <stdio.h>
+#line 66 "ctangle.w"
-/*:6*//*62:*/
-#line 888 "ctangle.w"
+/*4:*/
+#line 46 "common.h"
#include <ctype.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
-/*:62*/
-#line 65 "ctangle.w"
-
-#define banner "This is CTANGLE (Version 3.64)\n" \
-
-#define max_bytes 90000 \
-
-#define max_toks 270000
-#define max_names 4000 \
+/*:4*/
+#line 67 "ctangle.w"
-#define max_texts 2500
-#define hash_size 353
-#define longest_name 10000
-#define stack_size 50
-#define buf_size 100 \
+#define banner "This is CTANGLE (Version 4.0)" \
#define ctangle 0
#define cweave 1 \
@@ -37,7 +26,7 @@
#define plus_plus 013
#define minus_minus 01
#define minus_gt 031
-#define not_eq 032
+#define non_eq 032
#define lt_eq 034
#define gt_eq 035
#define eq_eq 036
@@ -47,14 +36,14 @@
#define period_ast 026
#define minus_gt_ast 027 \
-#define xisalpha(c) (isalpha(c) &&((eight_bits) c<0200) )
-#define xisdigit(c) (isdigit(c) &&((eight_bits) c<0200) )
-#define xisspace(c) (isspace(c) &&((eight_bits) c<0200) )
-#define xislower(c) (islower(c) &&((eight_bits) c<0200) )
-#define xisupper(c) (isupper(c) &&((eight_bits) c<0200) )
-#define xisxdigit(c) (isxdigit(c) &&((eight_bits) c<0200) ) \
+#define xisalpha(c) (isalpha((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisdigit(c) (isdigit((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) )
+#define xislower(c) (islower((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) )
+#define xisxdigit(c) (isxdigit((eight_bits) c) &&((eight_bits) c<0200) ) \
-#define length(c) (c+1) ->byte_start-(c) ->byte_start
+#define length(c) (size_t) ((c+1) ->byte_start-(c) ->byte_start)
#define print_id(c) term_write((c) ->byte_start,length((c) ) )
#define llink link
#define rlink dummy.Rlink
@@ -69,16 +58,22 @@
#define mark_harmless {if(history==spotless) history= harmless_message;}
#define mark_error history= error_message
#define confusion(s) fatal("! This can't happen: ",s) \
+ \
-#define max_file_name_length 60
+#define max_include_depth 10 \
+
+#define max_file_name_length 1024
#define cur_file file[include_depth]
#define cur_file_name file_name[include_depth]
-#define web_file_name file_name[0]
-#define cur_line line[include_depth] \
+#define cur_line line[include_depth]
+#define web_file file[0]
+#define web_file_name file_name[0] \
#define show_banner flags['b']
#define show_progress flags['p']
-#define show_happiness flags['h'] \
+#define show_stats flags['s']
+#define show_happiness flags['h']
+#define make_xrefs flags['x'] \
#define update_terminal fflush(stdout)
#define new_line putchar('\n')
@@ -87,6 +82,18 @@
#define C_printf(c,a) fprintf(C_file,c,a)
#define C_putc(c) putc(c,C_file) \
+#define max_bytes 1000000 \
+
+#define max_toks 1000000
+#define max_names 10239 \
+
+#define max_sections 4000
+#define max_texts 10239
+#define longest_name 10000
+#define stack_size 500
+#define buf_size 1000
+#define long_buf_size (buf_size+longest_name) \
+
#define equiv equiv_or_xref \
#define section_flag max_texts \
@@ -128,7 +135,7 @@
#define isxalpha(c) ((c) =='_'||(c) =='$') \
-#define ishigh(c) ((unsigned char) (c) > 0177) \
+#define ishigh(c) ((eight_bits) (c) > 0177) \
\
#define compress(c) if(loc++<=limit) return(c) \
@@ -137,34 +144,35 @@
#define app_repl(c) {if(tok_ptr==tok_mem_end) overflow("token") ;*tok_ptr++= c;} \
-#line 66 "ctangle.w"
+#line 68 "ctangle.w"
-/*5:*/
-#line 29 "common.h"
+/*3:*/
+#line 37 "common.h"
-typedef short boolean;
-typedef char unsigned eight_bits;
+typedef bool boolean;
+typedef uint8_t eight_bits;
+typedef uint16_t sixteen_bits;
extern boolean program;
extern int phase;
-/*:5*//*7:*/
-#line 57 "common.h"
+/*:3*//*5:*/
+#line 74 "common.h"
-char section_text[longest_name+1];
-char*section_text_end= section_text+longest_name;
-char*id_first;
-char*id_loc;
+extern char section_text[];
+extern char*section_text_end;
+extern char*id_first;
+extern char*id_loc;
-/*:7*//*8:*/
-#line 72 "common.h"
+/*:5*//*6:*/
+#line 88 "common.h"
extern char buffer[];
extern char*buffer_end;
extern char*loc;
extern char*limit;
-/*:8*//*9:*/
-#line 87 "common.h"
+/*:6*//*7:*/
+#line 103 "common.h"
typedef struct name_info{
char*byte_start;
@@ -174,7 +182,7 @@ struct name_info*Rlink;
char Ilk;
}dummy;
-char*equiv_or_xref;
+void*equiv_or_xref;
}name_info;
typedef name_info*name_pointer;
typedef name_pointer*hash_pointer;
@@ -187,23 +195,16 @@ extern char*byte_ptr;
extern name_pointer hash[];
extern hash_pointer hash_end;
extern hash_pointer h;
-extern name_pointer id_lookup();
-extern name_pointer section_lookup();
-extern void print_section_name(),sprint_section_name();
-/*:9*//*10:*/
-#line 122 "common.h"
+/*:7*//*9:*/
+#line 147 "common.h"
-extern history;
-extern err_print();
-extern wrap_up();
-extern void fatal();
-extern void overflow();
+extern int history;
-/*:10*//*11:*/
-#line 137 "common.h"
+/*:9*//*11:*/
+#line 167 "common.h"
-extern include_depth;
+extern int include_depth;
extern FILE*file[];
extern FILE*change_file;
extern char C_file_name[];
@@ -213,34 +214,30 @@ extern char scn_file_name[];
extern char file_name[][max_file_name_length];
extern char change_file_name[];
-extern line[];
-extern change_line;
-extern change_depth;
+extern int line[];
+extern int change_line;
+extern int change_depth;
extern boolean input_has_ended;
extern boolean changing;
extern boolean web_file_open;
-extern reset_input();
-extern get_line();
-extern check_complete();
-/*:11*//*12:*/
-#line 159 "common.h"
+/*:11*//*13:*/
+#line 191 "common.h"
-typedef unsigned short sixteen_bits;
extern sixteen_bits section_count;
extern boolean changed_section[];
extern boolean change_pending;
extern boolean print_where;
-/*:12*//*13:*/
-#line 171 "common.h"
+/*:13*//*14:*/
+#line 204 "common.h"
extern int argc;
extern char**argv;
extern boolean flags[];
-/*:13*//*14:*/
-#line 183 "common.h"
+/*:14*//*15:*/
+#line 216 "common.h"
extern FILE*C_file;
extern FILE*tex_file;
@@ -248,17 +245,11 @@ extern FILE*idx_file;
extern FILE*scn_file;
extern FILE*active_file;
-/*:14*//*15:*/
-#line 192 "common.h"
-
-extern void common_init();
-#line 128 "ctangle.w"
-
/*:15*/
-#line 67 "ctangle.w"
+#line 69 "ctangle.w"
-/*16:*/
-#line 152 "ctangle.w"
+/*19:*/
+#line 124 "ctangle.w"
typedef struct{
eight_bits*tok_start;
@@ -266,8 +257,8 @@ sixteen_bits text_link;
}text;
typedef text*text_pointer;
-/*:16*//*27:*/
-#line 296 "ctangle.w"
+/*:19*//*31:*/
+#line 272 "ctangle.w"
typedef struct{
eight_bits*end_field;
@@ -278,11 +269,11 @@ sixteen_bits section_field;
}output_state;
typedef output_state*stack_pointer;
-/*:27*/
-#line 68 "ctangle.w"
+/*:31*/
+#line 70 "ctangle.w"
-/*17:*/
-#line 159 "ctangle.w"
+/*20:*/
+#line 131 "ctangle.w"
text text_info[max_texts];
text_pointer text_info_end= text_info+max_texts-1;
@@ -291,13 +282,13 @@ eight_bits tok_mem[max_toks];
eight_bits*tok_mem_end= tok_mem+max_toks-1;
eight_bits*tok_ptr;
-/*:17*//*23:*/
-#line 227 "ctangle.w"
+/*:20*//*26:*/
+#line 200 "ctangle.w"
text_pointer last_unnamed;
-/*:23*//*28:*/
-#line 312 "ctangle.w"
+/*:26*//*32:*/
+#line 288 "ctangle.w"
output_state cur_state;
@@ -305,143 +296,206 @@ output_state stack[stack_size+1];
stack_pointer stack_ptr;
stack_pointer stack_end= stack+stack_size;
-/*:28*//*32:*/
-#line 384 "ctangle.w"
+/*:32*//*37:*/
+#line 364 "ctangle.w"
int cur_val;
-/*:32*//*36:*/
-#line 473 "ctangle.w"
+/*:37*//*42:*/
+#line 456 "ctangle.w"
eight_bits out_state;
boolean protect;
-/*:36*//*38:*/
-#line 502 "ctangle.w"
+/*:42*//*45:*/
+#line 488 "ctangle.w"
name_pointer output_files[max_files];
name_pointer*cur_out_file,*end_output_files,*an_output_file;
char cur_section_name_char;
-char output_file_name[longest_name];
+char output_file_name[longest_name+1];
-/*:38*//*45:*/
-#line 599 "ctangle.w"
+/*:45*//*52:*/
+#line 588 "ctangle.w"
boolean output_defs_seen= 0;
-/*:45*//*51:*/
-#line 710 "ctangle.w"
+/*:52*//*57:*/
+#line 697 "ctangle.w"
char translit[128][translit_length];
-/*:51*//*56:*/
-#line 789 "ctangle.w"
+/*:57*//*62:*/
+#line 776 "ctangle.w"
eight_bits ccode[256];
-/*:56*//*59:*/
-#line 845 "ctangle.w"
+/*:62*//*66:*/
+#line 836 "ctangle.w"
boolean comment_continues= 0;
-/*:59*//*61:*/
-#line 884 "ctangle.w"
+/*:66*//*68:*/
+#line 875 "ctangle.w"
name_pointer cur_section_name;
int no_where;
-/*:61*//*75:*/
-#line 1195 "ctangle.w"
+/*:68*//*82:*/
+#line 1189 "ctangle.w"
text_pointer cur_text;
eight_bits next_control;
-/*:75*//*82:*/
-#line 1353 "ctangle.w"
+/*:82*//*90:*/
+#line 1350 "ctangle.w"
extern sixteen_bits section_count;
-/*:82*/
-#line 69 "ctangle.w"
+/*:90*/
+#line 71 "ctangle.w"
+
+/*8:*/
+#line 126 "common.h"
+
+extern boolean names_match(name_pointer,const char*,size_t,eight_bits);
+extern name_pointer id_lookup(const char*,const char*,char);
+
+extern name_pointer section_lookup(char*,char*,int);
+extern void init_node(name_pointer);
+extern void init_p(name_pointer,eight_bits);
+extern void print_prefix_name(name_pointer);
+extern void print_section_name(name_pointer);
+extern void sprint_section_name(char*,name_pointer);
+
+/*:8*//*10:*/
+#line 150 "common.h"
+
+extern int wrap_up(void);
+extern void err_print(const char*);
+extern void fatal(const char*,const char*);
+extern void overflow(const char*);
+
+/*:10*//*12:*/
+#line 185 "common.h"
+
+extern boolean get_line(void);
+extern void check_complete(void);
+extern void reset_input(void);
+
+/*:12*//*16:*/
+#line 224 "common.h"
+
+extern void common_init(void);
+extern void print_stats(void);
+
+/*:16*//*29:*/
+#line 233 "ctangle.w"
+
+static void store_two_bytes(sixteen_bits);
+
+/*:29*//*34:*/
+#line 312 "ctangle.w"
+
+static void push_level(name_pointer);
+static void pop_level(int);
+
+/*:34*//*38:*/
+#line 371 "ctangle.w"
-/*2:*/
-#line 77 "ctangle.w"
+static void get_output(void);
-extern int strlen();
-extern int strcmp();
-extern char*strcpy();
-extern int strncmp();
-extern char*strncpy();
+/*:38*//*43:*/
+#line 464 "ctangle.w"
-/*:2*//*41:*/
-#line 533 "ctangle.w"
+static void flush_buffer(void);
-void phase_two();
+/*:43*//*48:*/
+#line 519 "ctangle.w"
-/*:41*//*46:*/
-#line 602 "ctangle.w"
+static void phase_two(void);
-void output_defs();
+/*:48*//*53:*/
+#line 591 "ctangle.w"
-/*:46*//*48:*/
-#line 648 "ctangle.w"
+static void output_defs(void);
+static void out_char(eight_bits);
-static void out_char();
+/*:53*//*64:*/
+#line 800 "ctangle.w"
-/*:48*//*90:*/
+static eight_bits skip_ahead(void);
+static boolean skip_comment(boolean);
+
+/*:64*//*69:*/
+#line 887 "ctangle.w"
+
+static eight_bits get_next(void);
+
+/*:69*//*83:*/
+#line 1193 "ctangle.w"
+
+static void scan_repl(eight_bits);
+
+/*:83*//*91:*/
+#line 1357 "ctangle.w"
+
+static void scan_section(void);
+
+/*:91*//*99:*/
#line 1460 "ctangle.w"
-void phase_one();
+static void phase_one(void);
-/*:90*//*92:*/
+/*:99*//*101:*/
#line 1478 "ctangle.w"
-void skip_limbo();
+static void skip_limbo(void);
-/*:92*/
-#line 70 "ctangle.w"
+/*:101*/
+#line 72 "ctangle.w"
-/*:1*//*3:*/
-#line 91 "ctangle.w"
+/*:1*//*2:*/
+#line 81 "ctangle.w"
-int main(ac,av)
-int ac;
-char**av;
+int main(
+int ac,
+char**av)
{
argc= ac;argv= av;
program= ctangle;
-/*18:*/
-#line 167 "ctangle.w"
+/*21:*/
+#line 139 "ctangle.w"
text_info->tok_start= tok_ptr= tok_mem;
text_ptr= text_info+1;text_ptr->tok_start= tok_mem;
-/*:18*//*20:*/
-#line 177 "ctangle.w"
+/*:21*//*23:*/
+#line 149 "ctangle.w"
-name_dir->equiv= (char*)text_info;
+init_node(name_dir);
-/*:20*//*24:*/
-#line 230 "ctangle.w"
+/*:23*//*27:*/
+#line 203 "ctangle.w"
last_unnamed= text_info;text_info->text_link= 0;
-/*:24*//*39:*/
-#line 512 "ctangle.w"
+/*:27*//*46:*/
+#line 498 "ctangle.w"
cur_out_file= end_output_files= output_files+max_files;
-/*:39*//*52:*/
-#line 713 "ctangle.w"
+/*:46*//*58:*/
+#line 700 "ctangle.w"
{
int i;
-for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned)(128+i));
+for(i= 0;i<128;i++)sprintf(translit[i],"X%02X",(unsigned int)(128+i));
}
-/*:52*//*57:*/
-#line 792 "ctangle.w"
+/*:58*//*63:*/
+#line 779 "ctangle.w"
{
int c;
for(c= 0;c<256;c++)ccode[c]= ignore;
@@ -460,62 +514,63 @@ ccode['<']= ccode['(']= section_name;
ccode['\'']= ord;
}
-/*:57*//*71:*/
-#line 1116 "ctangle.w"
+/*:63*//*78:*/
+#line 1110 "ctangle.w"
section_text[0]= ' ';
-/*:71*/
-#line 98 "ctangle.w"
-;
+/*:78*/
+#line 88 "ctangle.w"
+
common_init();
-if(show_banner)printf(banner);
+if(show_banner)puts(banner);
phase_one();
phase_two();
return wrap_up();
}
-/*:3*//*21:*/
-#line 183 "ctangle.w"
+/*:2*//*24:*/
+#line 155 "ctangle.w"
-int names_match(p,first,l)
-name_pointer p;
-char*first;
-int l;
-{
+boolean names_match(
+name_pointer p,
+const char*first,
+size_t l,
+eight_bits t)
+{(void)t;
if(length(p)!=l)return 0;
return!strncmp(first,p->byte_start,l);
}
-/*:21*//*22:*/
-#line 198 "ctangle.w"
+/*:24*//*25:*/
+#line 171 "ctangle.w"
void
-init_node(node)
-name_pointer node;
+init_node(
+name_pointer node)
{
-node->equiv= (char*)text_info;
+node->equiv= (void*)text_info;
}
void
-init_p(){}
+init_p(name_pointer p,eight_bits t){(void)p;(void)t;}
-/*:22*//*26:*/
-#line 260 "ctangle.w"
+/*:25*//*30:*/
+#line 236 "ctangle.w"
void
-store_two_bytes(x)
-sixteen_bits x;
+store_two_bytes(
+sixteen_bits x)
{
if(tok_ptr+2> tok_mem_end)overflow("token");
*tok_ptr++= x>>8;
*tok_ptr++= x&0377;
}
-/*:26*//*30:*/
-#line 336 "ctangle.w"
+/*:30*//*35:*/
+#line 316 "ctangle.w"
-void
-push_level(p)
-name_pointer p;
+static void
+push_level(
+name_pointer p)
{
if(stack_ptr==stack_end)overflow("stack");
*stack_ptr= cur_state;
@@ -527,12 +582,12 @@ cur_section= 0;
}
}
-/*:30*//*31:*/
-#line 355 "ctangle.w"
+/*:35*//*36:*/
+#line 335 "ctangle.w"
-void
-pop_level(flag)
-int flag;
+static void
+pop_level(
+int flag)
{
if(flag&&cur_repl->text_link<section_flag){
cur_repl= cur_repl->text_link+text_info;
@@ -543,11 +598,11 @@ stack_ptr--;
if(stack_ptr> stack)cur_state= *stack_ptr;
}
-/*:31*//*33:*/
-#line 391 "ctangle.w"
+/*:36*//*39:*/
+#line 374 "ctangle.w"
-void
-get_output()
+static void
+get_output(void)
{
sixteen_bits a;
restart:if(stack_ptr==stack)return;
@@ -566,23 +621,23 @@ a= (a-0200)*0400+*cur_byte++;
switch(a/024000){
case 0:cur_val= a;out_char(identifier);break;
case 1:if(a==output_defs_flag)output_defs();
-else/*34:*/
-#line 423 "ctangle.w"
+else/*40:*/
+#line 406 "ctangle.w"
{
a-= 024000;
-if((a+name_dir)->equiv!=(char*)text_info)push_level(a+name_dir);
+if((a+name_dir)->equiv!=(void*)text_info)push_level(a+name_dir);
else if(a!=0){
-printf("\n! Not present: <");
+fputs("\n! Not present: <",stdout);
print_section_name(a+name_dir);err_print(">");
}
goto restart;
}
-/*:34*/
-#line 412 "ctangle.w"
-;
+/*:40*/
+#line 395 "ctangle.w"
+
break;
default:cur_val= a-050000;if(cur_val> 0)cur_section= cur_val;
out_char(section_number);
@@ -590,11 +645,11 @@ out_char(section_number);
}
}
-/*:33*//*37:*/
-#line 481 "ctangle.w"
+/*:39*//*44:*/
+#line 467 "ctangle.w"
-void
-flush_buffer()
+static void
+flush_buffer(void)
{
C_putc('\n');
if(cur_line%100==0&&show_progress){
@@ -605,33 +660,33 @@ update_terminal;
cur_line++;
}
-/*:37*//*42:*/
-#line 536 "ctangle.w"
+/*:44*//*49:*/
+#line 522 "ctangle.w"
-void
-phase_two(){
+static void
+phase_two(void){
web_file_open= 0;
cur_line= 1;
-/*29:*/
-#line 325 "ctangle.w"
+/*33:*/
+#line 301 "ctangle.w"
stack_ptr= stack+1;cur_name= name_dir;cur_repl= text_info->text_link+text_info;
cur_byte= cur_repl->tok_start;cur_end= (cur_repl+1)->tok_start;cur_section= 0;
-/*:29*/
-#line 541 "ctangle.w"
-;
-/*44:*/
-#line 595 "ctangle.w"
+/*:33*/
+#line 527 "ctangle.w"
+
+/*51:*/
+#line 584 "ctangle.w"
if(!output_defs_seen)
output_defs();
-/*:44*/
-#line 542 "ctangle.w"
-;
+/*:51*/
+#line 528 "ctangle.w"
+
if(text_info->text_link==0&&cur_out_file==end_output_files){
-printf("\n! No program text was specified.");mark_harmless;
+fputs("\n! No program text was specified.",stdout);mark_harmless;
}
else{
@@ -641,7 +696,7 @@ printf("\nWriting the output file (%s):",C_file_name);
}
else{
if(show_progress){
-printf("\nWriting the output files:");
+fputs("\nWriting the output files:",stdout);
printf(" (%s)",C_file_name);
update_terminal;
@@ -650,17 +705,17 @@ if(text_info->text_link==0)goto writeloop;
}
while(stack_ptr> stack)get_output();
flush_buffer();
-writeloop:/*43:*/
-#line 572 "ctangle.w"
+writeloop:/*50:*/
+#line 561 "ctangle.w"
for(an_output_file= end_output_files;an_output_file> cur_out_file;){
an_output_file--;
sprint_section_name(output_file_name,*an_output_file);
fclose(C_file);
-C_file= fopen(output_file_name,"w");
-if(C_file==0)fatal("! Cannot open output file:",output_file_name);
+C_file= fopen(output_file_name,"wb");
+if(C_file==0)fatal("! Cannot open output file ",output_file_name);
-printf("\n(%s)",output_file_name);update_terminal;
+if(show_progress){printf("\n(%s)",output_file_name);update_terminal;}
cur_line= 1;
stack_ptr= stack+1;
cur_name= (*an_output_file);
@@ -671,18 +726,21 @@ while(stack_ptr> stack)get_output();
flush_buffer();
}
-/*:43*/
-#line 563 "ctangle.w"
-;
-if(show_happiness)printf("\nDone.");
+/*:50*/
+#line 549 "ctangle.w"
+
+if(show_happiness){
+if(show_progress)new_line;
+fputs("Done.",stdout);
+}
}
}
-/*:42*//*47:*/
-#line 605 "ctangle.w"
+/*:49*//*54:*/
+#line 595 "ctangle.w"
-void
-output_defs()
+static void
+output_defs(void)
{
sixteen_bits a;
push_level(NULL);
@@ -718,12 +776,12 @@ flush_buffer();
pop_level(0);
}
-/*:47*//*49:*/
-#line 651 "ctangle.w"
+/*:54*//*55:*/
+#line 638 "ctangle.w"
static void
-out_char(cur_char)
-eight_bits cur_char;
+out_char(
+eight_bits cur_char)
{
char*j,*k;
restart:
@@ -731,26 +789,26 @@ switch(cur_char){
case'\n':if(protect&&out_state!=verbatim)C_putc(' ');
if(protect||out_state==verbatim)C_putc('\\');
flush_buffer();if(out_state!=verbatim)out_state= normal;break;
-/*53:*/
-#line 719 "ctangle.w"
+/*59:*/
+#line 706 "ctangle.w"
case identifier:
if(out_state==num_or_id)C_putc(' ');
j= (cur_val+name_dir)->byte_start;
k= (cur_val+name_dir+1)->byte_start;
while(j<k){
-if((unsigned char)(*j)<0200)C_putc(*j);
+if((eight_bits)(*j)<0200)C_putc(*j);
-else C_printf("%s",translit[(unsigned char)(*j)-0200]);
+else C_printf("%s",translit[(eight_bits)(*j)-0200]);
j++;
}
out_state= num_or_id;break;
-/*:53*/
-#line 662 "ctangle.w"
-;
-/*54:*/
-#line 732 "ctangle.w"
+/*:59*/
+#line 649 "ctangle.w"
+
+/*60:*/
+#line 719 "ctangle.w"
case section_number:
if(cur_val> 0)C_printf("/*%d:*/",cur_val);
@@ -776,11 +834,11 @@ C_printf("%s","\"\n");
}
break;
-/*:54*/
-#line 663 "ctangle.w"
-;
-/*50:*/
-#line 681 "ctangle.w"
+/*:60*/
+#line 650 "ctangle.w"
+
+/*56:*/
+#line 668 "ctangle.w"
case plus_plus:C_putc('+');C_putc('+');out_state= normal;break;
case minus_minus:C_putc('-');C_putc('-');out_state= normal;break;
@@ -790,7 +848,7 @@ case eq_eq:C_putc('=');C_putc('=');out_state= normal;break;
case lt_lt:C_putc('<');C_putc('<');out_state= normal;break;
case gt_eq:C_putc('>');C_putc('=');out_state= normal;break;
case lt_eq:C_putc('<');C_putc('=');out_state= normal;break;
-case not_eq:C_putc('!');C_putc('=');out_state= normal;break;
+case non_eq:C_putc('!');C_putc('=');out_state= normal;break;
case and_and:C_putc('&');C_putc('&');out_state= normal;break;
case or_or:C_putc('|');C_putc('|');out_state= normal;break;
case dot_dot_dot:C_putc('.');C_putc('.');C_putc('.');out_state= normal;
@@ -800,9 +858,9 @@ case period_ast:C_putc('.');C_putc('*');out_state= normal;break;
case minus_gt_ast:C_putc('-');C_putc('>');C_putc('*');out_state= normal;
break;
-/*:50*/
-#line 664 "ctangle.w"
-;
+/*:56*/
+#line 651 "ctangle.w"
+
case'=':case'>':C_putc(cur_char);C_putc(' ');
out_state= normal;break;
case join:out_state= unbreakable;break;
@@ -819,11 +877,11 @@ default:C_putc(cur_char);out_state= normal;break;
}
}
-/*:49*//*58:*/
-#line 813 "ctangle.w"
+/*:55*//*65:*/
+#line 804 "ctangle.w"
-eight_bits
-skip_ahead()
+static eight_bits
+skip_ahead(void)
{
eight_bits c;
while(1){
@@ -837,11 +895,11 @@ if(c!=ignore||*(loc-1)=='>')return(c);
}
}
-/*:58*//*60:*/
-#line 848 "ctangle.w"
+/*:65*//*67:*/
+#line 839 "ctangle.w"
-int skip_comment(is_long_comment)
-boolean is_long_comment;
+static boolean skip_comment(
+boolean is_long_comment)
{
char c;
while(1){
@@ -871,11 +929,11 @@ else loc++;
}
}
-/*:60*//*63:*/
-#line 900 "ctangle.w"
+/*:67*//*70:*/
+#line 890 "ctangle.w"
-eight_bits
-get_next()
+static eight_bits
+get_next(void)
{
static int preprocessing= 0;
eight_bits c;
@@ -885,8 +943,8 @@ if(preprocessing&&*(limit-1)!='\\')preprocessing= 0;
if(get_line()==0)return(new_section);
else if(print_where&&!no_where){
print_where= 0;
-/*77:*/
-#line 1225 "ctangle.w"
+/*85:*/
+#line 1222 "ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -897,12 +955,12 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
-app_repl(a%0400);}
+{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
+app_repl(a_l%0400);}
+
+/*:85*/
+#line 902 "ctangle.w"
-/*:77*/
-#line 912 "ctangle.w"
-;
}
else return('\n');
}
@@ -914,8 +972,8 @@ if(comment_continues)return('\n');
else continue;
}
loc++;
-if(xisdigit(c)||c=='.')/*66:*/
-#line 978 "ctangle.w"
+if(xisdigit(c)||c=='.')/*73:*/
+#line 971 "ctangle.w"
{
id_first= loc-1;
if(*id_first=='.'&&!xisdigit(*loc))goto mistake;
@@ -939,17 +997,20 @@ id_loc= loc;
return(constant);
}
-/*:66*/
-#line 924 "ctangle.w"
+/*:73*/
+#line 914 "ctangle.w"
-else if(c=='\''||c=='"'||(c=='L'&&(*loc=='\''||*loc=='"')))
-/*67:*/
-#line 1006 "ctangle.w"
+else if(c=='\''||c=='"'
+||((c=='L'||c=='u'||c=='U')&&(*loc=='\''||*loc=='"'))
+||((c=='u'&&*loc=='8')&&(*(loc+1)=='\''||*(loc+1)=='"')))
+/*74:*/
+#line 999 "ctangle.w"
{
char delim= c;
id_first= section_text+1;
id_loc= section_text;*++id_loc= delim;
-if(delim=='L'){
+if(delim=='L'||delim=='u'||delim=='U'){
+if(delim=='u'&&*loc=='8'){*++id_loc= *loc++;}
delim= *loc++;*++id_loc= delim;
}
while(1){
@@ -977,7 +1038,7 @@ c= *loc++;
if(++id_loc<=section_text_end)*id_loc= c;
}
if(id_loc>=section_text_end){
-printf("\n! String too long: ");
+fputs("\n! String too long: ",stdout);
term_write(section_text+1,25);
err_print("...");
@@ -986,23 +1047,24 @@ id_loc++;
return(string);
}
-/*:67*/
-#line 926 "ctangle.w"
+/*:74*/
+#line 918 "ctangle.w"
else if(isalpha(c)||isxalpha(c)||ishigh(c))
-/*65:*/
-#line 972 "ctangle.w"
+/*72:*/
+#line 964 "ctangle.w"
{
id_first= --loc;
-while(isalpha(*++loc)||isdigit(*loc)||isxalpha(*loc)||ishigh(*loc));
+while(isalpha((eight_bits)*++loc)||isdigit((eight_bits)*loc)
+||isxalpha((eight_bits)*loc)||ishigh((eight_bits)*loc));
id_loc= loc;return(identifier);
}
-/*:65*/
-#line 928 "ctangle.w"
+/*:72*/
+#line 920 "ctangle.w"
-else if(c=='@')/*68:*/
-#line 1050 "ctangle.w"
+else if(c=='@')/*75:*/
+#line 1044 "ctangle.w"
{
c= ccode[(eight_bits)*loc++];
switch(c){
@@ -1017,12 +1079,12 @@ err_print("! Double @ should be used in control text");
continue;
case section_name:
cur_section_name_char= *(loc-1);
-/*70:*/
-#line 1098 "ctangle.w"
+/*77:*/
+#line 1092 "ctangle.w"
{
char*k;
-/*72:*/
-#line 1118 "ctangle.w"
+/*79:*/
+#line 1112 "ctangle.w"
k= section_text;
while(1){
@@ -1032,8 +1094,8 @@ err_print("! Input ended in section name");
loc= buffer+1;break;
}
c= *loc;
-/*73:*/
-#line 1142 "ctangle.w"
+/*80:*/
+#line 1136 "ctangle.w"
if(c=='@'){
c= *(loc+1);
@@ -1051,9 +1113,9 @@ err_print("! Nesting of section names not allowed");break;
*(++k)= '@';loc++;
}
-/*:73*/
-#line 1127 "ctangle.w"
-;
+/*:80*/
+#line 1121 "ctangle.w"
+
loc++;if(k<section_text_end)k++;
if(xisspace(c)){
c= ' ';if(*(k-1)==' ')k--;
@@ -1061,22 +1123,22 @@ c= ' ';if(*(k-1)==' ')k--;
*k= c;
}
if(k>=section_text_end){
-printf("\n! Section name too long: ");
+fputs("\n! Section name too long: ",stdout);
term_write(section_text+1,25);
printf("...");mark_harmless;
}
if(*k==' '&&k> section_text)k--;
-/*:72*/
-#line 1100 "ctangle.w"
-;
+/*:79*/
+#line 1094 "ctangle.w"
+
if(k-section_text> 3&&strncmp(k-2,"...",3)==0)
cur_section_name= section_lookup(section_text+1,k-3,1);
else cur_section_name= section_lookup(section_text+1,k,0);
if(cur_section_name_char=='(')
-/*40:*/
-#line 516 "ctangle.w"
+/*47:*/
+#line 502 "ctangle.w"
{
for(an_output_file= cur_out_file;
@@ -1091,17 +1153,17 @@ overflow("output files");
}
}
-/*:40*/
-#line 1106 "ctangle.w"
-;
+/*:47*/
+#line 1100 "ctangle.w"
+
return(section_name);
}
-/*:70*/
-#line 1064 "ctangle.w"
-;
-case string:/*74:*/
-#line 1164 "ctangle.w"
+/*:77*/
+#line 1058 "ctangle.w"
+
+case string:/*81:*/
+#line 1158 "ctangle.w"
{
id_first= loc++;*(limit+1)= '@';*(limit+2)= '>';
while(*loc!='@'||*(loc+1)!='>')loc++;
@@ -1111,11 +1173,11 @@ id_loc= loc;loc+= 2;
return(string);
}
-/*:74*/
-#line 1065 "ctangle.w"
-;
-case ord:/*69:*/
-#line 1077 "ctangle.w"
+/*:81*/
+#line 1059 "ctangle.w"
+
+case ord:/*76:*/
+#line 1071 "ctangle.w"
id_first= loc;
if(*loc=='\\'){
@@ -1137,15 +1199,15 @@ err_print("! String didn't end");loc= limit-1;break;
loc++;
return(ord);
-/*:69*/
-#line 1066 "ctangle.w"
-;
+/*:76*/
+#line 1060 "ctangle.w"
+
default:return(c);
}
}
-/*:68*/
-#line 929 "ctangle.w"
+/*:75*/
+#line 921 "ctangle.w"
else if(xisspace(c)){
if(!preprocessing||loc> limit)continue;
@@ -1153,14 +1215,14 @@ if(!preprocessing||loc> limit)continue;
else return(' ');
}
else if(c=='#'&&loc==buffer+1)preprocessing= 1;
-mistake:/*64:*/
-#line 950 "ctangle.w"
+mistake:/*71:*/
+#line 942 "ctangle.w"
switch(c){
case'+':if(*loc=='+')compress(plus_plus);break;
case'-':if(*loc=='-'){compress(minus_minus);}
-else if(*loc=='>')if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);}
-else compress(minus_gt);break;
+else{if(*loc=='>'){if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);}
+else compress(minus_gt);}}break;
case'.':if(*loc=='*'){compress(period_ast);}
else if(*loc=='.'&&*(loc+1)=='.'){
loc++;compress(dot_dot_dot);
@@ -1174,26 +1236,26 @@ case'<':if(*loc=='='){compress(lt_eq);}
else if(*loc=='<')compress(lt_lt);break;
case'&':if(*loc=='&')compress(and_and);break;
case'|':if(*loc=='|')compress(or_or);break;
-case'!':if(*loc=='=')compress(not_eq);break;
+case'!':if(*loc=='=')compress(non_eq);break;
}
-/*:64*/
-#line 936 "ctangle.w"
+/*:71*/
+#line 928 "ctangle.w"
return(c);
}
}
-/*:63*//*76:*/
-#line 1199 "ctangle.w"
+/*:70*//*84:*/
+#line 1196 "ctangle.w"
-void
-scan_repl(t)
-eight_bits t;
+static void
+scan_repl(
+eight_bits t)
{
sixteen_bits a;
-if(t==section_name){/*77:*/
-#line 1225 "ctangle.w"
+if(t==section_name){/*85:*/
+#line 1222 "ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1204,23 +1266,23 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
-app_repl(a%0400);}
+{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
+app_repl(a_l%0400);}
-/*:77*/
-#line 1205 "ctangle.w"
-;}
+/*:85*/
+#line 1202 "ctangle.w"
+}
while(1)switch(a= get_next()){
-/*78:*/
-#line 1238 "ctangle.w"
+/*86:*/
+#line 1235 "ctangle.w"
case identifier:a= id_lookup(id_first,id_loc,0)-name_dir;
app_repl((a/0400)+0200);
app_repl(a%0400);break;
case section_name:if(t!=section_name)goto done;
else{
-/*79:*/
-#line 1271 "ctangle.w"
+/*87:*/
+#line 1268 "ctangle.w"
{
char*try_loc= loc;
while(*try_loc==' '&&try_loc<limit)try_loc++;
@@ -1232,14 +1294,14 @@ if(*try_loc=='=')err_print("! Missing `@ ' before a named section");
}
-/*:79*/
-#line 1244 "ctangle.w"
-;
+/*:87*/
+#line 1241 "ctangle.w"
+
a= cur_section_name-name_dir;
app_repl((a/0400)+0250);
app_repl(a%0400);
-/*77:*/
-#line 1225 "ctangle.w"
+/*85:*/
+#line 1222 "ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1250,12 +1312,12 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
-app_repl(a%0400);}
+{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
+app_repl(a_l%0400);}
-/*:77*/
-#line 1248 "ctangle.w"
-;break;
+/*:85*/
+#line 1245 "ctangle.w"
+break;
}
case output_defs_code:if(t!=section_name)err_print("! Misplaced @h");
@@ -1264,8 +1326,8 @@ output_defs_seen= 1;
a= output_defs_flag;
app_repl((a/0400)+0200);
app_repl(a%0400);
-/*77:*/
-#line 1225 "ctangle.w"
+/*85:*/
+#line 1222 "ctangle.w"
store_two_bytes(0150000);
if(changing&&include_depth==change_depth){
@@ -1276,17 +1338,17 @@ id_first= cur_file_name;
store_two_bytes((sixteen_bits)cur_line);
}
id_loc= id_first+strlen(id_first);
-{int a= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a/0400)+0200);
-app_repl(a%0400);}
+{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
+app_repl(a_l%0400);}
+
+/*:85*/
+#line 1254 "ctangle.w"
-/*:77*/
-#line 1257 "ctangle.w"
-;
}
break;
case constant:case string:
-/*80:*/
-#line 1282 "ctangle.w"
+/*88:*/
+#line 1279 "ctangle.w"
app_repl(a);
while(id_first<id_loc){
@@ -1299,12 +1361,12 @@ app_repl(*id_first++);
}
app_repl(a);break;
-/*:80*/
-#line 1261 "ctangle.w"
-;
+/*:88*/
+#line 1258 "ctangle.w"
+
case ord:
-/*81:*/
-#line 1298 "ctangle.w"
+/*89:*/
+#line 1295 "ctangle.w"
{
int c= (eight_bits)*id_first;
if(c=='\\'){
@@ -1330,12 +1392,12 @@ case'x':
if(xisdigit(*(id_first+1)))c= *(++id_first)-'0';
else if(xisxdigit(*(id_first+1))){
++id_first;
-c= toupper(*id_first)-'A'+10;
+c= toupper((eight_bits)*id_first)-'A'+10;
}
if(xisdigit(*(id_first+1)))c= 16*c+*(++id_first)-'0';
else if(xisxdigit(*(id_first+1))){
++id_first;
-c= 16*c+toupper(*id_first)-'A'+10;
+c= 16*c+toupper((eight_bits)*id_first)-'A'+10;
}
break;
case'\\':c= '\\';break;
@@ -1354,9 +1416,9 @@ app_repl(constant);
}
break;
-/*:81*/
-#line 1263 "ctangle.w"
-;
+/*:89*/
+#line 1260 "ctangle.w"
+
case definition:case format_code:case begin_C:if(t!=section_name)goto done;
else{
err_print("! @d, @f and @c are ignored in C text");continue;
@@ -1364,8 +1426,8 @@ err_print("! @d, @f and @c are ignored in C text");continue;
}
case new_section:goto done;
-/*:78*/
-#line 1210 "ctangle.w"
+/*:86*/
+#line 1207 "ctangle.w"
case')':app_repl(a);
if(t==macro)app_repl(' ');
@@ -1377,11 +1439,11 @@ if(text_ptr> text_info_end)overflow("text");
cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr;
}
-/*:76*//*83:*/
+/*:84*//*92:*/
#line 1360 "ctangle.w"
-void
-scan_section()
+static void
+scan_section(void)
{
name_pointer p;
text_pointer q;
@@ -1392,7 +1454,7 @@ printf("*%d",section_count);update_terminal;
}
next_control= 0;
while(1){
-/*84:*/
+/*93:*/
#line 1399 "ctangle.w"
while(next_control<definition)
@@ -1401,11 +1463,11 @@ if((next_control= skip_ahead())==section_name){
loc-= 2;next_control= get_next();
}
-/*:84*/
+/*:93*/
#line 1374 "ctangle.w"
-;
+
if(next_control==definition){
-/*85:*/
+/*94:*/
#line 1406 "ctangle.w"
{
while((next_control= get_next())=='\n');
@@ -1424,7 +1486,7 @@ scan_repl(macro);
cur_text->text_link= 0;
}
-/*:85*/
+/*:94*/
#line 1376 "ctangle.w"
continue;
@@ -1434,41 +1496,41 @@ p= name_dir;break;
}
if(next_control==section_name){
p= cur_section_name;
-/*86:*/
+/*95:*/
#line 1431 "ctangle.w"
while((next_control= get_next())=='+');
if(next_control!='='&&next_control!=eq_eq)
continue;
-/*:86*/
+/*:95*/
#line 1384 "ctangle.w"
-;
+
break;
}
return;
}
no_where= print_where= 0;
-/*87:*/
+/*96:*/
#line 1436 "ctangle.w"
-/*88:*/
+/*97:*/
#line 1441 "ctangle.w"
store_two_bytes((sixteen_bits)(0150000+section_count));
-/*:88*/
+/*:97*/
#line 1437 "ctangle.w"
-;
+
scan_repl(section_name);
-/*89:*/
+/*98:*/
#line 1445 "ctangle.w"
if(p==name_dir||p==0){
(last_unnamed)->text_link= cur_text-text_info;last_unnamed= cur_text;
}
-else if(p->equiv==(char*)text_info)p->equiv= (char*)cur_text;
+else if(p->equiv==(void*)text_info)p->equiv= (void*)cur_text;
else{
q= (text_pointer)p->equiv;
@@ -1479,20 +1541,20 @@ q->text_link= cur_text-text_info;
cur_text->text_link= section_flag;
-/*:89*/
+/*:98*/
#line 1439 "ctangle.w"
-;
-/*:87*/
+
+/*:96*/
#line 1390 "ctangle.w"
-;
+
}
-/*:83*//*91:*/
+/*:92*//*100:*/
#line 1463 "ctangle.w"
-void
-phase_one(){
+static void
+phase_one(void){
phase= 1;
section_count= 0;
reset_input();
@@ -1502,11 +1564,11 @@ check_complete();
phase= 2;
}
-/*:91*//*93:*/
+/*:100*//*102:*/
#line 1481 "ctangle.w"
-void
-skip_limbo()
+static void
+skip_limbo(void)
{
char c;
while(1){
@@ -1517,7 +1579,7 @@ if(loc++<=limit){
c= *loc++;
if(ccode[(eight_bits)c]==new_section)break;
switch(ccode[(eight_bits)c]){
-case translit_code:/*94:*/
+case translit_code:/*103:*/
#line 1510 "ctangle.w"
while(xisspace(*loc)&&loc<limit)loc++;
@@ -1527,7 +1589,7 @@ if(loc> limit||!xisxdigit(*(loc-3))||!xisxdigit(*(loc-2))
err_print("! Improper hex number following @l");
else{
-unsigned i;
+unsigned int i;
char*beg;
sscanf(loc-3,"%x",&i);
while(xisspace(*loc)&&loc<limit)loc++;
@@ -1537,14 +1599,14 @@ if(loc-beg>=translit_length)
err_print("! Replacement string in @l too long");
else{
-strncpy(translit[i-0200],beg,loc-beg);
+strncpy(translit[i-0200],beg,(size_t)(loc-beg));
translit[i-0200][loc-beg]= '\0';
}
}
-/*:94*/
+/*:103*/
#line 1494 "ctangle.w"
-;break;
+break;
case format_code:case'@':break;
case control_text:if(c=='q'||c=='Q'){
while((c= skip_ahead())=='@');
@@ -1560,20 +1622,20 @@ default:err_print("! Double @ should be used in limbo");
}
}
-/*:93*//*95:*/
+/*:102*//*104:*/
#line 1536 "ctangle.w"
void
-print_stats(){
-printf("\nMemory usage statistics:\n");
+print_stats(void){
+puts("\nMemory usage statistics:");
printf("%ld names (out of %ld)\n",
-(long)(name_ptr-name_dir),(long)max_names);
+(ptrdiff_t)(name_ptr-name_dir),(long)max_names);
printf("%ld replacement texts (out of %ld)\n",
-(long)(text_ptr-text_info),(long)max_texts);
+(ptrdiff_t)(text_ptr-text_info),(long)max_texts);
printf("%ld bytes (out of %ld)\n",
-(long)(byte_ptr-byte_mem),(long)max_bytes);
+(ptrdiff_t)(byte_ptr-byte_mem),(long)max_bytes);
printf("%ld tokens (out of %ld)\n",
-(long)(tok_ptr-tok_mem),(long)max_toks);
+(ptrdiff_t)(tok_ptr-tok_mem),(long)max_toks);
}
-/*:95*/
+/*:104*/