summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2012-07-09 12:04:10 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2012-07-09 12:04:10 +0000
commit189b1c7cbb80cd8f4fd56bb371c6256bdb28a79a (patch)
tree062bd8abb4f243d912401ec530527365392dd5d7
parent9b5d983d826f99ea00ef534d1f908e3816c58c1b (diff)
cweb: Use binary mode for output files (from W32TeX)
git-svn-id: svn://tug.org/texlive/trunk@26962 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/ctangleboot.cin42
-rw-r--r--Build/source/texk/web2c/cwebboot.cin12
-rw-r--r--Build/source/texk/web2c/cwebboot.hin8
-rw-r--r--Build/source/texk/web2c/cwebdir/ChangeLog5
-rw-r--r--Build/source/texk/web2c/cwebdir/comm-w2c.ch14
-rw-r--r--Build/source/texk/web2c/cwebdir/ctang-w2c.ch8
-rw-r--r--Build/source/texk/web2c/cwebdir/cweav-w2c.ch14
7 files changed, 74 insertions, 29 deletions
diff --git a/Build/source/texk/web2c/ctangleboot.cin b/Build/source/texk/web2c/ctangleboot.cin
index 727ff5a22ea..9998974f58c 100644
--- a/Build/source/texk/web2c/ctangleboot.cin
+++ b/Build/source/texk/web2c/ctangleboot.cin
@@ -375,28 +375,28 @@ static void phase_two(void);
/*:40*//*45:*/
#line 602 "cwebdir/ctangle.w"
-#line 257 "cwebdir/ctang-w2c.ch"
+#line 265 "cwebdir/ctang-w2c.ch"
static void output_defs(void);
#line 604 "cwebdir/ctangle.w"
/*:45*//*47:*/
#line 648 "cwebdir/ctangle.w"
-#line 275 "cwebdir/ctang-w2c.ch"
+#line 283 "cwebdir/ctang-w2c.ch"
static void out_char(eight_bits);
#line 650 "cwebdir/ctangle.w"
/*:47*//*89:*/
#line 1457 "cwebdir/ctangle.w"
-#line 370 "cwebdir/ctang-w2c.ch"
+#line 378 "cwebdir/ctang-w2c.ch"
static void phase_one(void);
#line 1459 "cwebdir/ctangle.w"
/*:89*//*91:*/
#line 1475 "cwebdir/ctangle.w"
-#line 388 "cwebdir/ctang-w2c.ch"
+#line 396 "cwebdir/ctang-w2c.ch"
static void skip_limbo(void);
#line 1477 "cwebdir/ctangle.w"
@@ -676,7 +676,9 @@ 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");
+#line 257 "cwebdir/ctang-w2c.ch"
+C_file= fopen(output_file_name,"wb");
+#line 578 "cwebdir/ctangle.w"
if(C_file==0)fatal("! Cannot open output file:",output_file_name);
printf("\n(%s)",output_file_name);update_terminal;
@@ -700,7 +702,7 @@ if(show_happiness)printf("\nDone.");
/*:41*//*46:*/
#line 605 "cwebdir/ctangle.w"
-#line 266 "cwebdir/ctang-w2c.ch"
+#line 274 "cwebdir/ctang-w2c.ch"
static void
output_defs(void)
#line 608 "cwebdir/ctangle.w"
@@ -743,7 +745,7 @@ pop_level(0);
#line 651 "cwebdir/ctangle.w"
static void
-#line 284 "cwebdir/ctang-w2c.ch"
+#line 292 "cwebdir/ctang-w2c.ch"
out_char(eight_bits cur_char)
#line 655 "cwebdir/ctangle.w"
{
@@ -844,7 +846,7 @@ default:C_putc(cur_char);out_state= normal;break;
/*:48*//*57:*/
#line 813 "cwebdir/ctangle.w"
-#line 293 "cwebdir/ctang-w2c.ch"
+#line 301 "cwebdir/ctang-w2c.ch"
static eight_bits
skip_ahead(void)
#line 816 "cwebdir/ctangle.w"
@@ -864,7 +866,7 @@ if(c!=ignore||*(loc-1)=='>')return(c);
/*:57*//*59:*/
#line 848 "cwebdir/ctangle.w"
-#line 303 "cwebdir/ctang-w2c.ch"
+#line 311 "cwebdir/ctang-w2c.ch"
static int
skip_comment(boolean is_long_comment)
#line 851 "cwebdir/ctangle.w"
@@ -900,7 +902,7 @@ else loc++;
/*:59*//*62:*/
#line 900 "cwebdir/ctangle.w"
-#line 320 "cwebdir/ctang-w2c.ch"
+#line 328 "cwebdir/ctang-w2c.ch"
static eight_bits
get_next(void)
#line 903 "cwebdir/ctangle.w"
@@ -922,7 +924,7 @@ else id_first= cur_file_name;
id_loc= id_first+strlen(id_first);
if(changing)store_two_bytes((sixteen_bits)change_line);
else store_two_bytes((sixteen_bits)cur_line);
-#line 351 "cwebdir/ctang-w2c.ch"
+#line 359 "cwebdir/ctang-w2c.ch"
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
#line 1234 "cwebdir/ctangle.w"
@@ -1186,7 +1188,7 @@ mistake:/*63:*/
switch(c){
case'+':if(*loc=='+')compress(plus_plus);break;
case'-':if(*loc=='-'){compress(minus_minus);}
-#line 330 "cwebdir/ctang-w2c.ch"
+#line 338 "cwebdir/ctang-w2c.ch"
else if(*loc=='>'){if(*(loc+1)=='*'){loc++;compress(minus_gt_ast);}
else compress(minus_gt);}break;
#line 956 "cwebdir/ctangle.w"
@@ -1216,7 +1218,7 @@ return(c);
/*:62*//*75:*/
#line 1199 "cwebdir/ctangle.w"
-#line 341 "cwebdir/ctang-w2c.ch"
+#line 349 "cwebdir/ctang-w2c.ch"
static void
scan_repl(eight_bits t)
#line 1203 "cwebdir/ctangle.w"
@@ -1231,7 +1233,7 @@ else id_first= cur_file_name;
id_loc= id_first+strlen(id_first);
if(changing)store_two_bytes((sixteen_bits)change_line);
else store_two_bytes((sixteen_bits)cur_line);
-#line 351 "cwebdir/ctang-w2c.ch"
+#line 359 "cwebdir/ctang-w2c.ch"
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
#line 1234 "cwebdir/ctangle.w"
@@ -1276,7 +1278,7 @@ else id_first= cur_file_name;
id_loc= id_first+strlen(id_first);
if(changing)store_two_bytes((sixteen_bits)change_line);
else store_two_bytes((sixteen_bits)cur_line);
-#line 351 "cwebdir/ctang-w2c.ch"
+#line 359 "cwebdir/ctang-w2c.ch"
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
#line 1234 "cwebdir/ctangle.w"
@@ -1301,7 +1303,7 @@ else id_first= cur_file_name;
id_loc= id_first+strlen(id_first);
if(changing)store_two_bytes((sixteen_bits)change_line);
else store_two_bytes((sixteen_bits)cur_line);
-#line 351 "cwebdir/ctang-w2c.ch"
+#line 359 "cwebdir/ctang-w2c.ch"
{int a_l= id_lookup(id_first,id_loc,0)-name_dir;app_repl((a_l/0400)+0200);
app_repl(a_l%0400);}
#line 1234 "cwebdir/ctangle.w"
@@ -1407,7 +1409,7 @@ cur_text= text_ptr;(++text_ptr)->tok_start= tok_ptr;
/*:75*//*82:*/
#line 1357 "cwebdir/ctangle.w"
-#line 361 "cwebdir/ctang-w2c.ch"
+#line 369 "cwebdir/ctang-w2c.ch"
static void
scan_section(void)
#line 1360 "cwebdir/ctangle.w"
@@ -1520,7 +1522,7 @@ cur_text->text_link= section_flag;
/*:82*//*90:*/
#line 1460 "cwebdir/ctangle.w"
-#line 379 "cwebdir/ctang-w2c.ch"
+#line 387 "cwebdir/ctang-w2c.ch"
static void
phase_one(void){
#line 1463 "cwebdir/ctangle.w"
@@ -1536,7 +1538,7 @@ phase= 2;
/*:90*//*92:*/
#line 1478 "cwebdir/ctangle.w"
-#line 397 "cwebdir/ctang-w2c.ch"
+#line 405 "cwebdir/ctang-w2c.ch"
static void
skip_limbo(void)
#line 1481 "cwebdir/ctangle.w"
@@ -1597,7 +1599,7 @@ default:err_print("! Double @ should be used in limbo");
#line 1533 "cwebdir/ctangle.w"
void
-#line 406 "cwebdir/ctang-w2c.ch"
+#line 414 "cwebdir/ctang-w2c.ch"
print_stats(void){
#line 1536 "cwebdir/ctangle.w"
printf("\nMemory usage statistics:\n");
diff --git a/Build/source/texk/web2c/cwebboot.cin b/Build/source/texk/web2c/cwebboot.cin
index 1ecc14bcd56..a52fa9ee2b5 100644
--- a/Build/source/texk/web2c/cwebboot.cin
+++ b/Build/source/texk/web2c/cwebboot.cin
@@ -344,12 +344,16 @@ show_banner= show_happiness= show_progress= 1;
scan_args();
if(program==ctangle){
-if((C_file= fopen(C_file_name,"w"))==NULL)
+#line 668 "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);
}
else{
-if((tex_file= fopen(tex_file_name,"w"))==NULL)
+#line 674 "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);
}
@@ -1122,7 +1126,7 @@ if((**(++argv)=='-'||**argv=='+')&&*(*argv+1))/*76:*/
{
if(strcmp("-help",*argv)==0||strcmp("--help",*argv)==0)
/*86:*/
-#line 712 "cwebdir/comm-w2c.ch"
+#line 726 "cwebdir/comm-w2c.ch"
usagehelp(program==ctangle?CTANGLEHELP:CWEAVEHELP,NULL);
@@ -1132,7 +1136,7 @@ usagehelp(program==ctangle?CTANGLEHELP:CWEAVEHELP,NULL);
;
if(strcmp("-version",*argv)==0||strcmp("--version",*argv)==0)
/*87:*/
-#line 721 "cwebdir/comm-w2c.ch"
+#line 735 "cwebdir/comm-w2c.ch"
printversionandexit((program==ctangle?ctangle_banner:cweave_banner),
"Silvio Levy and Donald E. Knuth",NULL,NULL);
diff --git a/Build/source/texk/web2c/cwebboot.hin b/Build/source/texk/web2c/cwebboot.hin
index 8360442207a..f7c5bee5ef2 100644
--- a/Build/source/texk/web2c/cwebboot.hin
+++ b/Build/source/texk/web2c/cwebboot.hin
@@ -1,5 +1,5 @@
/*84:*/
-#line 701 "cwebdir/comm-w2c.ch"
+#line 715 "cwebdir/comm-w2c.ch"
/* Prototypes for functions, either
* declared in common.w and used in ctangle.w and cweave.w, or
@@ -43,7 +43,7 @@ extern void overflow(const char*);
#line 1175 "cwebdir/common.w"
/*:65*//*83:*/
-#line 682 "cwebdir/comm-w2c.ch"
+#line 696 "cwebdir/comm-w2c.ch"
extern void common_init(void);
extern int input_ln(FILE*fp);
@@ -56,9 +56,9 @@ extern void sprint_section_name(char*dest,name_pointer p);
extern name_pointer section_lookup(char*first,char*last,int ispref);
#line 1417 "cwebdir/common.w"
-#line 697 "cwebdir/comm-w2c.ch"
+#line 711 "cwebdir/comm-w2c.ch"
/*:83*/
-#line 705 "cwebdir/comm-w2c.ch"
+#line 719 "cwebdir/comm-w2c.ch"
extern const char*versionstring;
diff --git a/Build/source/texk/web2c/cwebdir/ChangeLog b/Build/source/texk/web2c/cwebdir/ChangeLog
index 0848bfed769..9b1ede03ba9 100644
--- a/Build/source/texk/web2c/cwebdir/ChangeLog
+++ b/Build/source/texk/web2c/cwebdir/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-18 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ * {comm,ctang,cweav}-w2c.ch: Use binary mode for output files.
+ From Akira Kakuto <kakuto@fuk.kindai.ac.jp> (W32TeX).
+
2011-04-19 Peter Breitenlohner <peb@mppmu.mpg.de>
Avoid 'differ in signedness' warnings.
diff --git a/Build/source/texk/web2c/cwebdir/comm-w2c.ch b/Build/source/texk/web2c/cwebdir/comm-w2c.ch
index cf1f9ede4fa..1561f961697 100644
--- a/Build/source/texk/web2c/cwebdir/comm-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/comm-w2c.ch
@@ -660,6 +660,20 @@ FILE *active_file; /* currently active file for \.{CWEAVE} output */
char *found_filename; /* filename found by |kpse_find_file| */
@z
+Section 78.
+
+@x l.1380 Use binary mode for output files
+ if ((C_file=fopen(C_file_name,"w"))==NULL)
+@y
+ if ((C_file=fopen(C_file_name,"wb"))==NULL)
+@z
+
+@x l.1386 Use binary mode for output files
+ if ((tex_file=fopen(tex_file_name,"w"))==NULL)
+@y
+ if ((tex_file=fopen(tex_file_name,"wb"))==NULL)
+@z
+
Section 81. (reused)
diff --git a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
index 82aec2d9f49..d4d301f7bd4 100644
--- a/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/ctang-w2c.ch
@@ -249,6 +249,14 @@ static void
phase_two (void) {
@z
+Section 43.
+
+@x l.577 Use binary mode for output files
+ C_file=fopen(output_file_name,"w");
+@y
+ C_file=fopen(output_file_name,"wb");
+@z
+
Section 46.
@x l.603
diff --git a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch
index 723daaf585e..a4f49e71470 100644
--- a/Build/source/texk/web2c/cwebdir/cweav-w2c.ch
+++ b/Build/source/texk/web2c/cwebdir/cweav-w2c.ch
@@ -891,9 +891,21 @@ static void
phase_three (void) {
@z
+@x l.4309 Use binary mode for output files
+ if ((idx_file=fopen(idx_file_name,"w"))==NULL)
+@y
+ if ((idx_file=fopen(idx_file_name,"wb"))==NULL)
+@z
+
+@x l.4324 Use binary mode for output files
+ if ((scn_file=fopen(scn_file_name,"w"))==NULL)
+@y
+ if ((scn_file=fopen(scn_file_name,"wb"))==NULL)
+@z
+
Section 235.
-@x
+@x l.4440
strcpy(collate+1," \1\2\3\4\5\6\7\10\11\12\13\14\15\16\17");
/* 16 characters + 1 = 17 */
strcpy(collate+17,"\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37");