tex5.o tex6.o tex7.o tex8.o tex9.o \
yandy_pool.o md5.o yandy_backend_pdf.o
-headers = yandytex.h texd.h coerce.h
+headers = yandytex.h texd.h coerce.h texmf.h texmfmem.h
yandytex: $(objects)
$(CC) -o yandytex $(objects) $(LDFLAGS)
#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(const char *);
+void print_esc(const char *);
void print_the_digs_(eight_bits);
#define print_the_digs(k) print_the_digs_((eight_bits) (k))
void print_int_(integer);
#define print_write_whatsit(s, p) print_write_whatsit_((str_number) (s), (pointer) (p))
void jump_out(void);
void error(void);
-void fatal_error_(char *);
-#define fatal_error(s) fatal_error_((char *) (s))
+void fatal_error(char *);
void overflow_(char *, integer);
#define overflow(s, n) overflow_((char *) (s), (integer) (n))
-void confusion_(char *);
-#define confusion(s) confusion_((char *) (s))
+void confusion_(const char *);
+#define confusion(s) confusion_((const char *) (s))
boolean init_terminal(void);
str_number make_string(void);
boolean str_eq_buf_(str_number, integer);
#define new_glue(q) new_glue_((pointer) (q))
pointer new_skip_param_(small_number);
#define new_skip_param(n) new_skip_param_((small_number) (n))
-pointer new_kern_(scaled);
-#define new_kern(w) new_kern_((scaled) (w))
-pointer new_penalty_(integer);
-#define new_penalty(m) new_penalty_((integer) (m))
-void check_mem_(boolean);
-#define check_mem(printlocs) check_mem_((boolean) (printlocs))
+pointer new_kern(scaled);
+pointer new_penalty(integer);
+void check_mem(boolean);
void search_mem_(halfword);
#define search_mem(p) search_mem_((halfword) (p))
void short_display_(integer);
#define short_display(p) short_display_((integer) (p))
-void print_font_and_char_(integer);
-#define print_font_and_char(p) print_font_and_char_((integer) (p))
+void print_font_and_char(integer);
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_rule_dimen(scaled);
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 *);
void x_token(void);
void scan_left_brace(void);
void scan_optional_equals(void);
-boolean scan_keyword_(const char *);
-#define scan_keyword(s) scan_keyword_((const char *) (s))
+boolean scan_keyword(const char *);
void mu_error(void);
void scan_eight_bit_int(void);
void scan_char_num(void);
void pack_buffered_name_(small_number, integer, integer);
#define pack_buffered_name(n, a, b) pack_buffered_name_((small_number) (n), (integer) (a), (integer) (b))
str_number make_name_string(void);
-str_number a_make_name_string_(alpha_file *);
-#define a_make_name_string(f) a_make_name_string_((alpha_file *) &(f))
-str_number b_make_name_string_(byte_file *);
-#define b_make_name_string(f) b_make_name_string_((byte_file *) &(f))
-str_number w_make_name_string_(word_file *);
-#define w_make_name_string(f) w_make_name_string_((word_file *) &(f))
+str_number a_make_name_string_(void);
+#define a_make_name_string(f) a_make_name_string_()
+str_number b_make_name_string_(void);
+#define b_make_name_string(f) b_make_name_string_()
+str_number w_make_name_string_(void);
+#define w_make_name_string(f) w_make_name_string_()
void scan_file_name(void);
void pack_job_name_(str_number);
#define pack_job_name(s) pack_job_name_(make_string_pool((char*)s))
void dvi_swap(void);
void dvi_four_(integer);
#define dvi_four(x) dvi_four_((integer) (x))
-void zdvipop(integer);
-#define dvi_pop(l) zdvipop((integer) (l))
+void dvi_pop_(integer);
+#define dvi_pop(l) dvi_pop_((integer) (l))
void dvi_font_def_(internal_font_number);
#define dvi_font_def(f) dvi_font_def_((internal_font_number) (f))
void zmovement(scaled, eight_bits);
if (flag)
{
- show_line("Inverted mapping xord[] pairs:\n", 0);
+ puts("Inverted mapping xord[] pairs:\n");
for (k = 0; k < 256; k++)
{
pack_begin_line = mode_line;
link(temp_head) = link(head);
- if ((tail >= hi_mem_min))
- {
+ if (is_char_node(tail))
tail_append(new_penalty(inf_penalty));
- }
else if (type(tail) != glue_node)
- {
tail_append(new_penalty(inf_penalty));
- }
else
{
type(tail) = penalty_node;
{
if (trie_not_ready)
init_trie();
- } /* bkph */
-#endif /* INITEX */
+ }
+#endif
cur_lang = init_cur_lang;
lhyf = init_l_hyf;
auto_breaking = true;
prevp = cur_p;
- while((cur_p != 0) && (link(active) != active))
+ while ((cur_p != 0) && (link(active) != active))
{
- if ((cur_p >= hi_mem_min))
+ if (is_char_node(cur_p))
{
prevp = cur_p;
active_width[1] = active_width[1] + char_width(f, char_info(f, character(cur_p)));
cur_p = link(cur_p);
}
- while(!(!(cur_p >= hi_mem_min)));
+ while (!(!is_char_node(cur_p)));
}
switch(type(cur_p))
{
if (auto_breaking)
{
- if ((prevp >= hi_mem_min))
+ if (is_char_node(prevp))
try_break(0, unhyphenated);
else if ((mem[prevp].hh.b0 < 9))
try_break(0, unhyphenated);
{
while (true)
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
c = character(s);
hf = font(s);
while (true)
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
if (font(s) != hf)
goto lab33;
while (true)
{
- if (!((s >= hi_mem_min)))
+ if (!(is_char_node(s)))
switch(type(s))
{
case ligature_node:
case kern_node:
if (subtype(cur_p) == explicit)
{
- if (!(link(cur_p) >= hi_mem_min) && auto_breaking)
+ if (!is_char_node(link(cur_p)) && auto_breaking)
if (type(link(cur_p)) == glue_node)
try_break(0, unhyphenated);
{
do
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
f = font(s);
disc_width = disc_width + char_width(f, char_info(f, character(s)));
}
s = link(s);
}
- while(!(s == 0));
+ while (!(s == 0));
active_width[1] = active_width[1] + disc_width;
try_break(hyphen_penalty, hyphenated);
while (r > 0)
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
f = font(s);
active_width[1] = active_width[1] + char_width(f, char_info(f, character(s)));
{
auto_breaking = (subtype(cur_p) == 1);
{
- if (!(link(cur_p) >= hi_mem_min) && auto_breaking)
+ if (!is_char_node(link(cur_p)) && auto_breaking)
if (type(link(cur_p)) == glue_node)
try_break(0, unhyphenated);
final_pass = true;
++final_pass_count; /* 96 Feb 9 */
} /* end of if second_pass */
- } /* end of while(true)do */
+ } /* end of while (true)do */
/* cannot drop through from above loop */
lab30: /* common exit point */
if (best_line == 2)
{
get_x_token();
}
- while(!((cur_cmd != spacer) && (cur_cmd != relax)));
+ while (!((cur_cmd != spacer) && (cur_cmd != relax)));
if (cur_cmd <= max_non_prefixed_command)
{
{
get_x_token();
}
- while(!((cur_cmd != spacer) && (cur_cmd != relax)));
+ while (!((cur_cmd != spacer) && (cur_cmd != relax)));
if (cur_cmd != left_brace)
{
scan_optional_equals();
scan_int();
- if (((cur_val < 0) && (p < del_code_base)) || (cur_val > n))
+ if (((cur_val < 0) && (p < del_code_base)) ||(cur_val > n))
{
print_err("Invalid code(");
print_int(cur_val);
{
get_token();
}
- while(!(cur_cmd == right_brace));
+ while (!(cur_cmd == right_brace));
return;
}
undump_int(x);
- if (x != BEGINFMTCHECKSUM) /* magic FMT file start 4C 20 E6 15 hex */
- goto lab6666;
+ if (x != BEGINFMTCHECKSUM)
+ goto lab_bad_fmt;
undump_int(x); /* mem_bot */
if (x != mem_bot)
- goto lab6666;
+ goto lab_bad_fmt;
undump_int(x); /* mem_top */
exit(1); /* redundant sanity test ! */
initialize_aux(); /* do `mem' part of initialize */
-/* mem = zmem; */ /* update pointer to main memory */
#endif
if (x != mem_top)
- goto lab6666;
+ goto lab_bad_fmt;
undump_int(x); /* eqtb_size */
if (x != (eqtb_size))
- goto lab6666;
+ goto lab_bad_fmt;
undump_int(x); /* hash_prime */
if (x != hash_prime)
- goto lab6666;
+ goto lab_bad_fmt;
undump_int(x); /* hyphen_prime */
#endif
if (x != hyphen_prime)
- goto lab6666;
+ goto lab_bad_fmt;
{
undump_int(x); /* pool_size */
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
#ifdef ALLOCATESTRING
if (x > current_pool_size)
{
sprintf(log_line, "%s%s\n", "---! Must increase the ", "string pool size");
show_line(log_line, 0);
- goto lab6666;
+ goto lab_bad_fmt;
}
else
pool_ptr = x;
{
undump_int(x); /* max_strings */
+
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
#ifdef ALLOCATESTRING
if (x > current_max_strings)
{
sprintf(log_line, "%s%s\n", "---! Must increase the ", "max strings");
show_line(log_line, 0);
- goto lab6666;
+ goto lab_bad_fmt;
}
else
str_ptr = x;
init_str_ptr = str_ptr;
init_pool_ptr = pool_ptr;
-
- /* undump the dynamic memory - paragraph 1312 in the book */
- {
- undump_int(x);
-
- if ((x < lo_mem_stat_max + 1000) || (x > hi_mem_stat_min - 1))
- goto lab6666;
- else
- lo_mem_max = x;
- }
-
- {
- undump_int(x);
-
- if ((x < lo_mem_stat_max + 1) || (x > lo_mem_max))
- goto lab6666;
- else
- rover = x;
- }
-
+ undump(lo_mem_stat_max + 1000, hi_mem_stat_min - 1, lo_mem_max);
+ undump(lo_mem_stat_max + 1, lo_mem_max, rover);
p = mem_bot;
q = rover;
p = q + node_size(q);
if ((p > lo_mem_max) || ((q >= rlink(q)) && (rlink(q) != rover)))
- goto lab6666;
+ goto lab_bad_fmt;
q = rlink(q);
}
{
/* or call add_variable_space(mem_bot - (mem_min + 1)) */
if (trace_flag)
- show_line("Splicing in mem_min space in undump!\n", 0);
+ puts("Splicing in mem_min space in undump!\n");
p = llink(rover);
q = mem_min + 1;
rlink(q) = rover;
llink(q) = p;
link(q) = empty_flag;
- node_size(q) = mem_bot - q; /* ? size of block */
- }
-
- {
- undump_int(x);
-
- if ((x < lo_mem_max + 1) || (x > hi_mem_stat_min))
- goto lab6666;
- else
- hi_mem_min = x;
- }
-
- {
- undump_int(x);
-
- if ((x < mem_bot) || (x > mem_top))
- goto lab6666;
- else
- avail = x;
+ node_size(q) = mem_bot - q;
}
+ undump(lo_mem_max + 1, hi_mem_stat_min, hi_mem_min);
+ undump(mem_bot, mem_top, avail);
mem_end = mem_top;
if (undumpthings(mem[hi_mem_min], mem_end + 1 - hi_mem_min))
undump_int(x);
if ((x < 1) || (k + x > (eqtb_size + 1)))
- goto lab6666;
+ goto lab_bad_fmt;
if (undumpthings(eqtb[k], x))
return -1;
undump_int(x);
if ((x < 0) || (k + x > (eqtb_size + 1)))
- goto lab6666;
+ goto lab_bad_fmt;
for (j = k; j <= k + x - 1; j++)
- {
eqtb[j] = eqtb[k - 1];
- }
k = k + x;
}
- while(!(k > (eqtb_size)));
-
- {
- undump_int(x);
-
- if ((x < hash_base) || (x > (frozen_control_sequence))) /*96/Jan/10*/
- goto lab6666;
- else
- par_loc = x;
- }
+ while (!(k > eqtb_size));
+ undump(hash_base, frozen_control_sequence, par_loc);
par_token = cs_token_flag + par_loc;
-
- {
- undump_int(x);
-
- if ((x < hash_base) || (x > (frozen_control_sequence))) /*96/Jan/10*/
- goto lab6666;
- else
- write_loc = x;
- }
-
- {
- undump_int(x);
- if ((x < hash_base) || (x > (frozen_control_sequence))) /*96/Jan/10*/
- goto lab6666;
- else
- hash_used = x;
- }
+ undump(hash_base, frozen_control_sequence, write_loc);
+ undump(hash_base, frozen_control_sequence, hash_used);
p = hash_base - 1;
do
{
- {
- undump_int(x);
-
- if ((x < p + 1) || (x > hash_used))
- goto lab6666;
- else
- p = x;
- }
-
+ undump(p + 1, hash_used, p);
undump_hh(hash[p]);
}
while (!(p == hash_used));
undump_int(x); /* font_mem_size */
if (x < 7)
- goto lab6666;
+ goto lab_bad_fmt;
#ifdef ALLOCATEFONT
if (trace_flag)
{
sprintf(log_line, "%s%s\n", "---! Must increase the ", "font mem size");
show_line(log_line, 0);
- goto lab6666;
+ goto lab_bad_fmt;
}
else
fmem_ptr = x;
undump_int(x); /* font_max */
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
if (x > font_max)
{
sprintf(log_line, "%s%s\n", "---! Must increase the ", "font max");
show_line(log_line, 0);
- goto lab6666;
+ goto lab_bad_fmt;
}
else
font_ptr = x;
if (undumpthings(char_base[0], font_ptr + 1))
return -1;
- if (undumpthings(ctype_base[0], font_ptr + 1))
- return -1;
-
if (undumpthings(width_base[0], font_ptr + 1))
return -1;
}
}
#endif
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* undump(0)(hyph_size)(hyph_count); */
- {
- undump_int(x);
- if ((x < 0) || (x > hyphen_prime))
- goto lab6666;
- else
- hyph_count = x;
- }
+ undump(0, hyphen_prime, hyph_count);
- /* undump hypenation exception tables p.1325 */
for (k = 1; k <= hyph_count; k++)
{
- {
- undump_int(x);
-
- if ((x < 0) || (x > hyphen_prime))
- goto lab6666;
- else
- j = x;
- }
-
- {
- undump_int(x);
-
- if ((x < 0) || (x > str_ptr))
- goto lab6666;
- else
- hyph_word[j] = x;
- }
-
- {
- undump_int(x);
-
- if ((x < 0) || (x > max_halfword)) /* mem_top ? no p.1325 */
- goto lab6666;
- else
- hyph_list[j] = x;
- }
+ undump(0, hyphen_prime, j);
+ undump(0, str_ptr, hyph_word[j]);
+ undump(0, max_halfword, hyph_list[j]);
}
#ifdef ALLOCATEHYPHEN
undump_int(x);
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
#ifdef ALLOCATETRIES
if (!is_initex)
{
sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie size");
show_line(log_line, 0);
- goto lab6666;
+ goto lab_bad_fmt;
}
else
j = x;
}
+
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
trie_max = j;
-#endif /* INITEX */
+#endif
+
if (undumpthings(trie_trl[0], j + 1))
return -1;
undump_int(x);
if (x < 0)
- goto lab6666;
+ goto lab_bad_fmt;
if (x > trie_op_size)
{
sprintf(log_line, "%s%s\n", "---! Must increase the ", "trie op size");
show_line(log_line, 0);
- goto lab6666;
+ goto lab_bad_fmt;
}
else
j = x;
}
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
trie_op_ptr = j;
-#endif /* INITEX */
+#endif
if (undumpthings(hyf_distance[1], j))
return -1;
return -1;
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
{
for (k = 0; k <= 255; k++)
- {
- trie_used[k] = 0;
- }
+ trie_used[k] = min_quarterword;
}
-#endif /* INITEX */
+#endif
+
k = 256;
while (j > 0)
{
- {
- undump_int(x);
+ undump(0, k - 1, k);
+ undump(1, j, x);
- if ((x < 0) || (x > k - 1))
- goto lab6666;
- else
- k = x;
- }
-
- {
- undump_int(x);
-
- if ((x < 1) || (x > j))
- goto lab6666;
- else
- x = x;
- }
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
trie_used[k] = x;
-#endif /* INITEX */
-/* j:=j-x; op_start[k]:=qo(j); */
+#endif
+
j = j - x;
op_start[k] = j;
}
+
#ifdef INITEX
- if (is_initex) /* bkph */
+ if (is_initex)
trie_not_ready = false;
-#endif /* INITEX */
- {
- undump_int(x);
-
- if ((x < batch_mode) || (x > error_stop_mode))
- goto lab6666;
-
- if (interaction < batch_mode) /* may now set in local.c bkph 94/Jan/8 */
- interaction = x;
- }
-
- {
- undump_int(x);
-
- if ((x < 0) || (x > str_ptr))
- goto lab6666;
- else
- format_ident = x;
- }
+#endif
+ undump(batch_mode, error_stop_mode, interaction);
+ undump(0, str_ptr, format_ident);
undump_int(x);
if ((x != ENDFMTCHECKSUM) || feof(fmt_file))
- goto lab6666;
+ goto lab_bad_fmt;
return true;
-lab6666:;
+lab_bad_fmt:;
sprintf(log_line, "(Fatal format file error; I'm stymied)\n");
show_line(log_line, 1);
while (input_ptr > 0)
{
- if (cur_input.state_field == 0)
+ if (state == 0)
{
end_token_list();
}
if (cs_token_flag + undefined_control_sequence > max_halfword)
bad = 21;
- if (format_default_length > PATH_MAX)
+ if (format_default_length > file_name_size)
bad = 31;
if (max_halfword < (mem_top - mem_min) / 2)
scanner_status = 0;
warning_index = 0;
first = 1;
- cur_input.state_field = new_line;
- cur_input.start_field = 1;
- cur_input.index_field = 0;
+ state = new_line;
+ start = 1;
+ index = 0;
line = 0;
cur_input.name_field = 0;
force_eof = false;
if (!init_terminal())
goto lab9999;
- cur_input.limit_field = last;
+ limit = last;
first = last + 1;
}
if ((format_ident == 0) ||
- (buffer[cur_input.loc_field] == '&') ||
- (buffer[cur_input.loc_field] == '+'))
+ (buffer[loc] == '&') ||
+ (buffer[loc] == '+'))
{
if (format_ident != 0)
initialize();
w_close(fmt_file);
#endif
- while ((cur_input.loc_field < cur_input.limit_field) &&
- (buffer[cur_input.loc_field] == ' '))
- incr(cur_input.loc_field);
+ while ((loc < limit) &&
+ (buffer[loc] == ' '))
+ incr(loc);
}
if ((end_line_char < 0) || (end_line_char > 255))
- decr(cur_input.limit_field);
+ decr(limit);
else
- buffer[cur_input.limit_field] = end_line_char;
+ buffer[limit] = end_line_char;
fix_date_and_time();
magic_offset = str_start[886] - 9 * ord_noad;
else
selector = term_only;
- if ((cur_input.loc_field < cur_input.limit_field) &&
- (cat_code(buffer[cur_input.loc_field]) != escape))
+ if ((loc < limit) &&
+ (cat_code(buffer[loc]) != escape))
start_input();
}
if (mem_min < mem_start) /* sanity test */
{
if (trace_flag)
- show_line("WARNING: mem_min < mem_start!\n", 0);
+ puts("WARNING: mem_min < mem_start!\n");
mem_min = mem_start;
}
cur_font = null_font;
eq_type(cur_font_loc) = data;
eq_level(cur_font_loc) = level_one;
- cur_jfont = null_font;
- eq_type(cur_jfont_loc) = data;
- eq_level(cur_jfont_loc) = level_one;
- cur_tfont = null_font;
- eq_type(cur_tfont_loc) = data;
- eq_level(cur_tfont_loc) = level_one;
for (k = math_font_base; k <= math_font_base + 47; k++)
eqtb[k] = eqtb[cur_font_loc];
for (k = cat_code_base; k <= int_base - 1; k++)
eqtb[k] = eqtb[cat_code_base];
- eqtb[auto_spacing_code] = eqtb[cat_code_base];
- eqtb[auto_xspacing_code] = eqtb[cat_code_base];
-
for (k = 0; k <= 255; k++)
{
cat_code(k) = other_char;
- kcat_code(k) = other_char;
math_code(k) = k;
sf_code(k) = 1000;
- auto_xsp_code(k) = 0;
- inhibit_xsp_code(k) = 0;
- inhibit_xsp_type(k) = 0;
- kinsoku_code(k) = 0;
- kinsoku_type(k) = 0;
}
cat_code(carriage_return) = car_ret;
cs_count = 0;
if (trace_flag)
- show_line("initex cs_count = 0 ", 0);
+ puts("initex cs_count = 0 ");
eq_type(frozen_dont_expand) = dont_expand;
text(frozen_dont_expand) = 499; /* notexpanded */
font_ec[null_font] = 0;
font_size[null_font] = 0;
font_dsize[null_font] = 0;
- ctype_base[null_font] = 0;
char_base[null_font] = 0;
width_base[null_font] = 0;
height_base[null_font] = 0;
#ifdef SHORTHASH
if (s > 65535L)
- show_line("ERROR: hash entry too large\n", 1);
+ puts("ERROR: hash entry too large\n");
#endif
text(cur_val) = s;
p = trie_r[p];
}
- while(!(p == 0));
+ while (!(p == 0));
}
/* sec 0959 */
void trie_fix_ (trie_pointer p)
p = trie_r[p];
}
- while(!(p == 0));
+ while (!(p == 0));
}
/* sec 0960 */
void new_patterns (void)
if (allow_patterns)
{
if (trace_flag)
- show_line("Resetting patterns\n", 0);
+ puts("Resetting patterns\n");
reset_trie(); /* RESET PATTERNS - 93/Nov/26 */
if (reset_exceptions)
{
if (trace_flag)
- show_line("Resetting exceptions\n", 0);
+ puts("Resetting exceptions\n");
reset_hyphen(); /* RESET HYPHENEXCEPTIONS - 93/Nov/26 */
}
r = s;
}
- while(!(r > trie_max));
+ while (!(r > trie_max));
}
trie_trc[0] = 63;
if (!is_initex)
{
- show_line("! \\dump is performed only by INITEX\n", 1);
+ puts("! \\dump is performed only by INITEX\n");
- if (! knuth_flag)
- show_line(" (Use -i on the command line)\n", 0);
+ if (!knuth_flag)
+ puts(" (Use -i on the command line)\n");
abort_flag++;
return;
format_ident = make_string();
pack_job_name(".fmt");
- while(!w_open_out(fmt_file))
+ while (!w_open_out(fmt_file))
{
prompt_file_name("format file name", ".fmt");
}
print_nl("");
slow_print(format_ident);
- dump_int(BEGINFMTCHECKSUM); /* magic FMT file start 4C 20 E6 15 hex */
-
+ dump_int(BEGINFMTCHECKSUM);
dump_int(mem_bot);
dump_int(mem_top);
dump_int(eqtb_size);
if (dumpthings(char_base[0], font_ptr + 1))
return;
- if (dumpthings(ctype_base[0], font_ptr + 1))
- return;
-
if (dumpthings(width_base[0], font_ptr + 1))
return;
primitive("spaceskip", assign_glue, glue_base + space_skip_code);
primitive("xspaceskip", assign_glue, glue_base + xspace_skip_code);
primitive("parfillskip", assign_glue, glue_base + par_fill_skip_code);
- primitive("kanjiskip", assign_glue, glue_base + kanji_skip_code);
- primitive("xkanjiskip", assign_glue, glue_base + xkanji_skip_code);
primitive("thinmuskip", assign_mu_glue, glue_base + thin_mu_skip_code);
primitive("medmuskip", assign_mu_glue, glue_base + med_mu_skip_code);
primitive("thickmuskip", assign_mu_glue, glue_base + thick_mu_skip_code);
primitive("defaultskewchar", assign_int, int_base + default_skew_char_code);
primitive("endlinechar", assign_int, int_base + end_line_char_code);
primitive("newlinechar", assign_int, int_base + new_line_char_code);
- primitive("jfam", assign_int, int_base + cur_jfam_code);
- primitive("jcharwidowpenalty", assign_int, int_base + jchr_widow_penalty_code);
primitive("language", assign_int, int_base + language_code);
primitive("lefthyphenmin", assign_int, int_base + left_hyphen_min_code);
primitive("righthyphenmin", assign_int, int_base + right_hyphen_min_code);
primitive("hangindent", assign_dimen, dimen_base + hang_indent_code);
primitive("hoffset", assign_dimen, dimen_base + h_offset_code);
primitive("voffset", assign_dimen, dimen_base + v_offset_code);
- primitive("tbaselineshift", assign_dimen, dimen_base + t_baseline_shift_code);
- primitive("ybaselineshift", assign_dimen, dimen_base + y_baseline_shift_code);
primitive("emergencystretch", assign_dimen, dimen_base + emergency_stretch_code);
primitive(" ", ex_space, 0);
primitive("/", ital_corr, 0);
eqtb[frozen_end_group] = eqtb[cur_val];
primitive("expandafter", expand_after, 0);
primitive("font", def_font, 0);
- //primitive("jfont", def_jfont, 0);
- //primitive("tfont", def_tfont, 0);
primitive("fontdimen", assign_font_dimen, 0);
primitive("halign", halign, 0);
primitive("hrule", hrule, 0);
primitive("muskipdef", shorthand_def, 5);
primitive("toksdef", shorthand_def, 6);
primitive("catcode", def_code, cat_code_base);
- primitive("kcatcode", def_code, kcat_code_base);
- primitive("xspcode", def_code, auto_xsp_code_base);
primitive("mathcode", def_code, math_code_base);
primitive("lccode", def_code, lc_code_base);
primitive("uccode", def_code, uc_code_base);
primitive("sfcode", def_code, sf_code_base);
- primitive("delcode", def_code, del_code_base);
- primitive("textfont", def_family, math_font_base);
- primitive("scriptfont", def_family, math_font_base + script_size);
- primitive("scriptscriptfont", def_family, math_font_base + script_script_size);
+ primitive("delcode", def_code, (hash_size + 3474));
+ primitive("textfont", def_family, (hash_size + 1835));
+ primitive("scriptfont", def_family, (hash_size + 1851));
+ primitive("scriptscriptfont", def_family, (hash_size + 1867));
primitive("hyphenation", hyph_data, 0);
primitive("patterns", hyph_data, 1);
primitive("hyphenchar", assign_font_int, 0);
primitive("closein", in_stream, 0);
primitive("message", message, 0);
primitive("errmessage", message, 1);
- primitive("lowercase", case_shift, lc_code_base);
- primitive("uppercase", case_shift, uc_code_base);
- primitive("show", xray, show_code);
- primitive("showbox", xray, show_box_code);
- primitive("showthe", xray, show_the_code);
- primitive("showlists", xray, show_lists);
- //primitive("showmode", xray, show_mode);
+ primitive("lowercase", case_shift, (hash_size + 2139));
+ primitive("uppercase", case_shift, (hash_size + 2395));
+ primitive("show", xray, 0);
+ primitive("showbox", xray, 1);
+ primitive("showthe", xray, 2);
+ primitive("showlists", xray, 3);
primitive("openout", extension, 0);
primitive("write", extension, 1);
write_loc = cur_val;
show_line(log_line, 1);
#ifndef _WINDOWS
- uexit(1); // has this been setup yet ???
+ uexit(EXIT_FAILURE); // has this been setup yet ???
#endif
}
void read_xchr_sub (FILE * xchr_input)
{
- char buffer[PATH_MAX];
+ char buffer[file_name_size];
int k, from, to, count = 0;
char *s;
void read_repl_sub (FILE * repl_input)
{
int k, n, m, chrs;
- char buffer[PATH_MAX];
+ char buffer[file_name_size];
char charname[128];
int charnum[10];
char *s, *t;
memset(replacement, 0, MAXCHRS * sizeof(replacement[ 0]));
- while (fgets(buffer, PATH_MAX, repl_input) != NULL)
+ while (fgets(buffer, file_name_size, repl_input) != NULL)
{
if (*buffer == '%' || *buffer == ';' || *buffer == '\n')
continue;
if (trace_flag)
{
- show_line("Key replacement table\n", 0);
+ puts("Key replacement table\n");
for (k = 0; k < MAXCHRS; k++)
{
int read_xchr_file (char *filename, int flag, char *argv[])
{
FILE *pinput;
- char infile[PATH_MAX];
+ char infile[file_name_size];
char *s;
if (filename == NULL)
if (main_memory != NULL)
{
if (trace_flag)
- show_line("Reallocating initial memory allocation\n", 1);
+ puts("Reallocating initial memory allocation\n");
}
mem_top = mem_bot + size;
if (is_initex)
{
- show_line("ERROR: Cannot extent main memory in iniTeX\n", 1);
+ puts("ERROR: Cannot extent main memory in iniTeX\n");
if (! knuth_flag)
- show_line("Please use `-m=...' on command line\n", 0);
+ puts("Please use `-m=...' on command line\n");
return NULL;
}
new_memory, (current_mem_size + 1) * sizeof(memory_word));
show_line(log_line, 0);
}
-
memmove (new_memory + lo_size, new_memory,
(current_mem_size + 1) * sizeof(memory_word));
/* could reduce words moved by (mem_max - mem_end) */
if (current_mem_size != mem_max - mem_start)
{
- show_line("ERROR: Impossible Memory Error\n", 1);
+ puts("ERROR: Impossible Memory Error\n");
}
if (mem_start != 0)
current_pool_size = 0;
str_start = NULL;
current_max_strings = 0;
-/* need to create space because iniTeX writes in before reading pool file */
-/* for a start, puts in strings for 256 characters */
+
/* maybe taylor allocations to actual pool file 1300 strings 27000 bytes ? */
if (is_initex)
{
if (trace_flag)
- show_line("ini TeX pool and string allocation\n", 0);
+ puts("ini TeX pool and string allocation\n");
- str_pool = realloc_str_pool (initial_pool_size);
- str_start = realloc_str_start (initial_max_strings);
+ str_pool = realloc_str_pool(initial_pool_size);
+ str_start = realloc_str_start(initial_max_strings);
}
#endif
unsigned int heap_total = 0;
if (trace_flag)
- show_line("free_memory ", 0);
+ puts("free_memory ");
if (verbose_flag || trace_flag)
show_maximums(stdout);
}
if (trace_flag)
- show_line("Freeing memory again\n", 0);
+ puts("Freeing memory again\n");
/* only free memory if safe ... additional check */
#ifdef ALLOCATEINI
{
if (test_align ((int) &mem_top, 4, "FIXED ALIGNMENT"))
{
- show_line("PLEASE RECOMPILE ME!\n", 1);
+ puts("PLEASE RECOMPILE ME!\n");
}
#ifdef CHECKALIGNMENT
void check_alloc_align (int flag)
{
if (test_align ((int) eqtb, sizeof(eqtb[0]), "ALLOCATED ALIGNMENT"))
- show_line("PLEASE RECOMPILE ME!\n", 1);
+ puts("PLEASE RECOMPILE ME!\n");
#ifdef CHECKALIGNMENT
if (!flag)
ignore_frozen = false;
suppress_f_ligs = false;
full_file_name_flag = false;
- save_strings_flag = false;
knuth_flag = true; /* so other code can know about this */
}
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;
if (read_xchr_file(repl_file, 1, av))
{
if (trace_flag)
- show_line("KEY REPLACE ON\n", 0);
+ puts("KEY REPLACE ON\n");
key_replace = true;
}
if (read_xchr_file(xchr_file, 0, av))
{
if (trace_flag)
- show_line("NON ASCII ON\n", 0);
+ puts("NON ASCII ON\n");
non_ascii = true;
}
show_line_break_stats = true; /* show line break statistics 96/Feb/8 */
show_fonts_used = true; /* show fonts used in LOG file 97/Dec/24 */
allow_quoted_names = true; /* allow quoted names with spaces 98/Mar/15 */
- show_cs_names = false; /* don't show csnames on start 98/Mar/31 */
+ show_cs_names = false;
knuth_flag = false; /* allow extensions to TeX */
full_file_name_flag = true; /* new default 2000 June 18 */
- save_strings_flag = true;
errout = stdout; /* as opposed to stderr say --- used ??? */
abort_flag = 0; // not yet hooked up ???
err_level = 0; // not yet hooked up ???
#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);
+ puts("ERROR: Cannot extend main memory in iniTeX\n");
mem_extra_high = 0; mem_extra_low = 0;
}
#endif
{
if (mem_initex != 0)
{
- show_line("ERROR: Can only set initial main memory size in iniTeX\n", 1);
+ puts("ERROR: Can only set initial main memory size in iniTeX\n");
mem_initex = 0;
}
if (trie_size != 0)
{
- show_line("ERROR: Need only set hyphenation trie size in iniTeX\n", 1);
+ puts("ERROR: Need only set hyphenation trie size in iniTeX\n");
/* trie_size = 0; */
}
}
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);
+ puts("WARNING: There may be no benefit to asking for so much memory\n");
/* mem_initex = 2048 * 1024; */
}
if (new_hyphen_prime > 0)
{
if (! is_initex)
- show_line("ERROR: Can only set hyphen prime in iniTeX\n", 1);
+ puts("ERROR: Can only set hyphen prime in iniTeX\n");
else
{
if (new_hyphen_prime % 2 == 0)
void deslash_all (int ac, char **av)
{
- char buffer[PATH_MAX];
+ char buffer[file_name_size];
char *s;
if ((s = grabenv("TEXDVI")) != NULL)
closed_already = 0;
if (trace_flag)
- show_line("Entering init (local.c)\n", 0);
+ puts("Entering init (local.c)\n");
probe_memory(); /* show top address */
ini_max_address = max_address; /* initial max address */
no_interrupts = 0;
if (format_spec && mem_spec_flag)
- {
- show_line("WARNING: Cannot change initial main memory size when format specified", 1);
- }
+ puts("WARNING: Cannot change initial main memory size when format specified");
if (allocate_memory() != 0)
return -1;
if (verbose_flag)
{
- show_line("Total ", 0);
+ puts("Total ");
show_inter_val(finish_time - start_time);
- show_line(" sec (", 0);
+ puts(" sec (");
show_inter_val(main_time - start_time);
- show_line(" format load + ", 0);
+ puts(" format load + ");
show_inter_val(finish_time - main_time);
- show_line(" processing) ", 0);
+ puts(" processing) ");
if (total_pages > 0)
{
show_inter_val((finish_time - main_time) / total_pages);
- show_line(" sec per page.", 0);
+ puts(" sec per page.");
}
- show_line("\n", 0);
+ puts("\n");
}
return flag;
LINK = link
RC = rc
+# -Gf saves about 7k bytes in EXE file
+
+# For production (-Bd show compiler passes)
+# ASSUMING WE WORK WITH MS COMPILER AND LINKER ONLY use -Gy and -Gf
+# CFLAGS=-c -DDOS -DMSDOS -DPHARLAP -DTeX -DMYDEBUG -Ilib -Ox -Gy -Gf -W3
+# CFLAGS=-c -DDOS -DMSDOS -DPHARLAP -DTeX -DMYDEBUG -Ilib -YX -Ox -Ge -Gy -Gf -W4
+# Release version
+# CFLAGS=/c /Ge /Gy /Gf /Ox /W4 /DMSDOS /DTeX /DPHARLAP /DNDEBUG /Ilib /YX
CFLAGS=/nologo /c /MT /GF /Gy /Ox /W4 /DMSDOS /DTeX /DPHARLAP /DNDEBUG \
/I"kpathsea" /I"libharu/include" /I"libharu/win32/include" /I"zlib" \
- /I"libmd5" /I"libtoua/ptexenc"
+ /I"libmd5"
+# Debugging version
+# CFLAGS=/c /Ge /Gy /Gf /Od /Zi /W4 /DMSDOS /DTeX /DPHARLAP /Ilib /YX
+# NOTE: -Ox => -Ogityb1 -Gs
+
+# Link with MS LINK
+# LFLAGS=@yandytex.nt /MAP lib\libdos.lib
+# Release version
+# LFLAGS=/MAP lib\libdos.lib
LFLAGS=/NOLOGO /MAP
+# /MACHINE:X86
+# debugging version
+# LFLAGS=@yandytex.nt /MAP /DEBUG /PDB:yandytex.pdb lib\libdos.lib
+# LFLAGS=/MAP /DEBUG /PDB:yandytex.pdb
objs = yandytex.obj itex.obj openinou.obj subroute.obj local.obj \
tex0.obj tex1.obj tex2.obj tex3.obj tex4.obj \
kpathsea\kpathsea.lib libharu\libhpdf.lib libpng\libpng.lib zlib\zlib.lib
del ..\yandy\bin\yandytex.exe
copy yandytex.exe ..\yandy\bin\yandytex.exe
-
# ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
yandy_backend_pdf.obj: yandy_backend_pdf.c
$(CC) $(CFLAGS) yandy_backend_pdf.c
rc yandytex.rc
yandytex.obj: yandytex.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
$(CC) /DINITEX /DINI $(CFLAGS) yandytex.c
itex.obj: itex.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
$(CC) /DINITEX $(CFLAGS) itex.c
openinou.obj: openinou.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
$(CC) $(CFLAGS) openinou.c
subroute.obj: subroute.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
$(CC) $(CFLAGS) subroute.c
local.obj: local.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
$(CC) /DINITEX $(CFLAGS) local.c
# NOTE: cannot compile tex5.c and tex6.c with full optimizations ...
tex0.obj: tex0.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex1.obj: tex1.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex2.obj: tex2.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex3.obj: tex3.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex4.obj: tex4.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex5.obj: tex5.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex6.obj: tex6.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex7.obj: tex7.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex8.obj: tex8.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
tex9.obj: tex9.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
yandy_pool.obj: yandy_pool.c \
- texd.h coerce.h yandy_macros.h
+ texd.h texmf.h texmfmem.h coerce.h yandy_macros.h
.SUFFIXES:
.SUFFIXES: .obj .c
#define BUILDNAMEDIRECT
-extern int shorten_file_name; /* in local.c bkph */
+extern int shorten_file_name;
#ifdef FUNNY_CORE_DUMP
extern void funny_core_dump(void);
int check_fclose (FILE * f)
{
if (f == NULL)
- return 0; // sanity check
+ return 0;
if (ferror(f) || fclose (f))
{
perrormod("\n! I/O Error");
- uexit (1);
+ uexit(EXIT_FAILURE);
}
return 0;
if (temp_dir != NULL)
{
#ifdef BUILDNAMEDIRECT
- unsigned char temp_name[PATH_MAX];
+ unsigned char temp_name[file_name_size];
xconcat3((char *) temp_name, temp_dir, PATH_SEP_STRING, (char *) name_of_file + 1);
#else
string temp_name = concat3 (temp_dir, PATH_SEP_STRING, name_of_file + 1);
if (jump_used)
{
- show_line("Jump Buffer already used\n", 1);
+ puts("Jump Buffer already used\n");
exit(1);
}
#include "texd.h"
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-INLINE void pack_cur_name(void)
-{
- pack_file_name(cur_name, cur_area, cur_ext);
-}
-INLINE void prompt_input(const char *s)
+INLINE void prompt_input(const char * s)
{
print_string(s);
term_input();
if (dvi_ptr == dvi_limit)
dvi_swap();
}
-INLINE void succumb(void)
+INLINE void succumb (void)
{
if (interaction == error_stop_mode)
interaction = scroll_mode;
history = 3;
jump_out();
}
-INLINE void flush_string(void)
+INLINE void flush_string (void)
{
decr(str_ptr);
pool_ptr = str_start[str_ptr];
}
-INLINE void append_char(ASCII_code c)
+INLINE void append_char (ASCII_code c)
{
str_pool[pool_ptr] = c;
incr(pool_ptr);
}
-INLINE void append_lc_hex(ASCII_code c)
+INLINE void append_lc_hex (ASCII_code c)
{
if (c < 10)
append_char(c + '0');
else
append_char(c - 10 + 'a');
}
-INLINE void print_err(const char * s)
+INLINE void print_err (const char * s)
{
if (interaction == error_stop_mode);
print_nl("! ");
print_string(s);
}
-INLINE void tex_help(unsigned int n, ...)
+INLINE void tex_help (unsigned int n, ...)
{
int i;
va_list help_arg;
va_end(help_arg);
}
-INLINE void str_room_(int val)
+INLINE void str_room_ (int val)
{
#ifdef ALLOCATESTRING
if (pool_ptr + val > current_pool_size)
}
#endif
}
-INLINE void tail_append_(pointer val)
+INLINE void tail_append_ (pointer val)
{
link(tail) = val;
tail = link(tail);
switch (selector)
{
case term_and_log:
- (void) show_char(Xchr(s));
+ (void) show_char(xchr[s]);
incr(term_offset);
- (void) putc(Xchr(s), log_file);
+ (void) putc(xchr[s], log_file);
incr(file_offset);
if (term_offset == max_print_line)
break;
case log_only:
- (void) putc(Xchr(s), log_file);
+ (void) putc(xchr[s], log_file);
incr(file_offset);
if (file_offset == max_print_line)
break;
case term_only:
- (void) show_char(Xchr(s));
+ (void) show_char(xchr[s]);
incr(term_offset);
if (term_offset == max_print_line)
break;
default:
- (void) putc(Xchr(s), write_file[selector]);
+ (void) putc(xchr[s], write_file[selector]);
break;
}
}
}
/* sec 0062 */
-void print_nl_ (const char * s)
+void print_nl (const char * s)
{
if (((term_offset > 0) && (odd(selector))) ||
((file_offset > 0) && (selector >= log_only)))
print_string(s);
}
/* sec 0063 */
-void print_esc_ (const char * s)
+void print_esc (const char * s)
{
integer c;
ready_already = 0;
if (trace_flag)
- show_line("EXITING at JUMPOUT\n", 0);
+ puts("EXITING at JUMPOUT\n");
if ((history != 0) && (history != 1))
code = 1;
if (last > first + 1)
{
- cur_input.loc_field = first + 1;
+ loc = first + 1;
buffer[first] = 32;
}
else
{
prompt_input("insert>");
- cur_input.loc_field = first;
+ loc = first;
}
first = last;
- cur_input.limit_field = last - 1;
+ limit = last - 1;
return;
}
break;
print_nl("H for help, X to quit.");
}
- } /* end of while(true) loop */
+ } /* end of while (true) loop */
incr(error_count);
print_ln();
give_err_help();
}
- else while(help_ptr > 0)
+ else while (help_ptr > 0)
{
decr(help_ptr);
print_nl(help_line[help_ptr] == NULL ? "" : help_line[help_ptr]);
print_ln();
}
/* sec 0093 */
-void fatal_error_(char * s)
+void fatal_error(char * s)
{
normalize_selector();
print_err("Emergency stop");
if (!knuth_flag)
{
- if (!strcmp(s, "pattern memory") && n == trie_size)
+ if (!strcmp(s, "pattern memory") && (n == trie_size))
{
sprintf(log_line, "\n (Maybe use -h=... on command line in ini-TeX)\n");
show_line(log_line, 0);
}
- else if (!strcmp(s, "exception dictionary") && n == hyphen_prime)
+ else if (!strcmp(s, "exception dictionary") && (n == hyphen_prime))
{
sprintf(log_line, "\n (Maybe use -e=... on command line in ini-TeX)\n");
show_line(log_line, 0);
succumb();
}
/* sec 0095 */
-void confusion_(char * s)
+void confusion_(const char * s)
{
normalize_selector();
if (last > first)
{
- cur_input.loc_field = first;
+ loc = first;
- while((cur_input.loc_field < last) && (buffer[cur_input.loc_field]== ' '))
- incr(cur_input.loc_field); // step over initial white space
+ while ((loc < last) && (buffer[loc]== ' '))
+ incr(loc); // step over initial white space
- if (cur_input.loc_field < last)
+ if (loc < last)
return true;
}
// failed to find input file name
while (true)
{
-#ifdef _WINDOWS
- flag = ConsoleInput("**", "Please type a file name or a control sequence\r\n(or ^z to exit)", (char *) &buffer[first]);
- last = first + strlen((char *) &buffer[first]); /* -1 ? */
-// may need to be more elaborate see input_line in texmf.c
-#else
- (void) fputs("**", stdout);
+ fputs("**", stdout);
fflush(stdout);
flag = input_ln(stdin, true);
-#endif
if (!flag)
{
show_char('\n');
- show_line("! End of file on the terminal... why?\n", 1);
+ puts("! End of file on the terminal... why?\n");
return false;
}
- cur_input.loc_field = first;
+ loc = first;
- while ((cur_input.loc_field < last) && (buffer[cur_input.loc_field]== ' '))
- incr(cur_input.loc_field); // step over intial white space
+ while ((loc < last) && (buffer[loc]== ' '))
+ incr(loc); // step over intial white space
- if (cur_input.loc_field < last)
+ if (loc < last)
return true;
sprintf(log_line, "%s\n", "Please type the name of your input file.");
incr(j);
}
}
+
+int stringlength (int str_ptr)
+{
+ return (str_start[str_ptr + 1] - str_start[str_ptr]) + 2;
+}
+
+char * add_string (char *s, char * str_string)
+{
+ int n;
+
+ n = strlen(str_string);
+ memcpy(s, &str_string, n);
+ s += n;
+ strcpy(s, "\r\n");
+ s += 2;
+
+ return s;
+}
+
+int addextrahelp = 1;
+
+// make one long \r\n separated string out of help lines
+// str_pool is packed_ASCII_code *
+
+char * make_up_help_string (int nhelplines)
+{
+ char * helpstring, *s;
+ int k, nlen = 0;
+
+// get length of help for this specific message
+ for (k = nhelplines - 1; k >= 0; k--)
+ {
+ nlen += strlen(help_line[k]);
+ }
+
+ nlen += 2; // for blank line separator: "\r\n"
+
+ if (addextrahelp)
+ {
+ nlen += stringlength(265);
+ nlen += stringlength(266);
+ nlen += stringlength(267);
+
+ if (base_ptr > 0)
+ nlen += stringlength(268);
+
+ if (deletions_allowed)
+ nlen += stringlength(269);
+
+ nlen += stringlength(270);
+ }
+
+ helpstring = (char *) malloc(nlen + 1); // +1 = '\0'
+ s = helpstring;
+
+ for (k = nhelplines-1; k >= 0; k--)
+ {
+ s = add_string(s, help_line[k]);
+ }
+
+ if (addextrahelp)
+ {
+ strcpy(s, "\r\n");
+ s += 2;
+ s = add_string(s, "Type <return> to proceed, S to scroll future error messages,");
+ s = add_string(s, "R to run without stopping, Q to run quietly,");
+ s = add_string(s, "I to insert something, ");
+
+ if (base_ptr > 0)
+ s = add_string(s, "E to edit your file, ");
+
+ if (deletions_allowed)
+ s = add_string(s, "1 or ... or 9 to ignore the next 1 to 9 tokens of input,");
+
+ s = add_string(s, "H for help, X to quit.");
+ }
+
+ return helpstring;
+}
+
+char * make_up_query_string (int promptstr)
+{
+ char *querystr;
+ int nstart, nnext, n;
+ char *s;
+
+ nstart = str_start[ promptstr];
+ nnext = str_start[ promptstr + 1];
+ n = nnext - nstart;
+ querystr = (char *) malloc(n + 1);
+ s = querystr;
+ memcpy(s, &str_pool[nstart], n);
+ s += n;
+ *s = '\0';
+
+ return querystr;
+}
+
+// abort_flag set if input_line / ConsoleInput returns non-zero
+// should set interrupt instead ???
+// called from tex0.c, tex2.c, tex3.c
/* sec 0071 */
void term_input(void)
{
integer k;
-
+ int flag;
+
if (!knuth_flag)
- show_line("\n", 0); // force it to show what may be buffered up ???
+ show_line("\n", 0);
fflush(stdout);
+ flag = input_ln(stdin, true);
- if (!input_ln(stdin, true))
+ if (!flag)
{
fatal_error("End of file on the terminal!");
- return;
+ return; // abort_flag set
}
-
term_offset = 0;
- decr(selector);
+ decr(selector); // shut off echo
if (last != first)
for (k = first; k <= last - 1; k++)
print(buffer[k]);
print_ln();
- incr(selector);
+ incr(selector); // reset selector again
}
/* sec 0091 */
void int_error_ (integer n)
if (s == 1073741824L) /* 2^30 - special case - merge adjacent */
{
if (trace_flag)
- show_line("Merged adjacent multi-word nodes\n", 0);
+ puts("Merged adjacent multi-word nodes\n");
return max_halfword;
}
return p;
}
/* sec 0155 */
-pointer new_kern_(scaled w)
+pointer new_kern(scaled w)
{
pointer p;
return p;
}
/* sec 0158 */
-pointer new_penalty_(integer m)
+pointer new_penalty(integer m)
{
pointer p;
#ifdef DEBUG
/* sec 0167 */
-void check_mem_(boolean printlocs)
+void check_mem(boolean printlocs)
{
pointer p, q;
boolean clobbered;
}
}
/* sec 0176 */
-void print_font_and_char_ (integer p)
+void print_font_and_char (integer p)
{
if (p > mem_end)
print_esc("CLOBBERED.");
print_char('}');
}
/* sec 0176 */
-void print_rule_dimen_ (scaled d)
+void print_rule_dimen(scaled d)
{
if ((d == -1073741824L)) /* - 2^30 */
print_char('*');
print_esc("parfillskip");
break;
- ///*
- case kanji_skip_code:
- print_esc("kanjiskip");
- break;
-
- case xkanji_skip_code:
- print_esc("xkanjiskip");
- break;
- //*/
-
case thin_mu_skip_code:
print_esc("thinmuskip");
break;
print_esc("thickmuskip");
break;
- case jfm_skip:
- print("refer from jfm");
- break;
-
default:
print_string("[unknown glue parameter!]");
break;
return;
}
- if ((p >= hi_mem_min))
+ if (is_char_node(p))
print_font_and_char(p);
else switch (type(p))
{
{
words = 1;
- if ((p >= hi_mem_min))
+ if (is_char_node(p))
r = get_avail();
else switch (type(p))
{
print_esc("newlinechar");
break;
- case cur_jfam_code:
- print_esc("jfam");
- break;
-
- case jchr_widow_penalty_code:
- print_esc("jcharwidowpenalty");
- break;
-
case language_code:
print_esc("language");
break;
print_esc("voffset");
break;
- case t_baseline_shift_code:
- print_esc("tbaselineshift");
- break;
-
- case y_baseline_shift_code:
- print_esc("ybaselineshift");
- break;
-
case emergency_stretch_code:
print_esc("emergencystretch");
break;
case def_code:
if (chr_code == cat_code_base)
print_esc("catcode");
- else if (chr_code == kcat_code_base)
- print_esc("kcatcode");
- else if (chr_code == auto_xsp_code_base)
- print_esc("xspcode");
else if (chr_code == math_code_base)
print_esc("mathcode");
else if (chr_code == lc_code_base)
print_esc("showlists");
break;
- //case show_mode:
- // print_esc("showmode");
- // break;
-
default:
print_esc("show");
break;
{
if (n < active_base)
print_char('?');
- else if (n < glue_base)
- {
- sprint_cs(n);
- print_char('=');
- print_cmd_chr(eq_type(n), equiv(n));
-
- if (eq_type(n) >= call)
- {
- print_char(':');
- show_token_list(link(equiv(n)), 0, 32);
- }
- }
- else if (n < local_base)
- if (n < skip_base)
- {
- print_skip_param(n - glue_base);
- print_char('=');
-
- if (n < glue_base + thin_mu_skip_code)
- print_spec(equiv(n), "pt");
- else
- print_spec(equiv(n), "mu");
- }
- else if (n < mu_skip_base)
- {
- print_esc("skip");
- print_int(n - skip_base);
- print_char('=');
- print_spec(equiv(n), "pt");
- }
- else
- {
- print_esc("muskip");
- print_int(n - mu_skip_base);
- print_char('=');
- print_spec(equiv(n), "mu");
- }
- else if (n < int_base)
- if (n == par_shape_loc)
- {
- print_esc("parshape");
- print_char('=');
-
- if (par_shape_ptr == 0)
- print_char('0');
- else
- print_int(info(par_shape_ptr));
- }
- else if (n < toks_base)
- {
- print_cmd_chr(assign_toks, n);
- print_char('=');
-
- if (equiv(n) != 0)
- show_token_list(link(equiv(n)), 0, 32);
- }
- else if (n < box_base)
+ else
+ if (n < glue_base)
{
- print_esc("toks");
- print_int(n - toks_base);
+ sprint_cs(n);
print_char('=');
+ print_cmd_chr(eq_type(n), equiv(n));
- if (equiv(n) != 0)
- show_token_list(link(equiv(n)), 0, 32);
- }
- else if (n < cur_font_loc)
- {
- print_esc("box");
- print_int(n - box_base);
- print_char('=');
-
- if (equiv(n) == 0)
- print_string("void");
- else
+ if (eq_type(n) >= call)
{
- depth_threshold = 0;
- breadth_max = 1;
- show_node_list(equiv(n));
+ print_char(':');
+ show_token_list(link(equiv(n)), 0, 32);
}
}
- else if (n < cat_code_base)
+ else
+ if (n < local_base)
+ if (n < skip_base)
+ {
+ print_skip_param(n - glue_base);
+ print_char('=');
+
+ if (n < glue_base + thin_mu_skip_code)
+ print_spec(equiv(n), "pt");
+ else
+ print_spec(equiv(n), "mu");
+ }
+ else
+ if (n < mu_skip_base)
+ {
+ print_esc("skip");
+ print_int(n - skip_base);
+ print_char('=');
+ print_spec(equiv(n), "pt");
+ }
+ else
+ {
+ print_esc("muskip");
+ print_int(n - mu_skip_base);
+ print_char('=');
+ print_spec(equiv(n), "mu");
+ }
+ else
+ if (n < int_base)
+ if (n == par_shape_loc)
+ {
+ print_esc("parshape");
+ print_char('=');
+
+ if (par_shape_ptr == 0)
+ print_char('0');
+ else
+ print_int(info(par_shape_ptr));
+ }
+ else
+ if (n < toks_base)
+ {
+ print_cmd_chr(assign_toks, n);
+ print_char('=');
+
+ if (equiv(n) != 0)
+ show_token_list(link(equiv(n)), 0, 32);
+ }
+ else
+ if (n < box_base)
+ {
+ print_esc("toks");
+ print_int(n - toks_base);
+ print_char('=');
+
+ if (equiv(n) != 0)
+ show_token_list(link(equiv(n)), 0, 32);
+ }
+ else
+ if (n < cur_font_loc)
+ {
+ print_esc("box");
+ print_int(n - box_base);
+ print_char('=');
+
+ if (equiv(n) == 0)
+ print_string("void");
+ else
+ {
+ depth_threshold = 0;
+ breadth_max = 1;
+ show_node_list(equiv(n));
+ }
+ }
+ else
+ if (n < cat_code_base)
+ {
+ if (n == cur_font_loc)
+ print_string("current font");
+ else
+ if (n < math_font_base + 16)
+ {
+ print_esc("textfont");
+ print_int(n - math_font_base);
+ }
+ else
+ if (n < math_font_base + 32)
+ {
+ print_esc("scriptfont");
+ print_int(n - math_font_base - 16);
+ }
+ else
+ {
+ print_esc("scriptscriptfont");
+ print_int(n - math_font_base - 32);
+ }
+
+ print_char('=');
+ print_esc("");
+ print(hash[font_id_base + equiv(n)].rh);
+ }
+ else
+ if (n < math_code_base)
+ {
+ if (n < lc_code_base)
+ {
+ print_esc("catcode");
+ print_int(n - cat_code_base);
+ }
+ else
+ if (n < uc_code_base)
+ {
+ print_esc("lccode");
+ print_int(n - lc_code_base);
+ }
+ else
+ if (n < sf_code_base)
+ {
+ print_esc("uccode");
+ print_int(n - uc_code_base);
+ }
+ else
+ {
+ print_esc("sfcode");
+ print_int(n - sf_code_base);
+ }
+
+ print_char('=');
+ print_int(equiv(n));
+ }
+ else
+ {
+ print_esc("mathcode");
+ print_int(n - math_code_base);
+ print_char('=');
+ print_int(equiv(n));
+ }
+ else
+ if (n < dimen_base)
{
- if (n == cur_font_loc)
- print_string("current font");
- else if (n < math_font_base + 16)
- {
- print_esc("textfont");
- print_int(n - math_font_base);
- }
- else if (n < math_font_base + 32)
- {
- print_esc("scriptfont");
- print_int(n - math_font_base - 16);
- }
+ if (n < count_base)
+ print_param(n - int_base);
else
- {
- print_esc("scriptscriptfont");
- print_int(n - math_font_base - 32);
- }
-
+ if (n < del_code_base)
+ {
+ print_esc("count");
+ print_int(n - count_base);
+ }
+ else
+ {
+ print_esc("delcode");
+ print_int(n - del_code_base);
+ }
+
print_char('=');
- print_esc("");
- print(hash[font_id_base + equiv(n)].rh);
+ print_int(eqtb[n].cint);
}
- else if (n < math_code_base)
- {
- if (n < kcat_code_base)
- {
- print_esc("catcode");
- print_int(n - cat_code_base);
- }
- else if (n < auto_xsp_code_base)
- {
- print_esc("kcatcode");
- print_int(n - kcat_code_base);
- }
- else if (n < inhibit_xsp_code_base)
- {
- print_esc("xspcode");
- print_int(n - auto_xsp_code_base);
- }
- else if (n < kinsoku_base)
- {
- print("(inhibitxspcode table) ");
- print_int(n - inhibit_xsp_code_base);
- }
- else if (n < kansuji_base)
- {
- print("(kinsoku table) ");
- print_int(n - kinsoku_base);
- }
- else if (n < lc_code_base)
- {
- print_esc("kansujichar");
- print_int(n - kansuji_base);
- }
- else if (n < uc_code_base)
- {
- print_esc("lccode");
- print_int(n - lc_code_base);
- }
- else if (n < sf_code_base)
+ else
+ if (n <= eqtb_size)
{
- print_esc("uccode");
- print_int(n - uc_code_base);
+ if (n < scaled_base)
+ print_length_param(n - dimen_base);
+ else
+ {
+ print_esc("dimen");
+ print_int(n - scaled_base);
+ }
+
+ print_char('=');
+ print_scaled(eqtb[n].cint);
+ print_string("pt");
}
else
- {
- print_esc("sfcode");
- print_int(n - sf_code_base);
- }
-
- print_char('=');
- print_int(equiv(n));
- }
- else
- {
- print_esc("mathcode");
- print_int(n - math_code_base);
- print_char('=');
- print_int(equiv(n));
- }
- else if (n < dimen_base)
- {
- if (n < count_base)
- print_param(n - int_base);
- else if (n < del_code_base)
- {
- print_esc("count");
- print_int(n - count_base);
- }
- else
- {
- print_esc("delcode");
- print_int(n - del_code_base);
- }
-
- print_char('=');
- print_int(eqtb[n].cint);
- }
- else if (n < kinsoku_penalty_base)
- {
- if (n < scaled_base)
- print_length_param(n - dimen_base);
- else
- {
- print_esc("dimen");
- print_int(n - scaled_base);
- }
-
- print_char('=');
- print_scaled(eqtb[n].cint);
- print_string("pt");
- }
- else if (n <= eqtb_size)
- print_string("kinsoku");
- else
- print_char('?');
+ print_char('?');
}
#endif /* STAT */
/* sec 0259 */
if (cur_level > level_one)
{
decr(cur_level);
- while (true) {
+
+ while (true)
+ {
decr(save_ptr);
if (save_type(save_ptr) == level_boundary)
#ifdef STAT
if (tracing_restores > 0)
restore_trace(p, "retaining");
-#endif /* STAT */
+#endif
}
else
{
#ifdef STAT
if (tracing_restores > 0)
restore_trace(p, "restoring");
-#endif /* STAT */
+#endif
}
else if (xeq_level[p] != level_one)
{
#ifdef STAT
if (tracing_restores > 0)
restore_trace(p, "restoring");
-#endif /* STAT */
+#endif
}
else
{
#ifdef STAT
if (tracing_restores > 0)
restore_trace(p, "retaining");
-#endif /* STAT */
+#endif
}
}
}
else
{
confusion("curlevel");
- return; // abort_flag set
+ return;
}
}
/* This is where the old tex2.c used to start */
{
cur_input = input_stack[base_ptr];
- if ((cur_input.state_field != 0))
+ if ((state != 0))
if ((cur_input.name_field > 17) || (base_ptr == 0))
bottomline = true;
if ((base_ptr == input_ptr) || bottomline || (nn < error_context_lines))
{
- if ((base_ptr == input_ptr) || (cur_input.state_field != token_list) ||
- (cur_input.index_field != backed_up) || (cur_input.loc_field != 0))
+ if ((base_ptr == input_ptr) || (state != token_list) ||
+ (index != backed_up) || (loc != 0))
{
tally = 0;
old_setting = selector;
- if (cur_input.state_field != 0)
+ if (state != 0)
{
if (cur_input.name_field <= 17)
if ((cur_input.name_field == 0))
if (c_style_flag)
{
print_ln();
- /* show current input file name - ignore if from terminal */
- if (cur_input.name_field > 17) /* redundant ? */
+
+ if (cur_input.name_field > 17)
print(cur_input.name_field);
print_char('(');
- print_int(line); /* line number */
+ print_int(line);
print_char(')');
print_char(' ');
print_char(':');
}
else
{
- print_nl("l."); /* l. ? 573 ????? 98/Dec/8 check ! */
- print_int(line); /* line number */
+ print_nl("l.");
+ print_int(line);
}
}
trick_count = 1000000L;
}
- if (buffer[cur_input.limit_field] == end_line_char)
- j = cur_input.limit_field;
+ if (buffer[limit] == end_line_char)
+ j = limit;
else
- j = cur_input.limit_field + 1;
+ j = limit + 1;
if (j > 0)
- for (i = cur_input.start_field; i <= j - 1; i++)
+ for (i = start; i <= j - 1; i++)
{
- if (i == cur_input.loc_field)
+ if (i == loc)
{
first_count = tally;
trick_count = tally + 1 + error_line - half_error_line;
}
else
{
- switch (cur_input.index_field)
+ switch (index)
{
case parameter:
print_nl("<argument> ");
break;
case backed_up:
- if (cur_input.loc_field == 0)
+ if (loc == 0)
print_nl("<recently read> ");
else
print_nl("<to be read again> ");
trick_count = 1000000L;
}
- if (cur_input.index_field < macro)
- show_token_list(cur_input.start_field, cur_input.loc_field, 100000L);
+ if (index < macro)
+ show_token_list(start, loc, 100000L);
else
- show_token_list(link(cur_input.start_field), cur_input.loc_field, 100000L);
+ show_token_list(link(start), loc, 100000L);
}
selector = old_setting;
incr(input_ptr);
}
- cur_input.state_field = token_list;
- cur_input.start_field = p;
- cur_input.index_field = t;
+ state = token_list;
+ start = p;
+ index = t;
if (t >= macro)
{
add_token_ref(p);
if (t == macro)
- cur_input.limit_field = param_ptr;
+ limit = param_ptr;
else
{
- cur_input.loc_field = link(p);
+ loc = link(p);
if (tracing_macros > 1)
{
break;
default:
- print_cmd_chr(assign_toks, t - output_text + output_routine_loc);
+ print_cmd_chr(assign_toks, t + (hash_size + 1307));
break;
}
}
}
else
- cur_input.loc_field = p;
+ loc = p;
}
//#pragma optimize("", on) /* 98/Dec/10 experiment */
/* sec 0324 */
void end_token_list (void)
{
- if (cur_input.index_field >= backed_up)
+ if (index >= backed_up)
{
- if (cur_input.index_field <= inserted)
- flush_list(cur_input.start_field);
+ if (index <= inserted)
+ flush_list(start);
else
{
- delete_token_ref(cur_input.start_field);
- if (cur_input.index_field == macro)
- while (param_ptr > cur_input.limit_field)
+ delete_token_ref(start);
+ if (index == macro)
+ while (param_ptr > limit)
{
decr(param_ptr);
flush_list(param_stack[param_ptr]);
}
}
}
- else if (cur_input.index_field == u_template)
+ else if (index == u_template)
if (align_state > 500000L)
align_state = 0;
else
{
halfword p;
- while ((cur_input.state_field == 0) && (cur_input.loc_field == 0) &&
- (cur_input.index_field != v_template))
+ while ((state == 0) && (loc == 0) &&
+ (index != v_template))
{
end_token_list();
}
incr(input_ptr);
}
- cur_input.state_field = token_list;
- cur_input.start_field = p;
- cur_input.index_field = backed_up;
- cur_input.loc_field = p;
+ state = token_list;
+ start = p;
+ index = backed_up;
+ loc = p;
}
/* sec 0327 */
void back_error (void)
{
OK_to_interrupt = false;
back_input();
- cur_input.index_field = inserted;
+ index = inserted;
OK_to_interrupt = true;
error();
}
input_stack[input_ptr] = cur_input;
incr(input_ptr);
}
- cur_input.index_field = in_open;
- line_stack[cur_input.index_field] = line;
- cur_input.start_field = first;
- cur_input.state_field = 1;
+ index = in_open;
+ line_stack[index] = line;
+ start = first;
+ state = 1;
cur_input.name_field = 0;
}
/* sec 0329 */
void end_file_reading (void)
{
- first = cur_input.start_field;
- line = line_stack[cur_input.index_field];
+ first = start;
+ line = line_stack[index];
if (cur_input.name_field > 17)
- (void) a_close(input_file[cur_input.index_field]);
+ (void) a_close(input_file[index]);
{
decr(input_ptr);
/* sec 0330 */
void clear_for_error_prompt (void)
{
- while ((cur_input.state_field != 0) &&
+ while ((state != 0) &&
(cur_input.name_field == 0) && (input_ptr > 0) &&
- (cur_input.loc_field > cur_input.limit_field))
+ (loc > limit))
end_file_reading();
print_ln();
if (cur_cs != 0)
{
- if ((cur_input.state_field == 0) || (cur_input.name_field < 1) || (cur_input.name_field > 17))
+ if ((state == 0) || (cur_input.name_field < 1) || (cur_input.name_field > 17))
{
p = get_avail();
info(p) = cs_token_flag + cur_cs;
deletions_allowed = true;
}
}
-/*****************************************************************************/
-/* get_next() moved from here to end for pragma optimize reasons 96/Sep/12 */
-void get_next(void);
-/*****************************************************************************/
/* sec 0363 */
void firm_up_the_line (void)
{
integer k;
- cur_input.limit_field = last;
+ limit = last;
if (pausing > 0)
if (interaction > nonstop_mode)
;
print_ln();
- if (cur_input.start_field < cur_input.limit_field)
- for (k = cur_input.start_field; k <= cur_input.limit_field - 1; k++)
+ if (start < limit)
+ for (k = start; k <= limit - 1; k++)
print(buffer[k]);
- first = cur_input.limit_field;
+ first = limit;
prompt_input("=>");
if (last > first)
{
for (k = first; k <= last - 1; k++)
- buffer[k + cur_input.start_field - first] = buffer[k];
+ buffer[k + start - first] = buffer[k];
- cur_input.limit_field = cur_input.start_field + last - first;
+ limit = start + last - first;
}
}
}
halfword s;
halfword t;
halfword u, v;
- halfword rbraceptr;
+ halfword rbrace_ptr;
small_number n;
halfword unbalance;
halfword m;
- halfword refcount;
- small_number savescannerstatus;
- halfword savewarningindex;
+ halfword ref_count;
+ small_number save_scanner_status;
+ halfword save_warning_index;
ASCII_code match_chr;
- savescannerstatus = scanner_status;
- savewarningindex = warning_index;
+ save_scanner_status = scanner_status;
+ save_warning_index = warning_index;
warning_index = cur_cs;
- refcount = cur_chr;
- r = link(refcount);
+ ref_count = cur_chr;
+ r = link(ref_count);
n = 0;
if (tracing_macros > 0)
begin_diagnostic();
print_ln();
print_cs(warning_index);
- token_show(refcount);
+ token_show(ref_count);
end_diagnostic(false);
}
lab30:
t = link(t);
}
- while(!(t == r));
+ while (!(t == r));
r = s;
}
}
}
lab31:
- rbraceptr = p;
+ rbrace_ptr = p;
store_new_token(cur_tok);
}
else
{
if ((m == 1) && (info(p) < right_brace_limit) && (p != temp_head))
{
- link(rbraceptr) = 0; /* rbraceptr may be used without ... */
+ link(rbrace_ptr) = 0; /* rbrace_ptr may be used without ... */
free_avail(p);
p = link(temp_head);
pstack[n] = link(p);
}
}
}
- while(!(info(r) == end_match_token));
+ while (!(info(r) == end_match_token));
}
- while((cur_input.state_field == token_list) && (cur_input.loc_field == 0) &&
- (cur_input.index_field != v_template))
+ while ((state == token_list) && (loc == 0) &&
+ (index != v_template))
end_token_list();
- begin_token_list(refcount, macro);
+ begin_token_list(ref_count, macro);
cur_input.name_field = warning_index;
- cur_input.loc_field = link(r);
+ loc = link(r);
if (n > 0)
{
param_ptr = param_ptr + n;
}
lab10:
- scanner_status = savescannerstatus;
- warning_index = savewarningindex;
+ scanner_status = save_scanner_status;
+ warning_index = save_warning_index;
}
/* sec 0379 */
void insert_relax (void)
back_input();
cur_tok = cs_token_flag + frozen_relax; /* 96/Jan/10 */
back_input();
- cur_input.index_field = inserted;
+ index = inserted;
}
/* sec 0366 */
void expand (void)
{
halfword t;
- halfword p, q, r;
+ pointer p, q, r;
integer j;
- integer cvbackup;
- small_number cvlbackup, radixbackup, cobackup;
- halfword backupbackup;
- small_number savescannerstatus;
+ integer cv_backup;
+ small_number cvl_backup, radix_backup, co_backup;
+ halfword backup_backup;
+ small_number save_scanner_status;
- cvbackup = cur_val;
- cvlbackup = cur_val_level;
- radixbackup = radix;
- cobackup = cur_order;
- backupbackup = link(backup_head);
+ cv_backup = cur_val;
+ cvl_backup = cur_val_level;
+ radix_backup = radix;
+ co_backup = cur_order;
+ backup_backup = link(backup_head);
if (cur_cmd < call)
{
break;
case no_expand:
- savescannerstatus = scanner_status;
+ save_scanner_status = scanner_status;
scanner_status = normal;
get_token();
- scanner_status = savescannerstatus;
+ scanner_status = save_scanner_status;
t = cur_tok;
back_input();
{
p = get_avail();
info(p) = cs_token_flag + frozen_dont_expand; /*96/Jan/10*/
- link(p) = cur_input.loc_field;
- cur_input.start_field = p;
- cur_input.loc_field = p;
+ link(p) = loc;
+ start = p;
+ loc = p;
}
break;
if (cur_cs == 0)
store_new_token(cur_tok);
}
- while(!(cur_cs != 0));
+ while (!(cur_cs != 0));
if (cur_cmd != end_cs_name)
{
}
else
{
- while(cur_chr != fi_code)
+ while (cur_chr != fi_code)
pass_text();
{
back_input();
}
- cur_val = cvbackup;
- cur_val_level = cvlbackup;
- radix = radixbackup;
- cur_order = cobackup;
- link(backup_head) = backupbackup;
+ cur_val = cv_backup;
+ cur_val_level = cvl_backup;
+ radix = radix_backup;
+ cur_order = co_backup;
+ link(backup_head) = backup_backup;
}
/* sec 0380 */
void get_x_token (void)
if (cur_cmd <= max_command)
goto lab30;
+
if (cur_cmd >= call)
if (cur_cmd < end_template)
macro_call();
else
{
- cur_cs = frozen_endv; /* 96/Jan/10 */
+ cur_cs = frozen_endv;
cur_cmd = endv;
goto lab30;
}
expand();
goto lab20;
+
lab30:
if (cur_cs == 0)
cur_tok = (cur_cmd * 256) + cur_chr;
{
get_x_token();
}
- while(!((cur_cmd != spacer) && (cur_cmd != relax)));
+ while (!((cur_cmd != spacer) && (cur_cmd != relax)));
if (cur_cmd != left_brace)
{
{
get_x_token();
}
- while(!(cur_cmd != spacer));
+ while (!(cur_cmd != spacer));
if (cur_tok != other_token + '=')
back_input();
}
/* sec 0407 */
-boolean scan_keyword_(const char * s)
+boolean scan_keyword(const char * s)
{
halfword p;
halfword q;
void scan_fifteen_bit_int (void)
{
scan_int();
+
if ((cur_val < 0) || (cur_val > 32767))
{
print_err("Bad mathchar");
if (n > font_params[f])
if (f < font_ptr)
cur_val = fmem_ptr;
- else
- {
- do
- {
- #ifdef ALLOCATEFONT
- if (fmem_ptr == current_font_mem_size) /* 93/Nov/28 ??? */
+ else
+ {
+ do
{
- font_info = realloc_font_info(increment_font_mem_size);
- }
+ #ifdef ALLOCATEFONT
+ if (fmem_ptr == current_font_mem_size)
+ font_info = realloc_font_info(increment_font_mem_size);
- if (fmem_ptr == current_font_mem_size) /* 94/Jan/24 */
- {
- overflow("font memory", current_font_mem_size); /* font memory */
- return; // abort_flag set
- }
+ if (fmem_ptr == current_font_mem_size)
+ {
+ overflow("font memory", current_font_mem_size);
+ return;
+ }
#else
- if (fmem_ptr == font_mem_size)
- {
- overflow("font memory", font_mem_size); /* font memory */
- return; // abort_flag set
- }
+ if (fmem_ptr == font_mem_size)
+ {
+ overflow("font memory", font_mem_size);
+ return;
+ }
#endif
- font_info[fmem_ptr].cint = 0;
- incr(fmem_ptr);
- incr(font_params[f]);
- }
- while(!(n == font_params[f]));
+ font_info[fmem_ptr].cint = 0;
+ incr(fmem_ptr);
+ incr(font_params[f]);
+ }
+ while (!(n == font_params[f]));
- cur_val = fmem_ptr - 1;
- }
- else if (n > 0)
- cur_val = n + param_base[f];
+ cur_val = fmem_ptr - 1;
+ }
+ else if (n > 0)
+ cur_val = n + param_base[f];
}
if (cur_val == fmem_ptr)
scan_char_num();
if (m == math_code_base)
- {
- cur_val = math_code(cur_val);
- cur_val_level = int_val;
- }
+ scanned_result(math_code(cur_val), int_val);
else if (m < math_code_base)
- {
- cur_val = equiv(m + cur_val);
- cur_val_level = int_val;
- }
+ scanned_result(equiv(m + cur_val), int_val);
else
- {
- cur_val = eqtb[m + cur_val].cint;
- cur_val_level = int_val;
- }
+ scanned_result(eqtb[m + cur_val].cint, int_val);
}
break;
"(If you can't figure out why I needed to see a number,",
"look up `weird error' in the index to The TeXbook.)");
back_error();
- {
- cur_val = 0;
- cur_val_level = dimen_val;
- }
+ scanned_result(0, dimen_val);
}
else if (cur_cmd <= assign_toks)
{
m = toks_base + cur_val;
}
- {
- cur_val = eqtb[m].hh.rh;
- cur_val_level = tok_val;
- }
+ scanned_result(equiv(m), tok_val);
}
else
{
back_input();
scan_font_ident();
-
- {
- cur_val = font_id_base + cur_val;
- cur_val_level = ident_val;
- }
+ scanned_result(font_id_base + cur_val, ident_val);
}
break;
case assign_int:
- {
- cur_val = eqtb[m].cint;
- cur_val_level = int_val;
- }
+ scanned_result(eqtb[m].cint, int_val);
break;
case assign_dimen:
- {
- cur_val = eqtb[m].cint;
- cur_val_level = dimen_val;
- }
+ scanned_result(eqtb[m].cint, dimen_val);
break;
case assign_glue:
- {
- cur_val = eqtb[m].hh.rh;
- cur_val_level = glue_val;
- }
+ scanned_result(equiv(m), glue_val);
break;
case assign_mu_glue:
- {
- cur_val = eqtb[m].hh.rh;
- cur_val_level = mu_val;
- }
+ scanned_result(equiv(m), mu_val);
break;
case set_aux:
error();
if (level != tok_val)
- {
- cur_val = 0;
- cur_val_level = dimen_val;
- }
+ scanned_result(0, dimen_val);
else
- {
- cur_val = 0;
- cur_val_level = int_val;
- }
+ scanned_result(0, int_val);
}
else if (m == vmode)
- {
- cur_val = cur_list.aux_field.cint;
- cur_val_level = dimen_val;
- }
+ scanned_result(prev_depth, dimen_val);
else
- {
- cur_val = space_factor;
- cur_val_level = int_val;
- }
+ scanned_result(space_factor, int_val);
break;
case set_prev_graf:
if (mode == 0)
- {
- cur_val = 0;
- cur_val_level = int_val;
- }
+ scanned_result(0, int_val);
else
{
nest[nest_ptr] = cur_list;
while (abs(nest[p].mode_field) != vmode)
decr(p);
- {
- cur_val = nest[p].pg_field;
- cur_val_level = int_val;
- }
+ scanned_result(nest[p].pg_field, int_val);
}
break;
{
if ((page_contents == 0) && (! output_active))
if (m == 0)
- cur_val = 1073741823L; /* 2^30 - 1 */
+ cur_val = max_dimen;
else
cur_val = 0;
else
case char_given:
case math_given:
- {
- cur_val = cur_chr;
- cur_val_level = int_val;
- }
+ scanned_result(cur_chr, int_val);
break;
case assign_font_dimen:
{
find_font_dimen(false);
font_info[fmem_ptr].cint = 0;
- {
- cur_val = font_info[cur_val].cint;
- cur_val_level = dimen_val;
- }
+ scanned_result(font_info[cur_val].cint, dimen_val);
}
break;
scan_font_ident();
if (m == 0)
- {
- cur_val = hyphen_char[cur_val];
- cur_val_level = int_val;
- }
+ scanned_result(hyphen_char[cur_val], int_val);
else
- {
- cur_val = skew_char[cur_val];
- cur_val_level = int_val;
- }
+ scanned_result(skew_char[cur_val], int_val);
}
break;
cur_val_level = cur_chr;
- if (!(tail >= hi_mem_min) && (mode != 0))
+ if (!is_char_node(tail) && (mode != 0))
switch(cur_chr)
{
case int_val:
}
break;
}
- else if ((mode == 1) && (tail == cur_list.head_field))
+ else if ((mode == vmode) && (tail == head))
switch (cur_chr)
{
case int_val:
error();
if (level != tok_val)
- {
- cur_val = 0;
- cur_val_level = dimen_val;
- }
+ scanned_result(0, dimen_val);
else
- {
- cur_val = 0;
- cur_val_level = int_val;
- }
+ scanned_result(0, int_val);
}
break;
}
cur_val = new_spec(cur_val);
{
- width(cur_val) = - (integer) width(cur_val);
- stretch(cur_val) = - (integer) stretch(cur_val);
- shrink(cur_val) = - (integer) shrink(cur_val);
+ width(cur_val) = -width(cur_val);
+ stretch(cur_val) = -stretch(cur_val);
+ shrink(cur_val) = -shrink(cur_val);
}
}
else
- cur_val = - (integer) cur_val;
+ cur_val = -cur_val;
else if ((cur_val_level >= glue_val) && (cur_val_level <= mu_val))
add_glue_ref(cur_val);
}
lab20:
cur_cs = 0;
- if (cur_input.state_field != token_list)
+ if (state != token_list)
{
lab25:
- if (cur_input.loc_field <= cur_input.limit_field)
+ if (loc <= limit)
{
- cur_chr = buffer[cur_input.loc_field];
- incr(cur_input.loc_field);
+ cur_chr = buffer[loc];
+ incr(loc);
lab21:
cur_cmd = cat_code(cur_chr);
- switch (cur_input.state_field + cur_cmd)
+ switch (state + cur_cmd)
{
case any_state_plus(ignore):
case skip_blanks + spacer:
case any_state_plus(escape):
{
- if (cur_input.loc_field > cur_input.limit_field)
+ if (loc > limit)
cur_cs = null_cs;
else
{
lab26:
- k = cur_input.loc_field;
+ k = loc;
cur_chr = buffer[k];
cat = cat_code(cur_chr);
incr(k);
if (cat == letter)
- cur_input.state_field = skip_blanks;
+ state = skip_blanks;
else if (cat == spacer)
- cur_input.state_field = skip_blanks;
+ state = skip_blanks;
else
- cur_input.state_field = mid_line;
+ state = mid_line;
- if ((cat == letter) && (k <= cur_input.limit_field))
+ if ((cat == letter) && (k <= limit))
{
do
{
cat = cat_code(cur_chr);
incr(k);
}
- while(!((cat != letter) || (k > cur_input.limit_field)));
+ while (!((cat != letter) || (k > limit)));
{
if (buffer[k]== cur_chr)
if (cat == sup_mark)
- if (k < cur_input.limit_field)
+ if (k < limit)
{
c = buffer[k + 1];
{
d = 2;
if ((((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102))))
- if (k + 2 <= cur_input.limit_field)
+ if (k + 2 <= limit)
{
cc = buffer[k + 2];
else
buffer[k - 1] = c - 64;
- cur_input.limit_field = cur_input.limit_field - d;
+ limit = limit - d;
first = first - d;
- while (k <= cur_input.limit_field)
+ while (k <= limit)
{
buffer[k] = buffer[k + d];
incr(k);
if (cat != letter)
decr(k);
- if (k > cur_input.loc_field + 1)
+ if (k > loc + 1)
{
- cur_cs = id_lookup(cur_input.loc_field, k - cur_input.loc_field);
- cur_input.loc_field = k;
+ cur_cs = id_lookup(loc, k - loc);
+ loc = k;
goto lab40;
}
}
{
if (buffer[k] == cur_chr)
if (cat == sup_mark)
- if (k < cur_input.limit_field)
+ if (k < limit)
{
c = buffer[k + 1];
{
d = 2;
if ((((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102))))
- if (k + 2 <= cur_input.limit_field)
+ if (k + 2 <= limit)
{
cc = buffer[k + 2];
else
buffer[k - 1] = c - 64;
- cur_input.limit_field = cur_input.limit_field - d;
+ limit = limit - d;
first = first - d;
- while (k <= cur_input.limit_field)
+ while (k <= limit)
{
buffer[k] = buffer[k + d];
incr(k);
}
}
}
- cur_cs = single_base + buffer[cur_input.loc_field];
- incr(cur_input.loc_field);
+ cur_cs = single_base + buffer[loc];
+ incr(loc);
}
lab40:
cur_cmd = eq_type(cur_cs);
cur_cs = cur_chr + active_base;
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
- cur_input.state_field = mid_line;
+ state = mid_line;
if (cur_cmd >= outer_call)
check_outer_validity();
case any_state_plus(sup_mark):
{
- if (cur_chr == buffer[cur_input.loc_field])
- if (cur_input.loc_field < cur_input.limit_field)
+ if (cur_chr == buffer[loc])
+ if (loc < limit)
{
- c = buffer[cur_input.loc_field + 1];
+ c = buffer[loc + 1];
if (c < 128)
{
- cur_input.loc_field = cur_input.loc_field + 2;
+ loc = loc + 2;
if ((((c >= 48) && (c <= 57)) || ((c >= 97) && (c <= 102))))
- if (cur_input.loc_field <= cur_input.limit_field)
+ if (loc <= limit)
{
- cc = buffer[cur_input.loc_field];
+ cc = buffer[loc];
if ((((cc >= 48) && (cc <= 57)) || ((cc >= 97) && (cc <= 102))))
{
- incr(cur_input.loc_field);
+ incr(loc);
if (c <= 57)
cur_chr = c - 48;
}
}
- cur_input.state_field = mid_line;
+ state = mid_line;
}
break;
case mid_line + spacer:
{
- cur_input.state_field = skip_blanks;
+ state = skip_blanks;
cur_chr = ' ';
}
break;
case mid_line + car_ret:
{
- cur_input.loc_field = cur_input.limit_field + 1;
+ loc = limit + 1;
cur_cmd = spacer;
cur_chr = ' ';
}
case skip_blanks + car_ret:
case any_state_plus(comment):
{
- cur_input.loc_field = cur_input.limit_field + 1;
+ loc = limit + 1;
goto lab25;
}
break;
case new_line + car_ret:
{
- cur_input.loc_field = cur_input.limit_field + 1;
+ loc = limit + 1;
cur_cs = par_loc;
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
case skip_blanks + left_brace:
case new_line + left_brace:
{
- cur_input.state_field = mid_line;
+ state = mid_line;
incr(align_state);
}
break;
case skip_blanks + right_brace:
case new_line + right_brace:
{
- cur_input.state_field = 1;
+ state = 1;
decr(align_state);
}
break;
case add_delims_to(skip_blanks):
case add_delims_to(new_line):
- cur_input.state_field = 1;
+ state = 1;
break;
default:
}
else
{
- cur_input.state_field = new_line;
+ state = new_line;
if (cur_input.name_field > 17)
{
incr(line);
- first = cur_input.start_field;
+ first = start;
if (!force_eof)
{
- if (input_ln(input_file[cur_input.index_field], true))
+ if (input_ln(input_file[index], true))
firm_up_the_line();
else
force_eof = true;
}
if ((end_line_char < 0) || (end_line_char > 255))
- decr(cur_input.limit_field);
+ decr(limit);
else
- buffer[cur_input.limit_field] = end_line_char;
+ buffer[limit] = end_line_char;
- first = cur_input.limit_field + 1;
- cur_input.loc_field = cur_input.start_field;
+ first = limit + 1;
+ loc = start;
}
else
{
if (interaction > nonstop_mode)
{
if ((end_line_char < 0) || (end_line_char > 255))
- incr(cur_input.limit_field);
+ incr(limit);
- if (cur_input.limit_field == cur_input.start_field)
+ if (limit == start)
print_nl("(Please type a command or say `\\end')");
print_ln();
- first = cur_input.start_field;
+ first = start;
prompt_input("*");
- cur_input.limit_field = last;
+ limit = last;
if ((end_line_char < 0) || (end_line_char > 255))
- decr(cur_input.limit_field);
+ decr(limit);
else
- buffer[cur_input.limit_field]= end_line_char;
+ buffer[limit]= end_line_char;
- first = cur_input.limit_field + 1;
- cur_input.loc_field = cur_input.start_field;
+ first = limit + 1;
+ loc = start;
}
else
{
goto lab25;
}
}
- else if (cur_input.loc_field != 0)
+ else if (loc != 0)
{
- t = info(cur_input.loc_field);
- cur_input.loc_field = link(cur_input.loc_field);
+ t = info(loc);
+ loc = link(loc);
if (t >= cs_token_flag)
{
if (cur_cmd >= outer_call)
if (cur_cmd == dont_expand)
{
- cur_cs = info(cur_input.loc_field) - cs_token_flag;
- cur_input.loc_field = 0;
+ cur_cs = info(loc) - cs_token_flag;
+ loc = 0;
cur_cmd = eq_type(cur_cs);
cur_chr = equiv(cur_cs);
case out_param:
{
- begin_token_list(param_stack[cur_input.limit_field + cur_chr - 1], parameter);
+ begin_token_list(param_stack[limit + cur_chr - 1], parameter);
goto lab20;
}
break;
{
char old_setting;
char c;
- small_number savescannerstatus;
+ small_number save_scanner_status;
pool_pointer b;
c = cur_chr;
case string_code:
case meaning_code:
- savescannerstatus = scanner_status;
+ save_scanner_status = scanner_status;
scanner_status = 0;
get_token();
- scanner_status = savescannerstatus;
+ scanner_status = save_scanner_status;
break;
case font_name_code:
}
}
- cur_input.limit_field = last;
+ limit = last;
if ((end_line_char < 0) || (end_line_char > 255))
- decr(cur_input.limit_field);
+ decr(limit);
else
- buffer[cur_input.limit_field] = end_line_char;
+ buffer[limit] = end_line_char;
- first = cur_input.limit_field + 1;
- cur_input.loc_field = cur_input.start_field;
- cur_input.state_field = new_line;
+ first = limit + 1;
+ loc = start;
+ state = new_line;
while (true)
{
{
get_token();
}
- while(!(cur_tok == 0));
+ while (!(cur_tok == 0));
align_state = 1000000L;
goto lab30;
lab30:
end_file_reading();
}
- while(!(align_state == 1000000L));
+ while (!(align_state == 1000000L));
cur_val = def_ref;
scanner_status = normal;
void pass_text (void)
{
integer l;
- small_number savescannerstatus;
+ small_number save_scanner_status;
- savescannerstatus = scanner_status;
+ save_scanner_status = scanner_status;
scanner_status = skipping;
l = 0;
skip_line = line;
incr(l);
}
lab30:
- scanner_status = savescannerstatus;
+ scanner_status = save_scanner_status;
}
/* sec 0497 */
void change_if_limit_(small_number l, halfword p)
char r;
integer m, n;
halfword p, q;
- small_number savescannerstatus;
+ small_number save_scanner_status;
halfword savecondptr;
small_number thisif;
{
get_x_token();
}
- while(!(cur_cmd != spacer));
+ while (!(cur_cmd != spacer));
if ((cur_tok >= other_token + '<') && (cur_tok <= other_token + '>'))
r = cur_tok - other_token;
case ifx_code:
{
- savescannerstatus = scanner_status;
+ save_scanner_status = scanner_status;
scanner_status = 0;
get_next();
n = cur_cs;
}
}
- scanner_status = savescannerstatus;
+ scanner_status = save_scanner_status;
}
break;
}
}
-// The following code is to save string space used by TeX for filenames
-// Not really critical in a system that has dynamic memory allocation
-// And may slow it down slightly - although this linear search only
-// occurs when opening a file, which is somewhat slow inany case...
-
-// see if string from str_pool[start] to str_pool[end]
-// occurs elsewhere in string pool - returns string number
-// returns -1 if not found in string pool 2000 Aug 15
-
-int find_string (int start, int end)
-{
- int k, nlen = end - start;
- char *s;
-
- if (trace_flag)
- {
- sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end - start);
- s = log_line + strlen(log_line);
- strncpy(s, (const char *) str_pool + start, nlen);
- strcpy(s + nlen, "");
- show_line(log_line, 0);
- }
-
-// avoid problems with(cur_name == flushablestring)by going only up to str_ptr-1
-// code in new_font (tex8.c) will take care of reuse of font name already
- for (k = 0; k < str_ptr - 1; k++)
- {
- 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, (const char *)str_pool + start, nlen);
- strcpy(s+nlen, "\n");
- show_line(log_line, 0);
- }
- return k; // return number of matching string
- }
- }
-
- if (trace_flag)
- {
- sprintf(log_line, "\nNOT FOUND string ");
- s = log_line + strlen(log_line);
- strncpy(s, (const char*)str_pool + start, nlen);
- strcpy(s + nlen, "\n");
- show_line(log_line, 0);
- }
-
- return -1; // no match found
-}
-
-// snip out the string from str_pool[start] to str_pool[end]
-// and move everything above it down 2000 Aug 15
-
-void remove_string (int start, int end)
-{
- int nlen = pool_ptr - end; // how many bytes to move down
- char *s;
-
- if (trace_flag)
- {
- int n = end - start;
- sprintf(log_line, "\nSTRIPPING OUT %d %d ", n, nlen);
- s = log_line + strlen(log_line);
- strncpy(s, (const char *) str_pool + start, n);
- strcpy(s + n, "\n");
- show_line(log_line, 0);
- }
-
- if (nlen > 0)
- memcpy(str_pool + start, str_pool + end, nlen);
-
- pool_ptr = start + nlen;
-}
-
-void show_string (int 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, (const char *)str_pool + str_start[k], nlen);
- strcpy(s + nlen, "");
- show_line(log_line, 0);
-}
-
-void show_all_strings (void)
-{
- int k;
-
- for (k = 0; k < str_ptr; k++)
- show_string(k);
-}
-
/* sec 0517 */
void end_name (void)
{
cur_area = 335; // "" default area
else
{
- if (save_strings_flag && (cur_area = find_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter)) > 0)
- {
- remove_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter);
- area_delimiter = 0; // area_delimiter - area_delimiter;
-
- if (ext_delimiter != 0)
- ext_delimiter = ext_delimiter - area_delimiter;
- }
- else // carve out string for "cur_area"
- {
- cur_area = str_ptr;
- str_start[str_ptr + 1] = str_start[str_ptr] + area_delimiter;
- incr(str_ptr);
- }
+ cur_area = str_ptr;
+ str_start[str_ptr + 1] = str_start[str_ptr] + area_delimiter;
+ incr(str_ptr);
}
if (ext_delimiter == 0) // no extension delimiter '.' found
{
cur_ext = 335; // "" default extension
-
- if (save_strings_flag && (cur_name = find_string(str_start[str_ptr], pool_ptr)) > 0)
- {
- remove_string(str_start[str_ptr], pool_ptr);
- }
- else // Make string from str_start[str_ptr]to pool_ptr
- cur_name = make_string();
+ cur_name = make_string();
}
else // did find an extension
{
- if (save_strings_flag &&
- (cur_name = find_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter-1)) > 0)
- {
- remove_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter - 1);
- }
- else // carve out string for "cur_name"
- {
- cur_name = str_ptr;
- str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1;
- incr(str_ptr);
- }
-
- if (save_strings_flag && (cur_ext = find_string(str_start[str_ptr], pool_ptr)) > 0)
- {
- remove_string(str_start[str_ptr], pool_ptr);
- }
- else // Make string from str_start[str_ptr]to pool_ptr
- cur_ext = make_string();
+ cur_name = str_ptr;
+ str_start[str_ptr + 1] = str_start[str_ptr]+ ext_delimiter - area_delimiter - 1;
+ incr(str_ptr);
+ cur_ext = make_string();
}
}
k = 0;
for (j = str_start[a]; j <= str_start[a + 1] - 1; j++)
- append_to_name(str_pool[j]);
+ {
+ c = str_pool[j];
+ incr(k);
+
+ if (k <= file_name_size)
+ name_of_file[k] = xchr[c];
+ }
for (j = str_start[n]; j <= str_start[n + 1] - 1; j++)
- append_to_name(str_pool[j]);
+ {
+ c = str_pool[j];
+ incr(k);
+
+ if (k <= file_name_size)
+ name_of_file[k] = xchr[c];
+ }
for (j = str_start[e]; j <= str_start[e + 1] - 1; j++)
- append_to_name(str_pool[j]);
+ {
+ c = str_pool[j];
+ incr(k);
- if (k < PATH_MAX)
+ if (k <= file_name_size)
+ name_of_file[k] = xchr[c];
+ }
+
+ if (k < file_name_size)
name_length = k;
else
- name_length = PATH_MAX - 1;
+ name_length = file_name_size - 1;
/* pad it out with spaces ... what for ? in case we modify and forget ? */
- for (k = name_length + 1; k <= PATH_MAX; k++)
+ for (k = name_length + 1; k <= file_name_size; k++)
name_of_file[k] = ' ';
- name_of_file[PATH_MAX] = '\0';
+ name_of_file[file_name_size] = '\0'; /* paranoia 94/Mar/24 */
{
name_of_file [name_length+1] = '\0';
ASCII_code c;
integer j;
- if (n + b - a + 5 > PATH_MAX)
- b = a + PATH_MAX - n - 5;
+ if (n + b - a + 5 > file_name_size)
+ b = a + file_name_size - n - 5;
k = 0;
c = xord[TEX_format_default[j]];
incr(k);
- if (k <= PATH_MAX)
+ if (k <= file_name_size)
name_of_file[k] = xchr[c];
}
/* This loop kicks in when we want a specififed format name */
c = buffer[j];
incr(k);
- if (k <= PATH_MAX)
+ if (k <= file_name_size)
name_of_file[k] = xchr[c];
}
c = xord[TEX_format_default[j]];
incr(k);
- if (k <= PATH_MAX)
+ if (k <= file_name_size)
name_of_file[k] = xchr[c];
}
- if (k < PATH_MAX)
+ if (k < file_name_size)
name_length = k;
else
- name_length = PATH_MAX - 1;
+ name_length = file_name_size - 1;
/* pad it out with spaces ... what for ? */
- for (k = name_length + 1; k <= PATH_MAX; k++)
+ for (k = name_length + 1; k <= file_name_size; k++)
name_of_file[k]= ' ';
- name_of_file[PATH_MAX] = '\0'; /* paranoia 94/Mar/24 */
+ name_of_file[file_name_size] = '\0'; /* paranoia 94/Mar/24 */
}
/* sec 0525 */
str_number make_name_string (void)
}
}
/* sec 0525 */
-str_number a_make_name_string_(alpha_file * f)
+//str_number a_make_name_string_(alpha_file * f)
+str_number a_make_name_string_(void)
{
return make_name_string();
}
/* sec 0525 */
-str_number b_make_name_string_(byte_file * f)
+//str_number b_make_name_string_(byte_file * f)
+str_number b_make_name_string_(void)
{
return make_name_string();
}
/* sec 0525 */
-str_number w_make_name_string_(word_file * f)
+//str_number w_make_name_string_(word_file * f)
+str_number w_make_name_string_(void)
{
return make_name_string();
}
if (interaction < 2)
{
fatal_error("*** (job aborted, file error in nonstop mode)");
- return;
+ return; // abort_flag set
}
if (!knuth_flag)
+#ifdef _WINDOWS
+ show_line(" (or ^z to exit)", 0);
+#else
show_line(" (or Ctrl-Z to exit)", 0);
-
+#endif
prompt_input(": ");
/* should we deal with tilde and space in file name here ??? */
{
stamp_it(log_line);
strcat(log_line, "\n");
- fputs(log_line, log_file);
+ (void) fputs(log_line, log_file);
stampcopy(log_line);
strcat(log_line, "\n");
- fputs(log_line, log_file);
+ (void) fputs(log_line, log_file);
}
- fputs(tex_version, log_file);
- fprintf(log_file, " (%s %s)", application, yandyversion);
+ (void) fputs(tex_version, log_file);
+ (void) fprintf(log_file, " (%s %s)", application, yandyversion);
if (format_ident > 0)
slow_print(format_ident);
months = " JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
for (k = 3 * month - 2; k <= 3 * month; k++)
- putc(months[k], log_file);
+ (void) putc(months[k], log_file);
print_char(' ');
selector = old_setting + 2;
}
+
+// Attempt to deal with foo.bar.tex given as foo.bar on command line
+// Makes copy of job_name with extension
+
+void more_name_copy(ASCII_code c)
+{
+#ifdef ALLOCATESTRING
+ if (pool_ptr + 1 > current_pool_size)
+ str_pool = realloc_str_pool (increment_pool_size);
+
+ if (pool_ptr + 1 > current_pool_size)
+ {
+ overflow("pool size", current_pool_size - init_pool_ptr);
+ return;
+ }
+#else
+ if (pool_ptr + 1 > pool_size)
+ {
+ overflow("pool size", pool_size - init_pool_ptr);
+ return;
+ }
+#endif
+
+ str_pool[pool_ptr] = c;
+ incr(pool_ptr);
+}
+
+int end_name_copy(void)
+{
+#ifdef ALLOCATESTRING
+ if (str_ptr + 1 > current_max_strings)
+ str_start = realloc_str_start(increment_max_strings + 1);
+
+ if (str_ptr + 1 > current_max_strings)
+ {
+ overflow("number of strings", current_max_strings - init_str_ptr);
+ return 0;
+ }
+#else
+ if (str_ptr + 1 > max_strings)
+ {
+ overflow("number of strings", max_strings - init_str_ptr);
+ return 0;
+ }
+#endif
+
+ return make_string();
+}
+
+void job_name_append (void)
+{
+ int k, n;
+
+ k = str_start[job_name];
+ n = str_start[job_name + 1];
+
+ while (k < n)
+ more_name_copy(str_pool[k++]);
+
+ k = str_start[cur_ext];
+ n = str_start[cur_ext + 1];
+
+ while (k < n)
+ more_name_copy(str_pool[k++]);
+
+ job_name = end_name_copy();
+}
+
/* sec 0537 */
void start_input(void)
{
- boolean added_extension = false;
-
scan_file_name();
pack_file_name(cur_name, cur_area, cur_ext);
while (true)
{
- added_extension = false;
begin_file_reading();
- if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
+ if (a_open_in(input_file[index], TEXINPUTPATH))
goto lab30;
end_file_reading();
}
lab30:
- cur_input.name_field = a_make_name_string(input_file[cur_input.index_field]);
+ cur_input.name_field = a_make_name_string(input_file[index]);
if (job_name == 0)
{
fflush(stdout);
#endif
- cur_input.state_field = new_line;
+ state = new_line;
{
line = 1;
- if (input_ln(input_file[cur_input.index_field], false));
+ if (input_ln(input_file[index], false));
firm_up_the_line();
if ((end_line_char < 0) || (end_line_char > 255))
- decr(cur_input.limit_field);
+ decr(limit);
else
- buffer[cur_input.limit_field] = end_line_char;
+ buffer[limit] = end_line_char;
- first = cur_input.limit_field + 1;
- cur_input.loc_field = cur_input.start_field;
+ first = limit + 1;
+ loc = start;
}
}
/* sec 0560 */
internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
{
font_index k;
- eight_bits jfm_flag;
- halfword nt;
- KANJI_code cx;
boolean file_opened;
halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
int bc, ec;
read_sixteen(lf);
tfm_temp = getc(tfm_file);
read_sixteen(lh);
-
- if (lf == yoko_jfm_id)
- {
- jfm_flag = dir_yoko;
- nt = lh;
- tfm_temp = getc(tfm_file);
- read_sixteen(lf);
- tfm_temp = getc(tfm_file);
- read_sixteen(lh);
- }
- else if (lf == tate_jfm_id)
- {
- jfm_flag = dir_tate;
- nt = lh;
- tfm_temp = getc(tfm_file);
- read_sixteen(lf);
- tfm_temp = getc(tfm_file);
- read_sixteen(lh);
- }
- else
- {
- jfm_flag = dir_default;
- nt = 0;
- }
-
tfm_temp = getc(tfm_file);
read_sixteen(bc);
tfm_temp = getc(tfm_file);
tfm_temp = getc(tfm_file);
read_sixteen(np);
- if (jfm_flag != dir_default)
- {
- if (lf != 7 + lh + nt + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
- goto lab11;
- }
- else
- {
- if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
- goto lab11;
- }
+ if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
+ goto lab11;
if ((nw == 0) || (nh == 0) || (nd == 0) || (ni == 0))
goto lab11;
}
- if (jfm_flag != dir_default)
- lf = lf - 7 - lh;
- else
- lf = lf - 6 - lh;
+ lf = lf - 6 - lh;
if (np < 7)
lf = lf + 7 - np;
}
f = font_ptr + 1;
- font_dir[f] = jfm_flag;
- font_num_ext[f] = nt;
- ctype_base[f] = fmem_ptr;
- char_base[f] = ctype_base[f] + nt - bc;
+ char_base[f] = fmem_ptr - bc;
width_base[f] = char_base[f] + ec + 1;
height_base[f] = width_base[f] + nw;
depth_base[f] = height_base[f] + nh;
z =(z * 16) + (tfm_temp / 16);
if (z < 65536L)
- goto lab11;
+ goto lab11;
while (lh > 2)
{
font_size[f] = z;
}
- if (jfm_flag != dir_default)
- {
- for (k = ctype_base[f]; k <= ctype_base[f] + nt - 1; k++)
- {
- tfm_temp = getc(tfm_file);
- read_sixteen(cx);
- font_info[k].hh.rh = cx;
- tfm_temp = getc(tfm_file);
- read_sixteen(cx);
- font_info[k].hh.lh = cx;
- }
- }
-
- for (k = char_base[f] + bc; k <= width_base[f] - 1; k++)
+ for (k = fmem_ptr; k <= width_base[f] - 1; k++)
{
store_four_quarters(font_info[k].qqqq);
goto lab11;
}
- while (d < k - char_base[f])
+ while (d < k + bc - fmem_ptr)
{
qw = char_info(f, d);
d = rem_byte(qw);
}
- if (d == k - char_base[f])
+ if (d == k + bc - fmem_ptr)
goto lab11;
lab45:;
}
else
{
if (b != bchar)
- check_existence(b);
+ {
+ {
+ if ((b < bc) || (b > ec)) /* check-existence(b) */
+ goto lab11; /* error in TFM, abort */
+ }
+
+ qw = font_info[char_base[f] + b].qqqq;
+
+ if (!(qw.b0 > 0))
+ goto lab11; /* error in TFM, abort */
+ }
if (c < 128)
{
- if (jfm_flag != dir_default)
{
- if (d > ne)
- goto lab11;
+ if ((d < bc) || (d > ec)) /* check-existence(d) */
+ goto lab11; /* error in TFM, abort */
}
- else
- check_existence(d);
+
+ qw = font_info[char_base[f] + d].qqqq;
+
+ if (!(qw.b0 > 0))
+ goto lab11; /* error in TFM, abort */
}
else if (256 * (c - 128) + d >= nk)
goto lab11; /* error in TFM, abort */
}
for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
- store_scaled(font_info[k].cint);
-
- if (jfm_flag != dir_default)
{
- for (k = exten_base[f]; k < param_base[f] - 1; k++)
- store_scaled(font_info[k].cint);
+ tfm_temp = getc(tfm_file);
+ a = tfm_temp;
+ tfm_temp = getc(tfm_file);
+ b = tfm_temp;
+ tfm_temp = getc(tfm_file);
+ c = tfm_temp;
+ tfm_temp = getc(tfm_file);
+ d = tfm_temp;
+ sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
+
+ if (a == 0)
+ font_info[k].cint = sw;
+ else if (a == 255)
+ font_info[k].cint = sw - alpha;
+ else goto lab11;
}
- else
+
+ /* read extensible character recipes */
+ for (k = exten_base[f]; k <= param_base[f] - 1; k++)
{
- for (k = exten_base[f]; k <= param_base[f] - 1; k++)
+ store_four_quarters(font_info[k].qqqq);
+
+ if (a != 0)
{
- store_four_quarters(font_info[k].qqqq);
-
- if (a != 0)
- check_existence(a);
+ {
+ if ((a < bc) || (a > ec))
+ goto lab11;
+ }
+
+ qw = font_info[char_base[f] + a].qqqq;
+
+ if (!(qw.b0 > 0))
+ goto lab11;
+ }
- if (b != 0)
- check_existence(b);
+ if (b != 0)
+ {
+ {
+ if ((b < bc) || (b > ec))
+ goto lab11;
+ }
- if (c != 0)
- check_existence(c);
+ qw = font_info[char_base[f] + b].qqqq;
- check_existence(d);
+ if (!(qw.b0 > 0))
+ goto lab11;
+ }
+
+ if (c != 0)
+ {
+ {
+ if ((c < bc) || (c > ec))
+ goto lab11;
+ }
+
+ qw = font_info[char_base[f] + c].qqqq;
+
+ if (!(qw.b0 > 0))
+ goto lab11;
+ }
+
+ {
+ {
+ if ((d < bc) || (d > ec))
+ goto lab11;
+ }
+
+ qw = font_info[char_base[f] + d].qqqq;
+
+ if (!(qw.b0 > 0))
+ goto lab11;
}
}
font_info[param_base[f]].cint = (sw * 16) + (tfm_temp / 16);
}
else
- store_scaled(font_info[param_base[f] + k - 1].cint);
+ {
+ tfm_temp = getc(tfm_file);
+ a = tfm_temp;
+ tfm_temp = getc(tfm_file);
+ b = tfm_temp;
+ tfm_temp = getc(tfm_file);
+ c = tfm_temp;
+ tfm_temp = getc(tfm_file);
+ d = tfm_temp;
+ sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;
+
+ if (a == 0)
+ font_info[param_base[f] + k - 1].cint = sw;
+ else if (a == 255)
+ font_info[param_base[f] + k - 1].cint = sw - alpha;
+ else goto lab11;
+ }
if (feof(tfm_file))
goto lab11;
if (bchar <= ec)
if (bchar >= bc)
{
- qw = char_info(f, bchar);
+ qw = font_info[char_base[f] + bchar].qqqq;
if ((qw.b0 > 0))
- font_false_bchar[f] = non_char;
+ font_false_bchar[f] = 256;
}
font_name[f] = nom;
font_bc[f] = bc;
font_ec[f] = ec;
font_glue[f] = 0;
- ctype_base[f] = ctype_base[f];
char_base[f] = char_base[f];
width_base[f] = width_base[f];
lig_kern_base[f] = lig_kern_base[f];
dvi_out(x % 0400); // dvi_out(x & 255);
}
/* sec 0601 */
-void zdvipop(integer l)
+void dvi_pop_(integer l)
{
if ((l == dvi_offset + dvi_ptr) && (dvi_ptr > 0))
decr(dvi_ptr);
{
get_token();
}
- while(!(cur_tok == end_write_token));
+ while (!(cur_tok == end_write_token));
}
mode = oldmode;
pack_file_name(cur_name, cur_area, cur_ext);
- while(! a_open_out(write_file[j]))
+ while (! a_open_out(write_file[j]))
{
prompt_file_name("output file name", ".tex");
}
cur_h = cur_h + char_width(f, char_info(f, c));
p = link(p);
}
- while(!(!(p >= hi_mem_min)));
+ while (!(!is_char_node(p)));
dvi_h = cur_h;
}
while (p != 0)
{
- if ((p >= hi_mem_min))
+ if (is_char_node(p))
{
confusion("vlistout");
return; // abort_flag set
print_char('[');
j = 9;
- while((count(j) == 0) && (j > 0))
+ while ((count(j) == 0) && (j > 0))
decr(j);
for (k = 0; k <= j; k++)
pack_job_name(".dvi");
- while(!b_open_out(dvi_file))
+ while (!b_open_out(dvi_file))
{
prompt_file_name("file name for output", ".dvi");
}
while (p != 0)
{
lab21:
- while ((p >= hi_mem_min))
+ while (is_char_node(p))
{
f = font(p);
i = char_info(f, character(p));
{
if ((overfull_rule > 0) && (- (integer) x - total_shrink[0] > hfuzz))
{
- while(link(q) != 0)
+ while (link(q) != 0)
q = link(q);
link(q) = new_rule();
while (p != 0)
{
- if ((p >= hi_mem_min))
+ if (is_char_node(p))
{
confusion("vpack");
return 0; // abort_flag set
n = 0;
if (u > 0)
- while(w < v)
+ while (w < v)
{
w = w + u;
incr(n);
p = list_ptr(b);
- if (((p >= hi_mem_min)) && (link(p) == 0))
+ if ((is_char_node(p)) && (link(p) == 0))
{
f = font(p);
v = char_width(f, char_info(f, character(p)));
cur_mu = x_over_n(math_quad(cur_size), 18);
}
lab40:
- if ((q >= hi_mem_min) || (q == 0))
+ if (is_char_node(q) || (q == 0))
x = hpack(q, 0, 1);
else if ((link(q) == 0) && (type(q) <= vlist_node) && (shift_amount(q) == 0))
x = q;
q = list_ptr(x);
- if ((q >= hi_mem_min))
+ if (is_char_node(q))
{
r = link(q);
if (r != 0)
if (link(r) == 0)
- if (!(r >= hi_mem_min))
+ if (!is_char_node(r))
if (type(r) == kern_node)
{
free_node(r, small_node_size);
while (q != 0)
{
- if (!(q >= hi_mem_min))
+ if (!is_char_node(q))
if (type(q) == unset_node)
{
if (mode == -vmode)
r = link(link(r));
s = link(link(s));
}
- while(!(r == 0));
+ while (!(r == 0));
}
else if (type(q) == rule_node)
{
p = new_hlist(q);
- if ((p >= hi_mem_min))
+ if (is_char_node(p))
{
shift_up = 0;
shift_down = 0;
decr(t);
v = link(v);
- if ((v >= hi_mem_min))
+ if (is_char_node(v))
{
f = font(v);
break_width[1] = break_width[1] - char_width(f, char_info(f, character(v)));
while (s != 0)
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
{
f = font(s);
break_width[1] = break_width[1] + char_width(f, char_info(f, character(s)));
while (s != 0)
{
- if ((s >= hi_mem_min))
+ if (is_char_node(s))
goto lab30;
switch (type(s))
if (q == cur_break(cur_p))
goto lab31;
- if ((q >= hi_mem_min))
+ if (is_char_node(q))
goto lab31;
if (non_discardable(q))
if (ligature_present)
lft_hit = init_lft;
- while(p != 0) /* 94/Mar/22 BUG FIX */
+ while (p != 0) /* 94/Mar/22 BUG FIX */
{
append_charnode_to_t(character(p));
p = link(p);
incr(j);
incr(u);
}
- while(!(j > hn));
+ while (!(j > hn));
s = hyph_list[h];
v = hyf_next[v];
}
- while(!(v == min_trie_op));
+ while (!(v == min_trie_op));
}
incr(l);
link(ha) = 0;
bchar = hyfbchar;
- if ((ha >= hi_mem_min))
+ if (is_char_node(ha))
if (font(ha) != hf)
goto lab42;
else
}
else
{
- if (!(r >= hi_mem_min))
+ if (!is_char_node(r))
if (type(r) == ligature_node)
if (subtype(r) > 1)
goto lab42;
hyphen_passed = j - 1;
link(hold_head) = 0;
}
- while(!(! odd(hyf[j - 1])));
+ while (!(! odd(hyf[j - 1])));
}
- while(!(j > hn));
+ while (!(j > hn));
link(s) = q;
flush_list(init_list);
incr(u);
incr(v);
}
- while(!(u == str_start[k + 1]));
+ while (!(u == str_start[k + 1]));
lab40:
q = hyph_list[h];
hyph_list[h] = p;
prev_p = temp_head;
link(temp_head) = p;
- while(p != 0)
+ while (p != 0)
switch(type(p))
{
case hlist_node:
{
get_x_token();
}
- while(!((cur_cmd != spacer) && (cur_cmd != relax)));
+ while (!((cur_cmd != spacer) && (cur_cmd != relax)));
if (((cur_cmd == hskip) && (abs(mode) != vmode)) || ((cur_cmd == vskip) && (abs(mode) == vmode)))
{
}
else
{
- if (!(tail >= hi_mem_min))
+ if (!is_char_node(tail))
if ((type(tail) == hlist_node) || (type(tail) == vlist_node))
{
q = head;
{
p = q;
- if (!(q >= hi_mem_min))
+ if (!is_char_node(q))
if (type(q) == disc_node)
{
for (m = 1; m <= replace_count(q); m++)
back_input();
cur_tok = par_token;
back_input();
- cur_input.index_field = inserted;
+ index = inserted;
}
}
/* sec 1096 */
}
else
{
- if (!(tail >= hi_mem_min))
+ if (!is_char_node(tail))
if (type(tail) == cur_chr)
{
q = head;
{
p = q;
- if (!(q >= hi_mem_min))
+ if (!is_char_node(q))
if (type(q) == disc_node)
{
for (m = 1; m <= replace_count(q); m++)
if (tail != head)
{
- if ((tail >= hi_mem_min))
+ if (is_char_node(tail))
p = tail;
else if (type(tail) == ligature_node)
p = tail + 1;
while (p != 0)
{
- if (!(p >= hi_mem_min))
+ if (!is_char_node(p))
if (type(p) > rule_node)
if (type(p) != kern_node)
if (type(p) != ligature_node)
while (p != 0)
{
lab21:
- if ((p >= hi_mem_min))
+ if (is_char_node(p))
{
f = font(p);
d = char_width(f, char_info(f, character(p)));
{
get_x_token();
}
- while(!((cur_cmd != spacer) && (cur_cmd != relax)));
+ while (!((cur_cmd != spacer) && (cur_cmd != relax)));
lab21:
switch (cur_cmd)
mlist_to_hlist();
link(tail) = link(temp_head);
- while(link(tail) != 0)
+ while (link(tail) != 0)
tail = link(tail);
tail_append(new_math(math_surround, 1));
d = half(z - w - e);
if (p != 0)
- if (!(p >= hi_mem_min))
+ if (!is_char_node(p))
if (type(p) == glue_node)
d = 0;
}
l1 = length(cur_area);
l2 = length(cur_name);
show_char('\n');
- show_line("FONT ", 0);
+ puts("FONT ");
for (i = 0; i < l1; i++)
{
if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH))
read_open[n] = 1;
- else if ((cur_ext != 785) && (name_length + 5 < PATH_MAX))
+ else if ((cur_ext != 785) && (name_length + 5 < file_name_size))
{
strncpy((char *) name_of_file + name_length + 1, ".tex ", 5);
name_length = name_length + 4;
break;
case output_group:
{
- if ((cur_input.loc_field != 0) || ((token_type != output_text) && (token_type != backed_up)))
+ if ((loc != 0) || ((token_type != output_text) && (token_type != backed_up)))
{
print_err("Unbalanced output routine");
help2("Your sneaky output routine has problematic {'s and/or }'s.",
{
get_token();
}
- while (!(cur_input.loc_field == 0));
+ while (!(loc == 0));
}
end_token_list();
{
q = head;
- while(link(q) != tail)
+ while (link(q) != tail)
q = link(q);
link(q) = p;
{
get_x_token();
}
- while(!(cur_cmd != spacer));
+ while (!(cur_cmd != spacer));
goto lab21;
}
break;
cur_l = character(lig_stack);
lab91:
- if (!(lig_stack >= hi_mem_min))
+ if (!is_char_node(lig_stack))
goto lab95;
lab92:
lig_stack = new_lig_item(cur_r);
bchar = non_char;
}
- else if ((lig_stack >= hi_mem_min))
+ else if (is_char_node(lig_stack))
{
main_p = lig_stack;
lig_stack = new_lig_item(cur_r);
{
integer j;
- j = cur_input.loc_field;
+ j = loc;
- if (buffer[cur_input.loc_field] == '&' || buffer[cur_input.loc_field] == '+')
+ if (buffer[loc] == '&' || buffer[loc] == '+')
{
- incr(cur_input.loc_field);
- j = cur_input.loc_field;
+ incr(loc);
+ j = loc;
buffer[last] = ' ';
while (buffer[j] != ' ')
incr(j);
- pack_buffered_name(0, cur_input.loc_field, j - 1);
+ pack_buffered_name(0, loc, j - 1);
if (w_open_in(fmt_file))
goto lab40;
}
lab40:
- cur_input.loc_field = j;
+ loc = j;
return true;
}
if (closed_already++)
{
- show_line("close_files_and_terminated already ", 0);
+ puts("close_files_and_terminated already ");
return; // sanity check
}
if (trace_flag)
- show_line("\nclose_files_and_terminate ", 0);
+ puts("\nclose_files_and_terminate ");
for (k = 0; k <= 15; k++)
if (write_open[k])
+#ifndef _YANDYTEX_TEXD_H
+#define _YANDYTEX_TEXD_H
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
#define ALLOCATEINI /* allocate iniTeX (550 k) trie_c, trie_o, trie_l, trie_r, trie_hash, trie_taken */
#define ALLOCATEMAIN /* allocate main memory for TeX (2 Meg) zmem = zzzaa */
#define COMPACTFORMAT
#define STAT
-#include "yandytex.h"
-
-enum {
- out_dvi_flag = (1 << 0),
- out_pdf_flag = (1 << 1),
- out_xdv_flag = (1 << 2),
- out_dpx_flag = (1 << 3),
-};
-
-#define INLINE inline
-
-#define dump_file fmt_file
-#define out_file dvi_file
-
-/* Read a line of input as quickly as possible. */
-extern boolean input_line (FILE *);
-#define input_ln(stream, flag) input_line(stream)
-
-/* `b_open_in' (and out) is used only for reading (and writing) .tfm
- files; `w_open_in' (and out) only for dump files. The filenames are
- passed in as a global variable, `name_of_file'. */
-
-#define b_open_in(f) open_input (&(f), TFMFILEPATH, FOPEN_RBIN_MODE)
-#define w_open_in(f) open_input (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
-#define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
-#define w_open_out b_open_out
-#define b_close a_close
-#define w_close a_close
-#define gz_w_close gzclose
-
-/* sec 0241 */
-#define fix_date_and_time() get_date_and_time (&(tex_time), &(day), &(month), &(year))
-
-/* If we're running under Unix, use system calls instead of standard I/O
- to read and write the output files; also, be able to make a core dump. */
-#ifndef unix
- #define dumpcore() exit(1)
-#else /* unix */
- #define dumpcore abort
-#endif
-
-#define write_dvi(a, b) \
- if ((size_t) fwrite ((char *) &dvi_buf[a], sizeof (dvi_buf[a]), \
- (size_t) ((size_t)(b) - (size_t)(a) + 1), dvi_file) \
- != (size_t) ((size_t)(b) - (size_t)(a) + 1)) \
- FATAL_PERROR ("\n! dvi file")
-
-extern int do_dump (char *, int, int, FILE *);
-extern int do_undump (char *, int, int, FILE *);
-
-/* Reading and writing the dump files. `(un)dumpthings' is called from
- the change file.*/
-#define dumpthings(base, len) \
- do_dump ((char *) &(base), sizeof (base), (int) (len), dump_file)
-
-#define undumpthings(base, len) \
- do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
-
-/* Use the above for all the other dumping and undumping. */
-#define generic_dump(x) dumpthings (x, 1)
-#define generic_undump(x) undumpthings (x, 1)
-
-#define dump_wd generic_dump
-#define undump_wd generic_undump
-#define dump_hh generic_dump
-#define undump_hh generic_undump
-#define dump_qqqq generic_dump
-#define undump_qqqq generic_undump
-
-/* `dump_int' is called with constant integers, so we put them into a
- variable first. */
-#define dump_int(x) \
- do \
- { \
- integer x_val = (x); \
- generic_dump (x_val); \
- } \
- while (0)
-
-/* web2c/regfix puts variables in the format file loading into
- registers. Some compilers aren't willing to take addresses of such
- variables. So we must kludge. */
-#ifdef REGFIX
-#define undump_int(x) \
- do \
- { \
- integer x_val; \
- generic_undump (x_val); \
- x = x_val; \
- } \
- while (0)
-#else
-#define undump_int generic_undump
-#endif
-
-
-/* If we're running on an ASCII system, there is no need to use the
- `xchr' array to convert characters to the external encoding. */
-
-#define Xchr(x) xchr[x]
+#include "texmf.h"
-/* following added from new texmf.c file 1996/Jan/12 */
-/* these, of course are useless definitions since parameters not given */
-
-/* Declare routines in texmf.c. */
-extern void t_open_in();
-#include "yandy_macros.h"
+#define file_name_size PATH_MAX
// #define max_halfword 65535L /* for 32 bit memory word */
#define min_halfword -2147483647L /* for 64 bit memory word (signed) */
typedef char two_choices;
typedef char four_choices;
/* sec 0113 */
-/*
- meaning structure TeX Y&Y TeX
- ----------------------------------------------------------------------
- integer | int || 4: long | 8: long long | min_quarterword 0
- ---------------------------------------------------------------------- max_quarterword FFFF
- scaled | sc || 4: long | 8: long long | min_halfword
- ----------------------------------------------------------------------
- glue_ratio | gr || 4: float | 8: double |
- ----------------------------------------------------------------------
- halfword | lh | rh || 2: unsigned short | 4: unsigned long |
- ----------------------------------------------------------------------
- half+quarter | b0 | b1 | rh || |
- ----------------------------------------------------------------------
- quarter | b0 | b1 | b2 | b3 || 1: unsigned char | 2: unsigned short |
- ----------------------------------------------------------------------
-*/
-
-typedef struct
-{
-#ifdef WORDS_BIGENDIAN
- halfword rh;
-
- union
- {
- halfword lh;
-
- struct
- {
- quarterword b0, b1;
- };
- };
-#endif
-} two_halves;
-
-typedef struct
-{
-#ifdef WORDS_BIGENDIAN
- quarterword b0, b1, b2, b3;
-#else
- quarterword b3, b2, b1, b0;
-#endif
-} four_quarters;
-
-typedef union
-{
- glue_ratio gr;
- two_halves hh;
- integer cint;
- four_quarters qqqq;
-} memory_word;
-
-#ifndef WORDS_BIGENDIAN
- #define cint u.CINT
- #define qqqq v.QQQQ
-#endif
+#include "texmfmem.h"
/* sec 0150 */
typedef char glue_ord;
/* sec 0212 */
EXTERN integer bad;
EXTERN ASCII_code xord[256];
EXTERN ASCII_code xchr[256];
-EXTERN unsigned char name_of_file[PATH_MAX + 4];
+EXTERN unsigned char name_of_file[file_name_size + 4];
EXTERN integer name_length;
#ifdef ALLOCATESTRING
/* sec 0116 */
#ifdef ALLOCATEMAIN
- EXTERN memory_word * main_memory;
+ EXTERN memory_word * main_memory; /* remembered so can be free() later */
EXTERN memory_word * mem;
#else
EXTERN memory_word
+ /* #define zmem (zzzaa - (int)(mem_min)) */
+ /* zzzaa[mem_max - mem_min + 1]; */
#define zmem (zzzaa - (int)(mem_bot))
zzzaa[mem_max - mem_bot + 1];
#endif
#endif
#ifdef ALLOCATEZEQTB
- EXTERN memory_word * eqtb;
+ EXTERN memory_word * zeqtb;
#else
#ifdef INCREASEFONTS
- EXTERN memory_word eqtb[eqtb_size + 1];
+ EXTERN memory_word eqtb[(hash_size + 4007) + eqtb_extra];
#else
- EXTERN memory_word eqtb[eqtb_size + 1];
+ EXTERN memory_word zeqtb[(hash_size + 4007)];
#endif
#endif
EXTERN memory_word font_info[font_mem_size + 1];
#endif
-EXTERN eight_bits font_dir[font_max + 1];
-EXTERN integer font_num_ext[font_max + 1];
EXTERN font_index fmem_ptr;
EXTERN internal_font_number font_ptr;
EXTERN internal_font_number frozen_font_ptr;
EXTERN integer skew_char[font_max + 1];
EXTERN font_index bchar_label[font_max + 1];
EXTERN short font_bchar[font_max + 1];
+/* don't change above to int or format file will be incompatible */
EXTERN short font_false_bchar[font_max + 1];
+/* don't change above to int or format file will be incompatible */
EXTERN integer char_base[font_max + 1];
-EXTERN integer ctype_base[font_max + 1];
EXTERN integer width_base[font_max + 1];
EXTERN integer height_base[font_max + 1];
EXTERN integer depth_base[font_max + 1];
EXTERN trie_pointer *trie_l; /* left subtrie links */
EXTERN trie_pointer *trie_r; /* right subtrie links */
EXTERN trie_pointer *trie_hash; /* used to identify equivlent subtries */
- #else /* end ALLOCATEINI */
+ #else
EXTERN packed_ASCII_code trie_c[trie_size + 1];
EXTERN trie_op_code trie_o[trie_size + 1];
EXTERN trie_pointer trie_l[trie_size + 1];
EXTERN trie_pointer trie_r[trie_size + 1];
EXTERN trie_pointer trie_hash[trie_size + 1];
- #endif /* end not ALLOCATEINI */
+ #endif
+
EXTERN trie_pointer trie_ptr;
-#endif /* INITEX */
+#endif
#ifdef INITEX
#ifdef ALLOCATEINI
EXTERN halfword page_tail;
EXTERN int page_contents;
+/* do *some* sanity checking here --- rather than in TeX later 96/Jan/18 */
/* (cannot catch everything here, since some is now dynamic) */
#if (half_error_line < 30) || (half_error_line > error_line - 15)
EXTERN integer edit_name_length, edit_line;
EXTERN int tfm_temp;
-/* new stuff defined in local.c - bkph */
+/* new variables defined in local.c */
EXTERN boolean is_initex;
EXTERN boolean verbose_flag;
EXTERN boolean trace_flag;
EXTERN boolean restrict_to_ascii;
EXTERN boolean show_missing;
EXTERN boolean full_file_name_flag;
-EXTERN boolean save_strings_flag;
EXTERN int mem_initex;
EXTERN int mem_extra_high;
EXTERN int mem_extra_low;
void add_variable_space(int);
-void get_date_and_time (integer *, integer *, integer *, integer *);
-
-//void get_date_and_time (integer *minutes, integer *day,
-// integer *month, integer *year);
+void get_date_and_time (integer *minutes, integer *day,
+ integer *month, integer *year);
char *unixify (char *);
-//#include "yandy_macros.h"
+#include "yandy_macros.h"
#include "coerce.h"
/* sec 79 */
EXTERN void pdf_begin_text(void);
EXTERN void pdf_font_def(internal_font_number f);
EXTERN void pdf_error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user_data);
-/********BINDING WITH LIBHARU*********/
\ No newline at end of file
+/********BINDING WITH LIBHARU*********/
+#endif
\ No newline at end of file
--- /dev/null
+/* Main include file for TeX in C. Originally by Tim Morgan,
+ December 23, 1987. These routines are also used by Metafont (with
+ some name changes).
+
+ Copyright 1992 Karl Berry
+ Copyright 2007 TeX Users Group
+ Copyright 2014 Clerk Ma
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA. */
+
+#include "yandytex.h"
+
+enum {
+ out_dvi_flag = (1 << 0),
+ out_pdf_flag = (1 << 1),
+ out_xdv_flag = (1 << 2),
+ out_dpx_flag = (1 << 3),
+};
+
+#define INLINE inline
+
+#define dump_file fmt_file
+#define out_file dvi_file
+
+/* Read a line of input as quickly as possible. */
+extern boolean input_line (FILE *);
+#define input_ln(stream, flag) input_line(stream)
+
+#define b_open_in(f) open_input (&(f), TFMFILEPATH, FOPEN_RBIN_MODE)
+#define w_open_in(f) open_input (&(f), TEXFORMATPATH, FOPEN_RBIN_MODE)
+#define b_open_out(f) open_output (&(f), FOPEN_WBIN_MODE)
+#define w_open_out b_open_out
+#define b_close a_close
+#define w_close a_close
+#define gz_w_close gzclose
+
+/* sec 0241 */
+#define fix_date_and_time() get_date_and_time (&(tex_time), &(day), &(month), &(year))
+
+/* If we're running under Unix, use system calls instead of standard I/O
+ to read and write the output files; also, be able to make a core dump. */
+#ifndef unix
+ #define dumpcore() exit(1)
+#else /* unix */
+ #define dumpcore abort
+#endif
+
+#define write_dvi(a, b) \
+ if ((size_t) fwrite ((char *) &dvi_buf[a], sizeof (dvi_buf[a]), \
+ (size_t) ((size_t)(b) - (size_t)(a) + 1), dvi_file) \
+ != (size_t) ((size_t)(b) - (size_t)(a) + 1)) \
+ FATAL_PERROR ("\n! dvi file")
+
+extern int do_dump (char *, int, int, FILE *);
+extern int do_undump (char *, int, int, FILE *);
+
+/* Reading and writing the dump files. `(un)dumpthings' is called from
+ the change file.*/
+#define dumpthings(base, len) \
+ do_dump ((char *) &(base), sizeof (base), (int) (len), dump_file)
+
+#define undumpthings(base, len) \
+ do_undump ((char *) &(base), sizeof (base), (int) (len), dump_file)
+
+/* Use the above for all the other dumping and undumping. */
+#define generic_dump(x) dumpthings (x, 1)
+#define generic_undump(x) undumpthings (x, 1)
+
+#define dump_wd generic_dump
+#define undump_wd generic_undump
+#define dump_hh generic_dump
+#define undump_hh generic_undump
+#define dump_qqqq generic_dump
+#define undump_qqqq generic_undump
+
+#define dump_int(x) \
+ do \
+ { \
+ integer x_val = (x); \
+ generic_dump (x_val); \
+ } \
+ while (0)
+
+#define undump_int generic_undump
+
+extern void t_open_in();
\ No newline at end of file
--- /dev/null
+/* Copyright 1992 Karl Berry
+ Copyright 2007 TeX Users Group
+ Copyright 2014 Clerk Ma
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA. */
+
+/*
+ meaning structure TeX Y&Y TeX
+ ----------------------------------------------------------------------
+ integer | int || 4: long | 8: long long | min_quarterword 0
+ ---------------------------------------------------------------------- max_quarterword FFFF
+ scaled | sc || 4: long | 8: long long | min_halfword
+ ----------------------------------------------------------------------
+ glue_ratio | gr || 4: float | 8: double |
+ ----------------------------------------------------------------------
+ halfword | lh | rh || 2: unsigned short | 4: unsigned long |
+ ----------------------------------------------------------------------
+ half+quarter | b0 | b1 | rh || |
+ ----------------------------------------------------------------------
+ quarter | b0 | b1 | b2 | b3 || 1: unsigned char | 2: unsigned short |
+ ----------------------------------------------------------------------
+*/
+
+typedef struct
+{
+#ifdef WORDS_BIGENDIAN
+ halfword rh;
+
+ union
+ {
+ halfword lh;
+
+ struct
+ {
+ quarterword b0, b1;
+ };
+ };
+#endif
+} two_halves;
+
+typedef struct
+{
+#ifdef WORDS_BIGENDIAN
+ quarterword b0, b1, b2, b3;
+#else
+ quarterword b3, b2, b1, b0;
+#endif
+} four_quarters;
+
+typedef union
+{
+ glue_ratio gr;
+ two_halves hh;
+ integer cint;
+ four_quarters qqqq;
+} memory_word;
\ No newline at end of file
print_char('[');
j = 9;
- while((count(j) == 0) && (j > 0))
+ while ((count(j) == 0) && (j > 0))
decr(j);
for (k = 0; k <= j; k++)
pack_job_name(".pdf");
- while(!b_open_out(pdf_file))
+ while (!b_open_out(pdf_file))
{
prompt_file_name("file name for output", ".pdf");
}
cur_h = cur_h + char_width(f, char_info(f, c));
p = link(p);
}
- while(((p >= hi_mem_min)));
+ while (((p >= hi_mem_min)));
dvi_h = cur_h;
}
#define null_code 0 // 0
#define carriage_return 015 // 13
#define invalid_code 0177 // 127
+/* sec 0036 */
+#define loc cur_input.loc_field
/* sec 0040 */
#define length(s) (str_start[(s) + 1] - str_start[(s)])
/* sec 0041 */
//#define pointer halfword
#define null min_halfword
/* sec 0118 */
-#define link(p) mem[(p)].hh.rh
-#define info(p) mem[(p)].hh.lh
+#define link(p) mem[p].hh.rh
+#define info(p) mem[p].hh.lh
/* sec 0122 */
#ifdef STAT
#define fast_get_avail(a) \
#define space_skip_code 12 // 794
#define xspace_skip_code 13 // 795
#define par_fill_skip_code 14 // 796
-#define kanji_skip_code 15 // 000 797
-#define xkanji_skip_code 16 //
-#define thin_mu_skip_code 17 //15 // 797
-#define med_mu_skip_code 18 //16 // 798
-#define thick_mu_skip_code 19 //17 // 799
-#define jfm_skip 20 //
-#define glue_pars 21 //18 // 800
+#define thin_mu_skip_code 15 // 797
+#define med_mu_skip_code 16 // 798
+#define thick_mu_skip_code 17 // 799
+#define glue_pars 18 // 800
#define skip_base (glue_base + glue_pars) // 800
#define mu_skip_base (skip_base + 256) // 1056
#define local_base (mu_skip_base + 256) // 1312
#define space_skip glue_par(space_skip_code)
#define xspace_skip glue_par(xspace_skip_code)
#define par_fill_skip glue_par(par_fill_skip_code)
-#define kanji_skip glue_par(kanji_skip_code)
-#define xkanji_skip glue_par(xkanji_skip_code)
#define thin_mu_skip glue_par(thin_mu_skip_code)
#define med_mu_skip glue_par(med_mu_skip_code)
#define thick_mu_skip glue_par(thick_mu_skip_code)
#define box_base (toks_base + 256) // 1578
#define cur_font_loc (box_base + 256) // 1834
#define math_font_base (cur_font_loc + 1) // 1835
-#define cur_jfont_loc (math_font_base + 48)
-#define cur_tfont_loc (cur_jfont_loc + 1)
-#define auto_spacing_code (cur_tfont_loc + 1)
-#define auto_xspacing_code (auto_spacing_code + 1)
-#define cat_code_base (auto_xspacing_code + 1) //(math_font_base + 48) // 1883
-#define kcat_code_base (cat_code_base + 256)
-#define auto_xsp_code_base (kcat_code_base + 256)
-#define inhibit_xsp_code_base (auto_xsp_code_base + 256)
-#define kinsoku_base (inhibit_xsp_code_base + 256)
-#define kansuji_base (kinsoku_base + 256)
-#define lc_code_base (kansuji_base + 10) //(cat_code_base + 256) // 2139
+#define cat_code_base (math_font_base + 48) // 1883
+#define lc_code_base (cat_code_base + 256) // 2139
#define uc_code_base (lc_code_base + 256) // 2395
#define sf_code_base (uc_code_base + 256) // 2651
#define math_code_base (sf_code_base + 256) // 2907
#define box(a) equiv(box_base + a)
#define cur_font equiv(cur_font_loc)
#define fam_fnt(a) equiv(math_font_base + a)
-#define cur_jfont equiv(cur_jfont_loc)
-#define cur_tfont equiv(cur_tfont_loc)
-#define auto_spacing equiv(auto_spacing_code)
-#define auto_xspacing equiv(auto_xspacing_code)
#define cat_code(a) equiv(cat_code_base + a)
-#define kcat_code(a) equiv(kcat_code_base + a)
-#define auto_xsp_code(a) equiv(auto_xsp_code_base + a)
-#define inhibit_xsp_type(a) eq_type(inhibit_xsp_code_base + a)
-#define inhibit_xsp_code(a) equiv(inhibit_xsp_code_base + a)
-#define kinsoku_type(a) eq_type(kinsoku_base + a)
-#define kinsoku_code(a) equiv(kinsoku_base + a)
-#define kansuji_char(a) equiv(kansuji_base + a)
#define lc_code(a) equiv(lc_code_base + a)
#define uc_code(a) equiv(uc_code_base + a)
#define sf_code(a) equiv(sf_code_base + a)
#define floating_penalty_code 42 // 3205
#define global_defs_code 43 // 3206
#define cur_fam_code 44 // 3207
-#define cur_jfam_code 45
-#define escape_char_code 46 //45 // 3208
-#define default_hyphen_char_code 47 //46 // 3209
-#define default_skew_char_code 48 //47 // 3210
-#define end_line_char_code 49 //48 // 3211
-#define new_line_char_code 50 //49 // 3212
-#define language_code 51 //50 // 3213
-#define left_hyphen_min_code 52 //51 // 3214
-#define right_hyphen_min_code 53 //52 // 3215
-#define holding_inserts_code 54 //53 // 3216
-#define error_context_lines_code 55 //54 // 3217
-#define jchr_widow_penalty_code 56
-#define int_pars 57 //55
+#define escape_char_code 45 // 3208
+#define default_hyphen_char_code 46 // 3209
+#define default_skew_char_code 47 // 3210
+#define end_line_char_code 48 // 3211
+#define new_line_char_code 49 // 3212
+#define language_code 50 // 3213
+#define left_hyphen_min_code 51 // 3214
+#define right_hyphen_min_code 52 // 3215
+#define holding_inserts_code 53 // 3216
+#define error_context_lines_code 54 // 3217
+#define int_pars 55
#define count_base (int_base + int_pars) // 3218
#define del_code_base (count_base + 256) // 3474
#define dimen_base (del_code_base + 256) // 3730
#define floating_penalty int_par(floating_penalty_code)
#define global_defs int_par(global_defs_code)
#define cur_fam int_par(cur_fam_code)
-#define cur_jfam int_par(cur_jfam_code)
#define escape_char int_par(escape_char_code)
#define default_hyphen_char int_par(default_hyphen_char_code)
#define default_skew_char int_par(default_skew_char_code)
#define right_hyphen_min int_par(right_hyphen_min_code)
#define holding_inserts int_par(holding_inserts_code)
#define error_context_lines int_par(error_context_lines_code)
-#define jchr_widow_penalty int_par(jchr_widow_penalty_code)
/* sec 0247 */
#define par_indent_code 0 // 3730
#define math_surround_code 1 // 3731
#define h_offset_code 18 // 3748
#define v_offset_code 19 // 3749
#define emergency_stretch_code 20 // 3750
-#define t_baseline_shift_code 21
-#define y_baseline_shift_code 22
-#define dimen_pars 23 //21
+#define dimen_pars 21
#define scaled_base (dimen_base + dimen_pars) // 3751
-#define kinsoku_penalty_base (scaled_base + 256)
-#define eqtb_size (kinsoku_penalty_base + 255) //(scaled_base + 255) // 4006
+#define eqtb_size (scaled_base + 255) // 4006
// #
#define dimen(a) eqtb[scaled_base + a].cint
#define dimen_par(a) eqtb[dimen_base + a].cint
-#define kinsoku_penalty(a) eqtb[kinsoku_penalty_base + a].cint
#define par_indent dimen_par(par_indent_code)
#define math_surround dimen_par(math_surround_code)
#define line_skip_limit dimen_par(line_skip_limit_code)
#define hang_indent dimen_par(hang_indent_code)
#define h_offset dimen_par(h_offset_code)
#define v_offset dimen_par(v_offset_code)
-#define t_baseline_shift dimen_par(t_baseline_shift_code)
-#define y_baseline_shift dimen_par(y_baseline_shift_code)
#define emergency_stretch dimen_par(emergency_stretch_code)
/* sec 0256 */
#define text(a) hash[a].rh
#define other_token 06000 // 3072 = 2^8 * other_char
#define match_token 06400 // 3328 = 2^8 * match
#define end_match_token 07000 // 3584 = 2^8 * end_match
+/* sec 0302 */
+#define state cur_input.state_field
+#define index cur_input.index_field
+#define start cur_input.start_field
+#define limit cur_input.limit_field
+//#define name
/* sec 0303 */
#define mid_line 1
#define skip_blanks 2 + max_char_code // 17
#define absorbing 5
/* sec 0307 */
#define token_list 0
-#define token_type cur_input.index_field
-#define param_start cur_input.limit_field
+#define token_type index
+#define param_start limit
#define parameter 0
#define u_template 1
#define v_template 2
#define mu_val 3
#define ident_val 4
#define tok_val 5
+/* sec 0413 */
+#define scanned_result(va, vb) \
+do \
+ { \
+ cur_val = va; \
+ cur_val_level = vb; \
+ } \
+while (0)
/* sec 0416 */
#define input_line_no_code (glue_val + 1)
#define badness_code (glue_val + 2)
#define fi_code 2
#define else_code 3
#define or_code 4
-/* sec 0519 */
-#define append_to_name(s) \
- do \
- { \
- c = s; \
- incr(k); \
- \
- if (k <= PATH_MAX) \
- name_of_file[k] = xchr[c];\
- } \
- while (0)
/* sec 0544 */
#define no_tag 0
#define lig_tag 1
-#define gk_tag 1
#define list_tag 2
#define ext_tag 3
/* sec 0545 */
#define non_address 0
/* sec 0554 */
#define char_info(a, b) font_info[char_base[a] + b].qqqq
-#define kchar_code(a, b) font_info[ctype_base[a] + b].hh.rh
-#define kchar_type(a, b) font_info[ctype_base[a] + b].hh.lh
#define char_width(a, b) font_info[width_base[a] + b.b0].cint
#define char_exists(a) (a.b0 > min_quarterword)
#define char_italic(a, b) font_info[italic_base[a] + (b.b2) / 4].cint
val = qw; \
}
/* sec 0571 */
-#define store_scaled(s) \
- do \
- { \
- tfm_temp = getc(tfm_file); \
- a = tfm_temp; \
- tfm_temp = getc(tfm_file); \
- b = tfm_temp; \
- tfm_temp = getc(tfm_file); \
- c = tfm_temp; \
- tfm_temp = getc(tfm_file); \
- d = tfm_temp; \
- sw = (((((d * z) / 256) + (c * z)) / 256) + (b * z)) / beta;\
- \
- if (a == 0) \
- s = sw; \
- else if (a == 255) \
- s = sw - alpha; \
- else \
- goto lab11; \
- } \
- while (0)
-/* sec 0573 */
-#define check_existence(s) \
- do \
- { \
- if ((s < bc) || (s > ec)) \
- goto lab11; \
- \
- qw = char_info(f, s); \
- \
- if (!(qw.b0 > 0)) \
- goto lab11; \
- } \
- while (0)
/* sec 0585 */
#define set1 128 // c[1]
#define set2 129 // c[2]
#define show_box_code 1
#define show_the_code 2
#define show_lists 3
-#define show_mode 4
+/* sec 1306 */
+#define undump(va, vb, vc) \
+do \
+ { \
+ undump_int(x); \
+ \
+ if ((x < (va)) || (x > (vb))) \
+ goto lab_bad_fmt; \
+ else \
+ vc = x; \
+ } \
+while (0)
/* sec 1342 */
#define write_node_size 2
#define open_node_size 3
#define immediate_code 4
#define set_language_code 5
/* sec 1371 */
-#define end_write_token (cs_token_flag + end_write)
-
-/* Appendix: pTeX*/
-// direction
-#define dir_default 0 // {direction of the box, default Left to Right}
-#define dir_dtou 1 // {direction of the box, Bottom to Top}
-#define dir_tate 3 // {direction of the box, Top to Bottom}
-#define dir_yoko 4 // {direction of the box, equal default}
-// jfm
-#define yoko_jfm_id 11 // {for `yoko-kumi' fonts}
-#define tate_jfm_id 9 // {for `tate-kumi' fonts}
\ No newline at end of file
+#define end_write_token (cs_token_flag + end_write)
\ No newline at end of file
/* 0782 */ "", //"I can't find file `",
/* 0783 */ "", //"I can't write on file `",
/* 0784 */ "", //"'.",
-/* 0785 */ ".tex",
+/* 0785 */ "", //".tex",
/* 0786 */ "", //"Please type another ",
/* 0787 */ "", //"*** (job aborted, file error in nonstop mode)",
/* 0788 */ "", //".dvi",
#define edit_value tex_edit_value
extern char * replacement[];
-
-/* The main program, etc. */
-/* What we were invoked as and with. */
-
-static char *program_name = NULL;
+static char * program_name = NULL;
int gargc; /* number of args - set to zero after initialization */
-char **gargv; /* char *gargv[] -- bkph ? */
+char **gargv;
/* The entry point: set up for reading the command line, which will
happen in `t_open_in', then call the main body. */
}
if (clock < 0)
- {
- show_line("Time not available!\n", 1);
- }
+ puts("Time not available!\n");
tmptr = localtime (&clock);
{
if (signal(SIGINT, catch_interrupt) == SIG_ERR)
{
- show_line(" CTRL-C handler not installed\n", 0);
+ puts(" CTRL-C handler not installed\n");
#ifndef _WINDOWS
- uexit(1); /* do we care when run as DLL ? */
+ uexit(EXIT_FAILURE); /* do we care when run as DLL ? */
#endif
}
}
if (output == stderr)
show_line(log_line, 1);
+ else if (output == stdout)
+ show_line(log_line, 0);
else
- if (output == stdout)
- show_line(log_line, 0);
- else
- fputs(log_line, output); // never
+ fputs(log_line, output); // never
- show_line(" (File may have a line termination problem.)", 0);
+ puts(" (File may have a line termination problem.)");
}
void show_bad_line (FILE *output, int first, int last)
last--; /* just in case */
}
else
- uexit(1); /* line too long */
+ uexit(EXIT_FAILURE); /* line too long */
}
return input_line_finish();
sprintf(log_line, "! `%%d' cannot appear twice in editor command.\n");
show_line(log_line, 1);
#endif
- uexit(1);
+ uexit(EXIT_FAILURE);
}
(void) sprintf (s, "%d", linenumber);
sprintf(log_line, "! `%%s' cannot appear twice in editor command.\n");
show_line(log_line, 1);
#endif
- uexit(1);
+ uexit(EXIT_FAILURE);
}
t = (char *) texfilename;
sprintf(log_line, "! `%%l' cannot appear twice in editor command.\n");
show_line(log_line, 1);
#endif
- uexit(1);
+ uexit(EXIT_FAILURE);
}
t = (char *) log_file_name;
{
sprintf(log_line, "Command too long (%d > %d)\n", strlen(command) + 1, commandlen);
show_line(log_line, 1);
- uexit(1);
+ uexit(EXIT_FAILURE);
}
//flushall();
sprintf(log_line, " (TEXEDIT=%s)\n", edit_value);
show_line(log_line, 0);
- show_line(" (Editor specified may be missing or path may be wrong)\n", 0);
- show_line(" (or there may be missing -- or extraneous -- quotation signs)\n", 0);
+ puts(" (Editor specified may be missing or path may be wrong)\n");
+ puts(" (or there may be missing -- or extraneous -- quotation signs)\n");
}
- uexit(1);
+ uexit(EXIT_FAILURE);
}
/* Read and write format (for TeX) or base (for Metafont) files. In
show_line("\n", 0);
sprintf(log_line, "! I can't (un)dump a %d byte item.\n", size);
show_line(log_line, 1);
- uexit(1);
+ uexit(EXIT_FAILURE);
}
return 0;
}
sprintf(log_line, "! Could not write %d %d-byte item%s.\n",
nitems, item_size, (nitems > 1) ? "s" : "");
show_line(log_line, 1);
- uexit(1);
+ uexit(EXIT_FAILURE);
}
/* Have to restore the old contents of memory, since some of it might get used again. */
sprintf(log_line, "! Could not read %d %d-byte item%s.\n",
nitems, item_size, (nitems > 1) ? "s" : "");
show_line(log_line, 1);
- uexit(1);
+ uexit(EXIT_FAILURE);
}
#if !defined (WORDS_BIGENDIAN) && !defined (NO_FMTBASE_SWAP)
swap_items (p, nitems, item_size);
#endif
+
return 0;
}
}
}
#endif /* FUNNY_CORE_DUMP */
+/*
+#include <tex0.c>
+#include <tex1.c>
+#include <tex2.c>
+#include <tex3.c>
+#include <tex4.c>
+#include <tex5.c>
+#include <tex6.c>
+#include <tex7.c>
+#include <tex8.c>
+#include <tex9.c>
+*/
\ No newline at end of file
#define WORDS_BIGENDIAN 0
+//#pragma warning(disable:4032)
#pragma warning(disable:4201)
#pragma warning(disable:4996)
#pragma warning(disable:4701)
#include <kpathsea/tex-file.h>
#include <kpathsea/variable.h>
#include <kpathsea/absolute.h>
-#include <ptexenc/ptexenc.h>
#include <stdarg.h>
#include <setjmp.h>
#include <time.h>
#define a_open_out(f) open_output (&(f), FOPEN_W_MODE)
#define a_close(f) check_fclose (f)
-#define Hi(x) (((x) >> 8) & 0xff)
-#define Lo(x) ((x) & 0xff)
-
#define MAXLINE 256
extern integer zround (double);