From: maqiyuan Date: Sun, 16 Feb 2014 17:43:08 +0000 (+0800) Subject: fixed a bug. X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=e3ede24f1c69f675a7087627e0778ce47381f824;p=putex%2Fputex.git fixed a bug. --- diff --git a/src/texsourc/c-pathmx.h b/src/texsourc/c-pathmx.h index 53b2dce..361dc98 100644 --- a/src/texsourc/c-pathmx.h +++ b/src/texsourc/c-pathmx.h @@ -34,4 +34,3 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #endif /* not PATH_MAX */ #endif /* not C_PATH_MAX_H */ - \ No newline at end of file diff --git a/src/texsourc/coerce.h b/src/texsourc/coerce.h index 9777b38..a0eb512 100644 --- a/src/texsourc/coerce.h +++ b/src/texsourc/coerce.h @@ -110,7 +110,8 @@ void print_roman_int_(integer); void print_current_string(void); #define printcurrentstring_regmem // void term_input(void); -void term_input(char *, int); +void term_input(int, int); +#define terminput_regmem void int_error_(integer); #define int_error(n) int_error_((integer) (n)) @@ -211,11 +212,11 @@ void print_mark_(integer); void print_rule_dimen_(scaled); #define print_rule_dimen(d) print_rule_dimen_((scaled) (d)) #define printruledimen_regmem -void print_glue_(scaled, integer, str_number); -#define print_glue(d, order, s) print_glue_((scaled) (d), (integer) (order), (str_number) (s)) +void print_glue_(scaled, integer, char *); +#define print_glue(d, order, s) print_glue_((scaled) (d), (integer) (order), (char *) (s)) #define printglue_regmem -void print_spec_(integer, str_number); -#define print_spec(p, s) print_spec_((integer) (p), (str_number) (s)) +void print_spec_(integer, char *); +#define print_spec(p, s) print_spec_((integer) (p), (char *) (s)) #define printspec_regmem register memory_word *mem=zmem; void print_fam_and_char_(halfword); #define print_fam_and_char(p) print_fam_and_char_((halfword) (p)) @@ -895,10 +896,10 @@ void print_string_(unsigned char * s); #define print_string(s) print_string_((unsigned char *) s) void slow_print_(integer); #define slow_print(s) slow_print_((integer) (s)) -void print_nl_(const char *); -#define print_nl(s) print_nl_((const char *) (s)) -void print_esc_(const char *); -#define print_esc(s) print_esc_((const char *) (s)) +void print_nl_(char *); +#define print_nl(s) print_nl_((char *) (s)) +void print_esc_(char *); +#define print_esc(s) print_esc_((char *) (s)) void print_the_digs_(eight_bits); #define print_the_digs(k) print_the_digs_((eight_bits) (k)) void print_int_(integer); @@ -935,7 +936,7 @@ void print_hex_(integer); void print_roman_int_(integer); #define print_roman_int(n) print_roman_int_((integer) (n)) void print_current_string(void); -void term_input(char *, int); +void term_input(int, int); void int_error_(integer); #define int_error(n) int_error_((integer) (n)) void normalize_selector(void); @@ -1000,10 +1001,10 @@ void print_mark_(integer); #define print_mark(p) print_mark_((integer) (p)) void print_rule_dimen_(scaled); #define print_rule_dimen(d) print_rule_dimen_((scaled) (d)) -void print_glue_(scaled, integer, str_number); -#define print_glue(d, order, s) print_glue_((scaled) (d), (integer) (order), (str_number) (s)) -void print_spec_(integer, str_number); -#define print_spec(p, s) print_spec_((integer) (p), (str_number) (s)) +void print_glue_(scaled, integer, char *); +#define print_glue(d, order, s) print_glue_((scaled) (d), (integer) (order), (char *) (s)) +void print_spec_(integer, char *); +#define print_spec(p, s) print_spec_((integer) (p), (char *) (s)) void print_fam_and_char_(halfword); #define print_fam_and_char(p) print_fam_and_char_((halfword) (p)) void print_delimiter_(halfword); diff --git a/src/texsourc/getopt.h b/src/texsourc/getopt.h index dd5eef0..d5bc883 100644 --- a/src/texsourc/getopt.h +++ b/src/texsourc/getopt.h @@ -124,4 +124,3 @@ extern int _getopt_internal(); #endif #endif /* _GETOPT_H */ - \ No newline at end of file diff --git a/src/texsourc/lib.h b/src/texsourc/lib.h index 9e5ebf6..c9deaff 100644 --- a/src/texsourc/lib.h +++ b/src/texsourc/lib.h @@ -67,7 +67,7 @@ #define MAX_INT_LENGTH 21 /* Return a fresh copy of S1 followed by S2, et al. */ -extern string concat(string s1, string s2); +extern string concat (string s1, string s2); extern string concat3 (string, string, string); extern string concat4 (string, string, string, string); extern string concat5 (string, string, string, string, string); @@ -126,4 +126,3 @@ extern address xcalloc (unsigned nelem, unsigned elsize); #define XRETALLOC(addr, n, t) ((addr) = (t *) xrealloc (addr, (n) * sizeof(t))) #endif /* not LIB_H */ - \ No newline at end of file diff --git a/src/texsourc/local.c b/src/texsourc/local.c index 2aa948d..ed9ef0e 100644 --- a/src/texsourc/local.c +++ b/src/texsourc/local.c @@ -78,7 +78,7 @@ #ifndef _WINDOWS #include /* for _getch() */ #endif -#pragma warning(default:4032) // different type when promoted` +#pragma warning(default:4032) // different type when promoted /* Argument handling, etc. */ /* from common.h - setup `main' in texmf.c */ @@ -133,20 +133,20 @@ bool reorder_arg_flag = true; /* put command line flags/arguments first */ /* Used in tex0.c with wintodos[c-128] */ unsigned char wintodos[128] = { - 0, 0, 0, 159, 0, 0, 0, 0, - 94, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 159, 0, 0, 0, 0, + 94, 0, 0, 0, 0, 0, 0, 0, 0, 96, 39, 0, 0, 7, 0, 0, - 126, 0, 0, 0, 0, 0, 0, 0, - 32, 173, 189, 156, 207, 190, 221, 21, - 0, 184, 166, 174, 170, 45, 169, 0, - 248, 241, 253, 252, 0, 230, 20, 250, - 0, 251, 167, 175, 172, 171, 243, 168, - 183, 181, 182, 199, 142, 143, 146, 128, - 212, 144, 210, 211, 222, 214, 215, 216, - 209, 165, 227, 224, 226, 229, 153, 158, - 157, 235, 233, 234, 154, 237, 232, 225, - 133, 160, 131, 198, 132, 134, 145, 135, - 138, 130, 136, 137, 141, 161, 140, 139, + 126, 0, 0, 0, 0, 0, 0, 0, + 32, 173, 189, 156, 207, 190, 221, 21, + 0, 184, 166, 174, 170, 45, 169, 0, + 248, 241, 253, 252, 0, 230, 20, 250, + 0, 251, 167, 175, 172, 171, 243, 168, + 183, 181, 182, 199, 142, 143, 146, 128, + 212, 144, 210, 211, 222, 214, 215, 216, + 209, 165, 227, 224, 226, 229, 153, 158, + 157, 235, 233, 234, 154, 237, 232, 225, + 133, 160, 131, 198, 132, 134, 145, 135, + 138, 130, 136, 137, 141, 161, 140, 139, 208, 164, 149, 162, 147, 228, 148, 246, 155, 151, 163, 150, 129, 236, 231, 152 }; @@ -156,7 +156,7 @@ void show_usage (char * program) { sprintf (s, "\n" " yandytex [-?ivnwdrzpK] [-m=ini_mem] [-e=hyph_size] [-h=trie_size]\n" " [-x=xchr_file] [-k=key_file] [-o=dvi_dir] [-l=log_dir] [-a=aux_dir]\n" - " [+format_file] [tex_file]\n" + " [+format_file] [tex_file]\n\n" " -? show this usage summary\n" " -i start up as iniTeX (create format file)\n" " -v be verbose (show implementation version number)\n" @@ -250,7 +250,7 @@ void stampcopy (char *s) #define MAXCHRS 256 #define NOTDEF 127 -void read_xchr_sub (FILE *pinput) +void read_xchr_sub (FILE * xchr_input) { char buffer[PATH_MAX]; int k, from, to, count = 0; @@ -268,9 +268,9 @@ void read_xchr_sub (FILE *pinput) #endif #ifdef ALLOCATEBUFFER - while (fgets(buffer, current_buf_size, pinput) != NULL) + while (fgets(buffer, current_buf_size, xchr_input) != NULL) #else - while (fgets(buffer, sizeof(buffer), pinput) != NULL) + while (fgets(buffer, sizeof(buffer), xchr_input) != NULL) #endif { if (*buffer == '%' || *buffer == ';' || *buffer == '\n') continue; @@ -319,7 +319,7 @@ void read_xchr_sub (FILE *pinput) char *replacement[MAXCHRS]; /* pointers to replacement strings */ -void read_repl_sub (FILE *pinput) +void read_repl_sub (FILE * repl_input) { int k, n, m, chrs; char buffer[PATH_MAX]; @@ -333,7 +333,7 @@ void read_repl_sub (FILE *pinput) for (k = 0; k < MAXCHRS; k++) replacement[k] = NULL; #endif - while (fgets(buffer, PATH_MAX, pinput) != NULL) { + while (fgets(buffer, PATH_MAX, repl_input) != NULL) { if (*buffer == '%' || *buffer == ';' || *buffer == '\n') continue; if ((m = sscanf (buffer, "%d%n %s", &chrs, &n, &charname)) == 0) continue; @@ -791,7 +791,8 @@ int allocate_tries (int trie_max) update_statistics ((int) trie_trc, nc, 0); /* sprintf(log_line, "trie_size %d trie_max %d\n", trie_size, trie_max); */ /* debug */ trie_size = trie_max; /* BUG FIX 98/Jan/5 */ - if (trace_flag) probe_show(); /* 94/Mar/25 */ + if (trace_flag) + probe_show(); /* 94/Mar/25 */ return 0; // success } #endif @@ -799,7 +800,7 @@ int allocate_tries (int trie_max) #ifdef ALLOCATEHYPHEN bool prime (int); /* test function later in this file */ -int currentprime = 0; /* remember in case reallocated later */ +int current_prime = 0; /* remember in case reallocated later */ /* we don't return an address here, since TWO memory regions allocated */ /* plus, we don't really reallocate, we FLUSH the old information totally */ @@ -833,8 +834,7 @@ int realloc_hyphen (int hyphen_prime) return -1; } if (trace_flag) { - sprintf(log_line, "Addresses hyph_word %d hyph_list %d\n", - hyph_word, hyph_list); + sprintf(log_line, "Addresses hyph_word %d hyph_list %d\n", hyph_word, hyph_list); show_line(log_line, 0); } /* cannot preserve old contents when hyphen prime is changed */ @@ -849,17 +849,17 @@ int realloc_hyphen (int hyphen_prime) for (k = 0; k <= hyphen_prime; k++) hyph_list[k]= 0; #endif hyph_count = 0; /* or use reset_hyphen() in itex.c */ - if (currentprime != 0) { + if (current_prime != 0) { update_statistics ((int) hyph_word, nw, - (currentprime + 1) * sizeof(str_number)); + (current_prime + 1) * sizeof(str_number)); update_statistics ((int) hyph_list, nl, - (currentprime + 1) * sizeof(halfword)); + (current_prime + 1) * sizeof(halfword)); } else { update_statistics ((int) hyph_word, nw, 0); update_statistics ((int) hyph_list, nl, 0); } - currentprime = hyphen_prime; + current_prime = hyphen_prime; if (trace_flag) probe_show(); /* 94/Mar/25 */ return 0; // success } @@ -943,9 +943,9 @@ memory_word *allocate_main_memory (int size) memory_word *realloc_main (int losize, int hisize) { int k, minsize; - int newsize=0; /* to quieten compiler */ - int n=0; /* to quieten compiler */ - memory_word *newmemory = NULL; /* to quieten compiler */ + int newsize = 0; /* to quieten compiler */ + int n = 0; /* to quieten compiler */ + memory_word * newmemory = NULL; /* to quieten compiler */ /* if (losize == 0 && hisize > 0) runawayflag = 1; else runawayflag = 0; */ /* 94/Jan/22 */ @@ -1796,11 +1796,11 @@ int free_memory (void) #ifdef ALLOCATEINI if (is_initex) { if (trie_taken != NULL) free(trie_taken); - if (trie_hash != NULL) free(trie_hash); - if (trie_r != NULL) free(trie_r); - if (trie_c != NULL) free(trie_c); - if (trie_o != NULL) free(trie_o); - if (trie_l != NULL) free(trie_l); + if (trie_hash != NULL) free(trie_hash); + if (trie_r != NULL) free(trie_r); + if (trie_c != NULL) free(trie_c); + if (trie_o != NULL) free(trie_o); + if (trie_l != NULL) free(trie_l); trie_taken = NULL; trie_hash = trie_l = trie_r = NULL; trie_c = NULL; @@ -1980,7 +1980,7 @@ void reorderargs (int ac, char **av) } } -int testalign (int address, int size, char *name) +int test_align (int address, int size, char *name) { int n; if (size > 4) n = address % 4; @@ -1996,157 +1996,157 @@ int testalign (int address, int size, char *name) void check_fixed_align (int flag) { - if (testalign ((int) &mem_top, 4, "FIXED ALIGNMENT")) { + if (test_align ((int) &mem_top, 4, "FIXED ALIGNMENT")) { show_line("PLEASE RECOMPILE ME!\n", 1); } #ifdef CHECKALIGNMENT if (!flag) return; - testalign ((int) &mem_top, 4, "mem_top"); - testalign ((int) &mem_max, 4, "mem_max"); - testalign ((int) &mem_min, 4, "mem_min"); - testalign ((int) &bad, 4, "bad"); - testalign ((int) &trie_size, 4, "trie_size"); - testalign ((int) &xord, sizeof(xord[0]), "xord"); /* no op */ - testalign ((int) &xchr, sizeof(xchr[0]), "xchr"); /* no op */ - testalign ((int) &name_length, 4, "name_length"); - testalign ((int) &first, 4, "first"); - testalign ((int) &last, 4, "last"); - testalign ((int) &max_buf_stack, 4, "max_buf_stack"); - testalign ((int) &pool_ptr, 4, "pool_ptr"); - testalign ((int) &str_ptr, 4, "str_ptr"); - testalign ((int) &init_pool_ptr, 4, "init_pool_ptr"); - testalign ((int) &init_str_ptr, 4, "init_str_ptr"); - testalign ((int) &log_file, 4, "log_file"); - testalign ((int) &tally, 4, "tally"); - testalign ((int) &term_offset, 4, "term_offset"); - testalign ((int) &file_offset, 4, "file_offset"); - testalign ((int) &trick_count, 4, "trick_count"); - testalign ((int) &first_count, 4, "first_count"); - testalign ((int) &deletions_allowed, 4, "deletions_allowed"); - testalign ((int) &set_box_allowed, 4, "set_box_allowed"); - testalign ((char *) &help_line, sizeof(help_line[0]), "help_line"); - testalign ((int) &use_err_help, 4, "use_err_help"); - testalign ((int) &interrupt, 4, "interrupt"); - testalign ((int) &OK_to_interrupt, 4, "OK_to_interrupt"); - testalign ((int) &arith_error, 4, "arith_error"); - testalign ((int) &tex_remainder, 4, "tex_remainder"); - testalign ((int) &temp_ptr, 4, "temp_ptr"); - testalign ((int) &lo_mem_max, 4, "lo_mem_max"); - testalign ((int) &hi_mem_min, 4, "hi_mem_min"); - testalign ((int) &var_used, 4, "var_used"); - testalign ((int) &dyn_used, 4, "dyn_used"); - testalign ((int) &avail, 4, "avail"); - testalign ((int) &mem_end, 4, "mem_end"); - testalign ((int) &mem_start, 4, "mem_start"); - testalign ((int) &rover, 4, "rover"); - testalign ((int) &font_in_short_display, 4, "font_in_short_display"); - testalign ((int) &depth_threshold, 4, "depth_threshold"); - testalign ((int) &breadth_max, 4, "breadth_max"); - testalign ((int) &nest, sizeof(nest[0]), "nest"); + test_align ((int) &mem_top, 4, "mem_top"); + test_align ((int) &mem_max, 4, "mem_max"); + test_align ((int) &mem_min, 4, "mem_min"); + test_align ((int) &bad, 4, "bad"); + test_align ((int) &trie_size, 4, "trie_size"); + test_align ((int) &xord, sizeof(xord[0]), "xord"); /* no op */ + test_align ((int) &xchr, sizeof(xchr[0]), "xchr"); /* no op */ + test_align ((int) &name_length, 4, "name_length"); + test_align ((int) &first, 4, "first"); + test_align ((int) &last, 4, "last"); + test_align ((int) &max_buf_stack, 4, "max_buf_stack"); + test_align ((int) &pool_ptr, 4, "pool_ptr"); + test_align ((int) &str_ptr, 4, "str_ptr"); + test_align ((int) &init_pool_ptr, 4, "init_pool_ptr"); + test_align ((int) &init_str_ptr, 4, "init_str_ptr"); + test_align ((int) &log_file, 4, "log_file"); + test_align ((int) &tally, 4, "tally"); + test_align ((int) &term_offset, 4, "term_offset"); + test_align ((int) &file_offset, 4, "file_offset"); + test_align ((int) &trick_count, 4, "trick_count"); + test_align ((int) &first_count, 4, "first_count"); + test_align ((int) &deletions_allowed, 4, "deletions_allowed"); + test_align ((int) &set_box_allowed, 4, "set_box_allowed"); + test_align ((int) &help_line, sizeof(help_line[0]), "help_line"); + test_align ((int) &use_err_help, 4, "use_err_help"); + test_align ((int) &interrupt, 4, "interrupt"); + test_align ((int) &OK_to_interrupt, 4, "OK_to_interrupt"); + test_align ((int) &arith_error, 4, "arith_error"); + test_align ((int) &tex_remainder, 4, "tex_remainder"); + test_align ((int) &temp_ptr, 4, "temp_ptr"); + test_align ((int) &lo_mem_max, 4, "lo_mem_max"); + test_align ((int) &hi_mem_min, 4, "hi_mem_min"); + test_align ((int) &var_used, 4, "var_used"); + test_align ((int) &dyn_used, 4, "dyn_used"); + test_align ((int) &avail, 4, "avail"); + test_align ((int) &mem_end, 4, "mem_end"); + test_align ((int) &mem_start, 4, "mem_start"); + test_align ((int) &rover, 4, "rover"); + test_align ((int) &font_in_short_display, 4, "font_in_short_display"); + test_align ((int) &depth_threshold, 4, "depth_threshold"); + test_align ((int) &breadth_max, 4, "breadth_max"); + test_align ((int) &nest, sizeof(nest[0]), "nest"); #ifdef ALLOCZEQTB - testalign ((int) &zeqtb, sizeof(zeqtb[0]), "zeqtb"); /* not any more ? */ -#endif -/* testalign ((int) &xeq_level, sizeof(xeq_level[0]), "xeq_level"); */ - testalign ((int) &zzzad, sizeof(zzzad[0]), "zzzad"); -/* testalign ((int) &hash, sizeof(hash[0]), "hash"); */ - testalign ((int) &zzzae, sizeof(zzzae[0]), "zzzae"); - - testalign ((int) &save_stack, sizeof(save_stack[0]), "save_stack"); - testalign ((int) &input_stack, sizeof(input_stack[0]), "input_stack"); - testalign ((int) &input_file, sizeof(input_file[0]), "input_file"); - testalign ((int) &line_stack, sizeof(line_stack[0]), "line_stack"); - testalign ((int) ¶m_stack, sizeof(param_stack[0]), "param_stack"); - testalign ((int) &cur_mark, sizeof(cur_mark[0]), "cur_mark"); - testalign ((int) &pstack, sizeof(pstack[0]), "pstack"); - testalign ((int) &read_file, sizeof(read_file[0]), "read_file"); - - testalign ((int) &font_check, sizeof(font_check[0]), "font_check"); - testalign ((int) &font_size, sizeof(font_size[0]), "font_size"); - testalign ((int) &font_dsize, sizeof(font_dsize[0]), "font_dsize"); - testalign ((int) &font_params, sizeof(font_params[0]), "font_params"); - testalign ((int) &font_name, sizeof(font_name[0]), "font_name"); - testalign ((int) &font_area, sizeof(font_area[0]), "font_area"); - testalign ((int) &font_bc, sizeof(font_bc[0]), "font_bc"); - testalign ((int) &font_ec, sizeof(font_ec[0]), "font_ec"); - testalign ((int) &font_glue, sizeof(font_glue[0]), "font_glue"); - testalign ((int) &font_used, sizeof(font_used[0]), "font_used"); - testalign ((int) &hyphen_char, sizeof(hyphen_char[0]), "hyphen_char"); - testalign ((int) &skew_char, sizeof(skew_char[0]), "skew_char"); - testalign ((int) &bchar_label, sizeof(bchar_label[0]), "bchar_label"); - testalign ((int) &font_bchar, sizeof(font_bchar[0]), "font_bchar"); - testalign ((int) &font_false_bchar, sizeof(font_false_bchar[0]), "font_false_bchar"); - testalign ((int) &char_base, sizeof(char_base[0]), "char_base"); - testalign ((int) &width_base, sizeof(width_base[0]), "width_base"); - testalign ((int) &height_base, sizeof(height_base[0]), "height_base"); - testalign ((int) &depth_base, sizeof(depth_base[0]), "depth_base"); - testalign ((int) &italic_base, sizeof(italic_base[0]), "italic_base"); - testalign ((int) &lig_kern_base, sizeof(lig_kern_base[0]), "lig_kern_base"); - testalign ((int) &kern_base, sizeof(kern_base[0]), "kern_base"); - testalign ((int) &exten_base, sizeof(exten_base[0]), "exten_base"); - testalign ((int) ¶m_base, sizeof(param_base[0]), "param_base"); + test_align ((int) &zeqtb, sizeof(zeqtb[0]), "zeqtb"); /* not any more ? */ +#endif +/* test_align ((int) &xeq_level, sizeof(xeq_level[0]), "xeq_level"); */ + test_align ((int) &zzzad, sizeof(zzzad[0]), "zzzad"); +/* test_align ((int) &hash, sizeof(hash[0]), "hash"); */ + test_align ((int) &zzzae, sizeof(zzzae[0]), "zzzae"); + + test_align ((int) &save_stack, sizeof(save_stack[0]), "save_stack"); + test_align ((int) &input_stack, sizeof(input_stack[0]), "input_stack"); + test_align ((int) &input_file, sizeof(input_file[0]), "input_file"); + test_align ((int) &line_stack, sizeof(line_stack[0]), "line_stack"); + test_align ((int) ¶m_stack, sizeof(param_stack[0]), "param_stack"); + test_align ((int) &cur_mark, sizeof(cur_mark[0]), "cur_mark"); + test_align ((int) &pstack, sizeof(pstack[0]), "pstack"); + test_align ((int) &read_file, sizeof(read_file[0]), "read_file"); + + test_align ((int) &font_check, sizeof(font_check[0]), "font_check"); + test_align ((int) &font_size, sizeof(font_size[0]), "font_size"); + test_align ((int) &font_dsize, sizeof(font_dsize[0]), "font_dsize"); + test_align ((int) &font_params, sizeof(font_params[0]), "font_params"); + test_align ((int) &font_name, sizeof(font_name[0]), "font_name"); + test_align ((int) &font_area, sizeof(font_area[0]), "font_area"); + test_align ((int) &font_bc, sizeof(font_bc[0]), "font_bc"); + test_align ((int) &font_ec, sizeof(font_ec[0]), "font_ec"); + test_align ((int) &font_glue, sizeof(font_glue[0]), "font_glue"); + test_align ((int) &font_used, sizeof(font_used[0]), "font_used"); + test_align ((int) &hyphen_char, sizeof(hyphen_char[0]), "hyphen_char"); + test_align ((int) &skew_char, sizeof(skew_char[0]), "skew_char"); + test_align ((int) &bchar_label, sizeof(bchar_label[0]), "bchar_label"); + test_align ((int) &font_bchar, sizeof(font_bchar[0]), "font_bchar"); + test_align ((int) &font_false_bchar, sizeof(font_false_bchar[0]), "font_false_bchar"); + test_align ((int) &char_base, sizeof(char_base[0]), "char_base"); + test_align ((int) &width_base, sizeof(width_base[0]), "width_base"); + test_align ((int) &height_base, sizeof(height_base[0]), "height_base"); + test_align ((int) &depth_base, sizeof(depth_base[0]), "depth_base"); + test_align ((int) &italic_base, sizeof(italic_base[0]), "italic_base"); + test_align ((int) &lig_kern_base, sizeof(lig_kern_base[0]), "lig_kern_base"); + test_align ((int) &kern_base, sizeof(kern_base[0]), "kern_base"); + test_align ((int) &exten_base, sizeof(exten_base[0]), "exten_base"); + test_align ((int) ¶m_base, sizeof(param_base[0]), "param_base"); #ifdef ALLOCATEDVIBUF - testalign ((int) &zdvibuf, sizeof(zdvibuf[0]), "zdvibuf"); /* no op */ -#endif - testalign ((int) &totalstretch, sizeof(totalstretch[0]), "totalstretch"); - testalign ((int) &totalshrink, sizeof(totalshrink[0]), "totalshrink"); - testalign ((int) &active_width, sizeof(active_width[0]), "active_width"); - testalign ((int) &cur_active_width, sizeof(cur_active_width[0]), "cur_active_width"); - testalign ((int) &background, sizeof(background[0]), "background"); - testalign ((int) &break_width, sizeof(break_width[0]), "break_width"); - testalign ((int) &minimal_demerits, sizeof(minimal_demerits[0]), "minimal_demerits"); - testalign ((int) &best_place, sizeof(best_place[0]), "best_place"); - testalign ((int) &best_pl_line, sizeof(best_pl_line[0]), "best_pl_line"); - testalign ((int) &hc, sizeof(hc[0]), "hc"); - testalign ((int) &hu, sizeof(hu[0]), "hu"); - testalign ((int) &hyf, sizeof(hyf[0]), "hyf"); -/* testalign ((int) &x, sizeof(x[0]), "x"); */ - - testalign ((int) &hyf_distance, sizeof(hyf_distance[0]), "hyf_distance"); - testalign ((int) &hyf_num, sizeof(hyf_num[0]), "hyf_num"); - testalign ((int) &hyf_next, sizeof(hyf_next[0]), "hyf_next"); - testalign ((int) &op_start, sizeof(op_start[0]), "op_start"); - -/* 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");*/ - testalign ((int) &trie_op_val, sizeof(trie_op_val[0]), "trie_op_val"); - - testalign ((int) &trie_min, sizeof(trie_min[0]), "trie_min"); - testalign ((int) &page_so_far, sizeof(page_so_far[0]), "page_so_far"); - testalign ((int) &write_file, sizeof(write_file[0]), "write_file"); - testalign ((int) &write_open, sizeof(write_open[0]), "write_open"); + test_align ((int) &zdvibuf, sizeof(zdvibuf[0]), "zdvibuf"); /* no op */ +#endif + test_align ((int) &total_stretch, sizeof(total_stretch[0]), "total_stretch"); + test_align ((int) &total_shrink, sizeof(total_shrink[0]), "total_shrink"); + test_align ((int) &active_width, sizeof(active_width[0]), "active_width"); + test_align ((int) &cur_active_width, sizeof(cur_active_width[0]), "cur_active_width"); + test_align ((int) &background, sizeof(background[0]), "background"); + test_align ((int) &break_width, sizeof(break_width[0]), "break_width"); + test_align ((int) &minimal_demerits, sizeof(minimal_demerits[0]), "minimal_demerits"); + test_align ((int) &best_place, sizeof(best_place[0]), "best_place"); + test_align ((int) &best_pl_line, sizeof(best_pl_line[0]), "best_pl_line"); + test_align ((int) &hc, sizeof(hc[0]), "hc"); + test_align ((int) &hu, sizeof(hu[0]), "hu"); + test_align ((int) &hyf, sizeof(hyf[0]), "hyf"); +/* test_align ((int) &x, sizeof(x[0]), "x"); */ + + test_align ((int) &hyf_distance, sizeof(hyf_distance[0]), "hyf_distance"); + test_align ((int) &hyf_num, sizeof(hyf_num[0]), "hyf_num"); + test_align ((int) &hyf_next, sizeof(hyf_next[0]), "hyf_next"); + test_align ((int) &op_start, sizeof(op_start[0]), "op_start"); + +/* test_align ((int) &trie_op_hash, sizeof(trie_op_hash[0]), "trie_op_hash"); */ + test_align ((int) &zzzaf, sizeof(zzzaf[0]), "zzzaf"); + test_align ((int) &trie_used, sizeof(trie_used[0]), "trie_used"); +/* test_align ((int) &trie_op_lang, sizeof(trie_op_lang[0]), "trie_op_lang");*/ + test_align ((int) &trie_op_val, sizeof(trie_op_val[0]), "trie_op_val"); + + test_align ((int) &trie_min, sizeof(trie_min[0]), "trie_min"); + test_align ((int) &page_so_far, sizeof(page_so_far[0]), "page_so_far"); + test_align ((int) &write_file, sizeof(write_file[0]), "write_file"); + test_align ((int) &write_open, sizeof(write_open[0]), "write_open"); #endif } void check_alloc_align (int flag) { - if (testalign ((int) eqtb, sizeof(eqtb[0]), "ALLOCATED ALIGNMENT")) + if (test_align ((int) eqtb, sizeof(eqtb[0]), "ALLOCATED ALIGNMENT")) show_line("PLEASE RECOMPILE ME!\n", 1); #ifdef CHECKALIGNMENT if (!flag) return; #ifndef ALLOCZEQTB - testalign ((int) zeqtb, sizeof(zeqtb[0]), "zeqtb"); + test_align ((int) zeqtb, sizeof(zeqtb[0]), "zeqtb"); #endif #ifndef ALLOCATEDVIBUF - testalign ((int) &zdvibuf, sizeof(zdvibuf[0]), "zdvibuf"); /* no op */ -#endif - testalign ((int) str_pool, sizeof(str_pool[0]), "str_pool"); /* no op */ - testalign ((int) str_start, sizeof(str_start[0]), "str_start"); - testalign ((int) zmem, sizeof(zmem[0]), "main memory"); - testalign ((int) font_info, sizeof(font_info[0]), "font memory"); - testalign ((int) trie_trl, sizeof(trie_trl[0]), "trie_trl"); - testalign ((int) trie_tro, sizeof(trie_tro[0]), "trie_tro"); - testalign ((int) trie_trc, sizeof(trie_trc[0]), "trie_trc"); - testalign ((int) hyph_word, sizeof(hyph_word[0]), "hyph_word"); - testalign ((int) hyph_list, sizeof(hyph_list[0]), "hyph_list"); -/* testalign ((int) trie_c, sizeof(trie_c[0]), "trie_c"); *//* no op */ - testalign ((int) trie_o, sizeof(trie_o[0]), "trie_o"); - testalign ((int) trie_l, sizeof(trie_l[0]), "trie_l"); - testalign ((int) trie_r, sizeof(trie_r[0]), "trie_r"); - testalign ((int) trie_hash, sizeof(trie_hash[0]), "trie_hash"); - testalign ((int) trie_taken, sizeof(trie_taken[0]), "trie_taken"); + test_align ((int) &zdvibuf, sizeof(zdvibuf[0]), "zdvibuf"); /* no op */ +#endif + test_align ((int) str_pool, sizeof(str_pool[0]), "str_pool"); /* no op */ + test_align ((int) str_start, sizeof(str_start[0]), "str_start"); + test_align ((int) zmem, sizeof(zmem[0]), "main memory"); + test_align ((int) font_info, sizeof(font_info[0]), "font memory"); + test_align ((int) trie_trl, sizeof(trie_trl[0]), "trie_trl"); + test_align ((int) trie_tro, sizeof(trie_tro[0]), "trie_tro"); + test_align ((int) trie_trc, sizeof(trie_trc[0]), "trie_trc"); + test_align ((int) hyph_word, sizeof(hyph_word[0]), "hyph_word"); + test_align ((int) hyph_list, sizeof(hyph_list[0]), "hyph_list"); +/* test_align ((int) trie_c, sizeof(trie_c[0]), "trie_c"); *//* no op */ + test_align ((int) trie_o, sizeof(trie_o[0]), "trie_o"); + test_align ((int) trie_l, sizeof(trie_l[0]), "trie_l"); + test_align ((int) trie_r, sizeof(trie_r[0]), "trie_r"); + test_align ((int) trie_hash, sizeof(trie_hash[0]), "trie_hash"); + test_align ((int) trie_taken, sizeof(trie_taken[0]), "trie_taken"); #endif } @@ -2159,8 +2159,7 @@ void showaddresses (void) show_line(log_line, 0); sprintf(log_line, "eqtb %d hash %d ", zeqtb, zzzae); show_line(log_line, 0); - sprintf(log_line, "dvi_buf %d xchr %d xord %d nest %d\n", - zdvibuf, xchr, xord, nest); + sprintf(log_line, "dvi_buf %d xchr %d xord %d nest %d\n", zdvibuf, xchr, xord, nest); show_line(log_line, 0); sprintf(log_line, "save_stack %d input_stack %d line_stack %d param_stack %d\n", save_stack, input_stack, line_stack, param_stack); @@ -2176,20 +2175,19 @@ void showaddresses (void) /* *** *** *** *** *** *** *** NEW APPROACH TO `ENV VARS' *** *** *** *** */ -/* grab `env var' from `dviwindo.ini' - or from DOS environment 94/May/19 */ -/* controlled by USEDVIWINDOINI environment variable 94/June/19 */ - -bool usedviwindo = true; /* use [Environment] section in `dviwindo.ini' */ -bool backwardflag = false; /* don't cripple all advanced features */ -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' */ -char *wndsection = "[Window]"; /* Window section in `dviwindo.ini' */ -char *workdirect = "WorkingDirectory"; /* key in [Window] section */ -bool usesourcedirectory = true; /* use source file directory as local */ - /* when WorkingDirectory is set */ -bool workingdirectory = false; /* if working directory set in ini */ +/* grab `env var' from `dviwindo.ini' - or from DOS environment 94/May/19 */ +/* controlled by USEDVIWINDOINI environment variable 94/June/19 */ + +bool usedviwindo = true; /* use [Environment] section in `dviwindo.ini' */ +bool backwardflag = false; /* don't cripple all advanced features */ +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' */ +char *wndsection = "[Window]"; /* Window section in `dviwindo.ini' */ +char *workdirect = "WorkingDirectory"; /* key in [Window] section */ +bool usesourcedirectory = true; /* use source file directory as local when WorkingDirectory is set */ +bool workingdirectory = false; /* if working directory set in ini */ /* set up full file name for dviwindo.ini and check for [Environment] */ bool setupdviwindo (void) @@ -2368,7 +2366,8 @@ char *grabenv (char *varname) /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ -void flush_trailing_slash (char *directory){ +void flush_trailing_slash (char *directory) +{ char *s; /* flush trailing \ or / in directory, if any 1993/Dec/12 */ if (strcmp(directory, "") != 0) { @@ -2423,7 +2422,7 @@ void knuthify (void) /* ........ */ -int nohandler=0; /* experiment to avoid Ctrl-C interrupt handler */ +int nohandler = 0; /* experiment to avoid Ctrl-C interrupt handler */ /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ @@ -2445,75 +2444,106 @@ char *replfile = NULL;/* save space use xstrdup */ int analyze_flag (int c, char *optarg) { switch (c) { - case 'v': want_version = true; - verbose_flag = true; - break; - case 'i': is_initex = true; - break; - case 'Q': interaction = 0; /* quiet mode */ - break; - case 'R': interaction = 1; /* run mode */ - break; - case 'S': interaction = 2; /* scroll mode */ - break; - case 'T': interaction = 3; /* tex mode */ - break; - case 'K': backwardflag = true; /* 94/Jun/15 */ - knuthify(); /* revert to `standard' Knuth TeX */ - break; - case 'L': c_style_flag = true; /* C style error msg 94/Mar/21 */ - break; - case 'Z': show_tfm_flag = true; /* show TFM in log file 94/Jun/21 */ - break; - case 'c': current_tfm = false; /* not look current dir for TFM */ - break; - case 'C': current_flag = false; /* not look current dir for files */ - break; - case 'M': show_missing = false; /* do not show missing 94/June/10 */ - break; - case 'd': deslash = false; /* flipped 93/Nov/18 */ - /* pseudo_tilde = 0; */ /* new 95/Sep/26 */ - break; - case 'p': allow_patterns = true; /* 93/Nov/26 */ - /* reset_exceptions = true; */ /* 93/Dec/23 */ - break; + case 'v': + want_version = true; + verbose_flag = true; + break; + case 'i': + is_initex = true; + break; + case 'Q': + interaction = batch_mode; /* quiet mode */ + break; + case 'R': + interaction = nonstop_mode; /* run mode */ + break; + case 'S': + interaction = scroll_mode; /* scroll mode */ + break; + case 'T': + interaction = error_stop_mode; /* tex mode */ + break; + case 'K': + backwardflag = true; /* 94/Jun/15 */ + knuthify(); /* revert to `standard' Knuth TeX */ + break; + case 'L': + c_style_flag = true; /* C style error msg 94/Mar/21 */ + break; + case 'Z': + show_tfm_flag = true; /* show TFM in log file 94/Jun/21 */ + break; + case 'c': + current_tfm = false; /* not look current dir for TFM */ + break; + case 'C': + current_flag = false; /* not look current dir for files */ + break; + case 'M': + show_missing = false; /* do not show missing 94/June/10 */ + break; + case 'd': + deslash = false; /* flipped 93/Nov/18 */ + /* pseudo_tilde = 0; */ /* new 95/Sep/26 */ + break; + case 'p': + allow_patterns = true; /* 93/Nov/26 */ + /* reset_exceptions = true; */ /* 93/Dec/23 */ + break; /* case 'w': show_in_hex = false; */ /* 94/Jan/26 */ - case 'w': show_in_hex = true; /* flipped 00/Jun/18 */ - break; - case 'j': show_in_dos = true; /* 96/Jan/26 */ - break; - case 'n': restrict_to_ascii = true; /* 0 - 127 1994/Jan/21 */ - break; - case '6': workingdirectory = true; /* use source dir 98/Sep/29 */ - break; - case '7': usesourcedirectory = false; /* use working dir 98/Sep/29 */ - break; - case 'f': show_fonts_used = false; /* 97/Dec/24 */ - break; - case '8': shorten_file_name = true; /* 95/Feb/20 */ - break; - case '9': show_cs_names = true; /* 98/Mar/31 */ - break; - case '4': ignore_frozen = true; /* 98/Oct/5 */ - break; - case '5': font_dimen_zero = false; /* 98/Oct/5 */ - break; - case 'F': show_texinput_flag = false; /* 98/Jan/28 */ - break; + case 'w': + show_in_hex = true; /* flipped 00/Jun/18 */ + break; + case 'j': + show_in_dos = true; /* 96/Jan/26 */ + break; + case 'n': + restrict_to_ascii = true; /* 0 - 127 1994/Jan/21 */ + break; + case '6': + workingdirectory = true; /* use source dir 98/Sep/29 */ + break; + case '7': + usesourcedirectory = false; /* use working dir 98/Sep/29 */ + break; + case 'f': + show_fonts_used = false; /* 97/Dec/24 */ + break; + case '8': + shorten_file_name = true; /* 95/Feb/20 */ + break; + case '9': + show_cs_names = true; /* 98/Mar/31 */ + break; + case '4': + ignore_frozen = true; /* 98/Oct/5 */ + break; + case '5': + font_dimen_zero = false; /* 98/Oct/5 */ + break; + case 'F': + show_texinput_flag = false; /* 98/Jan/28 */ + break; /* case 'X': truncate_long_lines = false; */ /* 98/Feb/2 */ /* break; */ - case 'W': usedviwindo = false; /* 94/May/19 */ - break; - case 'J': show_line_break_stats = false; /* 96/Feb/8 */ - break; - case 'O': show_fmt_flag = false; /* 94/Jun/21 */ - break; - case 'I': format_specific = false; /* 95/Jan/7 */ - break; - case '3': encoding_specific = false; /* 98/Oct/5 */ - break; - case '2': suppress_f_ligs = true; /* 99/Jan/5 f-lig */ - break; + case 'W': + usedviwindo = false; /* 94/May/19 */ + break; + case 'J': + show_line_break_stats = false; /* 96/Feb/8 */ + break; + case 'O': + show_fmt_flag = false; /* 94/Jun/21 */ + break; + case 'I': + format_specific = false; /* 95/Jan/7 */ + break; + case '3': + encoding_specific = false; /* 98/Oct/5 */ + break; + case '2': + suppress_f_ligs = true; /* 99/Jan/5 f-lig */ + break; /* following are pretty obscure */ /* case 'y': cache_file_flag = false; */ /* 96/Nov/16 */ /* break; */ @@ -2521,95 +2551,177 @@ int analyze_flag (int c, char *optarg) /* break; */ /* case 'z': trimeof = false; */ /* 93/Nov/24 */ /* break; */ - case 'z': full_file_name_flag = false; // 00 Jun 18 - break; - case 'X': save_strings_flag = false; // 00 Aug 15 - break; + case 'z': + full_file_name_flag = false; // 00 Jun 18 + break; + case 'X': + save_strings_flag = false; // 00 Aug 15 + break; /* following are unannounced options */ /* some may be recycled ... */ - case 't': trace_flag = true; - break; - case 'q': quitflag++; /* 93/Dec/16 */ - break; + case 't': + trace_flag = true; + break; + case 'q': + quitflag++; /* 93/Dec/16 */ + break; /* The following are really obscure and should not be advertized */ - case 's': show_current = false; /* tex8 93/Dec/14 */ - break; - case 'N': show_numeric = false; /* 93/Dec/21 */ - break; - case 'A': civilize_flag = false; /* 93/Dec/16 */ - break; - case 'B': open_trace_flag = true; /* openinou 1994/Jan/8 */ - break; - case 'Y': reorder_arg_flag = false; /* local */ - break; - case 'b': test_dir_access = false; /* 94/Feb/10 */ - break; - case 'D': dir_method = false; /* 94/Feb/10 */ - break; - case 'G': file_method = false; /* 94/Feb/13 */ - break; + case 's': + show_current = false; /* tex8 93/Dec/14 */ + break; + case 'N': + show_numeric = false; /* 93/Dec/21 */ + break; + case 'A': + civilize_flag = false; /* 93/Dec/16 */ + break; + case 'B': + open_trace_flag = true; /* openinou 1994/Jan/8 */ + break; + case 'Y': + reorder_arg_flag = false; /* local */ + break; + case 'b': + test_dir_access = false; /* 94/Feb/10 */ + break; + case 'D': + dir_method = false; /* 94/Feb/10 */ + break; + case 'G': + file_method = false; /* 94/Feb/13 */ + break; // case 'V': share_flag = _SH_DENYNO; break; /* 0x40 - deny none mode */ /* case 'X': nohandler++; break; */ /* case 'f': waitflush = false; break; */ /* case 'F': floating = true; break; */ /* *********** following command line options take arguments ************** */ - case 'm': if (optarg == 0) mem_initex = mem_top; else mem_initex = atoi(optarg) * 1024; /* 93 Dec/1 */ - if (mem_initex == 0) complainarg(c, optarg); - mem_spec_flag = 1; - break; + case 'm': + if (optarg == 0) + mem_initex = mem_top; + else + mem_initex = atoi(optarg) * 1024; /* 93 Dec/1 */ + if (mem_initex == 0) + complainarg(c, optarg); + mem_spec_flag = 1; + break; #ifdef VARIABLETRIESIZE - case 'h': if (optarg == 0) trie_size = default_trie_size; else trie_size = atoi(optarg); /* 93 Dec/1 */ - if (trie_size == 0) complainarg(c, optarg); - break; + case 'h': + if (optarg == 0) + trie_size = default_trie_size; + else + trie_size = atoi(optarg); /* 93 Dec/1 */ + if (trie_size == 0) + complainarg(c, optarg); + break; #endif #ifdef ALLOCATEHYPHEN - case 'e': if (optarg == 0) new_hyphen_prime = hyphen_prime * 2; else new_hyphen_prime = atoi(optarg); /* 93/Nov/26 */ - if (new_hyphen_prime == 0) complainarg(c, optarg); - break; + case 'e': + if (optarg == 0) + new_hyphen_prime = hyphen_prime * 2; + else + new_hyphen_prime = atoi(optarg); /* 93/Nov/26 */ + if (new_hyphen_prime == 0) + complainarg(c, optarg); + break; #endif #ifdef ALLOCATEDVIBUF - case 'u': if (optarg == 0) dvi_buf_size = default_dvi_buf_size; else dvi_buf_size = atoi(optarg); /* 94/Mar/24 */ - if (dvi_buf_size == 0) complainarg(c, optarg); - break; -#endif - case 'g': if (optarg == 0) percent_grow = 62; else percent_grow = atoi(optarg); /* 93/Dec/11 */ - if (percent_grow == 0) complainarg(c, optarg); - break; - case 'U': if (optarg == 0) pseudo_tilde = 0; else pseudo_tilde = atoi(optarg); /* 95/Sep/26 */ - if (pseudo_tilde > 255) pseudo_tilde = 255; else if (pseudo_tilde < 128) pseudo_tilde = 128; - break; + case 'u': + if (optarg == 0) + dvi_buf_size = default_dvi_buf_size; + else + dvi_buf_size = atoi(optarg); /* 94/Mar/24 */ + if (dvi_buf_size == 0) + complainarg(c, optarg); + break; +#endif + case 'g': + if (optarg == 0) + percent_grow = 62; + else + percent_grow = atoi(optarg); /* 93/Dec/11 */ + if (percent_grow == 0) + complainarg(c, optarg); + break; + case 'U': + if (optarg == 0) + pseudo_tilde = 0; + else + pseudo_tilde = atoi(optarg); /* 95/Sep/26 */ + if (pseudo_tilde > 255) + pseudo_tilde = 255; + else if (pseudo_tilde < 128) + pseudo_tilde = 128; + break; /* case 'H': if (optarg == 0) heapthreshold = 1024; else heapthreshold = atoi(optarg); * if (heapthreshold == 0) complainarg(c, optarg); else heap_flag = 1; * break; */ - case 'H': if (optarg == 0) tab_step = 8; else tab_step = atoi(optarg); /* 94/July/3 */ - if (tab_step == 0) complainarg(c, optarg); - break; - case 'x': if (optarg == 0) xchrfile=xstrdup("xchr.map"); else xchrfile = xstrdup(optarg); - if (xchrfile == NULL || *xchrfile == '\0') complainarg(c, optarg); - break; - case 'k': if (optarg == 0) replfile =xstrdup("repl.key"); else replfile = xstrdup(optarg); - if (replfile == NULL || *replfile == '\0') - complainarg(c, optarg); - break; + case 'H': + if (optarg == 0) + tab_step = 8; + else + tab_step = atoi(optarg); /* 94/July/3 */ + if (tab_step == 0) + complainarg(c, optarg); + break; + case 'x': + if (optarg == 0) + xchrfile = xstrdup("xchr.map"); + else + xchrfile = xstrdup(optarg); + if (xchrfile == NULL || *xchrfile == '\0') + complainarg(c, optarg); + break; + case 'k': + if (optarg == 0) + replfile = xstrdup("repl.key"); + else + replfile = xstrdup(optarg); + if (replfile == NULL || *replfile == '\0') + complainarg(c, optarg); + break; /* more obscure stuff - ppssibly recycle */ - case 'P': if (optarg == 0) default_rule = 26214; /* 95/Oct/9 */ - else default_rule = atoi(optarg); /* 95/Oct/9 */ - if (default_rule == 0) complainarg(c, optarg); - break; - case 'E': if (optarg != 0) putenv(optarg); else complainarg(c, optarg); - break; - case 'o': if (optarg == 0) dvi_directory = ""; else dvi_directory = xstrdup(optarg); - if (strcmp(dvi_directory, "") == 0) complainarg(c, optarg); - break; - case 'l': if (optarg == 0) log_directory = ""; else log_directory = xstrdup(optarg); - if (strcmp(log_directory, "") == 0) complainarg(c, optarg); - break; - case 'a': if (optarg == 0) aux_directory = ""; else aux_directory = xstrdup(optarg); - if (strcmp(aux_directory, "") == 0) complainarg(c, optarg); - break; + case 'P': + if (optarg == 0) + default_rule = 26214; /* 95/Oct/9 */ + else + default_rule = atoi(optarg); /* 95/Oct/9 */ + if (default_rule == 0) + complainarg(c, optarg); + break; + case 'E': + if (optarg != 0) + putenv(optarg); + else + complainarg(c, optarg); + break; + case 'o': + if (optarg == 0) + dvi_directory = ""; + else + dvi_directory = xstrdup(optarg); + if (strcmp(dvi_directory, "") == 0) + complainarg(c, optarg); + break; + case 'l': + if (optarg == 0) + log_directory = ""; + else + log_directory = xstrdup(optarg); + if (strcmp(log_directory, "") == 0) + complainarg(c, optarg); + break; + case 'a': + if (optarg == 0) + aux_directory = ""; + else + aux_directory = xstrdup(optarg); + if (strcmp(aux_directory, "") == 0) + complainarg(c, optarg); + break; case '?': - default : show_use = true; - return -1; // failed to recognize - break; + default: + show_use = true; + return -1; // failed to recognize + break; } return 0; } @@ -2631,9 +2743,9 @@ char *yytexcmd="YANDYTEX.CMD"; /* name of command line file */ void yy_extension (char *fname, char *ext) { char *s, *t; - if ((s = strrchr(fname, '.')) == NULL || + if ((s = strrchr(fname, '.')) == NULL || ((t = strrchr(fname, '\\')) != NULL && s < t)) { - strcat(fname, "."); + strcat(fname, "."); strcat(fname, ext); } } @@ -2643,9 +2755,9 @@ void yy_extension (char *fname, char *ext) void strip_name (char *pathname) { char *s; - if ((s=strrchr(pathname, '\\')) != NULL); - else if ((s=strrchr(pathname, '/')) != NULL); - else if ((s=strrchr(pathname, ':')) != NULL) s++; + if ((s = strrchr(pathname, '\\')) != NULL); + else if ((s = strrchr(pathname, '/')) != NULL); + else if ((s = strrchr(pathname, ':')) != NULL) s++; else s = pathname; *s = '\0'; } @@ -2743,9 +2855,9 @@ int read_command_line (int ac, char **av) /* WARNING: if adding flags, change also `allowedargs' and `takeargs' !!!! */ while ((c = getopt(ac, av, allowedargs)) != EOF) { if (optarg != 0 && *optarg == '=') - optargnew = optarg+1; + optargnew = optarg+1; else - optargnew = optarg; + optargnew = optarg; analyze_flag (c, optargnew); } if (show_use || quitflag == 3) { @@ -2787,7 +2899,8 @@ int read_command_line (int ac, char **av) } #ifdef IGNORED -void uppercase (char *s) { +void uppercase (char *s) +{ int c; while ((c = *s) != '\0') { /* if (islower(c)) *s = toupper (*s); */ @@ -2804,7 +2917,7 @@ int init_commands (int ac, char **av) is_initex = trace_flag = deslash = non_ascii = false; */ is_initex = false; /* check for dumping format file */ allow_patterns = false; /* using \pattern after format file loaded */ - reset_exceptions = false; + reset_exceptions = false; non_ascii = false; key_replace = false; want_version = false; @@ -2851,8 +2964,7 @@ int init_commands (int ac, char **av) 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; + new_hyphen_prime = 0; #ifdef VARIABLETRIESIZE /* trie_size = default_trie_size; */ trie_size = 0; @@ -2900,84 +3012,81 @@ int init_commands (int ac, char **av) /* if we aren't including current directory in any directory lists */ /* then makes no sense to avoid them separately for TFM files ... */ /* (that is, the ./ is already omitted from the dir list in that case */ - if (!current_flag && !current_tfm) current_tfm = true; /* 94/Jan/24 */ + if (!current_flag && !current_tfm) + current_tfm = true; /* 94/Jan/24 */ return 0; // success } /* E sets environment variable ? */ void initial_memory (void) -{ /* set initial memory allocations */ - if (mem_extra_high < 0) mem_extra_high = 0; - if (mem_extra_low < 0) mem_extra_low = 0; - if (mem_initex < 0) mem_initex = 0; - if (is_initex) { +{ + /* set initial memory allocations */ + if (mem_extra_high < 0) mem_extra_high = 0; + if (mem_extra_low < 0) mem_extra_low = 0; + if (mem_initex < 0) mem_initex = 0; + if (is_initex) { #if defined(ALLOCATEHIGH) || defined(ALLOCATELOW) - if (mem_extra_high != 0 || mem_extra_low != 0) { - show_line("ERROR: Cannot extend main memory in iniTeX\n", 1); - mem_extra_high = 0; mem_extra_low = 0; - } - #endif + if (mem_extra_high != 0 || mem_extra_low != 0) { + show_line("ERROR: Cannot extend main memory in iniTeX\n", 1); + mem_extra_high = 0; mem_extra_low = 0; } - else { - if (mem_initex != 0) { - show_line("ERROR: Can only set initial main memory size in iniTeX\n", 1); - mem_initex = 0; - } - if (trie_size != 0) { - show_line("ERROR: Need only set hyphenation trie size in iniTeX\n", 1); -/* trie_size = 0; */ - } +#endif + } else { + if (mem_initex != 0) { + show_line("ERROR: Can only set initial main memory size in iniTeX\n", 1); + mem_initex = 0; + } + if (trie_size != 0) { + show_line("ERROR: Need only set hyphenation trie size in iniTeX\n", 1); +/* trie_size = 0; */ } - if (mem_initex == 0) mem_initex = default_mem_top; - if (trie_size == 0) trie_size = default_trie_size; + } + 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 */ - 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; + 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; #ifdef ALLOCATEHIGH /* not used anymore */ - if (mem_extra_high > 2048L * 1024L) { /* extend SW area by 16 mega byte! */ - show_line( - "WARNING: There may be no benefit to asking for so much memory\n", 0); - mem_extra_high = 2048 * 1024; /* limit to SW to 4 x VLR */ - } + if (mem_extra_high > 2048L * 1024L) { /* extend SW area by 16 mega byte! */ + show_line("WARNING: There may be no benefit to asking for so much memory\n", 0); + mem_extra_high = 2048 * 1024; /* limit to SW to 4 x VLR */ + } #endif #ifdef ALLOCATELOW /* not used anymore */ - if (mem_extra_low > 2048L * 1024L) { /* extend VL area by 16 mega byte! */ - show_line( - "WARNING: There may be no benefit to asking for so much memory\n", 0); - mem_extra_low = 2048 * 1024; /* limit VLR to 4 x SW */ - } + if (mem_extra_low > 2048L * 1024L) { /* extend VL area by 16 mega byte! */ + show_line("WARNING: There may be no benefit to asking for so much memory\n", 0); + mem_extra_low = 2048 * 1024; /* limit VLR to 4 x SW */ + } #endif - if (mem_initex > 2048L * 1024L) { /* extend main memory by 16 mega byte! */ - show_line( - "WARNING: There may be no benefit to asking for so much memory\n", 0); -/* mem_initex = 2048 * 1024; */ - } + if (mem_initex > 2048L * 1024L) { /* extend main memory by 16 mega byte! */ + show_line("WARNING: There may be no benefit to asking for so much memory\n", 0); +/* mem_initex = 2048 * 1024; */ + } #ifdef ALLOCATEDVIBUF - if (dvi_buf_size == 0) dvi_buf_size = default_dvi_buf_size; - /* if less than 1024 assume user specified kilo-bytes, not bytes */ - if (dvi_buf_size < 1024) dvi_buf_size = dvi_buf_size * 1024; - if (dvi_buf_size % 8 != 0) /* check multiple of eight */ - dvi_buf_size = (dvi_buf_size / 8 + 1) * 8; + if (dvi_buf_size == 0) dvi_buf_size = default_dvi_buf_size; +/* if less than 1024 assume user specified kilo-bytes, not bytes */ + if (dvi_buf_size < 1024) dvi_buf_size = dvi_buf_size * 1024; + if (dvi_buf_size % 8 != 0) /* check multiple of eight */ + dvi_buf_size = (dvi_buf_size / 8 + 1) * 8; #endif - if (new_hyphen_prime < 0) new_hyphen_prime = 0; - if (new_hyphen_prime > 0) { - if (! is_initex) - show_line("ERROR: Can only set hyphen prime in iniTeX\n", 1); - else { - if (new_hyphen_prime % 2 == 0) new_hyphen_prime++; - while (!prime(new_hyphen_prime)) new_hyphen_prime = new_hyphen_prime+2; - if (trace_flag) { - sprintf(log_line, "Using %d as hyphen prime\n", new_hyphen_prime); - show_line(log_line, 0); - } + if (new_hyphen_prime < 0) new_hyphen_prime = 0; + if (new_hyphen_prime > 0) { + if (! is_initex) + show_line("ERROR: Can only set hyphen prime in iniTeX\n", 1); + else { + if (new_hyphen_prime % 2 == 0) new_hyphen_prime++; + while (!prime(new_hyphen_prime)) new_hyphen_prime = new_hyphen_prime+2; + if (trace_flag) { + sprintf(log_line, "Using %d as hyphen prime\n", new_hyphen_prime); + show_line(log_line, 0); } } - - if (percent_grow > 100) percent_grow = percent_grow - 100; - if (percent_grow > 100) percent_grow = 100; /* upper limit - double */ - if (percent_grow < 10) percent_grow = 10; /* lower limit - 10% */ + } + if (percent_grow > 100) percent_grow = percent_grow - 100; + if (percent_grow > 100) percent_grow = 100; /* upper limit - double */ + if (percent_grow < 10) percent_grow = 10; /* lower limit - 10% */ } /**********************************************************************/ @@ -3116,7 +3225,6 @@ 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; /* NOTE: assuming that command line arguments are in writable memory ! */ /* if (trace_flag || debug_flag) @@ -3220,10 +3328,15 @@ int init (int ac, char **av) buffer = realloc_buffer (initial_buf_size); /* sprintf(log_line, "buffer %x, current_buf_size %d\n", buffer, current_buf_size); */ #endif - hyph_list = NULL; hyph_word = NULL; + hyph_list = NULL; hyph_word = NULL; trie_taken = NULL; trie_hash = NULL; - trie_r = NULL; trie_c = NULL; trie_o = NULL; trie_l = NULL; - trie_trc = NULL; trie_tro = NULL; trie_trl = NULL; + trie_r = NULL; + trie_c = NULL; + trie_o = NULL; + trie_l = NULL; + trie_trc = NULL; + trie_tro = NULL; + trie_trl = NULL; log_opened = false; /* so can tell whether opened */ interaction = -1; /* default state => 3 */ @@ -3242,9 +3355,9 @@ int init (int ac, char **av) check_fixed_align(trace_flag); /* sanity check 1994/Jan/8 */ - format_file = NULL; /* to be set in openinou.c 94/Jun/21 */ - string_file = NULL; /* to be set in openinou.c 96/Jan/15 */ - source_direct = NULL; /* to be set in openinou.c 98/Sep/29 */ + format_file = NULL; /* to be set in openinou.c 94/Jun/21 */ + string_file = NULL; /* to be set in openinou.c 96/Jan/15 */ + source_direct = NULL; /* to be set in openinou.c 98/Sep/29 */ 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 */ @@ -3396,7 +3509,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 = length(textof); if (textcolumn != 0) { sprintf(log_line, ", "); if (output != NULL) fprintf(output, log_line); @@ -3420,24 +3533,24 @@ void print_cs_name (FILE *output, int h) textcolumn += n; } -int comparestrn (int, int, int, int); /* in tex9.c */ +int compare_strn (int, int, int, int); /* in tex9.c */ /* compare two csnames in qsort */ -int comparecs (const void *cp1, const void *cp2) +int compare_cs (const void *cp1, const void *cp2) { int c1, c2, l1, l2, k1, k2, textof1, textof2; c1 = *(int *)cp1; c2 = *(int *)cp2; textof1 = hash[c1].v.RH; textof2 = hash[c2].v.RH; - l1 =(str_start[textof1 + 1] - str_start[textof1]); - l2 =(str_start[textof2 + 1] - str_start[textof2]); + l1 = length(textof1); + l2 = length(textof2); k1 = str_start[textof1]; k2 = str_start[textof2]; /* showstring (k1, l1); */ /* showstring (k2, l2); */ - return comparestrn (k1, l1, k2, l2); + return compare_strn (k1, l1, k2, l2); } char *csused=NULL; @@ -3488,7 +3601,7 @@ void print_cs_names (FILE *output, int pass) if (hash[h].v.RH != 0) cnumtable[ccount++] = h; } - qsort ((void *)cnumtable, ccount, sizeof (int), &comparecs); + qsort ((void *)cnumtable, ccount, sizeof (int), &compare_cs); repeatflag = 0; for (k = 0; k < ccount; k++) { @@ -3524,7 +3637,7 @@ void showstring (int k, int l) /* k1 and k2 are positions in string pool */ /* l1 and l2 are lengths of strings */ -int comparestrn (int k1, int l1, int k2, int l2) +int compare_strn (int k1, int l1, int k2, int l2) { int c1, c2; /* while (l1-- > 0 && l2-- > 0) { */ @@ -3544,18 +3657,18 @@ int comparestrn (int k1, int l1, int k2, int l2) /* compare two font names and their at sizes in qsort */ -int comparefnt (const void *fp1, const void *fp2) +int compare_fnt (const void *fp1, const void *fp2) { int f1, f2, l1, l2, k1, k2, s; f1 = *(short *)fp1; f2 = *(short *)fp2; - l1 =(str_start[font_name[f1]+ 1] - str_start[font_name[f1]]); - l2 =(str_start[font_name[f2]+ 1] - str_start[font_name[f2]]); + l1 = length(font_name[f1]); + l2 = length(font_name[f2]); k1 = str_start[font_name[f1]]; k2 = str_start[font_name[f2]]; /* showstring (k1, l1); */ /* showstring (k2, l2); */ - s = comparestrn (k1, l1, k2, l2); + s = compare_strn (k1, l1, k2, l2); /* sprintf(log_line, "%d\n", s); */ if (s != 0) return s; if (font_size[f1]> font_size[f2]) return 1; @@ -3565,16 +3678,16 @@ int comparefnt (const void *fp1, const void *fp2) /* compare two font names */ -int comparefntname (int f1, int f2) +int compare_fnt_name (int f1, int f2) { int l1, l2, k1, k2, s; - l1 =(str_start[font_name[f1]+ 1] - str_start[font_name[f1]]); - l2 =(str_start[font_name[f2]+ 1] - str_start[font_name[f2]]); + l1 = length(font_name[f1]); + l2 = length(font_name[f2]); k1 = str_start[font_name[f1]]; k2 = str_start[font_name[f2]]; /* showstring (k1, l1); */ /* showstring (k2, l2); */ - s = comparestrn (k1, l1, k2, l2); + s = compare_strn (k1, l1, k2, l2); /* sprintf(log_line, "%d\n", s); */ return s; } @@ -3640,8 +3753,8 @@ void dvi_font_show(internal_font_number f, int suppressname) /* suppressname = 0; */ putc(' ', log_file); if (suppressname == 0) { - a = (str_start[font_area[f]+ 1]- str_start[font_area[f]]); - l = (str_start[font_name[f]+ 1]- str_start[font_name[f]]); + a = length(font_area[f]); + l = length(font_name[f]); k = str_start[font_area[f]]; for_end = str_start[font_area[f]+ 1]- 1; if (k <= for_end) do { @@ -3694,12 +3807,12 @@ void show_font_info (void) for (k = 1; k <= font_ptr; k++) if (font_used[k])fnumtable[fcount++] = (short) k; - qsort ((void *)fnumtable, fcount, sizeof (short), &comparefnt); + qsort ((void *)fnumtable, fcount, sizeof (short), &compare_fnt); repeatflag = 0; for (m = 0; m < fcount; m++) { if (m > 0) { - if (comparefntname(fnumtable[m-1], fnumtable[m]) == 0) + if (compare_fnt_name(fnumtable[m-1], fnumtable[m]) == 0) repeatflag = 1; else repeatflag = 0; } diff --git a/src/texsourc/ourpaths.h b/src/texsourc/ourpaths.h index 2b0ae10..4715e83 100644 --- a/src/texsourc/ourpaths.h +++ b/src/texsourc/ourpaths.h @@ -57,4 +57,3 @@ typedef enum #define VFFILEPATHBIT (1 << VFFILEPATH) #endif /* not OURPATHS_H */ - \ No newline at end of file diff --git a/src/texsourc/pascal.h b/src/texsourc/pascal.h index 35dd945..f9fcecc 100644 --- a/src/texsourc/pascal.h +++ b/src/texsourc/pascal.h @@ -27,7 +27,7 @@ Specifically, a test in diag_round (in Metafont) on a quarterword comes out differently without the cast, thus causing the trap test to fail. (A path at line 86 is constructed slightly differently). */ -#define abs(x)((integer)(x)>=0?(integer)(x):(integer)-(x)) +#define abs(x) ((integer)(x)>=0?(integer)(x):(integer)-(x)) /* above conflicts with math.h ... */ diff --git a/src/texsourc/paths.h b/src/texsourc/paths.h index 539594f..8926941 100644 --- a/src/texsourc/paths.h +++ b/src/texsourc/paths.h @@ -61,18 +61,6 @@ #define BSTINPUTS ".;" TEXPATH "bib//" #endif -#ifndef MFBASES -#define MFBASES ".;c:/mf/bases" -#endif - -#ifndef MFINPUTS -#define MFINPUTS "c:/mf/inputs//" -#endif - -#ifndef MFPOOL -#define MFPOOL "c:/mf/bases" -#endif - /* Of course, TeX itself doesn't give a damn about any of the following: */ #ifndef GFFONTS diff --git a/src/texsourc/subroute.c b/src/texsourc/subroute.c index ff49864..8b2791f 100644 --- a/src/texsourc/subroute.c +++ b/src/texsourc/subroute.c @@ -67,21 +67,21 @@ typedef struct map_element_struct { - char *key; - char *value; - struct map_element_struct *next; + char * key; + char * value; + struct map_element_struct * next; } map_element_type; typedef map_element_type **map_type; -extern bool usesourcedirectory; /* in local.c */ +extern bool usesourcedirectory; /* in local.c */ -extern bool workingdirectory; /* in local.c */ +extern bool workingdirectory; /* in local.c */ bool absolute_p (string filename); string readable (string name); string truncate_pathname (string name); -char *file_p(string fn); +char * file_p(string fn); bool dir_p(string fn); string *find_dir_list (string path); void add_directory (string **dir_list_ptr, unsigned *dir_count_ptr, string dir); @@ -96,7 +96,7 @@ char *map_lookup (map_type map, char *key); // the following do *not* use MALLOC -extern char * xconcat (char *buffer, char *s1, char *s2); /* openinou.c */ +extern char * xconcat (char *buffer, char *s1, char *s2); /* openinou.c */ extern char * xconcat3 (char *buffer, char *s1, char *s2, char *s3); /* openinou.c */ ///////////////////////////////////////////////////////////////////////// @@ -123,7 +123,7 @@ void uexit (int unix_code) } jump_used++; // I removed the longjmp. - //longjmp(jumpbuffer, code+1); // 1999/Nov/7 + //longjmp(jumpbuffer, final_code + 1); // 1999/Nov/7 exit(final_code); } @@ -182,7 +182,7 @@ address xcalloc (unsigned nelem, unsigned elsize) return new_mem; } -/* Return a copy of s in new storage. */ /* xmalloc does error checking */ +/* Return a copy of s in new storage. */ /* xmalloc does error checking */ string xstrdup (string s) { @@ -265,12 +265,12 @@ string concat3 (string s1, string s2, string s3) // following used only in itex.c on pool file -/* Return true if we're at the end of FILE, else false. This implements - Pascal's `eof' builtin. */ +/* Return true if we're at the end of FILE, else false. This implements */ +/* Pascal's `eof' builtin. */ /* It differs from C feof in that the latter is not true at end of file - unless an attempt has actually been made to read past EOF */ + unless an attempt has actually been made to read past EOF */ -bool test_eof (FILE *file) +bool test_eof (FILE * file) { int c; /* Maybe we're already at the end? */ @@ -285,7 +285,7 @@ bool test_eof (FILE *file) /* Return true on end-of-line in FILE or at the end of FILE, else false. */ -bool eoln (FILE *file) +bool eoln (FILE * file) { int c; if (feof (file)) @@ -403,7 +403,7 @@ string extend_filename (string name, string default_suffix) // this returns newly allocated character string -char *read_line (FILE *f) +char *read_line (FILE * f) { int c; unsigned int limit = BLOCK_SIZE; @@ -495,7 +495,7 @@ static string *path_dirs[LAST_PATH]; void set_paths (int path_bits) { - int n; /* 97/Apr/2 */ + int n; /* 97/Apr/2 */ char *s, *t, *u; /* 94/Jan/6 */ char buffer[PATH_MAX]; @@ -631,9 +631,9 @@ void set_paths (int path_bits) } #ifdef CACHEFILENAME - char last_filename[PATH_MAX]=""; /* last full path / file name found C */ - char last_name[PATH_MAX]=""; /* last file name searched for C */ - int last_path_index=-1; /* last path_index */ + char last_filename[PATH_MAX] = ""; /* last full path / file name found C */ + char last_name[PATH_MAX] = ""; /* last file name searched for C */ + int last_path_index = -1; /* last path_index */ #endif /* Look for NAME, a C string (no longer Pascal), in the colon-separated list @@ -667,18 +667,18 @@ bool test_read_access (unsigned char *name, int path_index) /* then use cached full path / file name 96/Nov/16 */ if (cache_file_flag) { if (path_index == last_path_index && - strcmp(name, last_name) == 0 && *last_filename != '\0') { + strcmp((const char *)name, last_name) == 0 && *last_filename != '\0') { if (open_trace_flag) { sprintf(log_line, "\nFOUND `%s' (%d) IN CACHE: `%s' ", name, path_index, last_filename); /* name+1, path_index, last_filename); */ show_line(log_line, 0); } - strcpy(name, last_filename); + strcpy((char *)name, last_filename); return TRUE; } last_path_index = path_index; - strcpy(last_name, name); + strcpy(last_name, (const char *)name); *last_filename = '\0'; /* in case not found */ } #endif @@ -788,7 +788,7 @@ bool test_read_access (unsigned char *name, int path_index) /* The hash function. We go for simplicity here. */ -static unsigned map_hash (char *key) +static unsigned map_hash (char * key) { unsigned n = 0; @@ -1196,7 +1196,7 @@ bool dir_p (string fn) /* this string allocation / concatination is silly - use fixed buffer! */ -int xfind_path_filename (string buffer, string filename, string * dir_list) +int xfind_path_filename (string buffer, string filename, string * dir_list) { string found_name = NULL; @@ -1651,7 +1651,7 @@ void convertexclam (string env_value) { /* 97/Mar/22 */ If ENV_NAME is null, only parse DEFAULT_PATH. If both are null, do nothing and return NULL. */ -string *initialize_path_list (string env_name, string default_path) +string * initialize_path_list (string env_name, string default_path) { string dir, path; string *dir_list; @@ -1768,8 +1768,7 @@ string *initialize_path_list (string env_name, string default_path) } add_directory (&dir_list, &dir_count, dir); /* local variable 'findt' used without having been initialized ? &findt ? */ - expand_subdir (&dir_list, &dir_count, dir, - findt, 1); /* 95/Jan/31 */ + expand_subdir (&dir_list, &dir_count, dir, findt, 1); /* 95/Jan/31 */ } } /* following is new to find only directories to one level 1994/Jan/24 */ diff --git a/src/texsourc/tex0.c b/src/texsourc/tex0.c index c634a8a..13407f2 100644 --- a/src/texsourc/tex0.c +++ b/src/texsourc/tex0.c @@ -29,6 +29,13 @@ static void winerror (char * message) #endif /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ +INLINE void dvi_out_(ASCII_code op) +{ + dvi_buf[dvi_ptr] = op; + incr(dvi_ptr); + if (dvi_ptr == dvi_limit) + dvi_swap(); +} void succumb (void) { if (interaction == error_stop_mode) @@ -2048,10 +2055,10 @@ void print_rule_dimen_ (scaled d) print_scaled(d); } /* sec 0177 */ -void print_glue_(scaled d, integer order, str_number s) +void print_glue_(scaled d, integer order, char * s) { print_scaled(d); - if ((order < normal)||(order > filll)) + if ((order < normal) || (order > filll)) print_string("foul"); else if (order > 0) { @@ -2060,19 +2067,19 @@ void print_glue_(scaled d, integer order, str_number s) print_char('l'); decr(order); } - } else if (s != 0) - print(s); + } else if (*s != '\0') + print_string(s); } /* sec 0178 */ -void print_spec_(integer p, str_number s) +void print_spec_(integer p, char * s) { if ((p < mem_min)||(p >= lo_mem_max)) print_char('*'); else { print_scaled(mem[p + 1].cint); - if (s != 0) - print(s); + if (*s != '\0') + print_string(s); if (stretch(p) != 0) { @@ -2289,12 +2296,12 @@ void show_node_list_(integer p) if (mem[p + 6].cint != 0) { print_string(", stretch"); - print_glue(mem[p + 6].cint, mem[p + 5].hh.b1, 0); + print_glue(mem[p + 6].cint, mem[p + 5].hh.b1, ""); } if (mem[p + 4].cint != 0) { print_string(", shrink"); - print_glue(mem[p + 4].cint, mem[p + 5].hh.b0, 0); + print_glue(mem[p + 4].cint, mem[p + 5].hh.b0, ""); } } else { g = mem[p + 6].gr; @@ -2309,8 +2316,8 @@ void show_node_list_(integer p) print_char('>'); else print_string("< -"); - print_glue(20000 * 65536L, mem[p + 5].hh.b1, 0); - } else print_glue(round(65536L * g), mem[p + 5].hh.b1, 0); + print_glue(20000 * 65536L, mem[p + 5].hh.b1, ""); + } else print_glue(round(65536L * g), mem[p + 5].hh.b1, ""); } if (mem[p + 4].cint != 0) { @@ -2342,10 +2349,10 @@ void show_node_list_(integer p) { print_esc("insert"); print_int(mem[p].hh.b1); - print_string(",natural size "); + print_string(", natural size "); print_scaled(mem[p + 3].cint); print_string("; split("); - print_spec(mem[p + 4].hh.v.RH, 0); + print_spec(mem[p + 4].hh.v.RH, ""); print_char(','); print_scaled(mem[p + 2].cint); print_string("(; float cost"); @@ -2410,7 +2417,7 @@ void show_node_list_(integer p) else if (mem[p].hh.b1 == 102) print_char('x'); print_string("leaders "); - print_spec(mem[p + 1].hh.v.LH, 0); + print_spec(mem[p + 1].hh.v.LH, ""); { { str_pool[pool_ptr]= 46; @@ -2435,9 +2442,9 @@ void show_node_list_(integer p) { print_char(' '); if (mem[p].hh.b1 < 98) - print_spec(mem[p + 1].hh.v.LH, 0); + print_spec(mem[p + 1].hh.v.LH, ""); else - print_spec(mem[p + 1].hh.v.LH, 334); /* mu */ + print_spec(mem[p + 1].hh.v.LH, "mu"); } } break; diff --git a/src/texsourc/tex1.c b/src/texsourc/tex1.c index 369796e..4d18c21 100644 --- a/src/texsourc/tex1.c +++ b/src/texsourc/tex1.c @@ -24,15 +24,18 @@ #pragma warning(disable:4244) /* 96/Jan/10 */ /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ +/* sec 0198 */ void show_box_(halfword p) { depth_threshold = show_box_depth; breadth_max = show_box_breadth; + if (breadth_max <= 0) - breadth_max = 5; + breadth_max = 5; + #ifdef ALLOCATESTRING if (pool_ptr + depth_threshold >= current_pool_size) - str_pool = realloc_str_pool (increment_pool_size); + str_pool = realloc_str_pool(increment_pool_size); if (pool_ptr + depth_threshold >= current_pool_size) depth_threshold = current_pool_size - pool_ptr - 1; #else @@ -41,7 +44,8 @@ void show_box_(halfword p) #endif show_node_list(p); print_ln(); -} +} +/* sec 0200 */ void delete_token_ref_(halfword p) { if (mem[p].hh.v.LH == 0) @@ -49,6 +53,7 @@ void delete_token_ref_(halfword p) else decr(mem[p].hh.v.LH); } +/* sec 0201 */ void delete_glue_ref_(halfword p) { if (mem[p].hh.v.RH == 0) @@ -56,6 +61,7 @@ void delete_glue_ref_(halfword p) else decr(mem[p].hh.v.RH); } +/* sec 0202 */ void flush_node_list_(halfword p) { halfword q; @@ -230,6 +236,7 @@ lab30:; p = q; } } +/* sec 0204 */ halfword copy_node_list_(halfword p) { register halfword Result; @@ -373,7 +380,8 @@ halfword copy_node_list_(halfword p) } Result = q; return Result; -} +} +/* sec 0211 */ void print_mode_(integer m) { if (m > 0) @@ -388,8 +396,9 @@ void print_mode_(integer m) case 2: print_string("display math"); break; - } else if (m == 0) - print_string("no"); + } + else if (m == 0) + print_string("no"); else switch ((- (integer) m)/(101)) { case 0: @@ -404,6 +413,7 @@ void print_mode_(integer m) } print_string(" mode"); } +/* sec 0216 */ void push_nest (void) { if (nest_ptr > max_nest_stack) @@ -430,6 +440,7 @@ void push_nest (void) prev_graf = 0; mode_line = line; } +/* sec 0217 */ void pop_nest (void) { { @@ -443,7 +454,8 @@ void pop_nest (void) decr(nest_ptr); cur_list = nest[nest_ptr]; } -void show_activities (void) +/* sec 0218 */ +void show_activities (void) { integer p; short m; @@ -752,6 +764,7 @@ void print_param_(integer n) break; } } +/* sec 0245 */ void begin_diagnostic (void) { old_setting = selector; @@ -760,12 +773,14 @@ void begin_diagnostic (void) if (history == 0) history = 1; } } +/* sec 0245 */ void end_diagnostic_(bool blankline) { print_nl(" "); if (blankline) print_ln(); selector = old_setting; } +/* sec 0247 */ void print_length_param_ (integer n) { switch (n) @@ -838,33 +853,26 @@ void print_length_param_ (integer n) break; } } +/* sec 0298 */ void print_cmd_chr_ (quarterword cmd, halfword chrcode) { switch (cmd) { case 1: - { - print_string("begin-group character "); - print(chrcode); - } + print_string("begin-group character "); + print(chrcode); break; case 2: - { - print_string("end-group character "); - print(chrcode); - } + print_string("end-group character "); + print(chrcode); break; case 3: - { - print_string("math shift character "); - print(chrcode); - } + print_string("math shift character "); + print(chrcode); break; case 6: - { - print_string("macro parameter character "); - print(chrcode); - } + print_string("macro parameter character "); + print(chrcode); break; case 7: { @@ -1708,6 +1716,7 @@ void print_cmd_chr_ (quarterword cmd, halfword chrcode) } #ifdef STAT +/* sec 0252 */ void show_eqtb_(halfword n) { if (n < 1) @@ -1728,20 +1737,20 @@ void show_eqtb_(halfword n) print_skip_param(n - (hash_size + 782)); /* lineskip */ print_char('='); if (n < (hash_size + 797)) - print_spec(eqtb[n].hh.v.RH, 394); /* pt */ + print_spec(eqtb[n].hh.v.RH, "pt"); else - print_spec(eqtb[n].hh.v.RH, 334); /* mu */ + print_spec(eqtb[n].hh.v.RH, "mu"); } else if (n < (hash_size + 1056)) { print_esc("skip"); print_int(n - (hash_size + 800)); print_char('='); - print_spec(eqtb[n].hh.v.RH, 394); /* pt */ + print_spec(eqtb[n].hh.v.RH, "pt"); } else { print_esc("muskip"); print_int(n - (hash_size + 1056)); print_char('='); - print_spec(eqtb[n].hh.v.RH, 334); /* mu */ + print_spec(eqtb[n].hh.v.RH, "mu"); } else if (n < (hash_size + 3163)) if (n == (hash_size + 1312)) { diff --git a/src/texsourc/tex2.c b/src/texsourc/tex2.c index bfabf74..39a0964 100644 --- a/src/texsourc/tex2.c +++ b/src/texsourc/tex2.c @@ -535,12 +535,12 @@ void back_error (void) error(); } void ins_error (void) -{ - OK_to_interrupt = false; - back_input(); - cur_input.index_field = 4; - OK_to_interrupt = true; - error(); +{ + OK_to_interrupt = false; + back_input(); + cur_input.index_field = 4; + OK_to_interrupt = true; + error(); } void begin_file_reading (void) { @@ -730,7 +730,7 @@ void firm_up_the_line (void) { ; print_string("=>"); - term_input("=>", 0); + term_input(615, 0); } if (last > first){ { @@ -840,12 +840,11 @@ void macro_call (void) incr(m); u = mem[t].hh.v.RH; v = s; - while(true){ + while (true) { if (u == r) if (cur_tok != mem[v].hh.v.LH) goto lab30; else { - r = mem[v].hh.v.RH; goto lab22; } @@ -888,7 +887,7 @@ void macro_call (void) if (cur_tok < 512) { unbalance = 1; - while(true){ + while (true) { { { q = avail; @@ -990,8 +989,7 @@ void macro_call (void) goto lab22; lab40: if (s != 0) { - if ((m == 1)&&(mem[p].hh.v.LH < 768)&&(p != temp_head - )) + if ((m == 1) && (mem[p].hh.v.LH < 768) && (p != temp_head)) { mem[rbraceptr].hh.v.RH = 0; /* rbraceptr may be used without ... */ { @@ -1079,28 +1077,28 @@ void insert_relax (void) } void expand (void) { - halfword t; - halfword p, q, r; - integer j; - integer cvbackup; - small_number cvlbackup, radixbackup, cobackup; - halfword backupbackup; - small_number savescannerstatus; + halfword t; + halfword p, q, r; + integer j; + integer cvbackup; + small_number cvlbackup, radixbackup, cobackup; + halfword backupbackup; + small_number savescannerstatus; - cvbackup = cur_val; - cvlbackup = cur_val_level; - radixbackup = radix; - cobackup = cur_order; - backupbackup = mem[mem_top - 13].hh.v.RH; + cvbackup = cur_val; + cvlbackup = cur_val_level; + radixbackup = radix; + cobackup = cur_order; + backupbackup = mem[mem_top - 13].hh.v.RH; if (cur_cmd < 111) { if (tracing_commands > 1) - show_cur_cmd_chr(); + show_cur_cmd_chr(); switch(cur_cmd) - {case 110 : + {case 110: { /* begin if cur_mark[cur_chr]<>null then l.7881 */ - if (cur_mark[cur_chr]!= 0) + if (cur_mark[cur_chr] != 0) begin_token_list(cur_mark[cur_chr], 14); } break; @@ -1109,7 +1107,7 @@ void expand (void) get_token(); t = cur_tok; get_token(); - if (cur_cmd > 100){ + if (cur_cmd > 100) { expand(); } else back_input(); @@ -1309,7 +1307,7 @@ void scan_left_brace (void) { do { get_x_token(); - } while(!((cur_cmd != 10)&&(cur_cmd != 0))); + } while(!((cur_cmd != 10) && (cur_cmd != 0))); if (cur_cmd != 1) { print_err("Missing { inserted"); @@ -1327,128 +1325,125 @@ void scan_left_brace (void) void scan_optional_equals (void) { do { - get_x_token(); - } while(!(cur_cmd != 10)); - if (cur_tok != 3133)back_input(); -} + get_x_token(); + } while(!(cur_cmd != 10)); + if (cur_tok != 3133) + back_input(); +} +/* sec 0407 */ bool scan_keyword_(char * s) -{/* 10 */ register bool Result; - halfword p; - halfword q; - char * k; - p = mem_top - 13; - mem[p].hh.v.RH = 0; - k = s; - while(*k) { +{ + register bool Result; + halfword p; + halfword q; + char * k; + p = mem_top - 13; + mem[p].hh.v.RH = 0; + k = s; + while (*k) { get_x_token(); - if ((cur_cs == 0) && ((cur_chr == (*k))||(cur_chr == (*k)- 32))) { + if ((cur_cs == 0) && ((cur_chr == (*k)) || (cur_chr == (*k) - 32))) { { - q = get_avail(); - mem[p].hh.v.RH = q; - mem[q].hh.v.LH = cur_tok; - p = q; - } - incr(k); - } - else if ((cur_cmd != 10)||(p != mem_top - 13)) - { - back_input(); + q = get_avail(); + mem[p].hh.v.RH = q; + mem[q].hh.v.LH = cur_tok; + p = q; + } + incr(k); + } else if ((cur_cmd != 10) || (p != mem_top - 13)) { + back_input(); if (p != mem_top - 13) - begin_token_list(mem[mem_top - 13].hh.v.RH, 3); - Result = false; - return(Result); - } - } - flush_list(mem[mem_top - 13].hh.v.RH); - Result = true; - return Result; -} + begin_token_list(mem[mem_top - 13].hh.v.RH, 3); + Result = false; + return(Result); + } + } + flush_list(mem[mem_top - 13].hh.v.RH); + Result = true; + return Result; +} void mu_error (void) -{ +{ print_err("Incompatible glue units"); - help1("I'm going to assume that 1mu=1pt when they're mixed."); - error(); -} -void scan_eight_bit_int (void) -{ - scan_int(); - if ((cur_val < 0)||(cur_val > 255)) - { - print_err("Bad register code"); + help1("I'm going to assume that 1mu=1pt when they're mixed."); + error(); +} +void scan_eight_bit_int (void) +{ + scan_int(); + if ((cur_val < 0) || (cur_val > 255)) { + print_err("Bad register code"); help2("A register number must be between 0 and 255.", "I changed this one to zero."); - int_error(cur_val); - cur_val = 0; - } -} + int_error(cur_val); + cur_val = 0; + } +} void scan_char_num (void) { - scan_int(); - if ((cur_val < 0)||(cur_val > 255)) - { + scan_int(); + if ((cur_val < 0) || (cur_val > 255)) { print_err("Bad character code"); help2("A character number must be between 0 and 255.", "I changed this one to zero."); - int_error(cur_val); - cur_val = 0; - } -} -void scan_four_bit_int (void) + int_error(cur_val); + cur_val = 0; + } +} +void scan_four_bit_int (void) { - scan_int(); - if ((cur_val < 0)||(cur_val > 15)) - { + scan_int(); + if ((cur_val < 0) || (cur_val > 15)) { print_err("Bad number"); help2("Since I expected to read a number between 0 and 15,", "I changed this one to zero."); - int_error(cur_val); - cur_val = 0; - } -} + int_error(cur_val); + cur_val = 0; + } +} void scan_fifteen_bit_int (void) -{ - scan_int(); - if ((cur_val < 0)||(cur_val > 32767)) - { +{ + scan_int(); + if ((cur_val < 0) || (cur_val > 32767)) { print_err("Bad mathchar"); help2("A mathchar number must be between 0 and 32767.", "I changed this one to zero."); - int_error(cur_val); - cur_val = 0; - } -} + int_error(cur_val); + cur_val = 0; + } +} void scan_twenty_seven_bit_int (void) -{ - scan_int(); - if ((cur_val < 0)||(cur_val > 134217727L)) /* 2^27 - 1 */ - { - print_err("Bad delimiter code"); +{ + scan_int(); + if ((cur_val < 0) || (cur_val > 134217727L)) /* 2^27 - 1 */ { + print_err("Bad delimiter code"); help2("A numeric delimiter code must be between 0 and 2^{27}-1.", "I changed this one to zero."); - int_error(cur_val); - cur_val = 0; - } -} + int_error(cur_val); + cur_val = 0; + } +} +/* sec 0577 */ void scan_font_ident (void) { - internal_font_number f; - halfword m; + internal_font_number f; + halfword m; + do { get_x_token(); - } while(!(cur_cmd != 10)); - if (cur_cmd == 88) - f = eqtb[(hash_size + 1834)].hh.v.RH; - else if (cur_cmd == 87) - f = cur_chr; - else if (cur_cmd == 86) - { - m = cur_chr; - scan_four_bit_int(); - f = eqtb[m + cur_val].hh.v.RH; - } - else { - print_err("Missing font identifier"); - help2("I was looking for a control sequence whose", + } while (!(cur_cmd != 10)); + + if (cur_cmd == def_font) + f = cur_font; + else if (cur_cmd == set_font) + f = cur_chr; + else if (cur_cmd == def_family) { + m = cur_chr; + scan_four_bit_int(); + f = equiv(m + cur_val); + } else { + print_err("Missing font identifier"); + help2("I was looking for a control sequence whose", "current meaning has been defined by \\font."); back_error(); f = 0; @@ -1470,7 +1465,7 @@ void find_font_dimen_(bool writing) /* else begin if writing and(n<=space_shrink_code)and@| (n>=space_code)and(font_glue[f]<>null) then begin delete_glue_ref(font_glue[f]); l.11225 */ - if (writing &&(n <= 4)&&(n >= 2)&&(font_glue[f]!= 0)) + if (writing && (n <= 4) && (n >= 2) && (font_glue[f]!= 0)) { delete_glue_ref(font_glue[f]); font_glue[f]= 0; /* font_glue[f]:=null */ @@ -1509,56 +1504,53 @@ void find_font_dimen_(bool writing) font_check[f].b2) << 8 | font_check[f].b3; */ } /* compiler error: '-' : incompatible types - from 'union fmemoryword *' to 'struct fourunsignedchars *' */ - if (cur_val == fmem_ptr){ + if (cur_val == fmem_ptr) { print_err("Font "); /* print_esc(hash[(hash_size + 524) + f].v.RH); */ //print_esc(hash[(hash_size + hash_extra + 524) + f].v.RH); /*96/Jan/10*/ - print_esc("");print(hash[(hash_size + hash_extra + 524) + f].v.RH); + print_esc(""); print(hash[(hash_size + hash_extra + 524) + f].v.RH); print_string(" has only "); print_int(font_params[f]); print_string(" fontdimen parameters"); - help2("To increase the number of font parameters, you must", - "use \\fontdimen immediately after the \\font is loaded."); + help2("To increase the number of font parameters, you must", + "use \\fontdimen immediately after the \\font is loaded."); error(); } -} +} /* NOTE: the above use of /fontdimen0 to access the checksum is a kludge */ /* In future would be better to do this by allocating one more slot for */ /* for parameters when a font is read rather than carry checksum separately */ /* The above gets the value byte order reversed ... 98/Oct/5 */ - +/* sec 0413 */ void scan_something_internal_(small_number level, bool negative) -{ - halfword m; - integer p; - m = cur_chr; +{ + halfword m; + integer p; + m = cur_chr; switch(cur_cmd) - {case 85 : + { + case def_code: { scan_char_num(); - if (m == (hash_size + 2907)) + if (m == math_code_base) { - cur_val = eqtb[(hash_size + 2907) + cur_val].hh.v.RH; - cur_val_level = 0; - } - else if (m < (hash_size + 2907)) - { - cur_val = eqtb[m + cur_val].hh.v.RH; - cur_val_level = 0; - } - else { - - cur_val = eqtb[m + cur_val].cint; - cur_val_level = 0; - } - } + cur_val = eqtb[(hash_size + 2907) + cur_val].hh.v.RH; + cur_val_level = 0; + } else if (m < math_code_base) { + cur_val = eqtb[m + cur_val].hh.v.RH; + cur_val_level = 0; + } else { + cur_val = eqtb[m + cur_val].cint; + cur_val_level = 0; + } + } break; - case 71 : - case 72 : - case 86 : - case 87 : - case 88 : + case toks_register: + case assign_toks: + case def_family: + case set_font: + case def_font: if (level != 5) { print_err("Missing number, treated as zero"); @@ -1576,7 +1568,7 @@ void scan_something_internal_(small_number level, bool negative) if (cur_cmd < 72) { scan_eight_bit_int(); - m = (hash_size + 1322) + cur_val; + m = toks_base + cur_val; } { cur_val = eqtb[m].hh.v.RH; @@ -1584,7 +1576,6 @@ void scan_something_internal_(small_number level, bool negative) } } else { - back_input(); scan_font_ident(); { @@ -1594,31 +1585,31 @@ void scan_something_internal_(small_number level, bool negative) } } break; - case 73 : + case assign_int: { cur_val = eqtb[m].cint; cur_val_level = 0; } break; - case 74 : + case assign_dimen: { cur_val = eqtb[m].cint; cur_val_level = 1; } break; - case 75 : + case assign_glue: { cur_val = eqtb[m].hh.v.RH; cur_val_level = 2; } break; - case 76 : + case assign_mu_glue: { cur_val = eqtb[m].hh.v.RH; cur_val_level = 3; } break; - case 79 : + case set_aux: if (abs(mode)!= m) { print_err("Improper "); @@ -1633,7 +1624,6 @@ void scan_something_internal_(small_number level, bool negative) cur_val_level = 1; } else { - cur_val = 0; cur_val_level = 0; } @@ -1644,19 +1634,17 @@ void scan_something_internal_(small_number level, bool negative) cur_val_level = 1; } else { - cur_val = space_factor; cur_val_level = 0; } break; - case 80 : + case set_prev_graf: if (mode == 0) { cur_val = 0; cur_val_level = 0; } else { - nest[nest_ptr]= cur_list; p = nest_ptr; while(abs(nest[p].mode_field)!= 1)decr(p); @@ -1666,7 +1654,7 @@ void scan_something_internal_(small_number level, bool negative) } } break; - case 82 : + case set_page_int: { if (m == 0) cur_val = dead_cycles; @@ -1674,41 +1662,41 @@ void scan_something_internal_(small_number level, bool negative) cur_val_level = 0; } break; - case 81 : + case set_page_dimen: { - if ((page_contents == 0)&&(! output_active)) - if (m == 0) - cur_val = 1073741823L; /* 2^30 - 1 */ - else cur_val = 0; - else cur_val = page_so_far[m]; + if ((page_contents == 0) && (! output_active)) + if (m == 0) + cur_val = 1073741823L; /* 2^30 - 1 */ + else cur_val = 0; + else cur_val = page_so_far[m]; cur_val_level = 1; } break; - case 84 : + case set_shape: { - if (eqtb[(hash_size + 1312)].hh.v.RH == 0) + if (par_shape_ptr == 0) cur_val = 0; - else cur_val = mem[eqtb[(hash_size + 1312)].hh.v.RH].hh.v.LH; + else cur_val = mem[par_shape_ptr].hh.v.LH; cur_val_level = 0; } break; - case 83 : + case set_box_dimen: { scan_eight_bit_int(); - if (eqtb[(hash_size + 1578) + cur_val].hh.v.RH == 0) + if (eqtb[box_base + cur_val].hh.v.RH == 0) cur_val = 0; else cur_val = mem[eqtb[(hash_size + 1578) + cur_val].hh.v.RH + m].cint; cur_val_level = 1; } break; - case 68 : - case 69 : + case char_given: + case math_given: { cur_val = cur_chr; cur_val_level = 0; } break; - case 77 : + case assign_font_dimen: { find_font_dimen(false); font_info[fmem_ptr].cint = 0; @@ -1718,41 +1706,40 @@ void scan_something_internal_(small_number level, bool negative) } } break; - case 78 : + case assign_font_int: { scan_font_ident(); - if (m == 0){ - cur_val = hyphen_char[cur_val]; - cur_val_level = 0; - } - else { - - cur_val = skew_char[cur_val]; - cur_val_level = 0; + if (m == 0) { + cur_val = hyphen_char[cur_val]; + cur_val_level = 0; + } else { + cur_val = skew_char[cur_val]; + cur_val_level = 0; } } break; - case 89 : + case tex_register: { - scan_eight_bit_int(); + scan_eight_bit_int(); switch(m) - {case 0 : - cur_val = eqtb[(hash_size + 3218) + cur_val].cint; - break; - case 1 : - cur_val = eqtb[(hash_size + 3751) + cur_val].cint; - break; - case 2 : - cur_val = eqtb[(hash_size + 800) + cur_val].hh.v.RH; - break; - case 3 : - cur_val = eqtb[(hash_size + 1056) + cur_val].hh.v.RH; - break; - } - cur_val_level = m; - } - break; - case 70 : + { + case 0 : + cur_val = eqtb[(hash_size + 3218) + cur_val].cint; + break; + case 1: + cur_val = eqtb[(hash_size + 3751) + cur_val].cint; + break; + case 2: + cur_val = eqtb[(hash_size + 800) + cur_val].hh.v.RH; + break; + case 3: + cur_val = eqtb[(hash_size + 1056) + cur_val].hh.v.RH; + break; + } + cur_val_level = m; + } + break; + case last_item: if (cur_chr > 2) { if (cur_chr == 3) @@ -1761,7 +1748,6 @@ void scan_something_internal_(small_number level, bool negative) cur_val_level = 0; } else { - if (cur_chr == 2) cur_val = 0; else cur_val = 0; @@ -1786,8 +1772,7 @@ void scan_something_internal_(small_number level, bool negative) } break; } - else if ((mode == 1)&&(tail == cur_list - .head_field)) + else if ((mode == 1) && (tail == cur_list.head_field)) switch(cur_chr) {case 0 : cur_val = last_penalty; @@ -1822,8 +1807,7 @@ void scan_something_internal_(small_number level, bool negative) } break; } - while(cur_val_level > level){ - + while (cur_val_level > level) { if (cur_val_level == 2) cur_val = mem[cur_val + 1].cint; else if (cur_val_level == 3){ @@ -1850,10 +1834,8 @@ void scan_something_internal_(small_number level, bool negative) /* Moved here to avoid question about pragma optimize 96/Sep/12 */ -/* #pragma optimize ("a", off) */ - void get_next (void) -{/* 20 25 21 26 40 10 */ +{ integer k; halfword t; /* char cat; */ /* make this an int ? */ @@ -2195,7 +2177,7 @@ lab20: { ; print_string("*"); /* * */ - term_input("*", 0); + term_input(42, 0); } cur_input.limit_field = last; if ((end_line_char < 0)|| diff --git a/src/texsourc/tex3.c b/src/texsourc/tex3.c index 28be535..aaa5f93 100644 --- a/src/texsourc/tex3.c +++ b/src/texsourc/tex3.c @@ -27,7 +27,7 @@ void scan_int (void) { - bool negative; + bool negative; integer m; small_number d; bool vacuous; @@ -553,7 +553,6 @@ halfword the_toks (void) if (q == 0) q = get_avail(); else { - avail = mem[q].hh.v.RH; mem[q].hh.v.RH = 0; ; @@ -570,9 +569,7 @@ halfword the_toks (void) } } Result = p; - } - else { - + } else { old_setting = selector; selector = 21; b = pool_ptr; @@ -588,13 +585,13 @@ halfword the_toks (void) break; case 2 : { - print_spec(cur_val, 394); /* pt */ + print_spec(cur_val, "pt"); delete_glue_ref(cur_val); } break; case 3 : { - print_spec(cur_val, 334); /* mu */ + print_spec(cur_val, "mu"); delete_glue_ref(cur_val); } break; @@ -662,7 +659,7 @@ void conv_toks (void) print(font_name[cur_val]); if (font_size[cur_val]!= font_dsize[cur_val]) { - print_string("at "); + print_string(" at "); print_scaled(font_size[cur_val]); print_string("pt"); } @@ -861,7 +858,7 @@ void read_toks_(integer n, halfword r) if (n < 0) { ; print_string(""); - term_input("", 0); + term_input(335, 0); } else { ; @@ -870,7 +867,7 @@ void read_toks_(integer n, halfword r) { ; print_string("="); - term_input("=", 0); + term_input(61, 0); } n = -1; } @@ -1291,11 +1288,11 @@ bool more_name_(ASCII_code c) if ((c == '/' || c == '\\' || c == ':')) /* 94/Mar/1 */ /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ { - area_delimiter = (pool_ptr - str_start[str_ptr]); + area_delimiter = cur_length; ext_delimiter = 0; } else if (c == 46) /* . */ - ext_delimiter = (pool_ptr - str_start[str_ptr]); + ext_delimiter = cur_length; Result = true; } return Result; @@ -1330,12 +1327,12 @@ int find_string (int start, int end) // code in new_font (tex8.c) will take care of reuse of font name already // for (k = 0; k < str_ptr; k++) { for (k = 0; k < str_ptr-1; k++) { - if ((str_start[k+1] - str_start[k]) != nlen) continue; - if (strncmp(str_pool+start, str_pool+str_start[k], nlen) == 0) { + if (length(k) != nlen) continue; + if (strncmp((const char *)str_pool + start, (const char *) str_pool + str_start[k], nlen) == 0) { if (trace_flag) { sprintf(log_line, "\nFOUND the string %d (%d) ", k, str_start[k+1]-str_start[k]); s = log_line + strlen(log_line); - strncpy(s, str_pool+start, nlen); + strncpy(s, (const char *)str_pool + start, nlen); strcpy(s+nlen, "\n"); show_line(log_line, 0); } @@ -1345,7 +1342,7 @@ int find_string (int start, int end) if (trace_flag) { sprintf(log_line, "\nNOT FOUND string "); s = log_line + strlen(log_line); - strncpy(s, str_pool+start, nlen); + strncpy(s, (const char*)str_pool + start, nlen); strcpy(s+nlen, "\n"); show_line(log_line, 0); } @@ -1368,7 +1365,7 @@ void remove_string (int start, int end) int n = end-start; sprintf(log_line, "\nSTRIPPING OUT %d %d ", n, nlen); s = log_line + strlen(log_line); - strncpy(s, str_pool+start, n); + strncpy(s, (const char *)str_pool + start, n); strcpy(s+n, "\n"); show_line(log_line, 0); } @@ -1378,13 +1375,13 @@ void remove_string (int start, int end) void show_string (int k) { // debugging code - int nlen = str_start[k+1] - str_start[k]; + int nlen = length(k); char *s; sprintf(log_line, "\nSTRING %5d (%3d) %5d--%5d ", k, nlen, str_start[k], str_start[k+1]); s = log_line + strlen(log_line); - strncpy(s, str_pool+str_start[k], nlen); + strncpy(s, (const char *)str_pool + str_start[k], nlen); strcpy(s + nlen, ""); show_line(log_line, 0); } @@ -1586,11 +1583,11 @@ str_number make_name_string (void) str_start = realloc_str_start(increment_max_strings); if ((pool_ptr + name_length > current_pool_size)|| (str_ptr == current_max_strings)|| - ((pool_ptr - str_start[str_ptr])> 0)) + (cur_length > 0)) #else /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if ((pool_ptr + name_length > pool_size)||(str_ptr == max_strings)|| - ((pool_ptr - str_start[str_ptr])> 0)) + (cur_length > 0)) #endif Result = 63; else { @@ -1710,7 +1707,7 @@ void show_tex_inputs (void) void prompt_file_name_(str_number s, str_number e)/* s - what can't be found, e - default */ { integer k; - if (interaction == 2) + if (interaction == scroll_mode) ; if (s == 781) print_err("I can't find file `"); @@ -1740,7 +1737,7 @@ void prompt_file_name_(str_number s, str_number e)/* s - what can't be found, e { ; print_string(": "); - term_input(": ", 0); + term_input(565, 0); } /* should we deal with tilde and space in file name here ??? */ { @@ -1983,8 +1980,7 @@ void start_input (void) jobnameappend(); /* append `extension' to job_name */ open_log_file(); } - if (term_offset +(str_start[cur_input.name_field + 1]- str_start[ - cur_input.name_field])> max_print_line - 2) /* was 3 ? */ + if (term_offset + length(cur_input.name_field) > max_print_line - 2) /* was 3 ? */ print_ln(); else if ((term_offset > 0)||(file_offset > 0)) print_char(' '); @@ -2618,7 +2614,7 @@ lab11: print_file_name(nom, aire, 335); /* "" */ if (s >= 0) { - print_string("at "); + print_string(" at "); print_scaled(s); print_string("pt"); } @@ -2627,8 +2623,8 @@ lab11: print_string("scaled"); print_int(- (integer) s); } - if (fileopened)print_string("not loadable: Bad metric (TFM) file"); - else print_string("not loadable: Metric (TFM) file not found"); + if (fileopened)print_string(" not loadable: Bad metric (TFM) file"); + else print_string(" not loadable: Metric (TFM) file not found"); if (aire == 335) { /* "" only if path not specified */ if (show_texinput_flag) show_tex_fonts(); /* 98/Jan/31 */ } diff --git a/src/texsourc/tex4.c b/src/texsourc/tex4.c index aa82dbf..c3ed652 100644 --- a/src/texsourc/tex4.c +++ b/src/texsourc/tex4.c @@ -63,7 +63,7 @@ void char_warning_(internal_font_number f, eight_bits c) /* print_char(32); */ } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ - print_string("in font"); + print_string(" in font "); slow_print(font_name[f]); print_char('!'); /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ @@ -122,59 +122,32 @@ void dvi_swap (void) void dvi_four_(integer x) /* attempt at speeding up bkph - is compiler smart ? */ { if (x >= 0) - { -/* dvi_buf[dvi_ptr]= x / 16777216L; */ /* 2^24 */ -/* dvi_buf[dvi_ptr]=(x >> 24); */ - dvi_buf[dvi_ptr]= (unsigned char)(x >> 24); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + // dvi_out(x % 16777216L); + dvi_out((x >> 24)); else { x = x + 1073741824L; /* 2^30 40000000 hex */ - x = x + 1073741824L; - { -/* dvi_buf[dvi_ptr]=(x / 16777216L)+ 128; */ /* 2^24 */ - dvi_buf[dvi_ptr]=(x >> 24)+ 128; /* set sign bit */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + x = x + 1073741824L; + //dvi_out((x / 16777216L) + 128); + dvi_out((x >> 24) + 128); } /* x = x % 16777216L; */ /* % 2^24 */ - x = x & 16777215L; - { -/* dvi_buf[dvi_ptr]= x / 65536L; */ -/* dvi_buf[dvi_ptr]=(x >> 16); */ - dvi_buf[dvi_ptr]= (unsigned char)(x >> 16); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + x = x & 16777215L; + //dvi_out(x / 65536L); + dvi_out((x >> 16)); /* x = x % 65536L; */ /* % 2^16 */ x = x & 65535L; - { -/* dvi_buf[dvi_ptr]= x / 256; */ -/* dvi_buf[dvi_ptr]=(x >> 8); */ - dvi_buf[dvi_ptr]= (unsigned char)(x >> 8); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { -/* dvi_buf[dvi_ptr]= x % 256; */ /* % 2^8 */ - dvi_buf[dvi_ptr]= x & 255; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + //dvi_out(x / 256); + dvi_out((x >> 8)); + //dvi_out(x % 256); + dvi_out(x & 255); } /* following needs access to dvi_buf=zdvibuf see coerce.h */ void zdvipop(integer l) { - if ((l == dvi_offset + dvi_ptr)&&(dvi_ptr > 0)) - decr(dvi_ptr); - else { - - dvi_buf[dvi_ptr]= 142; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + if ((l == dvi_offset + dvi_ptr) && (dvi_ptr > 0)) + decr(dvi_ptr); + else + dvi_out(142); } /* following needs access to dvi_buf=zdvibuf see coerce.h */ void dvi_font_def_(internal_font_number f) @@ -183,108 +156,35 @@ void dvi_font_def_(internal_font_number f) /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ #ifdef INCREASEFONTS if (f <= 256) { - { - dvi_buf[dvi_ptr]= 243; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= f - 1; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(243); + dvi_out(f - 1); } else { - { - dvi_buf[dvi_ptr]= 244; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= (f - 1) >> 8; /* top byte */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= (f - 1) & 255; /* bottom byte */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(244); + dvi_out(((f - 1) >> 8)); + dvi_out(((f - 1) & 255)); } #else - { - dvi_buf[dvi_ptr]= 243; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= f - 1; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(243); + dvi_out(f - 1); #endif /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ /* spit out the font checksum now */ - { - dvi_buf[dvi_ptr]= font_check[f].b0; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= font_check[f].b1; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= font_check[f].b2; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= font_check[f].b3; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(font_check[f].b0); + dvi_out(font_check[f].b1); + dvi_out(font_check[f].b2); + dvi_out(font_check[f].b3); dvi_four(font_size[f]); - dvi_four(font_dsize[f]); - { + dvi_four(font_dsize[f]); /* long to unsigned char ... */ - dvi_buf[dvi_ptr]= - (str_start[font_area[f]+ 1]- str_start[font_area[f]]); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { + dvi_out(length(font_area[f])); /* long to unsigned char ... */ - dvi_buf[dvi_ptr]= - (str_start[font_name[f]+ 1]- str_start[font_name[f]]); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - register integer for_end; - k = str_start[font_area[f]]; - for_end = str_start[font_area[f]+ 1]- 1; - if (k <= for_end) do - { - dvi_buf[dvi_ptr]= str_pool[k]; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - while(k++ < for_end); - } - { - register integer for_end; - k = str_start[font_name[f]]; - for_end = str_start[font_name[f]+ 1]- 1; - if (k <= for_end) do - { - dvi_buf[dvi_ptr]= str_pool[k]; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - while(k++ < for_end); - } + dvi_out(length(font_name[f])); +/* sec 0603 */ + for (k = str_start[font_area[f]]; k <= str_start[font_area[f]+ 1] - 1; k++) + dvi_out(str_pool[k]); + for (k = str_start[font_name[f]]; k <= str_start[font_name[f]+ 1] - 1; k++) + dvi_out(str_pool[k]); } /* following needs access to dvi_buf=zdvibuf see coerce.h */ void zmovement(scaled w, eight_bits o) @@ -295,19 +195,16 @@ void zmovement(scaled w, eight_bits o) q = get_node(3); mem[q + 1].cint = w; mem[q + 2].cint = dvi_offset + dvi_ptr; - if (o == 157) /* 157 == down1 */ - { + if (o == 157) /* 157 == down1 */ { mem[q].hh.v.RH = down_ptr; down_ptr = q; - } - else { /* 143 == right1 */ - + } else { /* 143 == right1 */ mem[q].hh.v.RH = right_ptr; right_ptr = q; } p = mem[q].hh.v.RH; mstate = 0; - while(p != 0){ /* while p<>null do l.12153 */ + while (p != 0) { /* while p<>null do l.12153 */ if (mem[p + 1].cint == w) switch(mstate + mem[p].hh.v.LH) {case 3 : @@ -372,77 +269,44 @@ void zmovement(scaled w, eight_bits o) mem[q].hh.v.LH = 3; if (abs(w)>= 8388608L) /* 2^23 */ { - { - dvi_buf[dvi_ptr]= o + 3; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(o + 3); dvi_four(w); return; } if (abs(w)>= 32768L) { - { - dvi_buf[dvi_ptr]= o + 2; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(o + 2); if (w < 0) w = w + 16777216L; /* 2^24 */ - { -/* dvi_buf[dvi_ptr]= w / 65536L; */ -/* dvi_buf[dvi_ptr]=(w >> 16); */ - dvi_buf[dvi_ptr]= (unsigned char)(w >> 16); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + //dvi_out(w / 65536L); + dvi_out((w >> 16)); /* w = w % 65536L; */ w = w & 65535L; goto lab2; } if (abs(w)>= 128) { - { - dvi_buf[dvi_ptr]= o + 1; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(o + 1); if (w < 0) w = w + 65536L; goto lab2; - } - { - dvi_buf[dvi_ptr]= o; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + } + dvi_out(o); if (w < 0) w = w + 256; - goto lab1; - lab2: { -/* dvi_buf[dvi_ptr]= w / 256; */ -/* dvi_buf[dvi_ptr]=(w >> 8); */ - dvi_buf[dvi_ptr]= (unsigned char)(w >> 8); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - lab1: { -/* dvi_buf[dvi_ptr]= w % 256; */ - dvi_buf[dvi_ptr]= w & 255; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + goto lab1; +lab2: + //dvi_out(w / 256); + dvi_out((w >> 8)); +lab1: + //dvi_out(w % 256); + dvi_out(w & 255); return; lab40: mem[q].hh.v.LH = mem[p].hh.v.LH; if (mem[q].hh.v.LH == 1) { - { - dvi_buf[dvi_ptr]= o + 4; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - while(mem[q].hh.v.RH != p){ - + dvi_out(o + 4); + while (mem[q].hh.v.RH != p) { q = mem[q].hh.v.RH; switch(mem[q].hh.v.LH) {case 3 : @@ -457,13 +321,8 @@ void zmovement(scaled w, eight_bits o) } } } else { - { - dvi_buf[dvi_ptr]= o + 9; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - while(mem[q].hh.v.RH != p){ - + dvi_out(o + 9); + while (mem[q].hh.v.RH != p) { q = mem[q].hh.v.RH; switch(mem[q].hh.v.LH) {case 3 : @@ -482,22 +341,22 @@ void zmovement(scaled w, eight_bits o) void prune_movements_(integer l) {/* 30 10 */ halfword p; - while(down_ptr != 0){ /* while down_ptr<>null do l.12206 */ - + while (down_ptr != 0) { /* while down_ptr<>null do l.12206 */ if (mem[down_ptr + 2].cint < l) goto lab30; p = down_ptr; down_ptr = mem[p].hh.v.RH; free_node(p, 3); - } - lab30: while(right_ptr != 0){ /* done: while right_ptr<>null do */ + } +lab30: + while (right_ptr != 0) { /* done: while right_ptr<>null do */ if (mem[right_ptr + 2].cint < l) - return; - p = right_ptr; - right_ptr = mem[p].hh.v.RH; - free_node(p, 3); - } -} + return; + p = right_ptr; + right_ptr = mem[p].hh.v.RH; + free_node(p, 3); + } +} /* following needs access to dvi_buf=zdvibuf see coerce.h */ void special_out_(halfword p) { @@ -555,27 +414,14 @@ void special_out_(halfword p) } #endif } - if ((pool_ptr - str_start[str_ptr])< 256) /* can use xxx1 ? */ + if (cur_length < 256) /* can use xxx1 ? */ { - { - dvi_buf[dvi_ptr]= 239; /* xxx1 */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { -/* long to unsigned char ... */ - dvi_buf[dvi_ptr]=(pool_ptr - str_start[str_ptr]); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - } - else { /* use xxx4 instead */ - { - dvi_buf[dvi_ptr]= 242; /* xxx4 */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - dvi_four((pool_ptr - str_start[str_ptr])); + dvi_out(239); +/* long to unsigned char ... */ + dvi_out(cur_length); + } else { /* use xxx4 instead */ + dvi_out(242); + dvi_four(cur_length); } #ifdef IGNORED @@ -618,12 +464,8 @@ void special_out_(halfword p) register integer for_end; k = str_start[str_ptr]; for_end = pool_ptr - 1; - if (k <= for_end) do - { - dvi_buf[dvi_ptr]= str_pool[k]; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + if (k <= for_end) do + dvi_out(str_pool[k]); while(k++ < for_end); } pool_ptr = str_start[str_ptr]; @@ -734,7 +576,7 @@ void out_what_(halfword p) } /* following needs access to dvi_buf=zdvibuf see coerce.h */ void hlist_out (void) -{/* 21 13 14 15 */ +{ scaled baseline; scaled leftedge; scaled saveh, savev; @@ -759,12 +601,7 @@ void hlist_out (void) p = mem[thisbox + 5].hh.v.RH; incr(cur_s); if (cur_s > 0) - { - dvi_buf[dvi_ptr]= 141; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit) - dvi_swap(); - } + dvi_out(141); if (cur_s > max_push) max_push = cur_s; saveloc = dvi_offset + dvi_ptr; @@ -772,7 +609,8 @@ void hlist_out (void) leftedge = cur_h; /* while p<>null do l.12314 */ while(p != 0) -lab21: if ((p >= hi_mem_min)) +lab21: + if ((p >= hi_mem_min)) { if (cur_h != dvi_h) { @@ -785,21 +623,17 @@ lab21: if ((p >= hi_mem_min)) dvi_v = cur_v; } do { - f = mem[p].hh.b0; - c = mem[p].hh.b1; + f = mem[p].hh.b0; + c = mem[p].hh.b1; if (f != dvi_f) { - if (! font_used[f]) + if (!font_used[f]) { dvi_font_def(f); - font_used[f]= true; + font_used[f] = true; } if (f <= 64) - { /* fnt_num_0 --- fnt_num_63 */ - dvi_buf[dvi_ptr]= f + 170; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(f + 170); /* fnt_num_0 --- fnt_num_63 */ /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ #ifdef INCREASEFONTS else if (f <= 256){ /* if we allow greater than 256 fonts */ @@ -807,59 +641,28 @@ lab21: if ((p >= hi_mem_min)) /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ else { /* normal TeX 82 case */ #endif - { /* fnt1 followed by f */ - dvi_buf[dvi_ptr]= 235; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= f - 1; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(235); /* fnt1 followed by f */ + dvi_out(f - 1); } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ #ifdef INCREASEFONTS else { /* fnt2 followed by f / 256, f % 256 */ - { - dvi_buf[dvi_ptr]= 236; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= (f - 1) >> 8; /* top byte */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= (f - 1) & 255; /* bottom byte */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(236); + dvi_out(((f - 1) >> 8)); /* top byte */ + dvi_out(((f - 1) & 255)); /* bottom byte */ } #endif /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ dvi_f = f; } if (c >= 128) - { - dvi_buf[dvi_ptr]= 128; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= c; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - cur_h = cur_h + font_info[width_base[f]+ font_info[char_base[f]+ c - ].qqqq.b0].cint; + dvi_out(128); + dvi_out(c); + cur_h = cur_h + font_info[width_base[f] + font_info[char_base[f] + c].qqqq.b0].cint; p = mem[p].hh.v.RH; } while(!(!(p >= hi_mem_min))); dvi_h = cur_h; - } - else { - + } else { switch(mem[p].hh.b0) {case 0 : case 1 : @@ -1035,12 +838,8 @@ lab21: if ((p >= hi_mem_min)) { movement(cur_v - dvi_v, 157); /* 157 == down1 */ dvi_v = cur_v; - } - { - dvi_buf[dvi_ptr]= 132; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + } + dvi_out(132); dvi_four(rule_ht); dvi_four(rule_wd); cur_v = baseline; @@ -1081,11 +880,7 @@ void vlist_out (void) p = mem[thisbox + 5].hh.v.RH; incr(cur_s); if (cur_s > 0) - { - dvi_buf[dvi_ptr]= 141; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + dvi_out(141); if (cur_s > max_push) max_push = cur_s; saveloc = dvi_offset + dvi_ptr; @@ -1269,12 +1064,8 @@ void vlist_out (void) { movement(cur_v - dvi_v, 157); /* 157 == down1 */ dvi_v = cur_v; - } - { - dvi_buf[dvi_ptr]= 137; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + } + dvi_out(137); dvi_four(rule_ht); dvi_four(rule_wd); } @@ -1338,18 +1129,15 @@ void ship_out_(halfword p) show_box(p); end_diagnostic(true); } - if ((mem[p + 3].cint > 1073741823L)|| /* 2^30 - 1 */ - (mem[p + 2].cint > 1073741823L)|| - (mem[p + 3].cint + mem[p + 2].cint + - v_offset > 1073741823L)|| - (mem[p + 1].cint + h_offset > 1073741823L)) - { + if ((mem[p + 3].cint > 1073741823L) || /* 2^30 - 1 */ + (mem[p + 2].cint > 1073741823L) || + (mem[p + 3].cint + mem[p + 2].cint + v_offset > 1073741823L) || + (mem[p + 1].cint + h_offset > 1073741823L)) { print_err("Huge page cannot be shipped out"); help2("The page just created is more than 18 feet tall or", "more than 18 feet wide, so I suspect something went wrong."); error(); - if (tracing_output <= 0) - { + if (tracing_output <= 0) { begin_diagnostic(); print_nl("The following box has been deleted:"); show_box(p); @@ -1357,37 +1145,27 @@ void ship_out_(halfword p) } goto lab30; } - if (mem[p + 3].cint + mem[p + 2].cint + v_offset > max_v -) - max_v = mem[p + 3].cint + mem[p + 2].cint + v_offset; + if (mem[p + 3].cint + mem[p + 2].cint + v_offset > max_v) + max_v = mem[p + 3].cint + mem[p + 2].cint + v_offset; if (mem[p + 1].cint + h_offset > max_h) - max_h = mem[p + 1].cint + h_offset; - dvi_h = 0; - dvi_v = 0; - cur_h = h_offset; - dvi_f = 0; - if (output_file_name == 0) - { - if (job_name == 0)open_log_file(); + max_h = mem[p + 1].cint + h_offset; + dvi_h = 0; + dvi_v = 0; + cur_h = h_offset; + dvi_f = 0; + if (output_file_name == 0) { + if (job_name == 0) + open_log_file(); pack_job_name(788); /* .dvi */ - while(! b_open_out(dvi_file)) { - prompt_file_name(789, 788); /* file name for output .dvi */ + while(!b_open_out(dvi_file)) { + prompt_file_name(789, 788); /* file name for output .dvi */ + } + output_file_name = b_make_name_string(dvi_file); } - output_file_name = b_make_name_string(dvi_file); - } - if (total_pages == 0) - { - { - dvi_buf[dvi_ptr]= 247; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= 2; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + if (total_pages == 0) { + dvi_out(247); + dvi_out(2); /********BINDING WITH LIBHARU*********/ /* yandy_pdf = HPDF_New(error_handler, NULL); @@ -1407,173 +1185,144 @@ void ship_out_(halfword p) /********BINDING WITH LIBHARU*********/ dvi_four(25400000L); /* magic DVI scale factor */ dvi_four(473628672L); /* 7227 * 65536 */ - prepare_mag(); - dvi_four(mag); - old_setting = selector; - selector = 21; + prepare_mag(); + dvi_four(mag); + old_setting = selector; + selector = 21; print_string(" TeX output "); - print_int(year); + print_int(year); print_char('.'); - print_two(month); + print_two(month); print_char('.'); print_two(day); print_char(':'); - print_two(tex_time / 60); - print_two(tex_time % 60); - selector = old_setting; - { -/* long to unsigned char ... */ - dvi_buf[dvi_ptr]=(pool_ptr - str_start[str_ptr]); - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - register integer for_end; - s = str_start[str_ptr]; - for_end = pool_ptr - 1; - if (s <= for_end) do - { - dvi_buf[dvi_ptr]= str_pool[s]; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - while(s++ < for_end); - } + print_two(tex_time / 60); + print_two(tex_time % 60); + selector = old_setting; +/* long to unsigned char ... */ + dvi_out(cur_length); + for (s = str_start[str_ptr]; s <= pool_ptr - 1; s++) dvi_out(str_pool[s]); pool_ptr = str_start[str_ptr]; } // end of if total_pages == 0 - pageloc = dvi_offset + dvi_ptr; - { - dvi_buf[dvi_ptr]= 139; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - register integer for_end; - k = 0; - for_end = 9; - if (k <= for_end) do - dvi_four(eqtb[(hash_size + 3218) + k].cint); - while(k++ < for_end); - } - dvi_four(last_bop); - last_bop = pageloc; - cur_v = mem[p + 3].cint + v_offset; - temp_ptr = p; - if (mem[p].hh.b0 == 1)vlist_out(); - else hlist_out(); - { - dvi_buf[dvi_ptr]= 140; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - incr(total_pages); - cur_s = -1; - lab30:; + pageloc = dvi_offset + dvi_ptr; + dvi_out(139); + for (k = 0; k <= 9; k++) dvi_four(eqtb[(hash_size + 3218) + k].cint); + dvi_four(last_bop); + last_bop = pageloc; + cur_v = mem[p + 3].cint + v_offset; + temp_ptr = p; + if (mem[p].hh.b0 == 1) + vlist_out(); + else + hlist_out(); + dvi_out(140); + incr(total_pages); + cur_s = -1; +lab30:; if (tracing_output <= 0) - print_char(']'); - dead_cycles = 0; + print_char(']'); + dead_cycles = 0; #ifndef _WINDOWS - fflush(stdout); + fflush(stdout); #endif ; #ifdef STAT - if (tracing_stats > 1) - { + if (tracing_stats > 1) { print_nl("Memory usage before: "); - print_int(var_used); + print_int(var_used); print_char('&'); - print_int(dyn_used); + print_int(dyn_used); print_char(';'); - } + } #endif /* STAT */ - flush_node_list(p); + flush_node_list(p); ; #ifdef STAT - if (tracing_stats > 1) - { + if (tracing_stats > 1) { print_string("after"); - print_int(var_used); + print_int(var_used); print_char('&'); - print_int(dyn_used); + print_int(dyn_used); print_string("still utouched"); print_int(hi_mem_min - lo_mem_max - 1); /* somewhat inaccurate free mem */ - print_ln(); + print_ln(); } #endif /* STAT */ } void scan_spec_(group_code c, bool threecodes) -{/* 40 */ - integer s; - char speccode; +{ + integer s; + char speccode; if (threecodes) - s = save_stack[save_ptr + 0].cint; - if (scan_keyword("to")) /* to */ - speccode = 0; - else if (scan_keyword("spread")) /* spread */ - speccode = 1; + s = save_stack[save_ptr + 0].cint; + if (scan_keyword("to")) + speccode = 0; + else if (scan_keyword("spread")) + speccode = 1; else { - speccode = 1; - cur_val = 0; - goto lab40; - } - scan_dimen(false, false, false); - lab40: if (threecodes) - { + speccode = 1; + cur_val = 0; + goto lab40; + } + scan_dimen(false, false, false); +lab40: + if (threecodes) { save_stack[save_ptr + 0].cint = s; /* s may be used without ... */ - incr(save_ptr); - } - save_stack[save_ptr + 0].cint = speccode; - save_stack[save_ptr + 1].cint = cur_val; - save_ptr = save_ptr + 2; - new_save_level(c); - scan_left_brace(); -} + incr(save_ptr); + } + save_stack[save_ptr + 0].cint = speccode; + save_stack[save_ptr + 1].cint = cur_val; + save_ptr = save_ptr + 2; + new_save_level(c); + scan_left_brace(); +} halfword hpack_(halfword p, scaled w, small_number m) -{/* 21 50 10 */ register halfword Result; - halfword r; - halfword q; - scaled h, d, x; - scaled s; - halfword g; +{ + register halfword Result; + halfword r; + halfword q; + scaled h, d, x; + scaled s; + halfword g; /* glue_ord o; */ int o; /* 95/Jan/7 */ - internal_font_number f; - ffourquarters i; - eight_bits hd; - last_badness = 0; - r = get_node(7); - mem[r].hh.b0 = 0; - mem[r].hh.b1 = 0; - mem[r + 4].cint = 0; - q = r + 5; - mem[q].hh.v.RH = p; - h = 0; - d = 0; - x = 0; - totalstretch[0]= 0; - totalshrink[0]= 0; - totalstretch[1]= 0; - totalshrink[1]= 0; - totalstretch[2]= 0; - totalshrink[2]= 0; - totalstretch[3]= 0; - totalshrink[3]= 0; + internal_font_number f; + ffourquarters i; + eight_bits hd; + last_badness = 0; + r = get_node(7); + mem[r].hh.b0 = 0; + mem[r].hh.b1 = 0; + mem[r + 4].cint = 0; + q = r + 5; + mem[q].hh.v.RH = p; + h = 0; + d = 0; + x = 0; + total_stretch[0] = 0; + total_shrink[0] = 0; + total_stretch[1] = 0; + total_shrink[1] = 0; + total_stretch[2] = 0; + total_shrink[2] = 0; + total_stretch[3] = 0; + total_shrink[3] = 0; while (p != 0) { /* while p<>null do l.12862 */ lab21: while ((p >= hi_mem_min)) { f = mem[p].hh.b0; - i = font_info[char_base[f]+ mem[p].hh.b1].qqqq; + i = font_info[char_base[f] + mem[p].hh.b1].qqqq; hd = i.b1; - x = x + font_info[width_base[f]+ i.b0].cint; - s = font_info[height_base[f]+(hd)/ 16].cint; + x = x + font_info[width_base[f] + i.b0].cint; + s = font_info[height_base[f] + (hd) / 16].cint; if (s > h) h = s; s = font_info[depth_base[f]+(hd)% 16].cint; if (s > d) d = s; p = mem[p].hh.v.RH; - } + } if (p != 0) /* if p<>null then l.12886 */ { switch (mem[p].hh.b0) @@ -1625,9 +1374,9 @@ lab21: g = mem[p + 1].hh.v.LH; x = x + mem[g + 1].cint; o = mem[g].hh.b0; - totalstretch[o]= totalstretch[o]+ mem[g + 2].cint; + total_stretch[o]= total_stretch[o]+ mem[g + 2].cint; o = mem[g].hh.b1; - totalshrink[o]= totalshrink[o]+ mem[g + 3].cint; + total_shrink[o]= total_shrink[o]+ mem[g + 3].cint; if (mem[p].hh.b1 >= 100) { g = mem[p + 1].hh.v.RH; if (mem[g + 3].cint > h) @@ -1670,19 +1419,19 @@ lab21: mem[r + 6].gr = 0.0; goto lab10; } else if (x > 0) { - if (totalstretch[3] != 0) + if (total_stretch[3] != 0) o = 3; - else if (totalstretch[2] != 0) + else if (total_stretch[2] != 0) o = 2; - else if (totalstretch[1] != 0) + else if (total_stretch[1] != 0) o = 1; else o = 0; mem[r + 5].hh.b1 = o; mem[r + 5].hh.b0 = 1; /* if total_stretch[o]<>0 then glue_set(r):=... l.12982 */ - if (totalstretch[o]!= 0) - mem[r + 6].gr = x / ((double) totalstretch[o]); + if (total_stretch[o]!= 0) + mem[r + 6].gr = x / ((double) total_stretch[o]); else { mem[r + 5].hh.b0 = 0; mem[r + 6].gr = 0.0; @@ -1691,7 +1440,7 @@ lab21: if (o == 0) if (mem[r + 5].hh.v.RH != 0) { - last_badness = badness(x, totalstretch[0]); + last_badness = badness(x, total_stretch[0]); if (last_badness > hbadness) { print_ln(); if (last_badness > 100) @@ -1707,46 +1456,46 @@ lab21: } goto lab10; } else { - if (totalshrink[3] != 0) + if (total_shrink[3] != 0) o = 3; - else if (totalshrink[2] != 0) + else if (total_shrink[2] != 0) o = 2; - else if (totalshrink[1] != 0) + else if (total_shrink[1] != 0) o = 1; else o = 0; mem[r + 5].hh.b1 = o; mem[r + 5].hh.b0 = 2; - if (totalshrink[o] != 0) - mem[r + 6].gr =(- (integer) x) / ((double) totalshrink[o]); + if (total_shrink[o] != 0) + mem[r + 6].gr =(- (integer) x) / ((double) total_shrink[o]); else { mem[r + 5].hh.b0 = 0; mem[r + 6].gr = 0.0; } /* if (total_shrink[o]<-x)and(o=normal)and(list_ptr(r)<>null) then l.13946 */ - if ((totalshrink[o]< - (integer) x) && (o == 0) && (mem[r + 5].hh.v.RH != 0)) { + if ((total_shrink[o]< - (integer) x) && (o == 0) && (mem[r + 5].hh.v.RH != 0)) { last_badness = 1000000L; /* set_glue_ratio_one(glue_set(r)); {use the maximum shrinkage} */ mem[r + 6].gr = 1.0; /* if (-x-total_shrink[normal]>hfuzz)or(hbadness<100) then */ - if ((- (integer) x - totalshrink[0] > hfuzz) || + if ((- (integer) x - total_shrink[0] > hfuzz) || (hbadness < 100)) { if ((overfull_rule > 0) && - (- (integer) x - totalshrink[0] > hfuzz)) { + (- (integer) x - total_shrink[0] > hfuzz)) { while(mem[q].hh.v.RH != 0)q = mem[q].hh.v.RH; mem[q].hh.v.RH = new_rule(); mem[mem[q].hh.v.RH + 1].cint = overfull_rule; } print_ln(); print_nl("Overfull \\hbox("); - print_scaled(- (integer) x - totalshrink[0]); + print_scaled(- (integer) x - total_shrink[0]); print_string("pt too wide"); overfull_hbox++; /* 1996/Feb/9 */ goto lab50; } } else if (o == 0) if (mem[r + 5].hh.v.RH != 0) { - last_badness = badness(- (integer) x, totalshrink[0]); + last_badness = badness(- (integer) x, total_shrink[0]); if (last_badness > hbadness) { print_ln(); print_nl("Tight \\hbox (badness "); @@ -1762,9 +1511,9 @@ lab50: else { if (pack_begin_line != 0) { if (pack_begin_line > 0) - print_string(")in paragraph at lines "); + print_string(") in paragraph at lines "); else - print_string(")in alignment at lines "); + print_string(") in alignment at lines "); print_int(abs(pack_begin_line)); print_string("--"); } else print_string(")detected at line "); @@ -1799,14 +1548,14 @@ halfword vpackage_(halfword p, scaled h, small_number m, scaled l) w = 0; d = 0; x = 0; - totalstretch[0] = 0; - totalshrink[0] = 0; - totalstretch[1] = 0; - totalshrink[1] = 0; - totalstretch[2] = 0; - totalshrink[2] = 0; - totalstretch[3] = 0; - totalshrink[3] = 0; + total_stretch[0] = 0; + total_shrink[0] = 0; + total_stretch[1] = 0; + total_shrink[1] = 0; + total_stretch[2] = 0; + total_shrink[2] = 0; + total_stretch[3] = 0; + total_shrink[3] = 0; while (p != 0) { if ((p >= hi_mem_min)) { confusion("vpack"); @@ -1837,9 +1586,9 @@ halfword vpackage_(halfword p, scaled h, small_number m, scaled l) g = mem[p + 1].hh.v.LH; x = x + mem[g + 1].cint; o = mem[g].hh.b0; - totalstretch[o] = totalstretch[o]+ mem[g + 2].cint; + total_stretch[o] = total_stretch[o]+ mem[g + 2].cint; o = mem[g].hh.b1; - totalshrink[o]= totalshrink[o]+ mem[g + 3].cint; + total_shrink[o]= total_shrink[o]+ mem[g + 3].cint; if (mem[p].hh.b1 >= 100) { g = mem[p + 1].hh.v.RH; if (mem[g + 1].cint > w) @@ -1874,25 +1623,25 @@ halfword vpackage_(halfword p, scaled h, small_number m, scaled l) mem[r + 6].gr = 0.0; goto lab10; } else if (x > 0) { - if (totalstretch[3] != 0) + if (total_stretch[3] != 0) o = 3; - else if (totalstretch[2]!= 0) + else if (total_stretch[2]!= 0) o = 2; - else if (totalstretch[1]!= 0) + else if (total_stretch[1]!= 0) o = 1; else o = 0; mem[r + 5].hh.b1 = o; mem[r + 5].hh.b0 = 1; - if (totalstretch[o] != 0) - mem[r + 6].gr = x / ((double) totalstretch[o]); + if (total_stretch[o] != 0) + mem[r + 6].gr = x / ((double) total_stretch[o]); else { mem[r + 5].hh.b0 = 0; mem[r + 6].gr = 0.0; } if (o == 0) if (mem[r + 5].hh.v.RH != 0) { - last_badness = badness(x, totalstretch[0]); + last_badness = badness(x, total_stretch[0]); if (last_badness > vbadness) { print_ln(); if (last_badness > 100) @@ -1908,31 +1657,31 @@ halfword vpackage_(halfword p, scaled h, small_number m, scaled l) } goto lab10; } else { - if (totalshrink[3] != 0) + if (total_shrink[3] != 0) o = 3; - else if (totalshrink[2] != 0) + else if (total_shrink[2] != 0) o = 2; - else if (totalshrink[1]!= 0) + else if (total_shrink[1]!= 0) o = 1; else o = 0; mem[r + 5].hh.b1 = o; mem[r + 5].hh.b0 = 2; - if (totalshrink[o]!= 0) - mem[r + 6].gr =(- (integer) x)/ ((double) totalshrink[o]); + if (total_shrink[o]!= 0) + mem[r + 6].gr =(- (integer) x)/ ((double) total_shrink[o]); else { mem[r + 5].hh.b0 = 0; mem[r + 6].gr = 0.0; } /* if (total_shrink[o]<-x)and(o=normal)and(list_ptr(r)<>null) then l.13046 */ - if ((totalshrink[o] < - (integer) x) && (o == 0) && (mem[r + 5].hh.v.RH != 0)) { + if ((total_shrink[o] < - (integer) x) && (o == 0) && (mem[r + 5].hh.v.RH != 0)) { last_badness = 1000000L; mem[r + 6].gr = 1.0; - if ((- (integer) x - totalshrink[0] > eqtb[(hash_size + 3739)].cint) || + if ((- (integer) x - total_shrink[0] > eqtb[(hash_size + 3739)].cint) || (vbadness < 100)) { print_ln(); print_nl("Overfull \\vbox("); - print_scaled(- (integer) x - totalshrink[0]); + print_scaled(- (integer) x - total_shrink[0]); print_string("pt too high"); overfull_vbox++; /* 1996/Feb/9 */ goto lab50; @@ -1941,7 +1690,7 @@ halfword vpackage_(halfword p, scaled h, small_number m, scaled l) /* else if o=normal then if list_ptr(r)<>null then l.13052 */ else if (o == 0) if (mem[r + 5].hh.v.RH != 0) { - last_badness = badness(- (integer) x, totalshrink[0]); + last_badness = badness(- (integer) x, total_shrink[0]); if (last_badness > vbadness) { print_ln(); print_nl("Tight \\vbox (badness "); @@ -1959,7 +1708,7 @@ lab50: print_string(") in alignment at lines "); print_int(abs(pack_begin_line)); print_string("--"); - } else print_string(")detected at line "); + } else print_string(") detected at line "); print_int(line); print_ln(); } @@ -1971,9 +1720,9 @@ lab10: return Result; } void append_to_vlist_(halfword b) -{ - scaled d; - halfword p; +{ + scaled d; + halfword p; if (cur_list.aux_field.cint > ignore_depth) { d = mem[eqtb[(hash_size + 783)].hh.v.RH + 1].cint - cur_list.aux_field.cint - mem[b + 3].cint; if (d < line_skip_limit) diff --git a/src/texsourc/tex5.c b/src/texsourc/tex5.c index e8f0e95..2af59b3 100644 --- a/src/texsourc/tex5.c +++ b/src/texsourc/tex5.c @@ -1208,8 +1208,8 @@ lab22: lab30: scanner_status = 0; new_save_level(6); /* if every_cr<>null then begin_token_list(every_cr,every_cr_text); l.15665 */ - if (eqtb[(hash_size + 1320)].hh.v.RH != 0)/* everycr */ - begin_token_list(eqtb[(hash_size + 1320)].hh.v.RH, 13); + if (every_cr != 0)/* everycr */ + begin_token_list(every_cr, 13); align_peek(); } void init_span_ (halfword p) @@ -1279,8 +1279,8 @@ void fin_row (void) } mem[p].hh.b0 = 13; mem[p + 6].cint = 0; - if (eqtb[(hash_size + 1320)].hh.v.RH != 0)/* everycr */ - begin_token_list(eqtb[(hash_size + 1320)].hh.v.RH, 13); + if (every_cr != 0)/* everycr */ + begin_token_list(every_cr, 13); align_peek(); } void fin_align (void) @@ -1732,24 +1732,24 @@ bool fin_col (void) mem[cur_align + 1].cint = w; mem[u].hh.b0 = 13; mem[u].hh.b1 = n; - if (totalstretch[3]!= 0) + if (total_stretch[3]!= 0) o = 3; - else if (totalstretch[2]!= 0) + else if (total_stretch[2]!= 0) o = 2; - else if (totalstretch[1]!= 0) + else if (total_stretch[1]!= 0) o = 1; else o = 0; mem[u + 5].hh.b1 = o; - mem[u + 6].cint = totalstretch[o]; - if (totalshrink[3]!= 0) + mem[u + 6].cint = total_stretch[o]; + if (total_shrink[3]!= 0) o = 3; - else if (totalshrink[2]!= 0) + else if (total_shrink[2]!= 0) o = 2; - else if (totalshrink[1]!= 0) + else if (total_shrink[1]!= 0) o = 1; else o = 0; mem[u + 5].hh.b0 = o; - mem[u + 4].cint = totalshrink[o]; + mem[u + 4].cint = total_shrink[o]; pop_nest(); mem[tail].hh.v.RH = u; tail = u; diff --git a/src/texsourc/tex6.c b/src/texsourc/tex6.c index 41be8c2..4fd98cf 100644 --- a/src/texsourc/tex6.c +++ b/src/texsourc/tex6.c @@ -342,10 +342,10 @@ lab30: oldl = l; if (l > last_special_line) linewidth = second_width; - else if (eqtb[(hash_size + 1312)].hh.v.RH == 0) + else if (par_shape_ptr == 0) linewidth = first_width; else - linewidth = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 * l].cint; + linewidth = mem[par_shape_ptr + 2 * l].cint; } } } @@ -632,12 +632,12 @@ lab30: if (curline > last_special_line) { curwidth = second_width; curindent = second_indent; - } else if (eqtb[(hash_size + 1312)].hh.v.RH == 0) { + } else if (par_shape_ptr == 0) { curwidth = first_width; curindent = first_indent; } else { - curwidth = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 * curline].cint; - curindent = mem[eqtb[(hash_size + 1312)].hh.v.RH + 2 * curline - 1].cint; + curwidth = mem[par_shape_ptr + 2 * curline].cint; + curindent = mem[par_shape_ptr + 2 * curline - 1].cint; } adjust_tail = adjust_head; just_box = hpack(q, curwidth, 0); @@ -1044,9 +1044,9 @@ void hyphenate (void) k = hyph_word[h]; if (k == 0) goto lab45; - if ((str_start[k + 1]- str_start[k])< hn) + if (length(k) < hn) goto lab45; - if ((str_start[k + 1]- str_start[k])== hn) + if (length(k) == hn) { j = 1; u = str_start[k]; @@ -1441,15 +1441,12 @@ lab21: switch(cur_cmd){ return; // abort_flag set } incr(hyph_count); - while(hyph_word[h]!= 0){ - - k = hyph_word[h]; - if ((str_start[k + 1]- str_start[k])<(str_start[s + 1 - ]- str_start[s])) - goto lab40; - if ((str_start[k + 1]- str_start[k])>(str_start[s + 1 - ]- str_start[s])) - goto lab45; + while (hyph_word[h]!= 0) { + k = hyph_word[h]; + if (length(k) < length(s)) + goto lab40; + if (length(k) > length(s)) + goto lab45; u = str_start[k]; v = str_start[s]; do { @@ -2018,7 +2015,7 @@ void fire_up_(halfword c) incr(mem[cur_mark[0]].hh.v.LH); } /* if output_routine<>null then */ - if (eqtb[(hash_size + 1313)].hh.v.RH != 0) + if (output_routine != 0) if (dead_cycles >= max_dead_cycles) { print_err("Output loop---"); @@ -2036,7 +2033,7 @@ void fire_up_(halfword c) mode = -1; cur_list.aux_field.cint = ignore_depth; mode_line = - (integer) line; - begin_token_list(eqtb[(hash_size + 1313)].hh.v.RH, 6); /* output */ + begin_token_list(output_routine, 6); /* output */ new_save_level(8); normal_paragraph(); scan_left_brace(); diff --git a/src/texsourc/tex7.c b/src/texsourc/tex7.c index 82f96dc..cb98508 100644 --- a/src/texsourc/tex7.c +++ b/src/texsourc/tex7.c @@ -368,7 +368,7 @@ void insert_dollar_sign (void) { back_input(); cur_tok = 804; - print_err("Proceed; I'll discard its present contents."); + print_err("Missing $ inserted"); help2("I've inserted a begin-math/end-math symbol since I think", "you left one out. Proceed, with fingers crossed."); ins_error(); @@ -575,7 +575,7 @@ void normal_paragraph (void) eq_word_define((hash_size + 3747), 0); if (hang_after != 1) eq_word_define((hash_size + 3204), 1); - if (eqtb[(hash_size + 1312)].hh.v.RH != 0) + if (par_shape_ptr != 0) eq_define((hash_size + 1312), 118, 0); } /* sec 1075 */ @@ -760,12 +760,12 @@ lab30:; if (k == 1) { cur_list.aux_field.cint = ignore_depth; - if (eqtb[(hash_size + 1318)].hh.v.RH != 0)/* everyhbox */ - begin_token_list(eqtb[(hash_size + 1318)].hh.v.RH, 11); + if (every_vbox != 0) + begin_token_list(every_vbox, 11); } else { space_factor = 1000; - if (eqtb[(hash_size + 1317)].hh.v.RH != 0)/* everyhbox */ - begin_token_list(eqtb[(hash_size + 1317)].hh.v.RH, 10); + if (every_hbox != 0) + begin_token_list(every_hbox, 10); } return; } @@ -844,8 +844,8 @@ void new_graf_(bool indented) mem[head].hh.v.RH = tail; mem[tail + 1].cint = par_indent; } - if (eqtb[(hash_size + 1314)].hh.v.RH != 0) /* everypar */ - begin_token_list(eqtb[(hash_size + 1314)].hh.v.RH, 7); + if (every_par != 0) + begin_token_list(every_par, 7); if (nest_ptr == 1){ build_page(); } @@ -1387,7 +1387,7 @@ lab45: } lab30:; } - if (eqtb[(hash_size + 1312)].hh.v.RH == 0) + if (par_shape_ptr == 0) if ((hang_indent != 0) && (((hang_after >= 0) && (prev_graf + 2 > hang_after)) ||(prev_graf + 1 < - (integer) hang_after))) { @@ -1401,11 +1401,11 @@ lab30:; s = 0; } else { - n = mem[eqtb[(hash_size + 1312)].hh.v.RH].hh.v.LH; + n = mem[par_shape_ptr].hh.v.LH; if (prev_graf + 2 >= n) - p = eqtb[(hash_size + 1312)].hh.v.RH + 2 * n; + p = par_shape_ptr + 2 * n; else - p = eqtb[(hash_size + 1312)].hh.v.RH + 2 *(prev_graf + 2); + p = par_shape_ptr + 2 *(prev_graf + 2); s = mem[p - 1].cint; l = mem[p].cint; } @@ -1415,8 +1415,8 @@ lab30:; eq_word_define((hash_size + 3743), w); eq_word_define((hash_size + 3744), l); eq_word_define((hash_size + 3745), s); - if (eqtb[(hash_size + 1316)].hh.v.RH != 0)/* everydisplay */ - begin_token_list(eqtb[(hash_size + 1316)].hh.v.RH, 9); + if (every_display != 0)/* everydisplay */ + begin_token_list(every_display, 9); if (nest_ptr == 1) { build_page(); } @@ -1425,8 +1425,8 @@ lab30:; { push_math(15); eq_word_define((hash_size + 3207), -1); - if (eqtb[(hash_size + 1315)].hh.v.RH != 0)/* everymath */ - begin_token_list(eqtb[(hash_size + 1315)].hh.v.RH, 8); + if (every_math != 0)/* everymath */ + begin_token_list(every_math, 8); } } } @@ -1438,8 +1438,8 @@ void start_eq_no (void) { push_math(15); eq_word_define((hash_size + 3207), -1); - if (eqtb[(hash_size + 1315)].hh.v.RH != 0)/* everymath */ - begin_token_list(eqtb[(hash_size + 1315)].hh.v.RH, 8); + if (every_math != 0)/* everymath */ + begin_token_list(every_math, 8); } } /* sec 1151 */ diff --git a/src/texsourc/tex8.c b/src/texsourc/tex8.c index 73e1f1a..259fa70 100644 --- a/src/texsourc/tex8.c +++ b/src/texsourc/tex8.c @@ -39,46 +39,43 @@ void math_fraction (void) scan_delimiter(lig_trick, false); } if (c % 3 == 0) - scan_dimen(false, false, false); - print_err("Ambiguous; you need another { and }"); - help3("I'm ignoring this fraction specification, since I don't", - "know whether a construction like `x \\over y \\over z'", - "means `{x \\over y} \\over z' or `x \\over {y \\over z}'."); - error(); - } - else { - - cur_list.aux_field.cint = get_node(6); - mem[cur_list.aux_field.cint].hh.b0 = 25; - mem[cur_list.aux_field.cint].hh.b1 = 0; - mem[cur_list.aux_field.cint + 2].hh.v.RH = 3; - mem[cur_list.aux_field.cint + 2].hh.v.LH = mem[head] - .hh.v.RH; - mem[cur_list.aux_field.cint + 3].hh = empty_field; - mem[cur_list.aux_field.cint + 4].qqqq = null_delimiter; - mem[cur_list.aux_field.cint + 5].qqqq = null_delimiter; - mem[head].hh.v.RH = 0; - tail = head; - if (c >= 3) - { - scan_delimiter(cur_list.aux_field.cint + 4, false); - scan_delimiter(cur_list.aux_field.cint + 5, false); - } + scan_dimen(false, false, false); + print_err("Ambiguous; you need another { and }"); + help3("I'm ignoring this fraction specification, since I don't", + "know whether a construction like `x \\over y \\over z'", + "means `{x \\over y} \\over z' or `x \\over {y \\over z}'."); + error(); + } else { + cur_list.aux_field.cint = get_node(6); + mem[cur_list.aux_field.cint].hh.b0 = 25; + mem[cur_list.aux_field.cint].hh.b1 = 0; + mem[cur_list.aux_field.cint + 2].hh.v.RH = 3; + mem[cur_list.aux_field.cint + 2].hh.v.LH = mem[head].hh.v.RH; + mem[cur_list.aux_field.cint + 3].hh = empty_field; + mem[cur_list.aux_field.cint + 4].qqqq = null_delimiter; + mem[cur_list.aux_field.cint + 5].qqqq = null_delimiter; + mem[head].hh.v.RH = 0; + tail = head; + if (c >= 3) { + scan_delimiter(cur_list.aux_field.cint + 4, false); + scan_delimiter(cur_list.aux_field.cint + 5, false); + } switch(c % 3) - {case 0 : + { + case 0: { - scan_dimen(false, false, false); - mem[cur_list.aux_field.cint + 1].cint = cur_val; - } - break; - case 1 : + scan_dimen(false, false, false); + mem[cur_list.aux_field.cint + 1].cint = cur_val; + } + break; + case 1: mem[cur_list.aux_field.cint + 1].cint = 1073741824L; /* 2^30 */ - break; - case 2 : - mem[cur_list.aux_field.cint + 1].cint = 0; - break; - } - } + break; + case 2: + mem[cur_list.aux_field.cint + 1].cint = 0; + break; + } + } } /* sec 1191 */ void math_left_right (void) @@ -86,44 +83,36 @@ void math_left_right (void) small_number t; halfword p; t = cur_chr; - if ((t == 31)&&(cur_group != 16)) - { - if (cur_group == 15) - { + if ((t == 31) && (cur_group != 16)) { + if (cur_group == 15) { scan_delimiter(lig_trick, false); - print_err("Extra "); + print_err("Extra "); print_esc("right"); - help1("I'm ignoring a \\right that had no matching \\left."); - error(); - } - else { - off_save(); - } - } - else { - - p = new_noad(); - mem[p].hh.b0 = t; - scan_delimiter(p + 1, false); - if (t == 30) - { - push_math(16); - mem[head].hh.v.RH = p; - tail = p; - } - else { - - p = fin_mlist(p); - unsave(); + help1("I'm ignoring a \\right that had no matching \\left."); + error(); + } else { + off_save(); + } + } else { + p = new_noad(); + mem[p].hh.b0 = t; + scan_delimiter(p + 1, false); + if (t == 30) { + push_math(16); + mem[head].hh.v.RH = p; + tail = p; + } else { + p = fin_mlist(p); + unsave(); { - mem[tail].hh.v.RH = new_noad(); - tail = mem[tail].hh.v.RH; - } - mem[tail].hh.b0 = 23; - mem[tail + 1].hh.v.RH = 3; - mem[tail + 1].hh.v.LH = p; - } - } + mem[tail].hh.v.RH = new_noad(); + tail = mem[tail].hh.v.RH; + } + mem[tail].hh.b0 = 23; + mem[tail + 1].hh.v.RH = 3; + mem[tail + 1].hh.v.LH = p; + } + } } /* sec 1194 */ void after_math (void) @@ -278,8 +267,8 @@ void after_math (void) } if (w + q > z) { - if ((e != 0)&&((w - totalshrink[0]+ q <= z)||(totalshrink - [1]!= 0)||(totalshrink[2]!= 0)||(totalshrink[3]!= 0) + if ((e != 0)&&((w - total_shrink[0]+ q <= z)||(total_shrink + [1]!= 0)||(total_shrink[2]!= 0)||(total_shrink[3]!= 0) )) { free_node(b, 7); @@ -381,25 +370,24 @@ void after_math (void) } /* sec 1200 */ void resume_after_display (void) -{ - - if (cur_group != 15){ +{ + if (cur_group != 15) { confusion("display"); return; // abort_flag set } - unsave(); - prev_graf = prev_graf + 3; - push_nest(); - mode = 102; - space_factor = 1000; + unsave(); + prev_graf = prev_graf + 3; + push_nest(); + mode = 102; + space_factor = 1000; /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ /* was clang = 0; etc in 3.141 new stuff follows */ if (language <= 0) - cur_lang = 0; + cur_lang = 0; else if (language > 255) - cur_lang = 0; - else cur_lang = language; - clang = cur_lang; + cur_lang = 0; + else cur_lang = language; + clang = cur_lang; prev_graf =(norm_min(left_hyphen_min) * 64 + norm_min(right_hyphen_min)) * 65536L + cur_lang; /* eqtb ??? hash_size ? hash_size + hash_extra ? norm_min etc */ @@ -408,44 +396,43 @@ void resume_after_display (void) get_x_token(); if (cur_cmd != 10) back_input(); } - if (nest_ptr == 1){ + if (nest_ptr == 1) { build_page(); } } /* sec 1215 */ void get_r_token (void) -{/* 20 */ +{ lab20: do { get_token(); - } while(!(cur_tok != 2592)); + } while (!(cur_tok != 2592)); /* if ((cur_cs == 0)||(cur_cs > (hash_size + 514))) */ /* 95/Jan/10 */ - if ((cur_cs == 0)||(cur_cs > (hash_size + hash_extra + 514))) { - print_err("Missing control sequence inserted"); - help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.", - "I've inserted an inaccessible control sequence so that your", - "definition will be completed without mixing me up too badly.", - "You can recover graciously from this error, if you're", - "careful; see exercise 27.2 in The TeXbook."); + if ((cur_cs == 0) || (cur_cs > (hash_size + hash_extra + 514))) { + print_err("Missing control sequence inserted"); + help5("Please don't say `\\def cs{...}', say `\\def\\cs{...}'.", + "I've inserted an inaccessible control sequence so that your", + "definition will be completed without mixing me up too badly.", + "You can recover graciously from this error, if you're", + "careful; see exercise 27.2 in The TeXbook."); if (cur_cs == 0) - back_input(); + back_input(); /* cur_tok = (hash_size + 4609); */ /* cur_tok = (hash_size + 4095 + 514); */ cur_tok = (hash_size + hash_extra + 4095 + 514); /* 96/Jan/10 */ - ins_error(); - goto lab20; - } + ins_error(); + goto lab20; + } } /* sec 1229 */ void trap_zero_glue (void) { - if ((mem[cur_val + 1].cint == 0)&&(mem[cur_val + 2].cint == 0) - &&(mem[cur_val + 3].cint == 0)) - { + if ((mem[cur_val + 1].cint == 0) && (mem[cur_val + 2].cint == 0) && + (mem[cur_val + 3].cint == 0)) { incr(mem[0].hh.v.RH); /* mem[mem_bot]? */ /* mem[null]? */ - delete_glue_ref(cur_val); - cur_val = 0; - } + delete_glue_ref(cur_val); + cur_val = 0; + } } /* sec 1236 */ void do_register_command_ (small_number a) @@ -494,8 +481,7 @@ void do_register_command_ (small_number a) lab40:; if (q == 89) scan_optional_equals(); - else if (scan_keyword("by")) /* by */ -; + else if (scan_keyword("by")); arith_error = false; if (q < 91) if (p < 2) @@ -754,13 +740,13 @@ void new_font_(small_number a) name_in_progress = false; flushablestring = str_ptr - 1; - if (trace_flag) { /* debugging stuff only 98/Oct/5 */ + if (trace_flag) { /* debugging stuff only 98/Oct/5 */ int i, k1, k2, l1, l2; char *sch=log_line; k1 = str_start[cur_area]; k2 = str_start[cur_name]; - l1 = str_start[cur_area + 1] - str_start[cur_area]; - l2 = str_start[cur_name + 1] - str_start[cur_name]; + l1 = length(cur_area); + l2 = length(cur_name); show_char('\n'); show_line("FONT ", 0); for (i = 0; i < l1; i++) { @@ -785,11 +771,8 @@ void new_font_(small_number a) /* if str_eq_str(font_name[f],cur_name) ^ str_eq_str(font_area[f],cur_area) */ if (str_eq_str(font_name[f], cur_name)&& str_eq_str(font_area[f], cur_area)) { - if (cur_name == flushablestring){ - { - decr(str_ptr); - pool_ptr = str_start[str_ptr]; - } + if (cur_name == flushablestring) { + flush_string(); cur_name = font_name[f]; } /* if (ignore_frozen) continue; */ /* 98/Oct/5 */ @@ -849,7 +832,7 @@ void new_interaction (void) { print_ln(); interaction = cur_chr; - if (interaction == 0) selector = 16; + if (interaction == batch_mode) selector = 16; else selector = 17; if (log_opened) selector = selector + 2; } @@ -888,7 +871,7 @@ void open_or_close_in (void) /* *** some changes in following in 3.14159 *** */ /* if current extension is *not* empty, try to open using name as is */ /* string 335 is "" the empty string */ - if ((cur_ext != 335)&& a_open_in(read_file[n], TEXINPUTPATH)) + if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH)) read_open[n]= 1; /* we get here if extension is "", or file with extension failed to open */ /* if current extension is not `tex,' and `tex' is not irrelevant, try it */ @@ -952,39 +935,33 @@ void issue_message (void) s = make_string(); if (c == 0) { - if (term_offset +(str_start[s + 1]- str_start[s])> max_print_line - - 2) - print_ln(); - else if ((term_offset > 0)||(file_offset > 0)) - print_char(' '); - slow_print(s); + if (term_offset + length(s) > max_print_line - 2) + print_ln(); + else if ((term_offset > 0)||(file_offset > 0)) + print_char(' '); + slow_print(s); #ifndef f_WINDOWS - fflush(stdout); + fflush(stdout); #endif - } - else { - print_err(""); - slow_print(s); - if (eqtb[(hash_size + 1321)].hh.v.RH != 0) - use_err_help = true; + } else { + print_err(""); + slow_print(s); + if (err_help != 0) + use_err_help = true; else if (long_help_seen) - help1("(That was another \\errmessage.)"); + help1("(That was another \\errmessage.)"); else { - if (interaction < 3) - long_help_seen = true; - help4("This error message was generated by an \\errmessage", - "command, so I can't give any explicit help.", - "Pretend that you're Hercule Poirot: Examine all clues,", - "and deduce the truth by order and method."); - } + long_help_seen = true; + help4("This error message was generated by an \\errmessage", + "command, so I can't give any explicit help.", + "Pretend that you're Hercule Poirot: Examine all clues,", + "and deduce the truth by order and method."); + } error(); use_err_help = false; - } - { - decr(str_ptr); - pool_ptr = str_start[str_ptr]; - } + } + flush_string(); } /* sec 1288 */ void shift_case (void) @@ -1045,7 +1022,7 @@ void show_whatever (void) case 0: { get_token(); - if (interaction == 3) + if (interaction == error_stop_mode) ; print_nl("> "); if (cur_cs != 0) @@ -1060,7 +1037,7 @@ void show_whatever (void) default: { p = the_toks(); - if (interaction == 3) + if (interaction == error_stop_mode) ; print_nl(" > "); token_show(temp_head); @@ -1439,8 +1416,8 @@ void main_control (void) integer t; integer bSuppress; /* 199/Jan/5 */ - if (eqtb[(hash_size + 1319)].hh.v.RH != 0)/* everyjob */ - begin_token_list(eqtb[(hash_size + 1319)].hh.v.RH, 12); + if (every_job != 0)/* everyjob */ + begin_token_list(every_job, 12); lab60: get_x_token(); /* big_switch */ @@ -1845,8 +1822,8 @@ lab21: push_nest(); mode = -1; cur_list.aux_field.cint = ignore_depth; - if (eqtb[(hash_size + 1318)].hh.v.RH != 0)/* everyvbox */ - begin_token_list(eqtb[(hash_size + 1318)].hh.v.RH, 11); + if (every_vbox != 0)/* everyvbox */ + begin_token_list(every_vbox, 11); } break; case 256 : diff --git a/src/texsourc/tex9.c b/src/texsourc/tex9.c index bf71196..a0f90cd 100644 --- a/src/texsourc/tex9.c +++ b/src/texsourc/tex9.c @@ -29,14 +29,14 @@ /* sec 1284 */ void give_err_help (void) { - token_show(eqtb[(hash_size + 1321)].hh.v.RH); + token_show(err_help); } /* sec 0524 */ bool open_fmt_file (void) -{/* 40 10 */ - register bool Result; - integer j; - j = cur_input.loc_field; +{ + register bool Result; + integer j; + j = cur_input.loc_field; /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ /* For Windows NT, lets allow + instead of & for format specification */ /* if (buffer[cur_input.loc_field]== 38) */ /* 95/Jan/22 */ @@ -44,26 +44,23 @@ bool open_fmt_file (void) { /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ /* User specified a format name on the command line */ - incr(cur_input.loc_field); - j = cur_input.loc_field; - buffer[last]= 32; - while (buffer[j]!= 32) incr(j); + incr(cur_input.loc_field); + j = cur_input.loc_field; + buffer[last]= 32; + while (buffer[j]!= 32) incr(j); pack_buffered_name(0, cur_input.loc_field, j - 1); - if (w_open_in(fmt_file)) + if (w_open_in(fmt_file)) goto lab40; // format file opened OK // format file open failed if (knuth_flag) { (void) sprintf(log_line, "%s;%s\n", "Sorry, I can't find that format", " will try the default."); show_line(log_line, 1); - } - else { - char *s=log_line; -/* null_terminate (name_of_file + 1); */ - name_of_file[name_length + 1] = '\0'; /* null terminate */ + } else { + char *s = log_line; + name_of_file[name_length + 1] = '\0'; (void) sprintf(s, "%s (%s);%s\n", "Sorry, I can't find that format", name_of_file+1, " will try the default."); -/* space_terminate (name_of_file + 1); */ - name_of_file[name_length + 1] = ' '; /* space terminate */ + name_of_file[name_length + 1] = ' '; s += strlen(s); (void) sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n", "TEXFORMATS"); s += strlen(s); @@ -83,39 +80,37 @@ bool open_fmt_file (void) } /* Try the default format (either because no format specified or failed) */ pack_buffered_name(format_default_length - 4, 1, 0); - if (! w_open_in(fmt_file)) - { - ; - if (knuth_flag) { + if (! w_open_in(fmt_file)) { + ; + if (knuth_flag) { (void) sprintf(log_line, "%s!\n", "I can't find the default format file"); show_line(log_line, 1); - } else { - char *s=log_line; -/* null_terminate (name_of_file + 1); */ - name_of_file[name_length + 1] = '\0'; /* null terminate */ - (void) sprintf(s, "%s (%s)!\n", "I can't find the default format file", name_of_file + 1); -/* space_terminate (name_of_file + 1); */ - name_of_file[name_length + 1] = ' '; /* space terminate */ - s += strlen(s); - (void) sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n", "TEXFORMATS"); - s += strlen(s); - { - char *t; /* extra info 97/June/13 */ - if ((t = grabenv("TEXFORMATS")) != NULL) { - sprintf(s, "(%s=%s)\n", "TEXFORMATS", t); - } else { - sprintf(s, "%s environment variable not set\n", "TEXFORMATS"); + } else { + char *s = log_line; + name_of_file[name_length + 1] = '\0'; + (void) sprintf(s, "%s (%s)!\n", "I can't find the default format file", name_of_file + 1); + name_of_file[name_length + 1] = ' '; + s += strlen(s); + (void) sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n", "TEXFORMATS"); + s += strlen(s); + { + char *t; /* extra info 97/June/13 */ + if ((t = grabenv("TEXFORMATS")) != NULL) { + sprintf(s, "(%s=%s)\n", "TEXFORMATS", t); + } else { + sprintf(s, "%s environment variable not set\n", "TEXFORMATS"); + } } + show_line(log_line, 1); // show all three lines at once } - show_line(log_line, 1); // show all three lines at once - } - Result = false; + Result = false; return(Result); - } - lab40: cur_input.loc_field = j; - Result = true; - return Result; -} + } +lab40: + cur_input.loc_field = j; + Result = true; + return Result; +} /**************************************************************************/ void print_char_string (unsigned char *s) { @@ -135,19 +130,13 @@ void close_files_and_terminate (void) show_line("close_files_and_terminated already ", 0); return; // sanity check } - if (trace_flag) show_line("\nclose_files_and_terminate ", 0); + if (trace_flag) + show_line("\nclose_files_and_terminate ", 0); // close all open files - { - register integer for_end; - k = 0; - for_end = 15; /* CHECK LIMIT */ - if (k <= for_end) do - if (write_open[k]){ - (void) a_close(write_file[k]); - } - while(k++ < for_end); - } -; + for (k = 0; k <= 15; k++) + if (write_open[k]) { + (void) a_close(write_file[k]); + } #ifdef STAT /* if tracing_stats>0 then @; */ @@ -286,131 +275,93 @@ void close_files_and_terminate (void) /************************************************************************/ } /* end of if (log_opened) */ #endif /* STAT */ - while(cur_s > -1){ - if (cur_s > 0){ - dvi_buf[dvi_ptr]= 142; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } + while (cur_s > -1) { + if (cur_s > 0) + dvi_out(142); else { - { - dvi_buf[dvi_ptr]= 140; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - incr(total_pages); - } - decr(cur_s); - } + dvi_out(140); + incr(total_pages); + } + decr(cur_s); + } - if (total_pages == 0) print_nl("No pages of output."); /* */ + if (total_pages == 0) + print_nl("No pages of output."); else { - { - dvi_buf[dvi_ptr]= 248; /* post - start of postamble */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - dvi_four(last_bop); - last_bop = dvi_offset + dvi_ptr - 5; + dvi_out(248); /* post - start of postamble */ + dvi_four(last_bop); + last_bop = dvi_offset + dvi_ptr - 5; dvi_four(25400000L); /* magic DVI scale factor */ dvi_four(473628672L); /* 7227 * 65536 */ prepare_mag(); /* in tex2.c */ dvi_four(mag); /* mag */ dvi_four(max_v); /* max height + depth */ dvi_four(max_h); /* max width */ - { - dvi_buf[dvi_ptr]= max_push / 256; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= max_push % 256; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - if (total_pages >= 65536) { // 99/Oct/10 dvi_t 16 bit problem - sprintf( - log_line, - "\nWARNING: page count (dvi_t) in DVI file will be %ld not %ld\n", - (total_pages % 65536), - total_pages); - if (log_opened) fputs (log_line, log_file); - show_line(log_line, 1); - } - { - dvi_buf[dvi_ptr]=(total_pages / 256)% 256; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - { - dvi_buf[dvi_ptr]= total_pages % 256; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit) dvi_swap(); - } - - if (show_fonts_used && log_opened) /* 97/Dec/24 */ - show_font_info(); // now in local.c - - while(font_ptr > 0){ - if (font_used[font_ptr])dvi_font_def(font_ptr); - decr(font_ptr); - } - { - dvi_buf[dvi_ptr]= 249; /* post_post end of postamble */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - dvi_four(last_bop); - { - dvi_buf[dvi_ptr]= 2; - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - k = 4 +((dvi_buf_size - dvi_ptr)% 4); - while(k > 0){ - { - dvi_buf[dvi_ptr]= 223; /* four to seven bytes of 223 */ - incr(dvi_ptr); - if (dvi_ptr == dvi_limit)dvi_swap(); - } - decr(k); - } + dvi_out(max_push / 256); + dvi_out(max_push % 256); + if (total_pages >= 65536) { // 99/Oct/10 dvi_t 16 bit problem + sprintf(log_line, "\nWARNING: page count (dvi_t) in DVI file will be %ld not %ld\n", + (total_pages % 65536), total_pages); + if (log_opened) + (void) fputs (log_line, log_file); + show_line(log_line, 1); + } + dvi_out((total_pages / 256) % 256); + dvi_out(total_pages % 256); + if (show_fonts_used && log_opened) /* 97/Dec/24 */ + show_font_info(); // now in local.c + while (font_ptr > 0) { + if (font_used[font_ptr]) + dvi_font_def(font_ptr); + decr(font_ptr); + } + dvi_out(249); /* post_post end of postamble */ + dvi_four(last_bop); + dvi_out(2); + k = 4 + ((dvi_buf_size - dvi_ptr) % 4); + while (k > 0) { + dvi_out(223); /* four to seven bytes of 223 */ + decr(k); + } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ if (trace_flag) { /* 93/Dec/28 - bkph */ sprintf(log_line, "\ndviwrite %d", dvi_gone); show_line(log_line, 0); } /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */ - if (dvi_limit == half_buf)writedvi(half_buf, dvi_buf_size - 1); - if (dvi_ptr > 0)writedvi(0, dvi_ptr - 1); + if (dvi_limit == half_buf) + writedvi(half_buf, dvi_buf_size - 1); + if (dvi_ptr > 0) + writedvi(0, dvi_ptr - 1); print_nl("Output written on "); - if (full_file_name_flag && dvi_file_name != NULL) - print_char_string((unsigned char *) dvi_file_name); - else - slow_print(output_file_name); + if (full_file_name_flag && dvi_file_name != NULL) + print_char_string((unsigned char *) dvi_file_name); + else + slow_print(output_file_name); print_string(" ("); - print_int(total_pages); + print_int(total_pages); print_string(" page"); - if (total_pages != 1) print_char('s'); + if (total_pages != 1) + print_char('s'); print_string(", "); - print_int(dvi_offset + dvi_ptr); + print_int(dvi_offset + dvi_ptr); print_string(" bytes)."); - b_close(dvi_file); + b_close(dvi_file); } if (log_opened) { (void) putc ('\n', log_file); (void) a_close(log_file); selector = selector - 2; if (selector == 17) { - print_nl("Transcript written on "); - if (full_file_name_flag && log_file_name != NULL) - print_char_string((unsigned char *) log_file_name); - else - slow_print(texmf_log_name); - print_char('.'); - } - } - print_ln(); + print_nl("Transcript written on "); + if (full_file_name_flag && log_file_name != NULL) + print_char_string((unsigned char *) log_file_name); + else + slow_print(texmf_log_name); + print_char('.'); + } + } + print_ln(); if ((edit_name_start != 0) && (interaction > 0)) { call_edit(str_pool, edit_name_start, edit_name_length, edit_line); } @@ -420,9 +371,9 @@ void close_files_and_terminate (void) void debug_help (void) {/* 888 10 */ integer k, l, m, n; - while(true){ + while (true) { ; - print_nl(" debug # (-1 to exit):"); /* */ + print_nl(" debug # (-1 to exit):"); #ifndef _WINDOWS fflush(stdout); #endif @@ -516,7 +467,7 @@ void debug_help (void) } break; case 16 : - panicking = ! panicking; + panicking = !panicking; break; default: print(63); /* ? */ diff --git a/src/texsourc/texd.h b/src/texsourc/texd.h index 332667b..08b6635 100644 --- a/src/texsourc/texd.h +++ b/src/texsourc/texd.h @@ -1914,7 +1914,7 @@ char *unixify (char *); /* in pathsrch.c bkph */ extern void tex_help (unsigned int n, ...); extern void append_char(ASCII_code c); extern void succumb(void); -extern void dvi_out_ (ASCII_code op); +extern INLINE void dvi_out_ (ASCII_code op); #define dvi_out(op) dvi_out_((ASCII_code) (op)) extern void flush_string (void); #define help0() tex_help(0) diff --git a/src/texsourc/texmf.c b/src/texsourc/texmf.c index 5d083f5..8a93f78 100644 --- a/src/texsourc/texmf.c +++ b/src/texsourc/texmf.c @@ -36,7 +36,7 @@ #include -#define EXTERN /* Instantiate data in `texd.h' or `mfd.h' here ! */ +#define EXTERN /* Instantiate data in `texd.h' or `mfd.h' here ! */ #include "texd.h" @@ -76,14 +76,14 @@ #include // needed for time, struct tm etc. -extern struct tm *localtime(); +extern struct tm * localtime(); /* Catch interrupts. */ #include // needed for signal, SIGINT, SIG_IGN, SIG_ERR etc. /* following may be found in local.c --- used for key replacement */ -extern char *replacement[]; /* pointers to replacement strings */ +extern char * replacement[]; /* pointers to replacement strings */ /* extern char *buffercopy; */ /* pointer to allocated copy of buffer */ @@ -114,7 +114,7 @@ char **gargv; /* char *gargv[] -- bkph ? */ int init(int, char **); /* in local.c */ #endif /* INIVIR */ -char *set_program_name(char *comm) +char * set_program_name(char *comm) { /* bkph */ char *s; if ((s = strrchr (comm, '\\')) != NULL) s++; @@ -141,8 +141,10 @@ int main (int ac, char *av[]) program_name = set_program_name(av[0]); /* rewritten 1994/Mar/1 - bkph */ #else program_name = strrchr (av[0], PATH_SEP); - if (program_name == NULL) program_name = av[0]; - else program_name++; + if (program_name == NULL) + program_name = av[0]; + else + program_name++; #endif #ifdef MSDOS @@ -162,12 +164,14 @@ int main (int ac, char *av[]) program_name = set_program_name(av[0]); /* rewritten 1994/Mar/1 - bkph */ #else program_name = strrchr (av[0], PATH_SEP); - if (program_name == NULL) program_name = av[0]; - else program_name++; + if (program_name == NULL) + program_name = av[0]; + else + program_name++; #endif if (strcmp (program_name, virgin_program) != 0) { -/* TeX or Metafont adds the space at the end of the name. */ - (void) sprintf (custom_default, dump_format, program_name); +/* TeX or Metafont adds the space at the end of the name. */ + (void) sprintf (custom_default, dump_format, program_name); dump_default_var = custom_default; dump_default_length = strlen (program_name) + dump_ext_length; } @@ -194,7 +198,8 @@ int main (int ac, char *av[]) // ABORTCHECKZERO; // after storefmtfiles e.g. - if (endit(flag) != 0) flag = 1; /* do final clean up in local.c */ + if (endit(flag) != 0) + flag = 1; /* do final clean up in local.c */ if (flag == 0) return 0; #ifdef _WINDOWS return flag; @@ -305,8 +310,7 @@ void get_date_and_time (integer *minutes, integer *pday, integer *pmonth, intege sprintf(log_line, "Cannot convert time (%0ld)!\n", clock); show_line(log_line, 1); *pyear=2038; *pmonth=1; *pday=18; *minutes=22 * 60 + 14; - } - else { + } else { *minutes = tmptr->tm_hour * 60 + tmptr->tm_min; *pday = tmptr->tm_mday; *pmonth = tmptr->tm_mon + 1; @@ -322,7 +326,7 @@ void get_date_and_time (integer *minutes, integer *pday, integer *pmonth, intege { #ifdef MSDOS if (!no_interrupts) { - if (signal(SIGINT, catch_interrupt)== SIG_ERR) { + if (signal(SIGINT, catch_interrupt) == SIG_ERR) { show_line(" CTRL-C handler not installed\n", 0); #ifndef _WINDOWS uexit(1); /* do we care when run as DLL ? */ @@ -654,10 +658,9 @@ void call_edit (ASCII_code *stringpool, pool_pointer fnstart, if (log_opened) { /* 1994/Aug/10 */ lgstart = str_start[texmf_log_name]; - lglength = str_start[texmf_log_name + 1]- str_start[texmf_log_name]; + lglength = length(texmf_log_name); log_file_name = stringpool + lgstart; - } - else { /* 1994/Aug/10 */ + } else { /* 1994/Aug/10 */ lglength = 0; log_file_name = (unsigned char *) ""; }