diff options
Diffstat (limited to 'Build/source/texk/web2c/cwebboot.cin')
-rw-r--r-- | Build/source/texk/web2c/cwebboot.cin | 1006 |
1 files changed, 667 insertions, 339 deletions
diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin index b8f0a754cf7..1964acd0b63 100644 --- a/Build/source/texk/web2c/cwebboot.cin +++ b/Build/source/texk/web2c/cwebboot.cin @@ -4,11 +4,7 @@ /*5:*/ #line 102 "cwebdir/common.w" -#line 73 "cwebdir/comm-w2c.ch" -#define CWEB -#include "cpascal.h" #include <ctype.h> -#line 104 "cwebdir/common.w" /*:5*//*8:*/ #line 165 "cwebdir/common.w" @@ -18,16 +14,57 @@ /*:8*//*22:*/ #line 471 "cwebdir/common.w" -#line 212 "cwebdir/comm-w2c.ch" -#include <kpathsea/kpathsea.h> #include <stdlib.h> + +/*:22*//*81:*/ +#line 1131 "cwebdir/comm-w2c.ch" + +#include <string.h> +#line 1417 "cwebdir/common.w" + +#line 1138 "cwebdir/comm-w2c.ch" +/*:81*//*85:*/ +#line 1177 "cwebdir/comm-w2c.ch" + +#include <stddef.h> +#include <stdbool.h> +#include <stdint.h> + +/*:85*//*88:*/ +#line 1215 "cwebdir/comm-w2c.ch" + +#include <locale.h> + +#ifndef HAVE_GETTEXT +#define HAVE_GETTEXT 0 +#endif + +#if HAVE_GETTEXT +#include <libintl.h> +#else +#define bindtextdomain(A,B) "" +#define textdomain(A) "" +#define gettext(A) A +#endif + +/*:88*//*90:*/ +#line 1272 "cwebdir/comm-w2c.ch" + +typedef bool boolean; +#define HAVE_BOOLEAN +#include <kpathsea/kpathsea.h> +#include <w2c/config.h> +#include <lib/lib.h> + +#define CWEB #include "help.h" -/*:22*/ +/*:90*/ #line 59 "cwebdir/common.w" #define ctangle 0 -#define cweave 1 \ +#define cweave 1 +#define ctwill 2 \ #define and_and 04 #define lt_lt 020 @@ -35,7 +72,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 @@ -48,8 +85,8 @@ #define buf_size 1000 #define longest_name 10000 #define long_buf_size (buf_size+longest_name) -#define xisspace(c) (isspace((unsigned char) c) &&((unsigned char) c<0200) ) -#define xisupper(c) (isupper((unsigned char) c) &&((unsigned char) c<0200) ) \ +#define xisspace(c) (isspace((eight_bits) c) &&((eight_bits) c<0200) ) +#define xisupper(c) (isupper((eight_bits) c) &&((eight_bits) c<0200) ) \ #define max_include_depth 10 \ @@ -61,7 +98,7 @@ #define web_file_name file_name[0] \ #define lines_dont_match (change_limit-change_buffer!=limit-buffer|| \ -strncmp(buffer,change_buffer,limit-buffer) ) \ +strncmp(buffer,change_buffer,(size_t) (limit-buffer) ) ) \ #define if_section_start_make_pending(b) {*limit= '!'; \ for(loc= buffer;xisspace(*loc) ;loc++) ; \ @@ -73,16 +110,14 @@ if(*loc=='@'&&(xisspace(*(loc+1) ) ||*(loc+1) =='*') ) change_pending= b; \ \ #define too_long() {include_depth--; \ -err_print("! Include file name too long") ;goto restart;} \ - -#define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) \ +err_print(_("! Include file name too long") ) ;goto restart;} \ #define max_bytes 1000000 \ #define max_names 10239 \ \ -#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 hash_size 8501 \ @@ -113,7 +148,12 @@ err_print("! Include file name too long") ;goto restart;} \ #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 RETURN_OK 0 +#define RETURN_WARN 5 +#define RETURN_ERROR 10 +#define RETURN_FAIL 20 \ + +#define confusion(s) fatal(_("! This can't happen: ") ,s) \ \ #define show_banner flags['b'] @@ -121,8 +161,10 @@ err_print("! Include file name too long") ;goto restart;} \ #define show_stats flags['s'] #define show_happiness flags['h'] #define show_kpathsea_debug flags['d'] \ - \ +#define make_xrefs flags['x'] \ + +#define flag_change (**argv!='-') #define update_terminal fflush(stdout) \ #define new_line putchar('\n') @@ -131,8 +173,15 @@ err_print("! Include file name too long") ;goto restart;} \ #define C_printf(c,a) fprintf(C_file,c,a) #define C_putc(c) putc(c,C_file) \ -#define ctangle_banner "This is CTANGLE, Version 3.64" -#define cweave_banner "This is CWEAVE, Version 3.64" \ +#define PATH_SEPARATOR separators[0] +#define DIR_SEPARATOR separators[1] +#define DEVICE_SEPARATOR separators[2] \ + +#define max_banner 50 \ + +#define _(STRING) gettext(STRING) \ + +#define kpse_find_cweb(name) kpse_find_file(name,kpse_cweb_format,true) \ #line 60 "cwebdir/common.w" @@ -140,8 +189,9 @@ err_print("! Include file name too long") ;goto restart;} \ /*2:*/ #line 73 "cwebdir/common.w" -#line 75 "cwebdir/common.w" -boolean program; +#line 56 "cwebdir/comm-w2c.ch" +int program; +#line 76 "cwebdir/common.w" /*:2*//*7:*/ #line 159 "cwebdir/common.w" @@ -171,24 +221,27 @@ boolean web_file_open= 0; /*:10*//*20:*/ #line 418 "cwebdir/common.w" -typedef unsigned short sixteen_bits; +#line 262 "cwebdir/comm-w2c.ch" +typedef uint8_t eight_bits; +typedef uint16_t sixteen_bits; +#line 420 "cwebdir/common.w" sixteen_bits section_count; boolean changed_section[max_sections]; boolean change_pending; boolean print_where= 0; -/*:20*//*29:*/ +/*:20*//*27:*/ #line 594 "cwebdir/common.w" typedef struct name_info{ char*byte_start; -/*33:*/ +/*31:*/ #line 631 "cwebdir/common.w" struct name_info*link; -/*:33*//*42:*/ +/*:31*//*40:*/ #line 730 "cwebdir/common.w" union{ @@ -197,12 +250,13 @@ struct name_info*Rlink; char Ilk; }dummy; -/*:42*//*57:*/ -#line 1062 "cwebdir/common.w" +/*:40*//*55:*/ +#line 701 "cwebdir/comm-w2c.ch" -char*equiv_or_xref; +void*equiv_or_xref; +#line 1064 "cwebdir/common.w" -/*:57*/ +/*:55*/ #line 597 "cwebdir/common.w" }name_info; @@ -212,13 +266,13 @@ char*byte_mem_end= byte_mem+max_bytes-1; name_info name_dir[max_names]; name_pointer name_dir_end= name_dir+max_names-1; -/*:29*//*31:*/ +/*:27*//*29:*/ #line 617 "cwebdir/common.w" name_pointer name_ptr; char*byte_ptr; -/*:31*//*34:*/ +/*:29*//*32:*/ #line 644 "cwebdir/common.w" typedef name_pointer*hash_pointer; @@ -226,13 +280,12 @@ name_pointer hash[hash_size]; hash_pointer hash_end= hash+hash_size-1; hash_pointer h; -#line 344 "cwebdir/comm-w2c.ch" -/*:34*//*58:*/ +/*:32*//*56:*/ #line 1082 "cwebdir/common.w" int history= spotless; -/*:58*//*69:*/ +/*:56*//*67:*/ #line 1220 "cwebdir/common.w" int argc; @@ -240,22 +293,30 @@ char**argv; char C_file_name[max_file_name_length]; char tex_file_name[max_file_name_length]; char idx_file_name[max_file_name_length]; +#line 887 "cwebdir/comm-w2c.ch" char scn_file_name[max_file_name_length]; +char check_file_name[max_file_name_length]; +#line 894 "cwebdir/comm-w2c.ch" boolean flags[128]; +const char*use_language= ""; +#line 1228 "cwebdir/common.w" -/*:69*//*79:*/ +/*:67*//*77:*/ #line 1370 "cwebdir/common.w" FILE*C_file; FILE*tex_file; FILE*idx_file; +#line 1064 "cwebdir/comm-w2c.ch" FILE*scn_file; -#line 736 "cwebdir/comm-w2c.ch" +FILE*check_file; +#line 1071 "cwebdir/comm-w2c.ch" FILE*active_file; char*found_filename; #line 1376 "cwebdir/common.w" -/*:79*/ +#line 1088 "cwebdir/comm-w2c.ch" +/*:77*/ #line 61 "cwebdir/common.w" /*3:*/ @@ -268,107 +329,208 @@ int phase; char change_buffer[buf_size]; char*change_limit; -/*:11*/ +/*:11*//*86:*/ +#line 1190 "cwebdir/comm-w2c.ch" + +char cb_banner[max_banner]; +#ifndef SEPARATORS +#define SEPARATORS "://" +#endif +char separators[]= SEPARATORS; + +/*:86*/ #line 62 "cwebdir/common.w" -#line 37 "cwebdir/comm-w2c.ch" -#include "cwebboot.h" -/*55:*/ +/*33:*/ +#line 650 "cwebdir/common.w" + +#line 430 "cwebdir/comm-w2c.ch" +extern boolean names_match(name_pointer,const char*,size_t,eight_bits); +#line 652 "cwebdir/common.w" + +/*:33*//*38:*/ +#line 703 "cwebdir/common.w" + +#line 460 "cwebdir/comm-w2c.ch" +extern void init_p(name_pointer,eight_bits); +#line 705 "cwebdir/common.w" + +/*:38*//*46:*/ +#line 852 "cwebdir/common.w" + +#line 540 "cwebdir/comm-w2c.ch" +extern void init_node(name_pointer); +#line 854 "cwebdir/common.w" + +/*:46*//*53:*/ #line 1017 "cwebdir/common.w" -#line 518 "cwebdir/comm-w2c.ch" +#line 666 "cwebdir/comm-w2c.ch" static int section_name_cmp(char**,int,name_pointer); #line 1019 "cwebdir/common.w" -/*:55*//*71:*/ +/*:53*//*57:*/ +#line 1092 "cwebdir/common.w" + +#line 708 "cwebdir/comm-w2c.ch" +extern void err_print(const char*); +#line 1094 "cwebdir/common.w" + +/*:57*//*60:*/ +#line 1140 "cwebdir/common.w" + +#line 735 "cwebdir/comm-w2c.ch" +extern int wrap_up(void); +extern void print_stats(void); +#line 1143 "cwebdir/common.w" + +#line 746 "cwebdir/comm-w2c.ch" +/*:60*//*63:*/ +#line 1173 "cwebdir/common.w" + +#line 809 "cwebdir/comm-w2c.ch" +extern void fatal(const char*,const char*); +extern void overflow(const char*); +#line 1175 "cwebdir/common.w" + +/*:63*//*69:*/ #line 1251 "cwebdir/common.w" -#line 653 "cwebdir/comm-w2c.ch" +#line 915 "cwebdir/comm-w2c.ch" static void scan_args(void); #line 1253 "cwebdir/common.w" -/*:71*/ -#line 38 "cwebdir/comm-w2c.ch" +/*:69*//*83:*/ +#line 1153 "cwebdir/comm-w2c.ch" + +boolean get_line(void); +name_pointer id_lookup(const char*,const char*,char); +name_pointer section_lookup(char*,char*,int); +void check_complete(void); +void common_init(void); +void print_prefix_name(name_pointer); +void print_section_name(name_pointer); +void reset_input(void); +void sprint_section_name(char*,name_pointer); + +/*:83*//*84:*/ +#line 1166 "cwebdir/comm-w2c.ch" + +static boolean input_ln(FILE*); +static int web_strcmp(char*,int,char*,int); +static name_pointer add_section_name(name_pointer,int,char*,char*,int); +static void extend_section_name(name_pointer,char*,char*,int); +static void check_change(void); +static void prime_the_change_buffer(void); + +/*:84*//*94:*/ +#line 1307 "cwebdir/comm-w2c.ch" + +void cb_show_banner(void); +static void cb_usage(const_string str); +static void cb_usagehelp(const_string*message,const_string bug_email); + +/*:94*/ +#line 63 "cwebdir/common.w" -#line 64 "cwebdir/common.w" /*:1*//*4:*/ #line 89 "cwebdir/common.w" +#line 63 "cwebdir/comm-w2c.ch" void -#line 58 "cwebdir/comm-w2c.ch" - common_init(void) +common_init(void) #line 92 "cwebdir/common.w" { -#line 64 "cwebdir/comm-w2c.ch" -/*32:*/ +#line 72 "cwebdir/comm-w2c.ch" +/*30:*/ #line 621 "cwebdir/common.w" name_dir->byte_start= byte_ptr= byte_mem; name_ptr= name_dir+1; name_ptr->byte_start= byte_mem; -/*:32*//*36:*/ +/*:30*//*34:*/ #line 655 "cwebdir/common.w" for(h= hash;h<=hash_end;*h++= NULL); -/*:36*//*43:*/ +/*:34*//*41:*/ #line 737 "cwebdir/common.w" root= NULL; -/*:43*/ -#line 64 "cwebdir/comm-w2c.ch" -; -/*24:*/ -#line 247 "cwebdir/comm-w2c.ch" +/*:41*/ +#line 72 "cwebdir/comm-w2c.ch" + +/*91:*/ +#line 1293 "cwebdir/comm-w2c.ch" kpse_set_program_name(argv[0],"cweb"); -#line 473 "cwebdir/common.w" -/*:24*/ -#line 65 "cwebdir/comm-w2c.ch" -; -#line 94 "cwebdir/common.w" -/*70:*/ +/*:91*/ +#line 73 "cwebdir/comm-w2c.ch" + +/*89:*/ +#line 1246 "cwebdir/comm-w2c.ch" + +setlocale(LC_MESSAGES,setlocale(LC_CTYPE,"")); +bindtextdomain("cweb","/usr/share/locale/"); +bindtextdomain("cweb-tl","/usr/share/locale/"); +bindtextdomain("web2c-help","/usr/share/locale/"); +textdomain("cweb"); + + +/*:89*/ +#line 74 "cwebdir/comm-w2c.ch" + +/*68:*/ #line 1233 "cwebdir/common.w" -#line 645 "cwebdir/comm-w2c.ch" -show_banner= show_happiness= show_progress= 1; #line 1235 "cwebdir/common.w" -/*:70*/ -#line 94 "cwebdir/common.w" -; -/*80:*/ -#line 1377 "cwebdir/common.w" +/*:68*/ +#line 75 "cwebdir/comm-w2c.ch" + +/*78:*/ +#line 1088 "cwebdir/comm-w2c.ch" scan_args(); if(program==ctangle){ -#line 745 "cwebdir/comm-w2c.ch" -if((C_file= fopen(C_file_name,"wb"))==NULL) -#line 1381 "cwebdir/common.w" -fatal("! Cannot open output file ",C_file_name); +strcpy(check_file_name,C_file_name); +if(check_file_name[0]!='\0'){ +char*dot_pos= strrchr(check_file_name,'.'); +if(dot_pos==NULL)strcat(check_file_name,".ttp"); +else strcpy(dot_pos,".ttp"); +} +if((C_file= fopen(check_file_name,"wb"))==NULL) +fatal(_("! Cannot open output file "),check_file_name); } else{ -#line 751 "cwebdir/comm-w2c.ch" -if((tex_file= fopen(tex_file_name,"wb"))==NULL) -#line 1386 "cwebdir/common.w" -fatal("! Cannot open output file ",tex_file_name); +strcpy(check_file_name,tex_file_name); +if(check_file_name[0]!='\0'){ +char*dot_pos= strrchr(check_file_name,'.'); +if(dot_pos==NULL)strcat(check_file_name,".wtp"); +else strcpy(dot_pos,".wtp"); +} +if((tex_file= fopen(check_file_name,"wb"))==NULL) +fatal(_("! Cannot open output file "),check_file_name); } +#line 1388 "cwebdir/common.w" -/*:80*/ -#line 95 "cwebdir/common.w" -; +/*:78*/ +#line 76 "cwebdir/comm-w2c.ch" + +#line 96 "cwebdir/common.w" } /*:4*//*9:*/ #line 172 "cwebdir/common.w" -#line 100 "cwebdir/comm-w2c.ch" -int input_ln(FILE*fp) +#line 103 "cwebdir/comm-w2c.ch" +static boolean input_ln( +FILE*fp) #line 175 "cwebdir/common.w" { register int c= EOF; @@ -376,12 +538,14 @@ register char*k; if(feof(fp))return(0); limit= k= buffer; while(k<=buffer_end&&(c= getc(fp))!=EOF&&c!='\n') -#line 106 "cwebdir/comm-w2c.ch" +#line 110 "cwebdir/comm-w2c.ch" if((*(k++)= c)!=' '&&c!='\r')limit= k; #line 182 "cwebdir/common.w" if(k> buffer_end) if((c= getc(fp))!=EOF&&c!='\n'){ -ungetc(c,fp);loc= buffer;err_print("! Input line too long"); +#line 116 "cwebdir/comm-w2c.ch" +ungetc(c,fp);loc= buffer;err_print(_("! Input line too long")); +#line 185 "cwebdir/common.w" } if(c==EOF&&limit==buffer)return(0); @@ -392,7 +556,7 @@ return(1); /*:9*//*12:*/ #line 251 "cwebdir/common.w" -#line 128 "cwebdir/comm-w2c.ch" +#line 142 "cwebdir/comm-w2c.ch" static void prime_the_change_buffer(void) #line 254 "cwebdir/common.w" @@ -406,13 +570,15 @@ change_line++; if(!input_ln(change_file))return; if(limit<buffer+2)continue; if(buffer[0]!='@')continue; -#line 135 "cwebdir/comm-w2c.ch" -if(xisupper(buffer[1]))buffer[1]= tolower((unsigned char)buffer[1]); +#line 149 "cwebdir/comm-w2c.ch" +if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]); #line 272 "cwebdir/common.w" if(buffer[1]=='x')break; if(buffer[1]=='y'||buffer[1]=='z'||buffer[1]=='i'){ loc= buffer+2; -err_print("! Missing @x in change file"); +#line 155 "cwebdir/comm-w2c.ch" +err_print(_("! Missing @x in change file")); +#line 276 "cwebdir/common.w" } } @@ -426,7 +592,9 @@ err_print("! Missing @x in change file"); do{ change_line++; if(!input_ln(change_file)){ -err_print("! Change file ended after @x"); +#line 161 "cwebdir/comm-w2c.ch" +err_print(_("! Change file ended after @x")); +#line 287 "cwebdir/common.w" return; } @@ -439,8 +607,10 @@ return; #line 292 "cwebdir/common.w" { -change_limit= change_buffer+(limit-buffer); -strncpy(change_buffer,buffer,limit-buffer+1); +#line 168 "cwebdir/comm-w2c.ch" +change_limit= change_buffer+(ptrdiff_t)(limit-buffer); +strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); +#line 296 "cwebdir/common.w" } /*:15*/ @@ -451,7 +621,7 @@ strncpy(change_buffer,buffer,limit-buffer+1); /*:12*//*16:*/ #line 320 "cwebdir/common.w" -#line 144 "cwebdir/comm-w2c.ch" +#line 176 "cwebdir/comm-w2c.ch" static void check_change(void) #line 323 "cwebdir/common.w" @@ -466,27 +636,33 @@ if(!change_pending)changed_section[section_count]= 1; while(1){ changing= 1;print_where= 1;change_line++; if(!input_ln(change_file)){ -err_print("! Change file ended before @y"); +#line 183 "cwebdir/comm-w2c.ch" +err_print(_("! Change file ended before @y")); +#line 335 "cwebdir/common.w" change_limit= change_buffer;changing= 0; return; } if(limit> buffer+1&&buffer[0]=='@'){ -#line 151 "cwebdir/comm-w2c.ch" -char xyz_code= xisupper(buffer[1])?tolower((unsigned char)buffer[1]):buffer[1]; +#line 189 "cwebdir/comm-w2c.ch" +char xyz_code= xisupper(buffer[1])?tolower((eight_bits)buffer[1]):buffer[1]; #line 341 "cwebdir/common.w" /*17:*/ #line 358 "cwebdir/common.w" if(xyz_code=='x'||xyz_code=='z'){ -loc= buffer+2;err_print("! Where is the matching @y?"); +#line 201 "cwebdir/comm-w2c.ch" +loc= buffer+2;err_print(_("! Where is the matching @y?")); +#line 361 "cwebdir/common.w" } else if(xyz_code=='y'){ if(n> 0){ loc= buffer+2; printf("\n! Hmm... %d ",n); -err_print("of the preceding lines failed to match"); +#line 207 "cwebdir/comm-w2c.ch" +err_print(_("of the preceding lines failed to match")); +#line 368 "cwebdir/common.w" } change_depth= include_depth; @@ -501,8 +677,10 @@ return; #line 292 "cwebdir/common.w" { -change_limit= change_buffer+(limit-buffer); -strncpy(change_buffer,buffer,limit-buffer+1); +#line 168 "cwebdir/comm-w2c.ch" +change_limit= change_buffer+(ptrdiff_t)(limit-buffer); +strncpy(change_buffer,buffer,(size_t)(limit-buffer+1)); +#line 296 "cwebdir/common.w" } /*:15*/ @@ -511,7 +689,9 @@ strncpy(change_buffer,buffer,limit-buffer+1); changing= 0;cur_line++; while(!input_ln(cur_file)){ if(include_depth==0){ -err_print("! CWEB file ended during a change"); +#line 195 "cwebdir/comm-w2c.ch" +err_print(_("! CWEB file ended during a change")); +#line 349 "cwebdir/common.w" input_has_ended= 1;return; } @@ -524,35 +704,39 @@ if(lines_dont_match)n++; /*:16*//*18:*/ #line 378 "cwebdir/common.w" +#line 214 "cwebdir/comm-w2c.ch" void -#line 159 "cwebdir/comm-w2c.ch" - reset_input(void) +reset_input(void) #line 381 "cwebdir/common.w" { limit= buffer;loc= buffer+1;buffer[0]= ' '; /*19:*/ #line 393 "cwebdir/common.w" -#line 171 "cwebdir/comm-w2c.ch" +#line 225 "cwebdir/comm-w2c.ch" if((found_filename= kpse_find_cweb(web_file_name))==NULL|| (web_file= fopen(found_filename,"r"))==NULL){ -fatal("! Cannot open input file ",web_file_name); +fatal(_("! Cannot open input file "),web_file_name); }else if(strlen(found_filename)<max_file_name_length){ -strcpy(web_file_name,found_filename); +if(strcmp(web_file_name,found_filename)) +strcpy(web_file_name,found_filename+ +((found_filename[0]=='.'&&found_filename[1]=='/')?2:0)); free(found_filename); -} +}else fatal(_("! Filename too long\n"),found_filename); #line 399 "cwebdir/common.w" web_file_open= 1; -#line 184 "cwebdir/comm-w2c.ch" +#line 240 "cwebdir/comm-w2c.ch" if((found_filename= kpse_find_cweb(change_file_name))==NULL|| (change_file= fopen(found_filename,"r"))==NULL){ -fatal("! Cannot open change file ",change_file_name); +fatal(_("! Cannot open change file "),change_file_name); }else if(strlen(found_filename)<max_file_name_length){ -strcpy(change_file_name,found_filename); +if(strcmp(change_file_name,found_filename)) +strcpy(change_file_name,found_filename+ +((found_filename[0]=='.'&&found_filename[1]=='/')?2:0)); free(found_filename); -} +}else fatal(_("! Filename too long\n"),found_filename); #line 404 "cwebdir/common.w" /*:19*/ @@ -567,18 +751,20 @@ limit= buffer;loc= buffer+1;buffer[0]= ' ';input_has_ended= 0; /*:18*//*21:*/ #line 426 "cwebdir/common.w" -#line 204 "cwebdir/comm-w2c.ch" -int get_line(void) +#line 269 "cwebdir/comm-w2c.ch" +boolean get_line(void) #line 428 "cwebdir/common.w" { restart: if(changing&&include_depth==change_depth) -/*27:*/ +/*25:*/ #line 537 "cwebdir/common.w" { change_line++; if(!input_ln(change_file)){ -err_print("! Change file ended without @z"); +#line 368 "cwebdir/comm-w2c.ch" +err_print(_("! Change file ended without @z")); +#line 541 "cwebdir/common.w" buffer[0]= '@';buffer[1]= 'z';limit= buffer+2; } @@ -591,12 +777,14 @@ changed_section[section_count]= 1;change_pending= 0; } *limit= ' '; if(buffer[0]=='@'){ -#line 311 "cwebdir/comm-w2c.ch" -if(xisupper(buffer[1]))buffer[1]= tolower((unsigned char)buffer[1]); +#line 374 "cwebdir/comm-w2c.ch" +if(xisupper(buffer[1]))buffer[1]= tolower((eight_bits)buffer[1]); #line 554 "cwebdir/common.w" if(buffer[1]=='x'||buffer[1]=='y'){ loc= buffer+2; -err_print("! Where is the matching @z?"); +#line 380 "cwebdir/comm-w2c.ch" +err_print(_("! Where is the matching @z?")); +#line 557 "cwebdir/common.w" } else if(buffer[1]=='z'){ @@ -606,11 +794,11 @@ prime_the_change_buffer();changing= !changing;print_where= 1; } } -/*:27*/ +/*:25*/ #line 431 "cwebdir/common.w" ; if(!changing||include_depth> change_depth){ -/*26:*/ +/*24:*/ #line 520 "cwebdir/common.w" { cur_line++; @@ -629,7 +817,7 @@ if(buffer[0]==change_buffer[0]) if(change_limit> change_buffer)check_change(); } -/*:26*/ +/*:24*/ #line 433 "cwebdir/common.w" ; if(changing&&include_depth==change_depth)goto restart; @@ -640,20 +828,24 @@ if(buffer[0]=='@'&&(buffer[1]=='i'||buffer[1]=='I')){ loc= buffer+2;*limit= '"'; while(*loc==' '||*loc=='\t')loc++; if(loc>=limit){ -err_print("! Include file name not given"); +#line 275 "cwebdir/comm-w2c.ch" +err_print(_("! Include file name not given")); +#line 443 "cwebdir/common.w" goto restart; } if(include_depth>=max_include_depth-1){ -err_print("! Too many nested includes"); +#line 281 "cwebdir/comm-w2c.ch" +err_print(_("! Too many nested includes")); +#line 448 "cwebdir/common.w" goto restart; } include_depth++; -/*25:*/ +/*23:*/ #line 474 "cwebdir/common.w" { -#line 260 "cwebdir/comm-w2c.ch" +#line 317 "cwebdir/comm-w2c.ch" char*cur_file_name_end= cur_file_name+max_file_name_length-1; char*k= cur_file_name; #line 479 "cwebdir/common.w" @@ -667,114 +859,120 @@ while(*loc!=' '&&*loc!='\t'&&*loc!='"'&&k<=cur_file_name_end)*k++= *loc++; if(k> cur_file_name_end)too_long(); *k= '\0'; -#line 267 "cwebdir/comm-w2c.ch" +#line 324 "cwebdir/comm-w2c.ch" if((found_filename= kpse_find_cweb(cur_file_name))!=NULL&& (cur_file= fopen(found_filename,"r"))!=NULL){ if(strlen(found_filename)<max_file_name_length){ -strcpy(cur_file_name,found_filename); +if(strcmp(cur_file_name,found_filename)) +strcpy(cur_file_name,found_filename+ +((found_filename[0]=='.'&&found_filename[1]=='/')?2:0)); free(found_filename); -} +}else fatal(_("! Filename too long\n"),found_filename); #line 490 "cwebdir/common.w" cur_line= 0;print_where= 1; goto restart; } -#line 517 "cwebdir/common.w" -include_depth--;err_print("! Cannot open include file");goto restart; +#line 362 "cwebdir/comm-w2c.ch" +include_depth--;err_print(_("! Cannot open include file"));goto restart; +#line 518 "cwebdir/common.w" } -/*:25*/ +/*:23*/ #line 452 "cwebdir/common.w" ; } return 1; } -/*:21*//*28:*/ +#line 296 "cwebdir/comm-w2c.ch" +/*:21*//*26:*/ #line 569 "cwebdir/common.w" +#line 390 "cwebdir/comm-w2c.ch" void -#line 317 "cwebdir/comm-w2c.ch" - check_complete(void){ -#line 572 "cwebdir/common.w" +check_complete(void){ if(change_limit!=change_buffer){ -strncpy(buffer,change_buffer,change_limit-change_buffer+1); -limit= buffer+(int)(change_limit-change_buffer); +strncpy(buffer,change_buffer,(size_t)(change_limit-change_buffer+1)); +limit= buffer+(ptrdiff_t)(change_limit-change_buffer); +#line 575 "cwebdir/common.w" changing= 1;change_depth= include_depth;loc= buffer; -err_print("! Change file entry did not match"); +#line 400 "cwebdir/comm-w2c.ch" +err_print(_("! Change file entry did not match")); +#line 577 "cwebdir/common.w" } } -/*:28*//*37:*/ +/*:26*//*35:*/ #line 660 "cwebdir/common.w" +#line 442 "cwebdir/comm-w2c.ch" name_pointer -#line 356 "cwebdir/comm-w2c.ch" - -id_lookup(const char*first,const char*last,char t) -#line 666 "cwebdir/common.w" +id_lookup( +const char*first, +const char*last, +char t) { -#line 363 "cwebdir/comm-w2c.ch" const char*i= first; -#line 369 "cwebdir/comm-w2c.ch" +#line 668 "cwebdir/common.w" int h; -#line 669 "cwebdir/common.w" int l; name_pointer p; if(last==NULL)for(last= first;*last!='\0';last++); -l= last-first; -/*38:*/ +#line 454 "cwebdir/comm-w2c.ch" +l= (int)(last-first); +#line 673 "cwebdir/common.w" +/*36:*/ #line 683 "cwebdir/common.w" -#line 378 "cwebdir/comm-w2c.ch" h= (unsigned char)*i; while(++i<last)h= (h+h+(int)((unsigned char)*i))%hash_size; -#line 686 "cwebdir/common.w" -/*:38*/ +/*:36*/ #line 673 "cwebdir/common.w" ; -/*39:*/ +/*37:*/ #line 691 "cwebdir/common.w" -#line 387 "cwebdir/comm-w2c.ch" p= hash[h]; -#line 693 "cwebdir/common.w" while(p&&!names_match(p,first,l,t))p= p->link; if(p==NULL){ p= name_ptr; -#line 393 "cwebdir/comm-w2c.ch" p->link= hash[h];hash[h]= p; -#line 697 "cwebdir/common.w" } -/*:39*/ +/*:37*/ #line 674 "cwebdir/common.w" ; -if(p==name_ptr)/*41:*/ +if(p==name_ptr)/*39:*/ #line 706 "cwebdir/common.w" { -if(byte_ptr+l> byte_mem_end)overflow("byte memory"); -if(name_ptr>=name_dir_end)overflow("name"); +#line 467 "cwebdir/comm-w2c.ch" +if(byte_ptr+l> byte_mem_end)overflow(_("byte memory")); +if(name_ptr>=name_dir_end)overflow(_("name")); +#line 709 "cwebdir/common.w" strncpy(byte_ptr,first,l); (++name_ptr)->byte_start= byte_ptr+= l; -if(program==cweave)init_p(p,t); +#line 474 "cwebdir/comm-w2c.ch" +init_p(p,t); +#line 712 "cwebdir/common.w" } -/*:41*/ +/*:39*/ #line 675 "cwebdir/common.w" ; return(p); } -/*:37*//*44:*/ +/*:35*//*42:*/ #line 764 "cwebdir/common.w" +#line 482 "cwebdir/comm-w2c.ch" void -#line 412 "cwebdir/comm-w2c.ch" - print_section_name(name_pointer p) +print_section_name( +name_pointer p) #line 768 "cwebdir/common.w" { char*ss,*s= first_chunk(p); @@ -782,21 +980,25 @@ name_pointer q= p+1; while(p!=name_dir){ ss= (p+1)->byte_start-1; if(*ss==' '&&ss>=s){ -term_write(s,ss-s);p= q->link;q= p; +#line 492 "cwebdir/comm-w2c.ch" +term_write(s,(size_t)(ss-s));p= q->link;q= p; }else{ -term_write(s,ss+1-s);p= name_dir;q= NULL; +term_write(s,(size_t)(ss+1-s));p= name_dir;q= NULL; +#line 777 "cwebdir/common.w" } s= p->byte_start; } if(q)term_write("...",3); } -/*:44*//*45:*/ +/*:42*//*43:*/ #line 783 "cwebdir/common.w" +#line 503 "cwebdir/comm-w2c.ch" void -#line 422 "cwebdir/comm-w2c.ch" - sprint_section_name(char*dest,name_pointer p) +sprint_section_name( +char*dest, +name_pointer p) #line 788 "cwebdir/common.w" { char*ss,*s= first_chunk(p); @@ -808,18 +1010,21 @@ p= q->link;q= p; }else{ ss++;p= name_dir; } -strncpy(dest,s,ss-s),dest+= ss-s; +#line 512 "cwebdir/comm-w2c.ch" +strncpy(dest,s,(size_t)(ss-s)),dest+= ss-s; +#line 799 "cwebdir/common.w" s= p->byte_start; } *dest= '\0'; } -/*:45*//*46:*/ +/*:43*//*44:*/ #line 804 "cwebdir/common.w" -#line 432 "cwebdir/comm-w2c.ch" -static void -print_prefix_name(name_pointer p) +#line 520 "cwebdir/comm-w2c.ch" +void +print_prefix_name( +name_pointer p) #line 808 "cwebdir/common.w" { char*s= first_chunk(p); @@ -828,40 +1033,47 @@ term_write(s,l); if(s+l<(p+1)->byte_start)term_write("...",3); } -/*:46*//*47:*/ +/*:44*//*45:*/ #line 825 "cwebdir/common.w" -#line 443 "cwebdir/comm-w2c.ch" - -static int -web_strcmp(char*j,int j_len,char*k,int k_len) +#line 530 "cwebdir/comm-w2c.ch" +static int web_strcmp( +char*j, +int j_len, +char*k, +int k_len) #line 829 "cwebdir/common.w" { -#line 455 "cwebdir/comm-w2c.ch" char*j1= j+j_len,*k1= k+k_len; while(k<k1&&j<j1&&*j==*k)k++,j++; if(k==k1)if(j==j1)return equal; else return extension; else if(j==j1)return prefix; -#line 835 "cwebdir/common.w" else if(*j<*k)return less; else return greater; } -/*:47*//*49:*/ +/*:45*//*47:*/ #line 855 "cwebdir/common.w" -#line 483 "cwebdir/comm-w2c.ch" +#line 552 "cwebdir/comm-w2c.ch" static name_pointer -add_section_name(name_pointer par,int c,char*first,char*last, +add_section_name( +name_pointer par, +int c, +char*first, +char*last, int ispref) #line 863 "cwebdir/common.w" { name_pointer p= name_ptr; char*s= first_chunk(p); -int name_len= last-first+ispref; -if(s+name_len> byte_mem_end)overflow("byte memory"); -if(name_ptr+1>=name_dir_end)overflow("name"); +#line 564 "cwebdir/comm-w2c.ch" +int name_len= (int)(last-first)+ispref; +#line 571 "cwebdir/comm-w2c.ch" +if(s+name_len> byte_mem_end)overflow(_("byte memory")); +if(name_ptr+1>=name_dir_end)overflow(_("name")); +#line 869 "cwebdir/common.w" (++name_ptr)->byte_start= byte_ptr= s+name_len; if(ispref){ *(byte_ptr-1)= ' '; @@ -877,35 +1089,45 @@ init_node(p); return par==NULL?(root= p):c==less?(par->llink= p):(par->rlink= p); } -/*:49*//*50:*/ +/*:47*//*48:*/ #line 884 "cwebdir/common.w" -#line 498 "cwebdir/comm-w2c.ch" +#line 583 "cwebdir/comm-w2c.ch" static void -extend_section_name(name_pointer p,char*first,char*last,int ispref) +extend_section_name( +name_pointer p, +char*first, +char*last, +int ispref) #line 891 "cwebdir/common.w" { char*s; name_pointer q= p+1; -int name_len= last-first+ispref; -if(name_ptr>=name_dir_end)overflow("name"); +#line 594 "cwebdir/comm-w2c.ch" +int name_len= (int)(last-first)+ispref; +#line 600 "cwebdir/comm-w2c.ch" +if(name_ptr>=name_dir_end)overflow(_("name")); +#line 896 "cwebdir/common.w" while(q->link!=name_dir)q= q->link; q->link= name_ptr; s= name_ptr->byte_start; name_ptr->link= name_dir; -if(s+name_len> byte_mem_end)overflow("byte memory"); +#line 606 "cwebdir/comm-w2c.ch" +if(s+name_len> byte_mem_end)overflow(_("byte memory")); +#line 901 "cwebdir/common.w" (++name_ptr)->byte_start= byte_ptr= s+name_len; strncpy(s,first,name_len); if(ispref)*(byte_ptr-1)= ' '; } -/*:50*//*51:*/ +/*:48*//*49:*/ #line 912 "cwebdir/common.w" +#line 615 "cwebdir/comm-w2c.ch" name_pointer -#line 509 "cwebdir/comm-w2c.ch" - -section_lookup(char*first,char*last,int ispref) +section_lookup( +char*first,char*last, +int ispref) #line 917 "cwebdir/common.w" { int c= 0; @@ -914,8 +1136,10 @@ name_pointer q= NULL; name_pointer r= NULL; name_pointer par= NULL; -int name_len= last-first+1; -/*52:*/ +#line 624 "cwebdir/comm-w2c.ch" +int name_len= (int)(last-first)+1; +#line 925 "cwebdir/common.w" +/*50:*/ #line 936 "cwebdir/common.w" while(p){ @@ -926,10 +1150,14 @@ par= p; p= (c==less?p->llink:p->rlink); }else{ if(r!=NULL){ -printf("\n! Ambiguous prefix: matches <"); +#line 630 "cwebdir/comm-w2c.ch" +fputs(_("\n! Ambiguous prefix: matches <"),stdout); +#line 946 "cwebdir/common.w" print_prefix_name(p); -printf(">\n and <"); +#line 636 "cwebdir/comm-w2c.ch" +fputs(_(">\n and <"),stdout); +#line 949 "cwebdir/common.w" print_prefix_name(r); err_print(">"); return name_dir; @@ -942,26 +1170,28 @@ if(p==NULL) p= q,q= NULL; } -/*:52*/ +/*:50*/ #line 926 "cwebdir/common.w" ; -/*53:*/ +/*51:*/ #line 961 "cwebdir/common.w" if(r==NULL) return add_section_name(par,c,first,last+1,ispref); -/*:53*/ +/*:51*/ #line 927 "cwebdir/common.w" ; -/*54:*/ +/*52:*/ #line 969 "cwebdir/common.w" switch(section_name_cmp(&first,name_len,r)){ case prefix: if(!ispref){ -printf("\n! New name is a prefix of <"); +#line 642 "cwebdir/comm-w2c.ch" +fputs(_("\n! New name is a prefix of <"),stdout); +#line 975 "cwebdir/common.w" print_section_name(r); err_print(">"); @@ -973,32 +1203,40 @@ case extension:if(!ispref||first<=last) extend_section_name(r,first,last+1,ispref); return r; case bad_extension: -printf("\n! New name extends <"); +#line 648 "cwebdir/comm-w2c.ch" +fputs(_("\n! New name extends <"),stdout); +#line 987 "cwebdir/common.w" print_section_name(r); err_print(">"); return r; default: -printf("\n! Section name incompatible with <"); +#line 654 "cwebdir/comm-w2c.ch" +fputs(_("\n! Section name incompatible with <"),stdout); +#line 993 "cwebdir/common.w" print_prefix_name(r); -printf(">,\n which abbreviates <"); +#line 660 "cwebdir/comm-w2c.ch" +fputs(_(">,\n which abbreviates <"),stdout); +#line 996 "cwebdir/common.w" print_section_name(r); err_print(">"); return r; } -/*:54*/ +/*:52*/ #line 928 "cwebdir/common.w" ; } -/*:51*//*56:*/ +/*:49*//*54:*/ #line 1020 "cwebdir/common.w" -#line 529 "cwebdir/comm-w2c.ch" -static int -section_name_cmp(char**pfirst,int len,name_pointer r) +#line 675 "cwebdir/comm-w2c.ch" +static int section_name_cmp( +char**pfirst, +int len, +name_pointer r) #line 1025 "cwebdir/common.w" { char*first= *pfirst; @@ -1013,37 +1251,44 @@ else ispref= 0,ss++,q= name_dir; switch(c= web_strcmp(first,len,s,ss-s)){ case equal:if(q==name_dir) if(ispref){ -*pfirst= first+(ss-s); +#line 684 "cwebdir/comm-w2c.ch" +*pfirst= first+(ptrdiff_t)(ss-s); +#line 1039 "cwebdir/common.w" return extension; }else return equal; else return(q->byte_start==(q+1)->byte_start)?equal:prefix; case extension: if(!ispref)return bad_extension; first+= ss-s; -if(q!=name_dir){len-= ss-s;s= q->byte_start;r= q;continue;} +#line 690 "cwebdir/comm-w2c.ch" +if(q!=name_dir){len-= (int)(ss-s);s= q->byte_start;r= q;continue;} +#line 1046 "cwebdir/common.w" *pfirst= first;return extension; default:return c; } } } -/*:56*//*60:*/ +/*:54*//*58:*/ #line 1095 "cwebdir/common.w" +#line 716 "cwebdir/comm-w2c.ch" void -#line 549 "cwebdir/comm-w2c.ch" - err_print(const char*s) +err_print( +const char*s) #line 1099 "cwebdir/common.w" { char*k,*l; printf(*s=='!'?"\n%s":"%s",s); -if(web_file_open)/*61:*/ +if(web_file_open)/*59:*/ #line 1115 "cwebdir/common.w" {if(changing&&include_depth==change_depth) -printf(". (l. %d of change file)\n",change_line); -else if(include_depth==0)printf(". (l. %d)\n",cur_line); -else printf(". (l. %d of include file %s)\n",cur_line,cur_file_name); +#line 726 "cwebdir/comm-w2c.ch" +printf(_(". (l. %d of change file)\n"),change_line); +else if(include_depth==0)printf(_(". (l. %d)\n"),cur_line); +else printf(_(". (l. %d of include file %s)\n"),cur_line,cur_file_name); +#line 1120 "cwebdir/common.w" l= (loc>=limit?limit:loc); if(l> buffer){ for(k= buffer;k<l;k++) @@ -1057,69 +1302,94 @@ if(*limit=='|')putchar('|'); putchar(' '); } -/*:61*/ +/*:59*/ #line 1102 "cwebdir/common.w" ; update_terminal;mark_error; } -/*:60*//*63:*/ +/*:58*//*61:*/ #line 1150 "cwebdir/common.w" -#line 569 "cwebdir/comm-w2c.ch" +#line 765 "cwebdir/comm-w2c.ch" int wrap_up(void){ -#line 1152 "cwebdir/common.w" -putchar('\n'); +if(show_progress)new_line; +#line 1153 "cwebdir/common.w" if(show_stats) print_stats(); -/*64:*/ +#line 772 "cwebdir/comm-w2c.ch" +/*62:*/ #line 1160 "cwebdir/common.w" switch(history){ -case spotless:if(show_happiness)printf("(No errors were found.)\n");break; +#line 796 "cwebdir/comm-w2c.ch" +case spotless: +if(show_happiness)puts(_("(No errors were found.)"));break; case harmless_message: -printf("(Did you see the warning message above?)\n");break; +puts(_("(Did you see the warning message above?)"));break; case error_message: -printf("(Pardon me, but I think I spotted something wrong.)\n");break; -case fatal_message:printf("(That was a fatal error, my friend.)\n"); +puts(_("(Pardon me, but I think I spotted something wrong.)"));break; +case fatal_message: +puts(_("(That was a fatal error, my friend.)")); +#line 1168 "cwebdir/common.w" } -/*:64*/ -#line 1155 "cwebdir/common.w" -; -if(history> harmless_message)return(1); -else return(0); +/*:62*/ +#line 772 "cwebdir/comm-w2c.ch" + +/*87:*/ +#line 1200 "cwebdir/comm-w2c.ch" + +if(C_file)fclose(C_file); +if(tex_file)fclose(tex_file); +if(check_file)fclose(check_file); +if(strlen(check_file_name)) +remove(check_file_name); + +/*:87*/ +#line 773 "cwebdir/comm-w2c.ch" + +#line 780 "cwebdir/comm-w2c.ch" +switch(history){ +case harmless_message:return RETURN_WARN; +case error_message:return RETURN_ERROR; +case fatal_message:return RETURN_FAIL; +default:return RETURN_OK; +} +#line 1158 "cwebdir/common.w" } -/*:63*//*66:*/ -#line 1179 "cwebdir/common.w" +/*:61*//*64:*/ +#line 818 "cwebdir/comm-w2c.ch" void -#line 589 "cwebdir/comm-w2c.ch" - fatal(const char*s,const char*t) +fatal( +const char*s,const char*t) #line 1182 "cwebdir/common.w" { -#line 595 "cwebdir/comm-w2c.ch" -if(*s)printf("%s",s); +#line 826 "cwebdir/comm-w2c.ch" +if(*s)fputs(s,stdout); #line 1184 "cwebdir/common.w" err_print(t); history= fatal_message;exit(wrap_up()); } -/*:66*//*67:*/ -#line 1190 "cwebdir/common.w" +/*:64*//*65:*/ +#line 834 "cwebdir/comm-w2c.ch" void -#line 604 "cwebdir/comm-w2c.ch" - overflow(const char*t) +overflow( +const char*t) #line 1193 "cwebdir/common.w" { -printf("\n! Sorry, %s capacity exceeded",t);fatal("",""); +#line 842 "cwebdir/comm-w2c.ch" +printf(_("\n! Sorry, %s capacity exceeded"),t);fatal("",""); +#line 1195 "cwebdir/common.w" } -/*:67*//*72:*/ +/*:65*//*70:*/ #line 1254 "cwebdir/common.w" -#line 663 "cwebdir/comm-w2c.ch" +#line 922 "cwebdir/comm-w2c.ch" static void scan_args(void) #line 1257 "cwebdir/common.w" @@ -1129,85 +1399,103 @@ char*name_pos; register char*s; boolean found_web= 0,found_change= 0,found_out= 0; -boolean flag_change; +#line 1264 "cwebdir/common.w" + +#line 934 "cwebdir/comm-w2c.ch" + +#if defined DEV_NULL +strncpy(change_file_name,DEV_NULL,max_file_name_length-2); +change_file_name[max_file_name_length-2]= '\0'; +#elif defined _DEV_NULL +strncpy(change_file_name,_DEV_NULL,max_file_name_length-2); +change_file_name[max_file_name_length-2]= '\0'; +#else +strcpy(change_file_name,"/dev/null"); +#endif while(--argc> 0){ -if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*76:*/ -#line 688 "cwebdir/comm-w2c.ch" +#line 1266 "cwebdir/common.w" +if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*74:*/ +#line 1017 "cwebdir/comm-w2c.ch" { if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0) -/*86:*/ -#line 803 "cwebdir/comm-w2c.ch" -usagehelp(program==ctangle?CTANGLEHELP:CWEAVEHELP,NULL); +/*93:*/ +#line 1300 "cwebdir/comm-w2c.ch" +cb_usagehelp(program==ctangle?CTANGLEHELP: +program==cweave?CWEAVEHELP:CTWILLHELP,NULL); + + +/*:93*/ +#line 1021 "cwebdir/comm-w2c.ch" -/*:86*/ -#line 691 "cwebdir/comm-w2c.ch" -; if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0) -/*87:*/ -#line 812 "cwebdir/comm-w2c.ch" -printversionandexit((program==ctangle?ctangle_banner:cweave_banner), -"Silvio Levy and Donald E. Knuth",NULL,NULL); +/*96:*/ +#line 1356 "cwebdir/comm-w2c.ch" +printversionandexit(cb_banner, +program==ctwill?"Donald E. Knuth":"Silvio Levy and Donald E. Knuth", +NULL,NULL); -/*:87*/ -#line 693 "cwebdir/comm-w2c.ch" -; -#line 1346 "cwebdir/common.w" -if(**argv=='-')flag_change= 0; -#line 699 "cwebdir/comm-w2c.ch" -else flag_change= 1; -if(*(*argv+1)=='d') -if(sscanf(*argv+2,"%u",&kpathsea_debug)!=1)/*77:*/ + +/*:96*/ +#line 1024 "cwebdir/comm-w2c.ch" + +for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) +if(*dot_pos=='d'){ +if(sscanf(*argv+2,"%u",&kpathsea_debug)!=1)/*75:*/ #line 1352 "cwebdir/common.w" { -#line 722 "cwebdir/comm-w2c.ch" -if(program==ctangle){ -fprintf(stderr,"ctangle: Need one to three file arguments.\n"); -usage("ctangle"); -}else{ -fprintf(stderr,"cweave: Need one to three file arguments.\n"); -usage("cweave"); -} +#line 1051 "cwebdir/comm-w2c.ch" +cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); + #line 1362 "cwebdir/common.w" } -/*:77*/ -#line 701 "cwebdir/comm-w2c.ch" -; -#line 1348 "cwebdir/common.w" -for(dot_pos= *argv+1;*dot_pos> '\0';dot_pos++) -#line 707 "cwebdir/comm-w2c.ch" -flags[(unsigned char)*dot_pos]= flag_change; +#line 1058 "cwebdir/comm-w2c.ch" +/*:75*/ +#line 1027 "cwebdir/comm-w2c.ch" + +}else +if(*dot_pos=='l'){ +use_language= ++dot_pos; +break; +}else +#line 1038 "cwebdir/comm-w2c.ch" + flags[(eight_bits)*dot_pos]= flag_change; #line 1350 "cwebdir/common.w" } -/*:76*/ +/*:74*/ #line 1266 "cwebdir/common.w" else{ s= name_pos= *argv;dot_pos= NULL; +#line 955 "cwebdir/comm-w2c.ch" while(*s){ if(*s=='.')dot_pos= s++; -else if(*s=='/')dot_pos= NULL,name_pos= ++s; +else if(*s==DIR_SEPARATOR||*s==DEVICE_SEPARATOR||*s=='/') +dot_pos= NULL,name_pos= ++s; else s++; } -if(!found_web)/*73:*/ + +#line 1274 "cwebdir/common.w" +if(!found_web)/*71:*/ #line 1292 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) -/*78:*/ -#line 1364 "cwebdir/common.w" -fatal("! Filename too long\n",*argv); +/*76:*/ +#line 1058 "cwebdir/comm-w2c.ch" +fatal(_("! Filename too long\n"),*argv); +#line 1365 "cwebdir/common.w" -/*:78*/ +/*:76*/ #line 1295 "cwebdir/common.w" ; if(dot_pos==NULL) @@ -1224,45 +1512,50 @@ sprintf(C_file_name,"%s.c",name_pos); found_web= 1; } -/*:73*/ +/*:71*/ #line 1275 "cwebdir/common.w" -else if(!found_change)/*74:*/ +else if(!found_change)/*72:*/ #line 1310 "cwebdir/common.w" { -if(strcmp(*argv,"-")==0)found_change= -1; -else{ +#line 992 "cwebdir/comm-w2c.ch" +if(strcmp(*argv,"-")!=0){ +#line 1314 "cwebdir/common.w" if(s-*argv> max_file_name_length-4) -/*78:*/ -#line 1364 "cwebdir/common.w" -fatal("! Filename too long\n",*argv); +/*76:*/ +#line 1058 "cwebdir/comm-w2c.ch" +fatal(_("! Filename too long\n"),*argv); +#line 1365 "cwebdir/common.w" -/*:78*/ +/*:76*/ #line 1315 "cwebdir/common.w" ; if(dot_pos==NULL) sprintf(change_file_name,"%s.ch",*argv); else strcpy(change_file_name,*argv); -found_change= 1; +#line 999 "cwebdir/comm-w2c.ch" } +found_change= 1; +#line 1321 "cwebdir/common.w" } -/*:74*/ +/*:72*/ #line 1276 "cwebdir/common.w" -else if(!found_out)/*75:*/ +else if(!found_out)/*73:*/ #line 1323 "cwebdir/common.w" { if(s-*argv> max_file_name_length-5) -/*78:*/ -#line 1364 "cwebdir/common.w" -fatal("! Filename too long\n",*argv); +/*76:*/ +#line 1058 "cwebdir/comm-w2c.ch" +fatal(_("! Filename too long\n"),*argv); +#line 1365 "cwebdir/common.w" -/*:78*/ +/*:76*/ #line 1326 "cwebdir/common.w" ; if(dot_pos==NULL){ @@ -1273,7 +1566,9 @@ sprintf(C_file_name,"%s.c",*argv); }else{ strcpy(tex_file_name,*argv); strcpy(C_file_name,*argv); -if(flags['x']){ +#line 1006 "cwebdir/comm-w2c.ch" +if(make_xrefs){ +#line 1336 "cwebdir/common.w" *dot_pos= 0; sprintf(idx_file_name,"%s.idx",*argv); sprintf(scn_file_name,"%s.scn",*argv); @@ -1282,51 +1577,84 @@ sprintf(scn_file_name,"%s.scn",*argv); found_out= 1; } -#line 688 "cwebdir/comm-w2c.ch" -/*:75*/ +#line 1016 "cwebdir/comm-w2c.ch" +/*:73*/ #line 1277 "cwebdir/common.w" -else/*77:*/ +else/*75:*/ #line 1352 "cwebdir/common.w" { -#line 722 "cwebdir/comm-w2c.ch" -if(program==ctangle){ -fprintf(stderr,"ctangle: Need one to three file arguments.\n"); -usage("ctangle"); -}else{ -fprintf(stderr,"cweave: Need one to three file arguments.\n"); -usage("cweave"); -} +#line 1051 "cwebdir/comm-w2c.ch" +cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); + #line 1362 "cwebdir/common.w" } -/*:77*/ +#line 1058 "cwebdir/comm-w2c.ch" +/*:75*/ #line 1278 "cwebdir/common.w" ; } } -if(!found_web)/*77:*/ +if(!found_web)/*75:*/ #line 1352 "cwebdir/common.w" { -#line 722 "cwebdir/comm-w2c.ch" -if(program==ctangle){ -fprintf(stderr,"ctangle: Need one to three file arguments.\n"); -usage("ctangle"); -}else{ -fprintf(stderr,"cweave: Need one to three file arguments.\n"); -usage("cweave"); -} +#line 1051 "cwebdir/comm-w2c.ch" +cb_usage(program==ctangle?"ctangle":program==cweave?"cweave":"ctwill"); + #line 1362 "cwebdir/common.w" } -/*:77*/ +#line 1058 "cwebdir/comm-w2c.ch" +/*:75*/ #line 1281 "cwebdir/common.w" ; -#line 673 "cwebdir/comm-w2c.ch" -if(found_change<=0)strcpy(change_file_name,DEV_NULL); #line 1283 "cwebdir/common.w" } -/*:72*/ +#line 977 "cwebdir/comm-w2c.ch" +/*:70*//*95:*/ +#line 1314 "cwebdir/comm-w2c.ch" + +void cb_show_banner(void) +{ +textdomain("cweb-tl"); + +printf("%s%s\n",cb_banner,versionstring); +textdomain("cweb"); + +} + +static void cb_usage(const_string str) +{ +textdomain("cweb-tl"); + +fprintf(stderr,_("%s: Need one to three file arguments.\n"),str); +fprintf(stderr,_("Try `%s --help' for more information.\n"),str); + +textdomain("cweb"); + +history= fatal_message;exit(wrap_up()); +} + +static void cb_usagehelp(const_string*message,const_string bug_email) +{ +if(!bug_email) +bug_email= "tex-k@tug.org"; +textdomain("web2c-help"); + +while(*message){ +printf("%s\n",strcmp("",*message)?_(*message):*message); +++message; +} +textdomain("cweb-tl"); + +printf(_("\nEmail bug reports to %s.\n"),bug_email); +textdomain("cweb"); + +history= spotless;exit(wrap_up()); +} + +/*:95*/ |