From 6fec78c78a04dcd09ef617c18d78aa5df9f63557 Mon Sep 17 00:00:00 2001 From: maqiyuan Date: Thu, 6 Feb 2014 22:35:18 +0800 Subject: [PATCH] overflow: str_number -> char *. --- src/texsourc/coerce.h | 14 +-- src/texsourc/itex.c | 270 ++++++++++++++++++++++-------------------------- src/texsourc/local.c | 266 +++++++++++++++++++++++------------------------ src/texsourc/makefile | 3 +- src/texsourc/openinou.c | 99 +++++++++--------- src/texsourc/subroute.c | 10 +- src/texsourc/tex0.c | 30 +++--- src/texsourc/tex1.c | 28 ++--- src/texsourc/tex2.c | 30 +++--- src/texsourc/tex3.c | 20 ++-- src/texsourc/tex4.c | 4 +- src/texsourc/tex6.c | 6 +- src/texsourc/tex8.c | 8 +- src/texsourc/texd.h | 12 +-- src/texsourc/texmf.c | 2 +- 15 files changed, 383 insertions(+), 419 deletions(-) diff --git a/src/texsourc/coerce.h b/src/texsourc/coerce.h index fa83f89..7065075 100644 --- a/src/texsourc/coerce.h +++ b/src/texsourc/coerce.h @@ -79,8 +79,8 @@ int fatal_error_(char *); #define fatal_error(s) fatal_error_((char *) (s)) #define fatalerror_regmem // void overflow_(str_number, integer); -int overflow_(str_number, integer); -#define overflow(s, n) overflow_((str_number) (s), (integer) (n)) +int overflow_(char *, integer); +#define overflow(s, n) overflow_((char *) (s), (integer) (n)) #define overflow_regmem // void confusion_(str_number); int confusion_(str_number); @@ -853,8 +853,8 @@ bool load_fmt_file(void); /* bool load_fmt_file(); */ #define loadfmtfile_regmem register memory_word *mem=zmem, *eqtb=zeqtb; void close_files_and_terminate(void); /* void close_files_and_terminate(); */ #define closefilesandterminate_regmem register memory_word *eqtb=zeqtb; -// void final_clean_up(void); /* void final_clean_up(); */ -int final_clean_up(void); /* void final_clean_up(); */ +// void final_cleanup(void); /* void final_cleanup(); */ +int final_cleanup(void); /* void final_cleanup(); */ #define finalcleanup_regmem register memory_word *mem=zmem; void init_prim(void); /* void init_prim(); */ #define initprim_regmem register memory_word *eqtb=zeqtb; @@ -919,8 +919,8 @@ void jump_out(void); void error(void); void fatal_error_(char *); #define fatal_error(s) fatal_error_((char *) (s)) -void overflow_(str_number, integer); -#define overflow(s, n) overflow_((str_number) (s), (integer) (n)) +void overflow_(char *, integer); +#define overflow(s, n) overflow_((char *) (s), (integer) (n)) void confusion_(str_number); #define confusion(s) confusion_((str_number) (s)) bool init_terminal(void); @@ -1401,7 +1401,7 @@ void close_files_and_terminate(void); #else #define closefilesandterminate_regmem /* register memory_word *eqtb=zeqtb; */ #endif -void final_clean_up(void); +void final_cleanup(void); void init_prim(void); void debug_help(void); int texbody(void); /* 1993/Dec/16 bkph */ diff --git a/src/texsourc/itex.c b/src/texsourc/itex.c index ca1dbe2..1d54f0a 100644 --- a/src/texsourc/itex.c +++ b/src/texsourc/itex.c @@ -46,9 +46,8 @@ /* #define CHECKPOOL */ /* debugging only */ -#define ENDFMTCHECKSUM 69069L - #define BEGINFMTCHECKSUM 367403084L +#define ENDFMTCHECKSUM 69069L extern clock_t start_time, main_time, finish_time; /* in local.c */ @@ -86,7 +85,6 @@ if (!non_ascii) { for_end = 255; if(i <= for_end) do -/* xchr[i]= chr(i); */ xchr[i]= (char) i; /* 95/Jan/7 */ while(i++ < for_end); } @@ -460,8 +458,8 @@ if (!non_ascii) { /* do this part after allocating main memory */ #ifdef ALLOCATEMAIN -void initialize_aux(void) { - /* ??? */ +void initialize_aux (void) +{/* ??? */ #ifdef DEBUG wasmemend = mem_min; /* waslomax = mem_min; */ @@ -499,33 +497,29 @@ void line_break_ (integer finalwidowpenalty) /* savedbadness = 0; */ /* 96/Feb/9 */ pack_begin_line = mode_line; - mem[mem_top - 3].hh.v.RH = mem[head].hh.v.RH; + mem[mem_top - 3].hh.v.RH = link(head); if((tail >= hi_mem_min)) { - mem[tail].hh.v.RH = new_penalty(10000); - tail = mem[tail].hh.v.RH; + link(tail) = new_penalty(10000); + tail = link(tail); } else if(mem[tail].hh.b0 != 10) { - mem[tail].hh.v.RH = new_penalty(10000); - tail = mem[tail].hh.v.RH; + link(tail) = new_penalty(10000); + tail = link(tail); } - else { - - mem[tail].hh.b0 = 12; + else { + type(tail) = 12; delete_glue_ref(mem[tail + 1].hh.v.LH); flush_node_list(mem[tail + 1].hh.v.RH); mem[tail + 1].cint = 10000; - } - mem[tail].hh.v.RH = new_param_glue(14); + } + link(tail) = new_param_glue(par_fill_skip_code); /* *********************************************************************** */ /* following is new in 3.14159 */ init_cur_lang = prev_graf % 65536L; -/* init_cur_lang = prev_graf & 65535L; */ /* last 16 bits */ - init_l_hyf = prev_graf / 4194304L; /* 2^22 */ -/* init_l_hyf = prev_graf >> 22; */ /* top 10 bits */ + init_l_hyf = prev_graf / 4194304L; /* 2^22 */ init_r_hyf =(prev_graf / 65536L)% 64; -/* init_r_hyf =(prev_graf >> 16)& 65; */ /* next to last 6 bits */ /* *********************************************************************** */ pop_nest (); noshrinkerroryet = true; @@ -564,8 +558,7 @@ void line_break_ (integer finalwidowpenalty) second_width = eqtb[(hash_size + 3733)].cint; second_indent = 0; } - else { - + else { last_special_line = abs(eqtb[(hash_size + 3204)].cint); if(eqtb[(hash_size + 3204)].cint < 0) { @@ -576,9 +569,7 @@ void line_break_ (integer finalwidowpenalty) else first_indent = 0; second_width = eqtb[(hash_size + 3733)].cint; second_indent = 0; - } - else { - + } else { first_width = eqtb[(hash_size + 3733)].cint; first_indent = 0; second_width = eqtb[(hash_size + 3733)].cint - @@ -588,13 +579,10 @@ void line_break_ (integer finalwidowpenalty) else second_indent = 0; } } - else { - + else { last_special_line = mem[eqtb[(hash_size + 1312)].hh.v.RH].hh.v.LH - 1; - second_width = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 *(last_special_line + 1) - ].cint; - second_indent = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 * last_special_line + 1] - .cint; + second_width = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 *(last_special_line + 1)].cint; + second_indent = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 * last_special_line + 1].cint; } /* if looseness=0 then easy_line:=last_special_line */ if(eqtb[(hash_size + 3182)].cint == 0) @@ -660,12 +648,12 @@ void line_break_ (integer finalwidowpenalty) mem[q + 1].hh.v.LH = prev_graf + 1; mem[q + 2].cint = 0; mem[mem_top - 7].hh.v.RH = q; - active_width[1]= background[1]; - active_width[2]= background[2]; - active_width[3]= background[3]; - active_width[4]= background[4]; - active_width[5]= background[5]; - active_width[6]= background[6]; + active_width[1] = background[1]; + active_width[2] = background[2]; + active_width[3] = background[3]; + active_width[4] = background[4]; + active_width[5] = background[5]; + active_width[6] = background[6]; /* passive:=null; printed_node:=temp_head; pass_number:=0; */ passive = 0; printed_node = mem_top - 3; @@ -1181,10 +1169,10 @@ void prefixed_command (void) } if((cur_cmd != 97)&&(a % 4 != 0)) { print_err("You can't use `"); - print_esc("long"); /* */ - print(1175); /* ' or ` */ - print_esc("outer"); /* */ - print(1176); /* ' with ` */ + print_esc("long"); + print_string("' or `"); + print_esc("outer"); + print_string("' with `"); print_cmd_chr(cur_cmd, cur_chr); print_char(39); /* ' */ help1("I'll pretend you didn't say \\long or \\outer here."); @@ -1461,8 +1449,9 @@ void prefixed_command (void) print_err("Invalid code("); print_int(cur_val); if(p < (hash_size + 3474)) - print(1197); /*), should be in the range 0.. */ - else print(1198); /*), should be at most */ + print_string("), should be in the range 0.."); + else + print_string("), should be at most "); print_int(n); help1("I'm going to use 0 instead of that illegal code value."); error (); @@ -1659,7 +1648,7 @@ void bad_formator_pool (char *name, char *defaultname, char *envvar) fflush(stdout); #endif } - +/* sec 1303 */ bool load_fmt_file (void) {/* 6666 10 */ register bool Result; @@ -1667,17 +1656,17 @@ bool load_fmt_file (void) halfword p, q; integer x; - undump_int(x); /* CHECKSUM */ +/* sec 1308 */ + undump_int(x); /* CHECKSUM */ if (x != BEGINFMTCHECKSUM) /* magic FMT file start 4C 20 E6 15 hex */ goto lab6666; - undump_int(x); /* mem_bot */ -/* if(x != 0) */ + undump_int(x); /* mem_bot */ if(x != mem_bot) goto lab6666; - undump_int(x); /* mem_top */ -/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ + undump_int(x); /* mem_top */ + #ifdef ALLOCATEMAIN /* we already read this once earlier to grab mem_top */ if (trace_flag) { @@ -1689,34 +1678,33 @@ bool load_fmt_file (void) initialize_aux(); /* do `mem' part of initialize */ /* mem = zmem; */ /* update pointer to main memory */ #endif -/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ + if(x != mem_top) goto lab6666; - undump_int(x); /* eqtbsize */ - if(x != (hash_size + 4006)) /* eqtbsize */ + undump_int(x); /* eqtbsize */ + if(x != (hash_size + 4006)) /* eqtbsize */ goto lab6666; - undump_int(x); /* hash_prime */ + undump_int(x); /* hash_prime */ if(x != hash_prime) goto lab6666; - undump_int(x); /* hyphen_prime */ -/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ + undump_int(x); /* hyphen_prime */ + #ifdef ALLOCATEHYPHEN /* allow format files dumped with arbitrary (prime) hyphenation exceptions */ realloc_hyphen (x); /* reset_hyphen(); */ hyphen_prime = x; #endif -/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ -/* if(x != 607)*/ + if(x != hyphen_prime) goto lab6666; { - undump_int(x); /* pool_size */ + undump_int(x); /* pool_size */ if(x < 0) goto lab6666; -/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ + #ifdef ALLOCATESTRING - if(x > current_pool_size) { + if (x > current_pool_size) { if (trace_flag) { sprintf(log_line, "undump string pool reallocation (%d > %d)\n", x, current_pool_size); show_line(log_line, 0); @@ -1725,7 +1713,6 @@ bool load_fmt_file (void) } if(x > current_pool_size) /* 94/Jan/24 */ #else -/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(x > pool_size) #endif { @@ -1733,19 +1720,17 @@ bool load_fmt_file (void) sprintf(log_line, "%s%s\n", "---! Must increase the ", "string pool size"); show_line(log_line, 0); goto lab6666; - } - else pool_ptr = x; + } else pool_ptr = x; } { undump_int(x); /* max_strings */ if(x < 0) goto lab6666; -/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ + #ifdef ALLOCATESTRING - if(x > current_max_strings){ + if (x > current_max_strings) { if (trace_flag) { - sprintf(log_line, "undump string pointer reallocation (%d > %d)\n", - x, current_max_strings); + sprintf(log_line, "undump string pointer reallocation (%d > %d)\n", x, current_max_strings); show_line(log_line, 0); } str_start = realloc_str_start(x - current_max_strings + increment_max_strings); @@ -2198,47 +2183,45 @@ bool load_fmt_file (void) Result = false; return Result; } - -void final_clean_up (void) +/* sec 1335 */ +void final_cleanup (void) {/* 10 */ small_number c; c = cur_chr; /* small_number c */ - if(job_name == 0)open_log_file (); -/* ******************************** 3.14159 ***************************** */ - while(input_ptr > 0) - if(cur_input.state_field == 0){ + if (job_name == 0) open_log_file (); + while (input_ptr > 0) { + if (cur_input.state_field == 0) { end_token_list (); - } - else end_file_reading (); -/* *********************************************************************** */ - while(open_parens > 0){ - print(1270); /* )*/ + } else end_file_reading (); + } + while (open_parens > 0) { + print_string(" )"); decr(open_parens); } - if(cur_level > 1) { - print_nl("("); /*(*/ - print_esc("end occurred "); /* */ - print(1272); /* inside a group at level */ + if(cur_level > level_one) { + print_nl("("); + print_esc("end occurred "); + print_string("inside a group at level "); print_int(cur_level - 1); - print_char(41); /*)*/ + print_char(')'); } - while(cond_ptr != 0){ - print_nl("("); /*(*/ - print_esc("end occurred "); /* */ - print(1273); /* when */ + while (cond_ptr != 0) { + print_nl("("); + print_esc("end occurred "); + print_string("when "); print_cmd_chr(105, cur_if); /* i */ if(if_line != 0) { - print(1274); /* on line */ + print_string("on line "); print_int(if_line); } - print(1275); /* was incomplete) */ + print_string(" was incomplete)"); if_line = mem[cond_ptr + 1].cint; cur_if = mem[cond_ptr].hh.b1; /* *********************************************************************** */ - temp_ptr = cond_ptr; /* new in 3.14159 */ + temp_ptr = cond_ptr; /* new in 3.14159 */ cond_ptr = mem[cond_ptr].hh.v.RH; - free_node(temp_ptr, 2); /* new in 3.14159 */ + free_node(temp_ptr, 2); /* new in 3.14159 */ /* *********************************************************************** */ } if(history != 0) @@ -2246,7 +2229,7 @@ void final_clean_up (void) if(selector == 19) { selector = 17; - print_nl(" (see the transcript file for additional information)"); /* */ + print_nl(" (see the transcript file for additional information)"); selector = 19; } if(c == 1){ @@ -2270,7 +2253,7 @@ void final_clean_up (void) } #endif /* INITEX */ if (!is_initex) /* 2000/March/3 */ - print_nl(" (\\dump is performed only by INITEX)"); /* */ + print_nl(" (\\dump is performed only by INITEX)"); /* */ } } @@ -2596,7 +2579,7 @@ lab1: /* get here directly if ready_already already set ... */ // what if abort_flag is set now ? - final_clean_up(); + final_cleanup(); // if (abort_flag) return -1; @@ -2669,7 +2652,7 @@ void reset_trie (void) k = - (integer) trie_op_size; for_end = trie_op_size; if(k <= for_end) - do trieophash[k]= 0; + do trie_op_hash[k]= 0; while(k++ < for_end); } { @@ -2705,9 +2688,9 @@ void reset_hyphen (void) hyph_count = 0; } +/* split out to allow optimize for space, not time */ void do_initex (void) -{ /* split out to allow optimize for space, not time */ - +{ /* integer i; */ integer k; /* hyph_pointer z; */ @@ -2976,7 +2959,7 @@ void do_initex (void) /* hash_used = (hash_size + 514); */ hash_used = (hash_size + hash_extra + 514); /* 96/Jan/10 */ cs_count = 0; - if (trace_flag) show_line("itex cs_count=0 ", 0); /* debugging */ + if (trace_flag) show_line("itex cs_count = 0 ", 0); /* debugging */ /* eq_type(frozen_dont_expand) <- dont_expand; */ /* eqtb[10023].hh.b0 = 116; */ /* eqtb[(hash_size + 523)].hh.b0 = 116; */ @@ -3020,7 +3003,7 @@ void do_initex (void) while(k++ < for_end); } {register integer for_end; k = - (integer) trie_op_size; for_end = trie_op_size; if(k <= for_end) do - trieophash[k]= 0; + trie_op_hash[k]= 0; while(k++ < for_end); } {register integer for_end; k = 0; for_end = 255; if(k <= for_end) do trie_used[k]= min_trie_op; @@ -3120,19 +3103,19 @@ bool get_strings_started (void) } while(k++ < for_end); } - vstrcpy((char *) name_of_file + 1, poolname); + vstrcpy((char *) name_of_file + 1, pool_name); name_of_file[0]= ' '; - name_of_file[strlen(poolname) + 1]= ' '; - name_length = strlen(poolname); + name_of_file[strlen(pool_name) + 1]= ' '; + name_length = strlen(pool_name); /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ /* if(a_open_in(pool_file, TEXPOOLPATH)) */ flag = a_open_in(pool_file, TEXPOOLPATH); if (flag == 0) { /* 95/Feb/19 */ - poolname [name_length - 1] = '\0'; /* `tex.pool' => `tex.poo' */ - vstrcpy((char *) name_of_file + 1, poolname); + pool_name [name_length - 1] = '\0'; /* `tex.pool' => `tex.poo' */ + vstrcpy((char *) name_of_file + 1, pool_name); name_of_file[0]= ' '; - name_of_file[strlen(poolname)+ 1]= ' '; - name_length = strlen(poolname); + name_of_file[strlen(pool_name)+ 1]= ' '; + name_length = strlen(pool_name); flag = a_open_in(pool_file, TEXPOOLPATH); } if (flag) { @@ -3253,11 +3236,10 @@ lab30: (void) a_close(pool_file); Result = true; } - else { - + else { ; /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ - sprintf(log_line, "! I can't read %s.\n", poolname); + sprintf(log_line, "! I can't read %s.\n", pool_name); show_line(log_line, 1); if (! knuth_flag) show_line(" (Was unable to find tex.poo or tex.pool)\n", 0); /* extra explain */ @@ -3274,7 +3256,7 @@ void sort_avail (void) { halfword p, q, r; halfword oldrover; - p = get_node(1073741824L); /* 2^30 merge adjacent free nodes */ + p = get_node(1073741824L); /* 2^30 merge adjacent free nodes */ p = mem[rover + 1].hh.v.RH; /* mem[rover + 1].hh.v.RH = 262143L; */ /* NO! */ mem[rover + 1].hh.v.RH = empty_flag; @@ -3285,9 +3267,7 @@ void sort_avail (void) p = mem[q + 1].hh.v.RH; mem[q + 1].hh.v.RH = rover; rover = q; - } - else { - + } else { q = rover; while(mem[q + 1].hh.v.RH < p)q = mem[q + 1].hh.v.RH; r = mem[p + 1].hh.v.RH; @@ -3297,8 +3277,7 @@ void sort_avail (void) } p = rover; /* while(mem[p + 1].hh.v.RH != 262143L){ */ /* NO! */ - while(mem[p + 1].hh.v.RH != empty_flag){ - + while (mem[p + 1].hh.v.RH != empty_flag) { mem[mem[p + 1].hh.v.RH + 1].hh.v.LH = p; p = mem[p + 1].hh.v.RH; } @@ -3348,7 +3327,8 @@ void primitive_ (str_number s, quarterword c, halfword o) #ifdef INITEX trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v) -{/* 10 */ register trie_op_code Result; +{/* 10 */ + register trie_op_code Result; integer h; trie_op_code u; integer l; @@ -3356,14 +3336,13 @@ trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v) /* begin h:=abs(n+313*d+361*v+1009*cur_lang) mod (trie_op_size+trie_op_size) */ h = abs(toint(n)+ 313 * toint(d)+ 361 * toint(v)+ 1009 * toint(cur_lang)) %(trie_op_size - neg_trie_op_size)+ neg_trie_op_size; - while(true){ - + while (true) { /* if l=0 then {empty position found for a new op} */ - l = trieophash[h]; + l = trie_op_hash[h]; if(l == 0) { if(trie_op_ptr == trie_op_size){ - overflow(943, trie_op_size); /* pattern memory ops - NOT DYNAMIC */ + overflow("pattern memory ops", trie_op_size); /* pattern memory ops - NOT DYNAMIC */ return 0; // abort_flag set } u = trie_used[cur_lang]; @@ -3371,7 +3350,7 @@ trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v) if(u == max_trie_op){ /* overflow("pattern memory ops per language", max_quarterword-min_quarterword); ??? */ - overflow(944, max_trie_op - min_trie_op); /* pattern memory ops per language */ + overflow("pattern memory ops per language", max_trie_op - min_trie_op); /* pattern memory ops per language */ return 0; // abort_flag set } incr(trie_op_ptr); @@ -3383,7 +3362,7 @@ trie_op_code new_trie_op_ (small_number d, small_number n, trie_op_code v) hyf_num[trie_op_ptr]= n; hyf_next[trie_op_ptr]= v; trie_op_lang[trie_op_ptr]= cur_lang; - trieophash[h]= trie_op_ptr; + trie_op_hash[h]= trie_op_ptr; trie_op_val[trie_op_ptr]= u; Result = u; return(Result); @@ -3433,7 +3412,6 @@ trie_pointer compress_trie_ (trie_pointer p) if(p == 0) Result = 0; else { - trie_l[p]= compress_trie(trie_l[p]); trie_r[p]= compress_trie(trie_r[p]); Result = trie_node(p); @@ -3455,7 +3433,7 @@ void first_fit_ (trie_pointer p) if(trie_max < h + 256) { if(trie_size <= h + 256){ - overflow(945, trie_size); /* pattern memory - NOT DYNAMIC */ + overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */ /* not dynamic ---- but can be set -h=... from command line in ini-TeX */ return; // abort_flag set } @@ -3633,7 +3611,7 @@ void new_patterns (void) if((p == 0)||(c < trie_c[p])) { if(trie_ptr == trie_size){ - overflow(945, trie_size); /* pattern memory - NOT DYNAMIC */ + overflow("pattern memory", trie_size); /* pattern memory - NOT DYNAMIC */ /* not dynamic ---- but can be set -h=... from command line in ini-TeX */ return; // abort_flag set } @@ -3707,7 +3685,7 @@ void init_trie (void) for_end = trie_op_ptr; if(j <= for_end) do - trieophash[j]= op_start[trie_op_lang[j]] + trie_op_val[j]; + trie_op_hash[j]= op_start[trie_op_lang[j]] + trie_op_val[j]; while(j++ < for_end); } { @@ -3716,8 +3694,8 @@ void init_trie (void) for_end = trie_op_ptr; if(j <= for_end) do - while(trieophash[j]> j){ - k = trieophash[j]; + while(trie_op_hash[j]> j){ + k = trie_op_hash[j]; t = hyf_distance[k]; hyf_distance[k]= hyf_distance[j]; hyf_distance[j]= t; @@ -3727,8 +3705,8 @@ void init_trie (void) t = hyf_next[k]; hyf_next[k]= hyf_next[j]; hyf_next[j]= t; - trieophash[j]= trieophash[k]; - trieophash[k]= k; + trie_op_hash[j]= trie_op_hash[k]; + trie_op_hash[k]= k; } while(j++ < for_end); } @@ -3832,7 +3810,7 @@ void store_fmt_file (void) } /* end of if save_ptr != 0 */ selector = 21; - print(1266); /* (format= */ + print_string(" (format="); print(job_name); print_char(32); /* */ /* print_int(eqtb[(hash_size + 3186)].cint % 100); */ /* Y2K */ @@ -3854,12 +3832,12 @@ void store_fmt_file (void) if(pool_ptr + 1 > current_pool_size) str_pool = realloc_str_pool (increment_pool_size); if(pool_ptr + 1 > current_pool_size){ /* in case it failed 94/Jan/24 */ - overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/9 */ + overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/9 */ return; // abort_flag set } #else if(pool_ptr + 1 > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size */ return; // abort_flag set } #endif @@ -3893,7 +3871,7 @@ void store_fmt_file (void) )return; print_ln (); print_int(str_ptr); - print(1254); /* strings of total length */ + print_string("strings of total length "); print_int(pool_ptr); sort_avail (); var_used = 0; @@ -3929,7 +3907,7 @@ void store_fmt_file (void) dump_int(dyn_used); print_ln (); print_int(x); - print(1255); /* memory locations dumped; current usage is */ + print_string("memory locations dumped; current usage is "); print_int(var_used); print_char(38); /* & */ print_int(dyn_used); @@ -4018,7 +3996,7 @@ void store_fmt_file (void) dump_int(cs_count); print_ln (); print_int(cs_count); - print(1256); /* multiletter control sequences */ + print_string(" multiletter control sequences"); dump_int(fmem_ptr); { if (dumpthings(font_info[0], fmem_ptr)) return; @@ -4054,7 +4032,7 @@ void store_fmt_file (void) if(k <= for_end) do { - print_nl("\\font"); /* \font */ + print_nl("\\font"); /* print_esc(hash[(hash_size + 524) + k].v.RH); */ //print_esc(hash[(hash_size + hash_extra + 524) + k].v.RH); print_esc("");print(hash[(hash_size + hash_extra + 524) + k].v.RH); @@ -4062,9 +4040,9 @@ void store_fmt_file (void) print_file_name(font_name[k], font_area[k], 335); if(font_size[k]!= font_dsize[k]) { - print(738); /* at */ + print_string(" at "); print_scaled(font_size[k]); - print(394); /* pt */ + print_string("pt"); } } while(k++ < for_end); @@ -4072,9 +4050,9 @@ void store_fmt_file (void) } print_ln (); print_int(fmem_ptr - 7); - print(1257); /* words of font info for */ + print_string("words of font info for"); print_int(font_ptr - 0); - print(1258); /* preloaded font */ + print_string(" preloaded font"); if(font_ptr != 1) print_char(115); /* s */ dump_int(hyph_count); @@ -4094,7 +4072,7 @@ void store_fmt_file (void) } print_ln (); print_int(hyph_count); - print(1260); /* hyphenation exception */ + print_string(" hyphenation exception"); if(hyph_count != 1) print_char(115); /* s */ if(trie_not_ready) @@ -4115,12 +4093,12 @@ void store_fmt_file (void) )return; print_nl("Hyphenation trie of length "); /* */ print_int(trie_max); - print(1262); /* has */ + print_string("has"); print_int(trie_op_ptr); - print(1263); /* op */ + print_string("op"); if(trie_op_ptr != 1) print_char(115); /* s */ - print(1264); /* out of */ + print_string("out of"); print_int(trie_op_size); { register integer for_end; @@ -4129,9 +4107,9 @@ void store_fmt_file (void) if(k >= for_end) do if(trie_used[k]> 0) { - print_nl(" "); /* */ + print_nl(" "); print_int(trie_used[k]); - print(1265); /* for language */ + print_string("for language"); print_int(k); dump_int(k); dump_int(trie_used[k]); diff --git a/src/texsourc/local.c b/src/texsourc/local.c index fb1b067..60ca310 100644 --- a/src/texsourc/local.c +++ b/src/texsourc/local.c @@ -60,8 +60,6 @@ /* #define SHOWHEAPERROR */ /* debugging 96/Jan/10 */ -#define ALLOWDEMO /* demo model - limited lifetime - DANGER ! */ - #ifndef _WINDOWS /* #define HEAPWALK */ /* debugging 96/Oct/22 */ #endif @@ -72,13 +70,9 @@ #define REALLOC realloc #endif -// #include -#include // needed for clock_t etc. -/* #include */ /* for islower ? */ -// #include -#include /* _msize, _expand, HEAPOK et.c */ -// #include /* SH_DENYNO */ -#include /* for _getcwd() */ +#include +#include /* _msize, _expand, HEAPOK et.c */ +#include /* for _getcwd() */ #pragma warning(disable:4032) // different type when promoted #ifndef _WINDOWS @@ -86,9 +80,6 @@ #endif #pragma warning(default:4032) // different type when promoted` -// #include "getopt.h" - -// #include "texd.h" /* Argument handling, etc. */ /* from common.h - setup `main' in texmf.c */ /* extern int gargc; */ @@ -100,11 +91,11 @@ int wantcopyrght=1; char *compiletime = __TIME__; char *compiledate = __DATE__; -char *www = "http://www.tug.org/yandy"; /* not used ? */ -char *rights = "All Rights Reserved."; /* not used ? */ +char *www = "http://www.tug.org/yandy"; +char *rights = "All Rights Reserved."; char *copyright = "Copyright (C) 2007--2014 TeX Users Group."; -char *yandyversion = "2.2.3"; /* 00/Jun/18 */ -char *application = "Y & Y TeX"; /* 96/Jan/17 */ +char *yandyversion = "2.2.3"; /* 00/Jun/18 */ +char *application = "Y & Y TeX"; /* 96/Jan/17 */ char *tex_version = "This is TeX, Version 3.14159265"; /* change with upgrade */ /* #define COPYHASH 1890382 */ @@ -117,9 +108,9 @@ char *tex_version = "This is TeX, Version 3.14159265"; /* change with upgrade clock_t start_time, main_time, finish_time; -char *dvi_directory = ""; /* user specified directory for dvi file */ -char *log_directory = ""; /* user specified directory for log file */ -char *aux_directory = ""; /* user specified directory for aux file */ +char *dvi_directory = ""; /* user specified directory for dvi file */ +char *log_directory = ""; /* user specified directory for log file */ +char *aux_directory = ""; /* user specified directory for aux file */ char *texpath = ""; /* path to executable - used if env vars not set */ @@ -127,15 +118,13 @@ char *texpath = ""; /* path to executable - used if env vars not set */ char log_line[MAXLINE]; // used also in tex9.c -int mem_spec_flag=0; /* non-zero if `-m=...' was used */ -int format_spec=0; /* non-zero if a format specified on command line */ - -int closed_already=0; // make sure we don't try this more than once - +int mem_spec_flag = 0; /* non-zero if `-m=...' was used */ +int format_spec = 0; /* non-zero if a format specified on command line */ +int closed_already = 0; /* make sure we don't try this more than once */ bool reorder_arg_flag = true; /* put command line flags/arguments first */ /* Mapping from Windows ANSI to DOS code page 850 96/Jan/20 */ -/* Used in tex0.c with wintodos[c-128] */ +/* Used in tex0.c with wintodos[c-128] */ unsigned char wintodos[128] = { 0, 0, 0, 159, 0, 0, 0, 0, @@ -291,15 +280,13 @@ void read_xchr_sub (FILE *input) if (xchr[from]== (unsigned char) NOTDEF) xchr[from]= (unsigned char) to; else { - sprintf(log_line, "NOTE: %s collision: %d => %d, %d\n", - "xchr", from, xchr[from], to); + sprintf(log_line, "NOTE: %s collision: %d => %d, %d\n", "xchr", from, xchr[from], to); show_line(log_line, 0); } if (xord[to]== NOTDEF) xord[to]= (unsigned char) from; else { - sprintf(log_line, "NOTE: %s collision: %d => %d, %d\n", - "xord", to, xord[to], from); + sprintf(log_line, "NOTE: %s collision: %d => %d, %d\n", "xord", to, xord[to], from); show_line(log_line, 0); } count++; @@ -637,9 +624,7 @@ void show_maximums (FILE *output) unsigned heaptotal=0; /* no longer used */ heaptotal = heap_dump(stdout, 0); /* 94/Apr/3 */ #endif - sprintf(log_line, - "Max allocated %d --- max address %d\n", - total_allocated, max_address); + sprintf(log_line, "Max allocated %d --- max address %d\n", total_allocated, max_address); // if (output != NULL) fputs(log_line, output); // log file // else if (flag == 0) show_line(log_line, 0); // informative // else if (flag == 1) show_line(log_line, 1); // error @@ -654,7 +639,7 @@ void show_maximums (FILE *output) #ifdef USEOUREALLOC void *ourrealloc (void *old, size_t new_size) { - void * new; + void * mnew; size_t old_size, overlap; /* round up to nearest multiple of four bytes *//* avoid unlikely alignment */ @@ -673,18 +658,18 @@ void *ourrealloc (void *old, size_t new_size) #endif } #endif - new = _expand (old, new_size); /* first try and expand in place */ - if (new != NULL) { + mnew = _expand (old, new_size); /* first try and expand in place */ + if (mnew != NULL) { if (trace_flag) { sprintf(log_line, "EXPANDED! %d (%d) == %d (%d)\n", - new, new_size, old, old_size); + mnew, new_size, old, old_size); show_line(log_line, 0); } - return new; + return mnew; } /* *********************************************************************** */ /* do this if you want to call the real realloc next - */ - new = realloc (old, new_size); + mnew = realloc (old, new_size); #ifdef HEAPSHOW if (trace_flag) { show_line("AFTER REALLOC: \n", 0); @@ -693,24 +678,23 @@ void *ourrealloc (void *old, size_t new_size) #endif } #endif - if (new != NULL) return new; + if (mnew != NULL) return mnew; /* we are screwed typically if we ever drop through here - no more space */ /* *********************************************************************** */ - new = malloc (new_size); /* otherwise find new space */ - if (new == NULL) return new; /* if unable to allocate */ + mnew = malloc (new_size); /* otherwise find new space */ + if (mnew == NULL) return mnew; /* if unable to allocate */ if (old_size < new_size) overlap = old_size; else overlap = new_size; - memcpy (new, old, overlap); /* copy old data to new area */ + memcpy (mnew, old, overlap); /* copy old data to new area */ free(old); /* free the old area */ - return new; + return mnew; } #endif void memory_error (char *s, int n) { if (log_opened) { - fprintf(log_file, - "\n! Unable to allocate %d bytes for %s\n", n, s); + fprintf(log_file, "\n! Unable to allocate %d bytes for %s\n", n, s); show_maximums(log_file); #ifdef HEAPWALK if (heap_flag) (void) heap_dump(log_file, 1); @@ -742,9 +726,9 @@ void update_statistics (int address, int size, int oldsize) void probe_memory (void) { char *s; - s = (char *) malloc (4); /* get current top address */ + s = (char *) malloc (4); /* get current top address */ free(s); - update_statistics ((int) s, 0, 0); /* show where we are */ + update_statistics ((int) s, 0, 0); /* show where we are */ } void probe_show (void) @@ -768,9 +752,9 @@ size_t roundup (size_t n) /* NOTE: it's safe to allocate based on the trie_max read from fmt file */ /* since hyphenation trie cannot be extended (after iniTeX) */ /* for iniTeX, however, we need to allocate the full trie_size ahead of time */ - -/* NOTE: we don't ever reallocate these */ -/* returns -1 if it fails */ +/* */ +/* NOTE: we don't ever reallocate these */ +/* returns -1 if it fails */ int allocate_tries (int trie_max) { @@ -794,11 +778,9 @@ int allocate_tries (int trie_max) if (trie_trl == NULL || trie_tro == NULL || trie_trc == NULL) { memory_error("hyphen trie", n); return -1; -// exit (1); /* serious error */ } if (trace_flag) { - sprintf(log_line, "Addresses trie_trl %d trie_tro %d trie_trc %d\n", - trie_trl, trie_tro, trie_trc); + sprintf(log_line, "Addresses trie_trl %d trie_tro %d trie_trc %d\n", trie_trl, trie_tro, trie_trc); show_line(log_line, 0); } update_statistics ((int) trie_trl, nl, 0); @@ -824,8 +806,7 @@ int realloc_hyphen (int hyphen_prime) { int n, nw, nl; if (!prime(hyphen_prime)) { - sprintf(log_line, "ERROR: non-prime hyphen exception number (%d)\n", - hyphen_prime); + sprintf(log_line, "ERROR: non-prime hyphen exception number (%d)\n", hyphen_prime); show_line(log_line, 1); // exit (1); return -1; @@ -846,7 +827,6 @@ int realloc_hyphen (int hyphen_prime) hyph_list = (halfword *) REALLOC (hyph_list, nl); /* 94/Mar/24 */ if (hyph_word == NULL || hyph_list == NULL) { memory_error("hyphen exception", n); -// exit (1); /* serious error */ return -1; } if (trace_flag) { @@ -891,13 +871,13 @@ int current_mem_size=0; /* current total words in main mem allocated -1 */ /* returns NULL if it fails */ #ifdef ALLOCATEMAIN -/* void allocate_main_memory (int size) { */ /* initial main memory alloc - mem_top */ +/* initial main memory alloc - mem_top */ memory_word *allocate_main_memory (int size) -{ /* initial main memory alloc - mem_top */ +{ int n; /* Using -i *and* pre-loading format */ /* in this case get called twice */ -/* Get rid of initial blank memory again */ /* or use realloc ... */ +/* Get rid of initial blank memory again or use realloc ... */ /* Could we avoid this by detecting presence of & before allocating ? */ /* Also, if its already large enough, maybe we can avoid this ? */ /* don't bother if current_mem_size == mem_max - mem_start ? */ @@ -968,15 +948,13 @@ memory_word *realloc_main (int losize, int hisize) else runawayflag = 0; */ /* 94/Jan/22 */ if (trace_flag) { - sprintf(log_line, "WARNING: Entering realloc_main lo %d hi %d\n", - losize, hisize); + sprintf(log_line, "WARNING: Entering realloc_main lo %d hi %d\n", losize, hisize); show_line(log_line, 0); } if (is_initex) { show_line("ERROR: Cannot extent main memory in iniTeX\n", 1); if (! knuth_flag) show_line("Please use `-m=...' on command line\n", 0); -// exit (1); // abort_flag++; // ??? return NULL; } @@ -986,7 +964,6 @@ memory_word *realloc_main (int losize, int hisize) } if (current_mem_size + 1 == max_mem_size) {/* if we REALLY run up to limit ! */ memory_error("main memory", (max_mem_size + 1) * sizeof(memory_word)); -// exit (1); /* serious error */ // abort_flag++; // ??? return NULL; } @@ -1065,7 +1042,6 @@ memory_word *realloc_main (int losize, int hisize) int current_font_mem_size=0; /* fmemoryword can be either halfword or memory_word */ - fmemoryword *realloc_font_info (int size) { /* number of memorywords */ fmemoryword *newfontinfo=NULL; @@ -1077,11 +1053,10 @@ fmemoryword *realloc_font_info (int size) sprintf(log_line, "Old Address %s == %d\n", "font_info", font_info); show_line(log_line, 0); } -/* during initial allocation, font_info == NULL - realloc acts like malloc */ +/* during initial allocation, font_info == NULL - realloc acts like malloc */ /* during initial allocation current_font_mem_size == 0 */ if (current_font_mem_size == font_mem_size) { /* if we REALLY run up to limit */ /* memory_error("font", (font_mem_size + 1) * sizeof(memory_word)); */ -/* exit (1); */ return font_info; /* pass it back to TeX 99/Fabe/4 */ } /* try and prevent excessive frequent reallocations */ @@ -2130,7 +2105,7 @@ void check_fixed_align (int flag) testalign ((int) &hyf_next, sizeof(hyf_next[0]), "hyf_next"); testalign ((int) &op_start, sizeof(op_start[0]), "op_start"); -/* testalign ((int) &trieophash, sizeof(trieophash[0]), "trieophash"); */ +/* testalign ((int) &trie_op_hash, sizeof(trie_op_hash[0]), "trie_op_hash"); */ testalign ((int) &zzzaf, sizeof(zzzaf[0]), "zzzaf"); testalign ((int) &trie_used, sizeof(trie_used[0]), "trie_used"); /* testalign ((int) &trie_op_lang, sizeof(trie_op_lang[0]), "trie_op_lang");*/ @@ -2203,7 +2178,7 @@ void showaddresses (void) bool usedviwindo = true; /* use [Environment] section in `dviwindo.ini' */ bool backwardflag = false; /* don't cripple all advanced features */ -bool shortenfilename = false; /* don't shorten file names to 8+3 for DOS */ +bool shorten_file_name = false; /* don't shorten file names to 8+3 for DOS */ char *inifilename = "dviwindo.ini"; /* name of ini file we look for */ char *dviwindo = ""; /* full file name for dviwindo.ini with path */ char *envsection = "[Environment]"; /* Env var section in `dviwindo.ini' */ @@ -2273,8 +2248,7 @@ bool setupdviwindo (void) /* fclose(input); */ /* return true; */ envflag++; - } - else if (wndflag && _strnicmp(line, workdirect, dm) == 0) { + } else if (wndflag && _strnicmp(line, workdirect, dm) == 0) { if (trace_flag) { sprintf(log_line, "Found %s", line); /* DEBUGGING */ show_line(log_line, 0); @@ -2391,7 +2365,7 @@ char *grabenv (char *varname) /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ -void flushtrailingslash (char *directory){ +void flush_trailing_slash (char *directory){ char *s; /* flush trailing \ or / in directory, if any 1993/Dec/12 */ if (strcmp(directory, "") != 0) { @@ -2513,7 +2487,7 @@ int analyze_flag (int c, char *optarg) break; case 'f': show_fonts_used = false; /* 97/Dec/24 */ break; - case '8': shortenfilename = true; /* 95/Feb/20 */ + case '8': shorten_file_name = true; /* 95/Feb/20 */ break; case '9': show_cs_names = true; /* 98/Mar/31 */ break; @@ -2638,9 +2612,7 @@ int analyze_flag (int c, char *optarg) } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ - -/* char *yytexcmd="Y&YTEX.CMD"; */ /* name of command line file */ - +//char *yytexcmd="yandytex.cmd"; char *yytexcmd="YANDYTEX.CMD"; /* name of command line file */ /* Try and read default command file - YANDYTEX.CMD */ @@ -2652,8 +2624,9 @@ char *yytexcmd="YANDYTEX.CMD"; /* name of command line file */ /* used both for yytex.cmd and @ indirect command line files */ /* can this be reentered ? */ +/* supply extension if none */ void extension (char *fname, char *ext) -{ /* supply extension if none */ +{ char *s, *t; if ((s = strrchr(fname, '.')) == NULL || ((t = strrchr(fname, '\\')) != NULL && s < t)) { @@ -2664,7 +2637,7 @@ void extension (char *fname, char *ext) /* remove file name - keep only path - inserts '\0' to terminate */ -void stripname (char *pathname) +void strip_name (char *pathname) { char *s; if ((s=strrchr(pathname, '\\')) != NULL); @@ -2674,9 +2647,9 @@ void stripname (char *pathname) *s = '\0'; } -/* char commandfile[PATH_MAX]; */ /* keep around so can open later */ +/* char commandfile[PATH_MAX]; */ /* keep around so can open later */ -char *programpath = ""; /* pathname of program */ +char *programpath = ""; /* pathname of program */ /* redundant with texpath ? */ /* The following does not deslashify arguments ? Do we need to ? */ @@ -2837,58 +2810,65 @@ int init_commands (int ac, char **av) verbose_flag = false; heap_flag = false; restrict_to_ascii = false; - show_in_hex = false; /* default is not to show as hex code ^^ 00/Jun/18 */ - show_in_dos = false; /* default is not to translate to DOS 850 */ - return_flag = trimeof = true; // hard wired now - deslash = true; - pseudo_tilde = 254; /* default '~' replace 95/Sep/26 filledbox DOS 850 */ - pseudo_space = 255; /* default ' ' replace 97/June/5 nbspace DOS 850 */ - default_rule = 26214; /* default rule variable 95/Oct/9 */ - show_current = civilize_flag = show_numeric = show_missing = true; - current_flag = true; - current_tfm = true; /* search for TFMs in current dir as well */ - test_dir_access = true; /* test if readable item is perhaps a sub-dir */ - dir_method = true; /* in dir_p: _findfirst instead of use fopen (nul) */ - file_method = true; /* use file_p (_findfirst) not readable (access) */ + show_in_hex = false; /* default is not to show as hex code ^^ 00/Jun/18 */ + show_in_dos = false; /* default is not to translate to DOS 850 */ + return_flag = true; // hard wired now + trimeof = true; // hard wired now + deslash = true; + pseudo_tilde = 254; /* default '~' replace 95/Sep/26 filledbox DOS 850 */ + pseudo_space = 255; /* default ' ' replace 97/June/5 nbspace DOS 850 */ + default_rule = 26214; /* default rule variable 95/Oct/9 */ + show_current = true; + civilize_flag = true; + show_numeric = true; + show_missing = true; + current_flag = true; + current_tfm = true; /* search for TFMs in current dir as well */ + test_dir_access = true; /* test if readable item is perhaps a sub-dir */ + dir_method = true; /* in dir_p: _findfirst instead of use fopen (nul) */ + file_method = true; /* use file_p (_findfirst) not readable (access) */ /* waitflush = true; */ /* flushed 97/Dec/24 */ - c_style_flag = false; /* use c-style error output */ - show_fmt_flag = true; /* show format file in log */ - show_tfm_flag = false; /* don't show metric file in log */ - shortenfilename = false; /* don't shorten file names to 8+3 */ - show_texinput_flag = true; /* show TEXINPUTS and TEXFONTS */ - truncate_long_lines = true; /* truncate long lines */ - tab_step = 0; /* do not replace tabs with spaces */ - format_specific = true; /* do format specific TEXINPUTS 95/Jan/7 */ - encoding_specific = true; /* do encoding specific TEXFONTS 98/Jan/31 */ + c_style_flag = false; /* use c-style error output */ + show_fmt_flag = true; /* show format file in log */ + show_tfm_flag = false; /* don't show metric file in log */ + shorten_file_name = false; /* don't shorten file names to 8+3 */ + show_texinput_flag = true; /* show TEXINPUTS and TEXFONTS */ + truncate_long_lines = true; /* truncate long lines */ + tab_step = 0; /* do not replace tabs with spaces */ + format_specific = true; /* do format specific TEXINPUTS 95/Jan/7 */ + encoding_specific = true; /* do encoding specific TEXFONTS 98/Jan/31 */ show_line_break_stats = true; /* show line break statistics 96/Feb/8 */ - show_fonts_used = true; /* show fonts used in LOG file 97/Dec/24 */ - allow_quoted_names = true; /* allow quoted names with spaces 98/Mar/15 */ - show_cs_names = false; /* don't show csnames on start 98/Mar/31 */ - knuth_flag = false; /* allow extensions to TeX */ - cache_file_flag = true; /* default is to cache full file names 96/Nov/16 */ - full_file_name_flag = true; /* new default 2000 June 18 */ - save_strings_flag = true; // 2000 Aug 15 - errout = stdout; /* as opposed to stderr say --- used ??? */ - abort_flag = 0; // not yet hooked up ??? - err_level = 0; // not yet hooked up ??? + show_fonts_used = true; /* show fonts used in LOG file 97/Dec/24 */ + allow_quoted_names = true; /* allow quoted names with spaces 98/Mar/15 */ + show_cs_names = false; /* don't show csnames on start 98/Mar/31 */ + knuth_flag = false; /* allow extensions to TeX */ + cache_file_flag = true; /* default is to cache full file names 96/Nov/16 */ + full_file_name_flag = true; /* new default 2000 June 18 */ + save_strings_flag = true; // 2000 Aug 15 + errout = stdout; /* as opposed to stderr say --- used ??? */ + abort_flag = 0; // not yet hooked up ??? + err_level = 0; // not yet hooked up ??? new_hyphen_prime = 0; #ifdef VARIABLETRIESIZE /* trie_size = default_trie_size; */ trie_size = 0; #endif - mem_extra_high = 0; mem_extra_low = 0; mem_initex = 0; + mem_extra_high = 0; + mem_extra_low = 0; + mem_initex = 0; #ifdef ALLOCATEDVIBUF dvi_buf_size = 0; #endif -/* share_flag = _SH_DENYNO; */ /* 0x40 - deny none mode */ -/* share_flag = _SH_COMPAT; */ /* 0x00 - compatability mode */ - share_flag = 0; /* revert to fopen for now */ +/* share_flag = _SH_DENYNO; */ /* 0x40 - deny none mode */ +/* share_flag = _SH_COMPAT; */ /* 0x00 - compatability mode */ + share_flag = 0; /* revert to fopen for now */ /* strncpy(programpath, argv[0], PATH_MAX); */ /* 94/July/12 */ - programpath = xstrdup(av[0]); /* extract path executable */ - stripname(programpath); /* strip off yandytex.exe */ + programpath = xstrdup(av[0]); /* extract path executable */ + strip_name(programpath); /* strip off yandytex.exe */ + //format_name = "yandytex"; format_name = "plain"; /* format name if specified on command line */ encoding_name = ""; @@ -2903,8 +2883,8 @@ int init_commands (int ac, char **av) /* Print version *after* banner ? */ /* does this get in log file ? */ if (want_version) { -// showversion (stdout); -// showversion (log_line); +// showversion (stdout); +// showversion (log_line); stamp_it(log_line); strcat(log_line, "\n"); show_line(log_line, 0); @@ -2948,7 +2928,7 @@ void initial_memory (void) } if (mem_initex == 0) mem_initex = default_mem_top; if (trie_size == 0) trie_size = default_trie_size; -/* Just in case user mistakenly specified words instead of kilo words */ +/* Just in case user mistakenly specified words instead of kilo words */ if (mem_extra_high > 10000L * 1024L) mem_extra_high = mem_extra_high / 1024; if (mem_extra_low > 10000L * 1024L) mem_extra_low = mem_extra_low / 1024; if (mem_initex > 10000L * 1024L) mem_initex = mem_initex / 1024; @@ -3103,7 +3083,7 @@ void deslash_all (int ac, char **av) check_enter(ac, av); /* 95/Oct/28 */ -/* environment variables for output directories (as in PC TeX) */ +/* environment variables for output directories (as in PC TeX) */ if ((s = grabenv("TEXDVI")) != NULL) dvi_directory = s; if ((s = grabenv("TEXLOG")) != NULL) log_directory = s; @@ -3119,9 +3099,9 @@ void deslash_all (int ac, char **av) /* Hmm, we may be operating on DOS environment variables here !!! */ - if (strcmp(dvi_directory, "") != 0) flushtrailingslash (dvi_directory); - if (strcmp(log_directory, "") != 0) flushtrailingslash (log_directory); - if (strcmp(aux_directory, "") != 0) flushtrailingslash (aux_directory); + if (strcmp(dvi_directory, "") != 0) flush_trailing_slash (dvi_directory); + if (strcmp(log_directory, "") != 0) flush_trailing_slash (log_directory); + if (strcmp(aux_directory, "") != 0) flush_trailing_slash (aux_directory); if (deslash) { unixify (texpath); /* 94/Jan/25 */ @@ -3134,7 +3114,7 @@ void deslash_all (int ac, char **av) /* deslash TeX source file (and format, if format specified) */ /* and check args to see whether format was specified */ - format_spec=0; + format_spec = 0; /* NOTE: assuming that command line arguments are in writable memory ! */ /* if (trace_flag || debug_flag) sprintf(log_line, "optind %d ac %d\n", optind, ac); */ /* debugging */ @@ -3150,11 +3130,10 @@ void deslash_all (int ac, char **av) } if (pseudo_tilde != 0 || pseudo_space != 0) hidetwiddle (av[optind]); /* 95/Sep/25 */ -/* if (*av[optind] == '&') { */ /* 95/Jan/22 */ -/* For Windows NT, lets allow + instead of & for format specification */ +/* For Windows NT, lets allow + instead of & for format specification */ if (*av[optind] == '&' || *av[optind] == '+') { - format_spec = 1; /* format file specified */ - format_name = xstrdup(av[optind]+1); /* 94/Oct/25 */ + format_spec = 1; /* format file specified */ + format_name = xstrdup(av[optind]+1); /* 94/Oct/25 */ /* uppercase (format_name); */ /* why ? 98/Jan/31 */ if (optind + 1 < ac) { if (deslash) { @@ -3178,9 +3157,9 @@ void deslash_all (int ac, char **av) /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* interaction == 0 => batch mode (omit all stops and omit terminal output) */ -/* interaction == 1 => nonstop mode (omit all stops) */ -/* interaction == 2 => scroll mode (omit error stops) */ -/* interaction == 3 => error_stop mode (stops at every opportunity) */ +/* interaction == 1 => nonstop mode (omit all stops) */ +/* interaction == 2 => scroll mode (omit error stops) */ +/* interaction == 3 => error_stop mode (stops at every opportunity) */ /* main entry point follows */ @@ -3195,8 +3174,11 @@ int init (int ac, char **av) int k; debugfile = getenv("TEXDEBUG"); /* 94/March/28 */ - if (debugfile) debug_flag = 1; - else debug_flag = 0; + if (debugfile) + debug_flag = 1; + else + debug_flag = 0; + if (debug_flag) { show_line("TEXDEBUG\n", 0); trace_flag = 1; /* 94/April/14 */ @@ -3242,7 +3224,7 @@ int init (int ac, char **av) log_opened = false; /* so can tell whether opened */ interaction = -1; /* default state => 3 */ - missing_characters=0; /* none yet! */ + missing_characters = 0; /* none yet! */ workingdirectory = false; /* set from dviwindo.ini & command line */ font_dimen_zero = true; /* \fontdimen0 for checksum 98/Oct/5 */ ignore_frozen = false; /* default is not to ignore 98/Oct/5 */ @@ -3263,9 +3245,15 @@ int init (int ac, char **av) dvi_file_name = NULL; /* to be set in openinou.c 00/Jun/18 */ log_file_name = NULL; /* to be set in openinou.c 00/Jun/18 */ - first_pass_count = second_pass_count = final_pass_count = 0; /* 96/Feb/9 */ - paragraph_failed = singleline = 0; /* 96/Feb/9 */ - overfull_hbox = underfull_hbox = overfull_vbox = underfull_vbox = 0; + first_pass_count = 0; + second_pass_count = 0; + final_pass_count = 0; + paragraph_failed = 0; + singleline = 0; + overfull_hbox = 0; + underfull_hbox = 0; + overfull_vbox = 0; + underfull_vbox = 0; closed_already=0; // so can only do once @@ -3405,7 +3393,7 @@ void print_cs_name (FILE *output, int h) textof = hash[h].v.RH; if (textof == 0) return; /* ignore if text() == 0 */ - n = str_start[textof+1] - str_start[textof]; + n = str_start[textof + 1] - str_start[textof]; if (textcolumn != 0) { sprintf(log_line, ", "); if (output != NULL) fprintf(output, log_line); diff --git a/src/texsourc/makefile b/src/texsourc/makefile index ae6b849..3fe370c 100644 --- a/src/texsourc/makefile +++ b/src/texsourc/makefile @@ -49,7 +49,8 @@ texmf.exe: $(objs) $(LINK) $(LFLAGS) texmf itex openinou subroute local \ tex0 tex1 tex2 tex3 tex4 tex5 tex6 tex7 tex8 tex9 copy texmf.exe yandytex.exe - copy texmf.exe ..\newyy\bin\texmf.exe + del ..\yandy\bin\texmf.exe + copy texmf.exe ..\yandy\bin\texmf.exe # ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### texmf.obj: texmf.c \ diff --git a/src/texsourc/openinou.c b/src/texsourc/openinou.c index 0e630db..7922aef 100644 --- a/src/texsourc/openinou.c +++ b/src/texsourc/openinou.c @@ -58,17 +58,14 @@ #define BUILDNAMEDIRECT /* avoid malloc for string concat */ -/* int _cdecl _access(const char *pathname, int mode); */ /* debugging */ -/* #define access _access */ +bool test_read_access (unsigned char *, int); /* in ourpaths.c - bkph */ +/* bool test_read_access (char *, int, int); */ /* in ourpaths.c - bkph */ -bool testreadaccess (unsigned char *, int); /* in ourpaths.c - bkph */ -/* bool testreadaccess (char *, int, int); */ /* in ourpaths.c - bkph */ +extern char *unixify (char *); /* in pathsrch.c bkph */ -extern unsigned char *unixify (unsigned char *); /* in pathsrch.c bkph */ +extern void try_and_open (char *); /* in local.c bkph */ -extern void tryandopen (char *); /* in local.c bkph */ - -extern int shortenfilename; /* in local.c bkph */ +extern int shorten_file_name; /* in local.c bkph */ #ifdef FUNNY_CORE_DUMP /* This is defined in ./texmf.c. */ @@ -123,8 +120,8 @@ char *xconcat3 (char *buffer, char *s1, char *s2, char *s3) void patch_in_path (unsigned char *buffer, unsigned char *name, unsigned char *path) { #ifdef BUILDNAMEDIRECT - if (*path == '\0') strcpy(buffer, name); - else xconcat3(buffer, path, PATH_SEP_STRING, name); + if (*path == '\0') strcpy((char *)buffer, (char *)name); + else xconcat3((char *)buffer, (char *)path, PATH_SEP_STRING, (char *)name); #else string temp_name; temp_name = concat3 (path, PATH_SEP_STRING, name); @@ -134,9 +131,9 @@ void patch_in_path (unsigned char *buffer, unsigned char *name, unsigned char *p } int qualified (unsigned char *name) { - if (strchr(name, PATH_SEP) != NULL || - strchr(name, '\\') != NULL || - strchr(name, ':') != NULL) + if (strchr((char *)name, PATH_SEP) != NULL || + strchr((char *)name, '\\') != NULL || + strchr((char *)name, ':') != NULL) return 1; else return 0; @@ -147,7 +144,7 @@ int prepend_path_if (unsigned char *buffer, unsigned char *name, char *ext, unsi if (path == NULL) return 0; if (*path == '\0') return 0; if (qualified(name)) return 0; - if (strstr(name, ext) == NULL) return 0; + if (strstr((char *)name, ext) == NULL) return 0; patch_in_path(buffer, name, path); return 1; } @@ -165,16 +162,16 @@ void check_short_name (unsigned char *s) else if ((star = strrchr(name_of_file+1, '/')) != NULL) star++; else if ((star = strchr(name_of_file+1, ':')) != NULL) star++; else star = name_of_file+1; */ /* 1995/Sep/26 */ - if ((star = strrchr(s, '\\')) != NULL) star++; - else if ((star = strrchr(s, '/')) != NULL) star++; - else if ((star = strchr(s, ':')) != NULL) star++; + if ((star = (unsigned char *) strrchr((char *)s, '\\')) != NULL) star++; + else if ((star = (unsigned char *) strrchr((char *)s, '/')) != NULL) star++; + else if ((star = (unsigned char *) strchr((char *)s, ':')) != NULL) star++; else star = s; - if ((sdot = strchr(star, '.')) != NULL) n = sdot - star; - else n = strlen(star); - if (n > 8) strcpy(star+8, star+n); - if ((sdot = strchr(star, '.')) != NULL) { + if ((sdot = (unsigned char *) strchr((char *)star, '.')) != NULL) n = sdot - star; + else n = strlen((char *)star); + if (n > 8) strcpy((char *)star+8, (char *)star+n); + if ((sdot = (unsigned char *)strchr((char *)star, '.')) != NULL) { star = sdot+1; - n = strlen(star); + n = strlen((char *)star); if (n > 3) *(star+3) = '\0'; } } @@ -232,7 +229,7 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode) } #ifdef MSDOS - if (shortenfilename) { /* 8 + 3 file names on Windows NT 95/Feb/20 */ + if (shorten_file_name) { /* 8 + 3 file names on Windows NT 95/Feb/20 */ /* null_terminate (name_of_file + 1); */ check_short_name(name_of_file + 1); /* 95/Sep/26 */ /* space_terminate (name_of_file + 1); */ @@ -268,15 +265,15 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode) /* space_terminate (name_of_file + 1); */ } // debugging only - if (testreadaccess(name_of_file+1, path_index)) { -/* if (testreadaccess(name_of_file, name_length, path_index)) */ + if (test_read_access(name_of_file+1, path_index)) { +/* if (test_read_access(name_of_file, name_length, path_index)) */ /* We can assume `name_of_file' is openable, */ -/* since `testreadaccess' just returned true. */ +/* since `test_read_access' just returned true. */ /* *f = xfopen_pas (name_of_file, fopen_mode); */ - *f = xfopen(name_of_file+1, fopen_mode); + *f = xfopen((char *)name_of_file+1, fopen_mode); -// should we check *f == NULL ??? (should be OK because of testreadaccess) +// should we check *f == NULL ??? (should be OK because of test_read_access) /* If we found the file in the current directory, don't leave the `./' at the beginning of `name_of_file', since it looks dumb when @@ -301,7 +298,7 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode) } else /* name_length = strchr(name_of_file + 1, ' ') - (name_of_file + 1); */ - name_length = strlen(name_of_file + 1); + name_length = strlen((char *)name_of_file + 1); #ifdef TeX /* If we just opened a TFM file, we have to read the first byte, @@ -316,23 +313,23 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode) #ifdef MSDOS /* code added 94/June/21 to show 'fmt' file opening in log */ /* if (show_fmt_flag && strstr(name_of_file+1, ".fmt") != NULL) { */ - if (strstr(name_of_file + 1, ".fmt") != NULL) { + if (strstr((char *)name_of_file + 1, ".fmt") != NULL) { if (format_file == NULL) { /* null_terminate (name_of_file + 1); */ - format_file = xstrdup(name_of_file + 1); + format_file = xstrdup((char *)name_of_file + 1); /* space_terminate (name_of_file + 1); */ } } /* remember full format file name with path */ /* if (showpoolflag && strstr(name_of_file+1, ".poo") != NULL) { */ - else if (strstr(name_of_file+1, ".poo") != NULL) { + else if (strstr((char *)name_of_file+1, ".poo") != NULL) { if (string_file == NULL) { /* null_terminate (name_of_file + 1); */ - string_file = xstrdup(name_of_file + 1); + string_file = xstrdup((char *)name_of_file + 1); /* space_terminate (name_of_file + 1); */ } } /* remember full pool file name with path */ /* else if (show_tfm_flag && strstr(name_of_file+1, ".tfm") != NULL) { */ - else if (strstr(name_of_file+1, ".tfm") != NULL) { + else if (strstr((char *)name_of_file+1, ".tfm") != NULL) { if (show_tfm_flag && log_opened) { #ifdef WRAPLINES int old_setting = selector; @@ -347,7 +344,7 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode) #else int n; /* null_terminate (name_of_file + 1); */ - n = strlen(name_of_file+1); + n = strlen((char *)name_of_file+1); if (file_offset + n > max_print_line) { putc('\n', log_file); file_offset = 0; @@ -364,7 +361,7 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode) else if (source_direct == NULL) { /* 98/Sep/29 */ char *s; /* null_terminate (name_of_file + 1); */ - source_direct = xstrdup(name_of_file + 1); + source_direct = xstrdup((char *)name_of_file + 1); /* space_terminate (name_of_file + 1); */ if (trace_flag) { sprintf(log_line, "Methinks the source %s is `%s'\n", "file", source_direct); @@ -383,7 +380,7 @@ bool open_input (FILE **f, path_constant_type path_index, char *fopen_mode) } /* space_terminate (name_of_file + 1); */ { - unsigned temp_length = strlen(name_of_file + 1); + unsigned temp_length = strlen((char *)name_of_file + 1); name_of_file[temp_length+1] = ' '; /* space terminate */ /* set up name_length ??? */ } @@ -608,7 +605,7 @@ bool open_output (FILE **f, char *fopen_mode) } #ifdef MSDOS - if (shortenfilename) { /* 8 + 3 file names on Windows NT 95/Feb/20 */ + if (shorten_file_name) { /* 8 + 3 file names on Windows NT 95/Feb/20 */ /* null_terminate (name_of_file + 1); */ /* check_short_name(); */ check_short_name(name_of_file + 1); /* 95/Sep/26 */ @@ -618,14 +615,14 @@ bool open_output (FILE **f, char *fopen_mode) /* null_terminate (name_of_file + 1); */ /* Make the filename into a C string. */ -/* if (debug_flag) tryandopen(name_of_file+1); */ /* debugging 94/Mar/20 */ +/* if (debug_flag) try_and_open(name_of_file+1); */ /* debugging 94/Mar/20 */ #ifdef MSDOS /* write into user specified output directory if given on command line */ /* following code added 1993/Dec/12 */ /* separated 1996/Jan/20 */ - if (prepend_path_if(name_of_file+1, name_of_file+1, ".dvi", dvi_directory) || - prepend_path_if(name_of_file+1, name_of_file+1, ".log", log_directory) || - prepend_path_if(name_of_file+1, name_of_file+1, ".aux", aux_directory)) { + if (prepend_path_if(name_of_file+1, name_of_file+1, ".dvi", (unsigned char *)dvi_directory) || + prepend_path_if(name_of_file+1, name_of_file+1, ".log", (unsigned char *)log_directory) || + prepend_path_if(name_of_file+1, name_of_file+1, ".aux", (unsigned char *)aux_directory)) { if (open_trace_flag) { sprintf(log_line, "After prepend %s\n", name_of_file+1); show_line(log_line, 0); @@ -646,7 +643,7 @@ bool open_output (FILE **f, char *fopen_mode) /* if share_flag is non-zero and we are opening for reading use fsopen */ /* but we can assume this is opening here for *output* */ - *f = fopen(name_of_file + 1, fopen_mode); + *f = fopen((char *)name_of_file + 1, fopen_mode); if (*f == NULL) { /* Can't open as given. Try the envvar. */ /* string temp_dir = getenv ("TEXMFOUTPUT"); */ /* 93/Nov/20 */ @@ -659,17 +656,17 @@ bool open_output (FILE **f, char *fopen_mode) if (temp_dir != NULL) { #ifdef BUILDNAMEDIRECT unsigned char temp_name[PATH_MAX]; - xconcat3(temp_name, temp_dir, PATH_SEP_STRING, name_of_file + 1); + xconcat3((char *)temp_name, temp_dir, PATH_SEP_STRING, (char *)name_of_file + 1); #else /* string temp_name = concat3 (temp_dir, "/", name_of_file + 1); */ string temp_name = concat3 (temp_dir, PATH_SEP_STRING, name_of_file + 1); #endif - if (deslash) unixify(temp_name); /* deslashify 93/Dec/28 */ + if (deslash) unixify((char *) temp_name); /* deslashify 93/Dec/28 */ /* If share_flag is non-zero and we are opening for reading use fsopen */ /* but we can assume this is opening here for *output* */ - *f = fopen((const char*)temp_name, fopen_mode); + *f = fopen((char*)temp_name, fopen_mode); /* If this succeeded, change name_of_file accordingly. */ - if (*f) strcpy((const char*)name_of_file + 1, (const char *)temp_name); + if (*f) strcpy((char*)name_of_file + 1, (char *)temp_name); #ifndef BUILDNAMEDIRECT free (temp_name); #endif @@ -679,7 +676,7 @@ bool open_output (FILE **f, char *fopen_mode) // show_line(name_of_file+1, 1); // debugging only // New code to remember complete dvi_file name and log_file_name // To remember for output at the end 2000 June 18 - if (strstr(name_of_file + 1, ".dvi") != NULL) { + if (strstr((char *)name_of_file + 1, ".dvi") != NULL) { if (qualified(name_of_file+1)) *log_line = '\0'; else { (void) _getcwd(log_line, sizeof(log_line)); @@ -690,19 +687,19 @@ bool open_output (FILE **f, char *fopen_mode) dvi_file_name = xstrdup(log_line); // show_line(dvi_file_name, 1); // debugging only } - else if (strstr(name_of_file + 1, ".log") != NULL) { + else if (strstr((char *)name_of_file + 1, ".log") != NULL) { if (qualified(name_of_file+1)) *log_line = '\0'; else { (void) _getcwd(log_line, sizeof(log_line)); strcat(log_line, PATH_SEP_STRING); } - strcat(log_line, name_of_file+1); + strcat(log_line, (char *)name_of_file+1); unixify(log_line); log_file_name = xstrdup(log_line); // show_line(log_file_name, 1); // debugging only } /* Back into a Pascal string, but first get its length. */ - temp_length = strlen (name_of_file + 1); + temp_length = strlen ((char *)name_of_file + 1); /* space_terminate (name_of_file + 1); */ name_of_file[temp_length+1] = ' '; /* space terminate */ diff --git a/src/texsourc/subroute.c b/src/texsourc/subroute.c index 2c25105..a0f5781 100644 --- a/src/texsourc/subroute.c +++ b/src/texsourc/subroute.c @@ -649,7 +649,7 @@ void set_paths (int path_bits) /* changed to take C string 97/June/5 - used to take Pascal strings */ /* now expects null terminated strings */ -bool testreadaccess (unsigned char *name, int path_index) +bool test_read_access (unsigned char *name, int path_index) { #ifdef BUILDNAMEDIRECT char buffer[PATH_MAX]; /* for constructing name 1996/Jan/20 */ @@ -1193,7 +1193,7 @@ bool dir_p (string fn) /* xfind_path_filename is used now */ -/* Called only from testreadaccess(...) in ourpaths.c */ +/* Called only from test_read_access(...) in ourpaths.c */ #ifdef BUILDNAMEDIRECT @@ -2020,14 +2020,12 @@ string *find_dir_list (string path) /* Unixify filename and path (turn \ into /) --- assumes null terminated */ -unsigned char *unixify (unsigned char * t) +char *unixify (char * t) { - unsigned char * s = t; + char * s = t; if (s == NULL) return s; /* paranoia -- 1993/Apr/10 */ #ifdef MSDOS if (t != '\0') { -/* while (*s) { */ -/* while (*s != 0 && *s != ' ') { */ /* paranoia -- 1994/Mar/22 */ while (*s != '\0') { /* paranoia -- 1997/Oct/23 */ /* if (*s == '\\') *s = '/'; */ if (*s == '\\') *s = PATH_SEP; diff --git a/src/texsourc/tex0.c b/src/texsourc/tex0.c index b1c9c94..bd422b5 100644 --- a/src/texsourc/tex0.c +++ b/src/texsourc/tex0.c @@ -624,27 +624,29 @@ void fatal_error_(char * s) } } /* sec 0094 */ -void overflow_(str_number s, integer n) +void overflow_(char * s, integer n) { - normalize_selector (); - print_err("TeX capacity exceeded, sorry["); - print(s); + normalize_selector (); + print_err("TeX capacity exceeded, sorry["); + print_string(s); print_char('='); print_int(n); print_char(']'); help2("If you really absolutely need more capacity,", "you can ask a wizard to enlarge me."); if (! knuth_flag) { /* Additional comments 98/Jan/5 */ - if (s == 945 && n == trie_size) { + //if (s == 945 && n == trie_size) { + if (!strcmp(s, "pattern memory") && n == trie_size) { sprintf(log_line, "\n (Maybe use -h=... on command line in ini-TeX)\n"); show_line(log_line, 0); } - else if (s == 942 && n == hyphen_prime) { + //else if (s == 942 && n == hyphen_prime) { + else if (!strcmp(s, "exception dictionary") && n == hyphen_prime) { sprintf(log_line, "\n (Maybe use -e=... on command line in ini-TeX)\n"); show_line(log_line, 0); } } - if(interaction == 3)interaction = 2; + if (interaction == 3) interaction = 2; if(log_opened){ error (); } @@ -746,13 +748,13 @@ str_number make_string (void) str_start = realloc_str_start(increment_max_strings); if(str_ptr == current_max_strings){ /* 94/Jan/24 */ // printf("**********MAKESTRING**********"); // debugging only - overflow(258, current_max_strings - init_str_ptr); /* 97/Mar/9 */ + overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/9 */ return 0; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(str_ptr == max_strings){ - overflow(258, max_strings - init_str_ptr); /* number of strings */ + overflow("number of strings", max_strings - init_str_ptr); /* number of strings */ return 0; // abort_flag set } #endif @@ -1028,7 +1030,7 @@ void term_input (int promptstr, int nhelplines) void int_error_ (integer n) { - print(" ("); + print_string(" ("); print_int(n); print_char(41); /*)*/ error(); @@ -1388,7 +1390,7 @@ void runaway (void) break; case 5 : { - print("text"); + print_string("text"); p = def_ref; } break; @@ -1433,7 +1435,7 @@ halfword get_avail (void) /* presumably now mem_end < mem_max - but need test in case allocation fails */ if (mem_end >= mem_max) { runaway (); - overflow(298, mem_max + 1 - mem_min); /* main memory size */ + overflow("main memory size", mem_max + 1 - mem_min); /* main memory size */ return 0; // abort_flag set } incr(mem_end); /* then grab from new area */ @@ -1556,7 +1558,7 @@ halfword get_node_(integer s) rover = q; goto lab20; } -/* overflow(298, mem_max + 1 - mem_min); */ /* what used to happen! */ +/* overflow("main memory size", mem_max + 1 - mem_min); */ /* what used to happen! */ /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ /* we've run out of space in the middle for variable length blocks */ /* try and add new block from below mem_bot *//* first check if space ! */ @@ -1573,7 +1575,7 @@ halfword get_node_(integer s) sprintf(log_line, "mem_min %d, mem_start %d, block_size %d\n", mem_min, mem_start, block_size); show_line(log_line, 0); } - overflow(298, mem_max + 1 - mem_min); /* darn: allocation failed ! */ + overflow("main memory size", mem_max + 1 - mem_min); /* darn: allocation failed ! */ return 0; // abort_flag set } /* avoid function call in following ? */ diff --git a/src/texsourc/tex1.c b/src/texsourc/tex1.c index 042e4d3..ebbb67c 100644 --- a/src/texsourc/tex1.c +++ b/src/texsourc/tex1.c @@ -412,12 +412,12 @@ void push_nest (void) if(nest_ptr == current_nest_size) nest = realloc_nest_stack (increment_nest_size); if(nest_ptr == current_nest_size){ /* check again after allocation */ - overflow(359, current_nest_size); + overflow("semantic nest size", current_nest_size); return; // abort_flag set } #else if(nest_ptr == nest_size){ - overflow(359, nest_size); /* semantic next size - not dynamic */ + overflow("semantic nest size", nest_size); /* semantic next size - not dynamic */ return; // abort_flag set } #endif @@ -1881,8 +1881,8 @@ halfword id_lookup_(integer j, integer l) do { if((hash_used == 514)) { /* if hash_used = hashbase ... */ /* we can't expand the hash table ... */ -/* overflow(500, hash_size); */ /* hash size - NOT DYNAMIC */ - overflow(500, hash_size + hash_extra); /* 96/Jan/10 */ +/* overflow("hash size", hash_size); */ /* hash size - NOT DYNAMIC */ + overflow("hash size", hash_size + hash_extra); /* 96/Jan/10 */ return 0; // abort_flag set } decr(hash_used); @@ -1907,13 +1907,13 @@ halfword id_lookup_(integer j, integer l) /* str_pool = realloc_str_pool (increment_pool_size); */ str_pool = realloc_str_pool (increment_pool_size + 1); if(pool_ptr + l > current_pool_size){ /* in case it failed 97/Mar/7 */ - overflow(257, current_pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", current_pool_size - init_pool_ptr); /* pool size */ return 0; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(pool_ptr + l > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size - not dynamic */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size - not dynamic */ return; // abort_flag set } #endif @@ -1986,12 +1986,12 @@ void new_save_level_(group_code c) if(max_save_stack > current_save_size - 6) save_stack = realloc_save_stack (increment_save_size); if(max_save_stack > current_save_size - 6){ /* check again after allocation */ - overflow(538, current_save_size); + overflow("save size", current_save_size); return; // abort_flag set } #else if(max_save_stack > save_size - 6){ /* save size - not dynamic */ - overflow(538, save_size); + overflow("save size", save_size); return; // abort_flag set } #endif @@ -2007,8 +2007,8 @@ void new_save_level_(group_code c) if(cur_level == max_quarterword) { /* { quit if (cur_level + 1) is too large to store in eqtb } */ /* overflow("grouping levels", max_quarterword - min_quarterword); */ -/* overflow(539, 255); */ /* grouping levels - not dynamic */ - overflow(539, max_quarterword - min_quarterword); /* 96/Oct/12 ??? */ +/* overflow("grouping levels", 255); */ /* grouping levels - not dynamic */ + overflow("grouping levels", max_quarterword - min_quarterword); /* 96/Oct/12 ??? */ return; // abort_flag set } /* cur_boundary <- save_ptr */ @@ -2054,12 +2054,12 @@ void eq_save_(halfword p, quarterword l) if(max_save_stack > current_save_size - 6) save_stack = realloc_save_stack (increment_save_size); if(max_save_stack > current_save_size - 6){ /* check again after allocation */ - overflow(538, current_save_size); + overflow("save size", current_save_size); return; // abort_flag set } #else if(max_save_stack > save_size - 6){ /* save size not dynamic */ - overflow(538, save_size); + overflow("save size", save_size); return; // abort_flag set } #endif @@ -2120,12 +2120,12 @@ void save_for_after_(halfword t) if(max_save_stack > current_save_size - 6) save_stack = realloc_save_stack (increment_save_size); if(max_save_stack > current_save_size - 6){ /* check again after allocation */ - overflow(538, current_save_size); + overflow("save size", current_save_size); return; // abort_flag set } #else if(max_save_stack > save_size - 6){ /* save satck - not dynamic */ - overflow(538, save_size); + overflow("save size", save_size); return; // abort_flag set } #endif diff --git a/src/texsourc/tex2.c b/src/texsourc/tex2.c index 412014b..d898536 100644 --- a/src/texsourc/tex2.c +++ b/src/texsourc/tex2.c @@ -416,12 +416,12 @@ void begin_token_list_ (halfword p, quarterword t) if(input_ptr == current_stack_size) input_stack = realloc_input_stack (increment_stack_size); if(input_ptr == current_stack_size){ /* check again after allocation */ - overflow(590, current_stack_size); + overflow("input stack size", current_stack_size); return; // abort_flag set } #else if(input_ptr == stack_size) { /* input stack - not dynamic */ - overflow(590, stack_size); + overflow("input stack size", stack_size); return; // abort_flag set } #endif @@ -515,12 +515,12 @@ void back_input (void) if(input_ptr == current_stack_size) input_stack = realloc_input_stack (increment_stack_size); if(input_ptr == current_stack_size){ /* check again after allocation */ - overflow(590, current_stack_size); + overflow("input stack size", current_stack_size); return; // abort_flag set } #else if(input_ptr == stack_size) { /* stack size - not dynamic */ - overflow(590, stack_size); + overflow("input stack size", stack_size); return; // abort_flag set } #endif @@ -551,19 +551,19 @@ void ins_error (void) void begin_file_reading (void) { if(in_open == max_in_open){ - overflow(593, max_in_open); /* text input levels - NOT DYNAMIC */ + overflow("text input levels", max_in_open); /* text input levels - NOT DYNAMIC */ return; // abort_flag set } #ifdef ALLOCATEBUFFER if(first == current_buf_size) buffer = realloc_buffer (increment_buf_size); if(first == current_buf_size) { /* check again after allocation */ - overflow(256, current_buf_size); + overflow("buffer size", current_buf_size); return; // abort_flag set } #else if(first == buf_size){ - overflow(256, buf_size); /* buffer size - not dynamic */ + overflow("buffer size", buf_size); /* buffer size - not dynamic */ return; // abort_flag set } #endif @@ -579,12 +579,12 @@ void begin_file_reading (void) if(input_ptr == current_stack_size) input_stack = realloc_input_stack (increment_stack_size); if(input_ptr == current_stack_size){ - overflow(590, current_stack_size); /* check again after allocation */ + overflow("input stack size", current_stack_size); /* check again after allocation */ return; // abort_flag set } #else if(input_ptr == stack_size){ - overflow(590, stack_size); /* input stack - not dynamic */ + overflow("input stack size", stack_size); /* input stack - not dynamic */ return; // abort_flag set } #endif @@ -1050,12 +1050,12 @@ void macro_call (void) if(max_param_stack > current_param_size) param_stack = realloc_param_stack (increment_param_size); if(max_param_stack > current_param_size){ /* check again after allocation */ - overflow(633, current_param_size); + overflow("parameter stack size", current_param_size); return; // abort_flag set } #else if(max_param_stack > param_size){ - overflow(633, param_size); /* parameter stack - not dynamic */ + overflow("parameter stack size", param_size); /* parameter stack - not dynamic */ return; // abort_flag set } #endif @@ -1179,12 +1179,12 @@ void expand (void) if(max_buf_stack == current_buf_size) buffer = realloc_buffer (increment_buf_size); if(max_buf_stack == current_buf_size){ /* check again after allocation */ - overflow(256, current_buf_size); + overflow("buffer size", current_buf_size); return; // abort_flag set } #else if(max_buf_stack == buf_size){ - overflow(256, buf_size); /* buffer size - not dynamic */ + overflow("buffer size", buf_size); /* buffer size - not dynamic */ return; // abort_flag set } #endif @@ -1495,13 +1495,13 @@ void find_font_dimen_(bool writing) font_info = realloc_font_info(increment_font_mem_size); } if(fmem_ptr == current_font_mem_size){ /* 94/Jan/24 */ - overflow(818, current_font_mem_size); /* font memory */ + overflow("font memory", current_font_mem_size); /* font memory */ return; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(fmem_ptr == font_mem_size){ - overflow(818, font_mem_size); /* font memory */ + overflow("font memory", font_mem_size); /* font memory */ return; // abort_flag set } #endif diff --git a/src/texsourc/tex3.c b/src/texsourc/tex3.c index 3f31d2c..61efb21 100644 --- a/src/texsourc/tex3.c +++ b/src/texsourc/tex3.c @@ -516,13 +516,13 @@ halfword str_toks_(pool_pointer b) if(pool_ptr + 1 > current_pool_size) str_pool = realloc_str_pool (increment_pool_size); if(pool_ptr + 1 > current_pool_size) { /* in case it failed 94/Jan/22 */ - overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/7 */ + overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */ return 0; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(pool_ptr + 1 > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size */ return; // abort_flag set } #endif @@ -1314,13 +1314,13 @@ bool more_name_(ASCII_code c) if(pool_ptr + 1 > current_pool_size) str_pool = realloc_str_pool (increment_pool_size); if(pool_ptr + 1 > current_pool_size) { /* in case it failed 94/Jan/24 */ - overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/7 */ + overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */ return 0; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(pool_ptr + 1 > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size */ return 0; // abort_flag set } #endif @@ -1451,13 +1451,13 @@ void end_name (void) /* str_start = realloc_str_start(increment_max_strings); */ str_start = realloc_str_start(increment_max_strings + 3); if(str_ptr + 3 > current_max_strings){ /* in case it failed 94/Jan/24 */ - overflow(258, current_max_strings - init_str_ptr); /* 97/Mar/7 */ + overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */ return; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(str_ptr + 3 > max_strings){ - overflow(258, max_strings - init_str_ptr); /* number of strings */ + overflow("number of strings", max_strings - init_str_ptr); /* number of strings */ return; // abort_flag set } #endif @@ -1917,12 +1917,12 @@ void morenamecopy(ASCII_code c) if(pool_ptr + 1 > current_pool_size) str_pool = realloc_str_pool (increment_pool_size); if(pool_ptr + 1 > current_pool_size) { /* in case it failed 94/Jan/24 */ - overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/7 */ + overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */ return; // abort_flag set } #else if(pool_ptr + 1 > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size */ return; // abort_flag set } #endif @@ -1936,12 +1936,12 @@ int endnamecopy(void) if(str_ptr + 1 > current_max_strings) str_start = realloc_str_start(increment_max_strings + 1); if(str_ptr + 1 > current_max_strings) { /* in case it failed 94/Jan/24 */ - overflow(258, current_max_strings - init_str_ptr); /* 97/Mar/7 */ + overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */ return 0; // abort_flag set } #else if(str_ptr + 1 > max_strings){ - overflow(258, max_strings - init_str_ptr); /* number of strings */ + overflow("number of strings", max_strings - init_str_ptr); /* number of strings */ return 0; // abort_flag set } #endif diff --git a/src/texsourc/tex4.c b/src/texsourc/tex4.c index 342dc07..8567d8a 100644 --- a/src/texsourc/tex4.c +++ b/src/texsourc/tex4.c @@ -553,13 +553,13 @@ void special_out_(halfword p) if(pool_ptr + 1 > current_pool_size) str_pool = realloc_str_pool (increment_pool_size); if(pool_ptr + 1 > current_pool_size) { /* in case it failed 94/Jan/24 */ - overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/7 */ + overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */ return; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(pool_ptr + 1 > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size */ return; // abort_flag set } #endif diff --git a/src/texsourc/tex6.c b/src/texsourc/tex6.c index ab12090..1f32a6d 100644 --- a/src/texsourc/tex6.c +++ b/src/texsourc/tex6.c @@ -1478,13 +1478,13 @@ lab21: switch(cur_cmd){ /* str_pool = realloc_str_pool (increment_pool_size); */ str_pool = realloc_str_pool (increment_pool_size + n); if(pool_ptr + n > current_pool_size){ /* in case it failed 94/Jan/24 */ - overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/7 */ + overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */ return; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(pool_ptr + n > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size */ return; // abort_flag set } #endif @@ -1509,7 +1509,7 @@ lab21: switch(cur_cmd){ /* if(hyph_count == 607)*/ if(hyph_count == hyphen_prime){ /* overflow(942, 607); */ - overflow(942, hyphen_prime); /* exception dictionary - NOT DYNAMIC */ + overflow("exception dictionary", hyphen_prime); /* exception dictionary - NOT DYNAMIC */ /* not dynamic ---- but can be set -e=... from command line in ini-TeX */ return; // abort_flag set } diff --git a/src/texsourc/tex8.c b/src/texsourc/tex8.c index f12c2e2..cc08267 100644 --- a/src/texsourc/tex8.c +++ b/src/texsourc/tex8.c @@ -706,13 +706,13 @@ void new_font_(small_number a) if(pool_ptr + 1 > current_pool_size) str_pool = realloc_str_pool (increment_pool_size); if(pool_ptr + 1 > current_pool_size){ /* 94/Jan/24 */ - overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/9 */ + overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/9 */ return; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(pool_ptr + 1 > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size */ return; // abort_flag set } #endif @@ -940,13 +940,13 @@ void issue_message (void) if(pool_ptr + 1 > current_pool_size) str_pool = realloc_str_pool (increment_pool_size); if(pool_ptr + 1 > current_pool_size){ /* in case it failed 94/Jan/24 */ - overflow(257, current_pool_size - init_pool_ptr); /* 97/Mar/7 */ + overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */ return; // abort_flag set } #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if(pool_ptr + 1 > pool_size){ - overflow(257, pool_size - init_pool_ptr); /* pool size */ + overflow("pool size", pool_size - init_pool_ptr); /* pool size */ return; // abort_flag set } #endif diff --git a/src/texsourc/texd.h b/src/texsourc/texd.h index dfda826..fd3014b 100644 --- a/src/texsourc/texd.h +++ b/src/texsourc/texd.h @@ -123,7 +123,7 @@ /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ -#define poolname TEXPOOLNAME +#define pool_name TEXPOOLNAME /* #define mem_top 262140L */ @@ -1015,7 +1015,7 @@ EXTERN int hyph_count; /* padded out */ /* 95/Jan/7 */ #ifdef INITEX EXTERN integer -#define trieophash (zzzaf - (int)(neg_trie_op_size)) +#define trie_op_hash (zzzaf - (int)(neg_trie_op_size)) zzzaf[trie_op_size - neg_trie_op_size + 1]; EXTERN trie_op_code trie_used[256]; EXTERN ASCII_code trie_op_lang[trie_op_size + 1]; /* already padded 751 + 1 */ @@ -1266,7 +1266,7 @@ EXTERN int tfm_temp; /* only used in tex3.c 95/Jan/7 */ int realloc_hyphen (int); /* in local.c - bkph */ int allocate_tries (int); /* in local.c - bkph */ -void tryandopen (char *); /* in local.c - bkph */ +void try_and_open (char *); /* in local.c - bkph */ void check_eqtb (char *); /* in local.c - bkph */ void probe_memory (void); /* in local.c - bkph */ // void show_maximums (FILE *); /* in local.c - bkph */ @@ -1296,7 +1296,7 @@ void get_date_and_time (integer *minutes, integer *day, bool maketextex (void); /* in openinou.c */ bool maketextfm (void); /* in openinou.c */ -unsigned char *unixify (unsigned char *); /* in pathsrch.c bkph */ +char *unixify (char *); /* in pathsrch.c bkph */ #ifdef _WINDOWS void show_line (char *, int); /* in local.c */ @@ -1357,8 +1357,8 @@ unsigned char *unixify (unsigned char *); /* in pathsrch.c bkph */ #define llink(a) info(a+1) #define rlink(a) link(a+1) /* sec 0133 */ -#define type(a) mem[a].hh.B0 -#define subtype(a) mem[a].hh.B1 +#define type(a) mem[a].hh.b0 +#define subtype(a) mem[a].hh.b1 /* sec 0134 */ #define is_char_node(a) (a >= hi_mem_min) #define font type diff --git a/src/texsourc/texmf.c b/src/texsourc/texmf.c index ba70f7d..32ca0ad 100644 --- a/src/texsourc/texmf.c +++ b/src/texsourc/texmf.c @@ -89,7 +89,7 @@ extern char *replacement[]; /* pointers to replacement strings */ // extern char *grabenv(char *); /* in local.c - bkph */ -/* extern void tryandopen(char *); */ /* inb local.c */ +/* extern void try_and_open(char *); */ /* inb local.c */ #ifdef FUNNY_CORE_DUMP void funny_core_dump (void); -- 2.11.0