+/* Copyright 2014 Clerk Ma
-#pragma warning(disable:4996)
-#pragma warning(disable:4131) // old style declarator
-#pragma warning(disable:4135) // conversion between different integral types
-#pragma warning(disable:4127) // conditional expression is constant
+ 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. */
#define EXTERN extern
#include "texd.h"
-#pragma warning(disable:4244) /* 96/Jan/10 */
-
/* sec 0440 */
void scan_int (void)
{
- bool negative;
+ boolean negative;
integer m;
small_number d;
- bool vacuous;
- bool OKsofar;
+ boolean vacuous;
+ boolean OKsofar;
radix = 0;
OKsofar = true;
cur_val = - (integer) cur_val;
}
/* sec 0448 */
-void scan_dimen_(bool mu, bool inf, bool shortcut)
+void scan_dimen_(boolean mu, boolean inf, boolean shortcut)
{
- bool negative;
+ boolean negative;
integer f;
integer num, denom;
small_number k, kk;
goto lab88;
if (scan_keyword("in"))
- {
- num = 7227;
- denom = 100;
- }
+ set_conversion(7227, 100);
else if (scan_keyword("pc"))
- {
- num = 12;
- denom = 1;
- }
+ set_conversion(12, 1);
else if (scan_keyword("cm"))
- {
- num = 7227;
- denom = 254;
- }
+ set_conversion(7227, 254);
else if (scan_keyword("mm"))
- {
- num = 7227;
- denom = 2540;
- }
+ set_conversion(7227, 2540);
else if (scan_keyword("bp"))
- {
- num = 7227;
- denom = 7200;
- }
+ set_conversion(7227, 7200);
else if (scan_keyword("dd"))
- {
- num = 1238;
- denom = 1157;
- }
+ set_conversion(1238, 1157);
else if (scan_keyword("cc"))
- {
- num = 14856;
- denom = 1157;
- }
+ set_conversion(14856, 1157);
else if (scan_keyword("Q"))
- {
- num = 7227;
- denom = 10160;
- }
+ set_conversion(7227, 10160);
else if (scan_keyword("H"))
- {
- num = 7227;
- denom = 10160;
- }
+ set_conversion(7227, 10160);
else if (scan_keyword("sp"))
goto lab30;
else
/* sec 0461 */
void scan_glue_(small_number level)
{
- bool negative;
+ boolean negative;
halfword q;
- bool mu;
+ boolean mu;
mu = (level == mu_val);
negative = false;
t = space_token;
else
t = other_token + t;
- {
- {
- q = avail;
- if (q == 0)
- q = get_avail();
- else
- {
- avail = mem[q].hh.v.RH;
- mem[q].hh.v.RH = 0;
-#ifdef STAT
- incr(dyn_used);
-#endif /* STAT */
- }
- }
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = t;
- p = q;
- }
+ fast_store_new_token(t);
incr(k);
}
+
pool_ptr = b;
return p;
if (cur_val_level >= ident_val)
{
- p = temp_head;
+ p = temp_head;
link(p) = 0;
if (cur_val_level == ident_val)
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = cs_token_flag + cur_val;
- p = q;
- }
+ store_new_token(cs_token_flag + cur_val);
else if (cur_val != 0)
{
r = link(cur_val);
- while (r != 0) { /* while r<>null do l.9178 */
- {
- {
- q = avail;
- if (q == 0)
- q = get_avail();
- else
- {
- avail = mem[q].hh.v.RH;
- mem[q].hh.v.RH = 0;
-#ifdef STAT
- incr(dyn_used);
-#endif /* STAT */
- }
- }
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = mem[r].hh.v.LH;
- p = q;
- }
+ while (r != 0)
+ {
+ fast_store_new_token(info(r));
r = link(r);
}
}
+
Result = p;
}
else
begin_token_list(link(temp_head), 4);
}
/* sec 0473 */
-halfword scan_toks_(bool macrodef, bool xpand)
+halfword scan_toks_(boolean macrodef, boolean xpand)
{
register halfword Result;
halfword t;
if (cur_cmd == left_brace)
{
hashbrace = cur_tok;
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = cur_tok;
- p = q;
- }
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = end_match_token;
- p = q;
- }
+ store_new_token(cur_tok);
+ store_new_token(end_match_token);
goto lab30;
}
cur_tok = s;
}
}
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = cur_tok;
- p = q;
- }
+
+ store_new_token(cur_tok);
}
+
lab31:
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = end_match_token;
- p = q;
- }
+ store_new_token(end_match_token);
if (cur_cmd == right_brace)
{
else
cur_tok = out_param_token - '0' + cur_chr;
}
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = cur_tok;
- p = q;
- }
+
+ store_new_token(cur_tok);
}
lab40:
scanner_status = 0;
if (hashbrace != 0)
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = hashbrace;
- p = q;
- }
+ store_new_token(hashbrace);
+
Result = p;
return Result;
}
def_ref = get_avail();
token_ref_count(def_ref) = 0;
p = def_ref;
-
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = end_match_token;
- p = q;
- }
+ store_new_token(end_match_token);
if ((n < 0) || (n > 15))
m = 16;
goto lab30;
}
- {
- q = get_avail();
- mem[p].hh.v.RH = q;
- mem[q].hh.v.LH = cur_tok;
- p = q;
- }
+ store_new_token(cur_tok);
}
lab30:
end_file_reading();
/* sec 0498 */
void conditional (void)
{
- bool b;
+ boolean b;
char r;
integer m, n;
halfword p, q;
/* sec 0515 */
void begin_name (void)
{
- area_delimiter = 0; /* index between `file area' and `file name' */
- ext_delimiter = 0; /* index between `file name' and `file extension' */
+ area_delimiter = 0;
+ ext_delimiter = 0;
}
/* This gathers up a file name and makes a string of it */
/* Also tries to break it into `file area' `file name' and `file extension' */
/* We assume tilde has been converted to pseudo_tilde and space to pseudo_space */
/* returns false if it is given a space character - end of file name */
/* sec 0516 */
-bool more_name_(ASCII_code c)
+boolean more_name_(ASCII_code c)
{
if (quoted_file_name == 0 && c == ' ')
return false;
return true; /* accept ending quote, but throw away */
}
else
- {
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* convert pseudo tilde back to '~' 95/Sep/26 */ /* moved here 97/June/5 */
-/* if (pseudo_tilde != 0 && c == pseudo_tilde) c = '~'; */
-/* convert pseudo space back to ' ' 97/June/5 */ /* moved here 97/June/5 */
-/* if (pseudo_space != 0 && c == pseudo_space) c = ' '; */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+ {
str_room(1);
append_char(c);
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-// if ((c == 47)) /* / */
-// for DOS/Windows
- if ((c == '/' || c == '\\' || c == ':')) /* 94/Mar/1 */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+ // for DOS/Windows
+ if ((c == '/' || c == '\\' || c == ':'))
{
area_delimiter = cur_length;
ext_delimiter = 0;
}
else if (c == '.')
ext_delimiter = cur_length;
+
return true;
}
}
int k, nlen = end - start;
char *s;
-// int trace_flag = 1; // debugging only
-
if (trace_flag)
{
sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end - start);
show_string(k);
}
-// int notfirst=0; // debugging only
-
/********************************** 2000 August 15 end ****************************/
/* sec 0517 */
void end_name (void)
if (str_ptr + 3 > current_max_strings)
{
- overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
+ overflow("number of strings", current_max_strings - init_str_ptr);
return; // abort_flag set
}
#else
if (str_ptr + 3 > max_strings)
{
- overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
+ overflow("number of strings", max_strings - init_str_ptr);
return; // abort_flag set
}
#endif
-// if (notfirst++ == 0) show_all_strings(); // debugging only
-
if (area_delimiter == 0) // no area delimiter ':' '/' or '\' found
cur_area = 335; // "" default area
else
c = str_pool[j];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
c = str_pool[j];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
c = str_pool[j];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
- if (k < PATHMAX)
+ if (k < PATH_MAX)
name_length = k;
else
- name_length = PATHMAX - 1;
+ name_length = PATH_MAX - 1;
/* pad it out with spaces ... what for ? in case we modify and forget ? */
- for (k = name_length + 1; k <= PATHMAX; k++)
+ for (k = name_length + 1; k <= PATH_MAX; k++)
name_of_file[k] = ' ';
- name_of_file[PATHMAX] = '\0'; /* paranoia 94/Mar/24 */
+ name_of_file[PATH_MAX] = '\0'; /* paranoia 94/Mar/24 */
{
name_of_file [name_length+1] = '\0';
ASCII_code c;
integer j;
- if (n + b - a + 5 > PATHMAX)
- b = a + PATHMAX - n - 5;
+ if (n + b - a + 5 > PATH_MAX)
+ b = a + PATH_MAX - n - 5;
k = 0;
c = xord[TEX_format_default[j]];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
/* This loop kicks in when we want a specififed format name */
c = buffer[j];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
c = xord[TEX_format_default[j]];
incr(k);
- if (k <= PATHMAX)
+ if (k <= PATH_MAX)
name_of_file[k] = xchr[c];
}
- if (k < PATHMAX)
+ if (k < PATH_MAX)
name_length = k;
else
- name_length = PATHMAX - 1;
+ name_length = PATH_MAX - 1;
/* pad it out with spaces ... what for ? */
- for (k = name_length + 1; k <= PATHMAX; k++)
+ for (k = name_length + 1; k <= PATH_MAX; k++)
name_of_file[k]= ' ';
- name_of_file[PATHMAX] = '\0'; /* paranoia 94/Mar/24 */
+ name_of_file[PATH_MAX] = '\0'; /* paranoia 94/Mar/24 */
}
/* sec 0525 */
str_number make_name_string (void)
}
while (!(cur_cmd != spacer));
- quoted_file_name = 0; /* 98/March/15 */
+ quoted_file_name = false;
- if (allow_quoted_names) /* check whether quoted name */
+ if (allow_quoted_names)
{
if (cur_chr == '"')
{
{
if ((cur_cmd > other_char) || (cur_chr > 255))
{
- back_input(); /* not a character put it back and leave */
+ back_input();
goto lab30;
}
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* convert tilde '~' to pseudo tilde */
-/* if (pseudo_tilde != 0 && cur_chr == '~') cur_chr = pseudo_tilde; */
-/* convert space ' ' to pseudo space */
-/* if (pseudo_space != 0 && cur_chr == ' ') cur_chr = pseudo_space; */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
if (!more_name(cur_chr)) /* up to next white space */
goto lab30;
get_x_token();
}
+
lab30:
end_name();
name_in_progress = false;
/**********************************************************************/
/* sec 0530 */
-/* s - what can't be found, e - default */
+/* s - what can't be found, e - default */
void prompt_file_name_(char * s, str_number e)
{
integer k;
old_setting = selector;
if (job_name == 0)
- job_name = 790; /* default: texput */
+ job_name = 790;
pack_job_name(".log");
log_opened = true;
{
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- if (want_version)
- {
- stamp_it(log_line); // ??? use log_line ???
- strcat(log_line, "\n");
- (void) fputs(log_line, log_file);
- stampcopy(log_line);
- strcat(log_line, "\n");
- (void) fputs(log_line, log_file);
- }
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* also change following in itex.c - bkph */
- (void) fputs(tex_version, log_file);
- (void) fprintf(log_file, " (%s %s)", application, yandyversion);
+ if (want_version)
+ {
+ stamp_it(log_line);
+ strcat(log_line, "\n");
+ (void) fputs(log_line, log_file);
+ stampcopy(log_line);
+ strcat(log_line, "\n");
+ (void) fputs(log_line, log_file);
+ }
+
+ (void) fputs(tex_version, log_file);
+ (void) fprintf(log_file, " (%s %s)", application, yandyversion);
- if (format_ident > 0)
- slow_print(format_ident); /* bkph */
+ if (format_ident > 0)
+ slow_print(format_ident);
+
+ print_string(" ");
+
+ if (civilize_flag)
+ print_int(year);
+ else
+ print_int(day);
- print_string(" ");
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- if (civilize_flag)
- print_int(year);
- else
- print_int(day);
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
print_char(' ');
months = " JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
(void) putc(months[k], log_file);
print_char(' ');
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
if (civilize_flag)
print_int(day);
else
print_int(year);
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
print_char(' ');
- print_two(tex_time / 60); /* hour */
+ print_two(tex_time / 60);
print_char(':');
- print_two(tex_time % 60); /* minute */
+ print_two(tex_time % 60);
}
input_stack[input_ptr] = cur_input;
print(buffer[k]);
print_ln();
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* a good place to show the fmt file name or pool file name ? 94/June/21 */
+
if (show_fmt_flag)
{
- if (string_file != NULL)
- {
- fprintf(log_file, "(%s)\n", string_file);
- free(string_file); /* this was allocated by strdup in openinou */
- string_file = NULL; /* for safety */
- }
-
if (format_file != NULL)
{
fprintf(log_file, "(%s)\n", format_file);
- free(format_file); /* this was allocated by strdup in openinou */
- format_file = NULL; /* for safety */
+ free(format_file);
+ format_file = NULL;
}
}
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
selector = old_setting + 2;
}
/**************************** start of insertion 98/Feb/7 **************/
-
// Attempt to deal with foo.bar.tex given as foo.bar on command line
// Makes copy of job_name with extension
-void morenamecopy(ASCII_code c)
+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) /* in case it failed 94/Jan/24 */
+ if (pool_ptr + 1 > current_pool_size)
{
- overflow("pool size", current_pool_size - init_pool_ptr); /* 97/Mar/7 */
- return; // abort_flag set
+ 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); /* pool size */
- return; // abort_flag set
+ overflow("pool size", pool_size - init_pool_ptr);
+ return;
}
#endif
+
str_pool[pool_ptr] = c;
incr(pool_ptr);
}
-int endnamecopy(void)
+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)
+ str_start = realloc_str_start(increment_max_strings + 1);
- if (str_ptr + 1 > current_max_strings) /* in case it failed 94/Jan/24 */
- {
- overflow("number of strings", current_max_strings - init_str_ptr); /* 97/Mar/7 */
- return 0; // abort_flag set
- }
+ 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); /* number of strings */
- return 0; // abort_flag set
- }
+ if (str_ptr + 1 > max_strings)
+ {
+ overflow("number of strings", max_strings - init_str_ptr);
+ return 0;
+ }
#endif
- return make_string();
+
+ return make_string();
}
-/* add extension to job_name */
-void jobnameappend (void)
+void job_name_append (void)
{
int k, n;
-/* copy job_name */
+
k = str_start[job_name];
n = str_start[job_name + 1];
while (k < n)
- morenamecopy(str_pool[k++]);
-/* copy `extension' */
+ more_name_copy(str_pool[k++]);
+
k = str_start[cur_ext];
n = str_start[cur_ext + 1];
while (k < n)
- morenamecopy(str_pool[k++]);
+ more_name_copy(str_pool[k++]);
- job_name = endnamecopy();
+ job_name = end_name_copy();
}
/**************************** end of insertion 98/Feb/7 **************/
/* sec 0537 */
-void start_input (void)
+void start_input(void)
{
- bool addedextension = false;
+ boolean added_extension = false;
scan_file_name();
pack_file_name(cur_name, cur_area, cur_ext);
- while (true) /* loop until we get a valid file name */
+ while (true)
{
- addedextension = false;
+ added_extension = false;
begin_file_reading();
-/* *** *** *** *** *** following is new in 3.14159 *** *** *** *** *** *** */
-/* if current extension is *not* empty, try to open using name as is */
-/* string 335 is "" the empty string */
-/* should be updated to current Kpathsea. */
+
if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
goto lab30;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* we get here if extension is "", or file with extension failed to open */
-/* if current extension is not `tex,' and `tex' is not irrelevant, try it */
-/* string 785 is .tex */
- if ((cur_ext != 785) && (name_length + 5 < PATHMAX))
+
+ if ((cur_ext != 785) && (name_length + 5 < PATH_MAX))
{
- //strcpy(name_of_file + name_length + 1, ".tex ");
name_of_file[name_length + 1] = '.';
name_of_file[name_length + 2] = 't';
name_of_file[name_length + 3] = 'e';
name_of_file[name_length + 5] = ' ';
name_length = name_length + 4;
- addedextension = true;
+ added_extension = true;
if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
goto lab30;
- name_length = name_length - 4; /* strip extension again */
- name_of_file[name_length + 1] = ' '; /* ' ' */
- addedextension = false;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+ name_length = name_length - 4;
+ name_of_file[name_length + 1] = ' ';
+ added_extension = false;
}
-/* *** *** *** *** major changes here in 3.14159 *** *** *** *** *** *** */
-/* string 335 is "" the empty string */
+
if ((cur_ext == 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
goto lab30;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
end_file_reading();
prompt_file_name("input file name", ".tex");
- } /* end of while(true)trying to get valid file name */
+ }
-/* maybe set pseudo_tilde = 0 at this point ? 95/Sep/26 */
lab30:
cur_input.name_field = a_make_name_string(input_file[cur_input.index_field]);
- if (job_name == 0) /* only the first time */
+ if (job_name == 0)
{
- job_name = cur_name; /* here we set the job_name */
-/* did file name have an `extension' already and we added ".tex" ? */
- if (cur_ext != 335 && addedextension) /* 98/Feb/7 */
- jobnameappend(); /* append `extension' to job_name */
+ job_name = cur_name;
+
+ if (cur_ext != 335 && added_extension)
+ job_name_append();
open_log_file();
}
- if (term_offset + length(cur_input.name_field) > max_print_line - 2) /* was 3 ? */
+ if (term_offset + length(cur_input.name_field) > max_print_line - 2)
print_ln();
else if ((term_offset > 0) || (file_offset > 0))
print_char(' ');
print_char('(');
-// print_char('@'); // debugging only marker
incr(open_parens);
if (open_parens > max_open_parens)
- max_open_parens = open_parens; /* 1999/Jan/17 */
+ max_open_parens = open_parens;
slow_print(cur_input.name_field);
-// print_char('@'); // debugging only marker
+
#ifndef _WINDOWS
fflush(stdout);
#endif
+
cur_input.state_field = new_line;
{
/* show TEXFONTS=... or format specific */
/* only show this if name was not fully qualified ? */
void show_tex_fonts (void)
-{ /* 98/Jan/28 */
+{
char *s, *t, *v, *u;
int n;
print_char(')');
}
-
-/**********************************************************************/
-
-/* called only from tex8.c */
/* sec 0560 */
internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
{
font_index k;
- bool fileopened;
-/* halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np; */
+ boolean file_opened;
halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
-/* halfword bc, ec; */
- int bc, ec; /* 95/Jan/7 */
+ int bc, ec;
internal_font_number f;
internal_font_number g;
eight_bits a, b, c, d;
- ffourquarters qw;
+ four_quarters qw;
scaled sw;
- integer bchlabel;
+ integer bch_label;
short bchar;
scaled z;
integer alpha;
char beta;
g = 0;
- fileopened = false;
+ file_opened = false;
pack_file_name(nom, aire, 805); /* .tfm */
- if (!b_open_in(tfm_file)) /* new in C version d */
+ if (!b_open_in(tfm_file))
{
goto lab11;
}
-/* was just: goto lab11; */
- fileopened = true;
+
+ file_opened = true;
+
{
-/* tfm_temp = getc(tfm_file); */ /* done already in open_input, but why? */
- //tfm_temp = getc(tfm_file);
- {
- lf = tfm_temp;
- if (lf > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- lf = lf * 256 + tfm_temp;
- }
+ read_sixteen(lf);
tfm_temp = getc(tfm_file);
- {
- lh = tfm_temp;
- if (lh > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- lh = lh * 256 + tfm_temp;
- }
+ read_sixteen(lh);
tfm_temp = getc(tfm_file);
- {
- bc = tfm_temp;
- if (bc > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- bc = bc * 256 + tfm_temp;
- }
+ read_sixteen(bc);
tfm_temp = getc(tfm_file);
- {
- ec = tfm_temp;
- if (ec > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- ec = ec * 256 + tfm_temp;
- }
- if ((bc > ec + 1)||(ec > 255))
+ read_sixteen(ec);
+
+ if ((bc > ec + 1) || (ec > 255))
goto lab11;
+
if (bc > 255)
{
bc = 1;
ec = 0;
}
+
tfm_temp = getc(tfm_file);
- {
- nw = tfm_temp;
- if (nw > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- nw = nw * 256 + tfm_temp;
- }
+ read_sixteen(nw);
tfm_temp = getc(tfm_file);
- {
- nh = tfm_temp;
- if (nh > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- nh = nh * 256 + tfm_temp;
- }
+ read_sixteen(nh);
tfm_temp = getc(tfm_file);
- {
- nd = tfm_temp;
- if (nd > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- nd = nd * 256 + tfm_temp;
- }
+ read_sixteen(nd);
tfm_temp = getc(tfm_file);
- {
- ni = tfm_temp;
- if (ni > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- ni = ni * 256 + tfm_temp;
- }
+ read_sixteen(ni);
tfm_temp = getc(tfm_file);
- {
- nl = tfm_temp;
- if (nl > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- nl = nl * 256 + tfm_temp;
- }
+ read_sixteen(nl);
tfm_temp = getc(tfm_file);
- {
- nk = tfm_temp;
- if (nk > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- nk = nk * 256 + tfm_temp;
- }
+ read_sixteen(nk);
tfm_temp = getc(tfm_file);
- {
- ne = tfm_temp;
- if (ne > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- ne = ne * 256 + tfm_temp;
- }
+ read_sixteen(ne);
tfm_temp = getc(tfm_file);
- {
- np = tfm_temp;
- if (np > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- np = np * 256 + tfm_temp;
- }
+ read_sixteen(np);
+
if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
goto lab11;
if (np < 7)
lf = lf + 7 - np;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
#ifdef ALLOCATEFONT
- if ((fmem_ptr + lf > current_font_mem_size)) /* 93/Nov/28 */
+ if ((fmem_ptr + lf > current_font_mem_size))
font_info = realloc_font_info (increment_font_mem_size + lf);
if ((font_ptr == font_max) || (fmem_ptr + lf > current_font_mem_size))
if (trace_flag)
{
sprintf(log_line, "font_ptr %d font_max %d fmem_ptr %d lf %d font_mem_size %d\n",
- font_ptr, font_max, fmem_ptr, lf, font_mem_size); /* debugging */
+ font_ptr, font_max, fmem_ptr, lf, font_mem_size);
show_line(log_line, 0);
}
{
if (lh < 2)
goto lab11;
-/* build the font checksum now */
- {
- tfm_temp = getc(tfm_file);
- a = tfm_temp;
- qw.b0 = a;
- tfm_temp = getc(tfm_file);
- b = tfm_temp;
- qw.b1 = b;
- tfm_temp = getc(tfm_file);
- c = tfm_temp;
- qw.b2 = c;
- tfm_temp = getc(tfm_file);
- d = tfm_temp;
- qw.b3 = d;
- font_check[f] = qw;
- }
-
+
+ store_four_quarters(font_check[f]);
tfm_temp = getc(tfm_file);
- {
- z = tfm_temp;
- if (z > 127)
- goto lab11;
- tfm_temp = getc(tfm_file);
- z = z * 256 + tfm_temp;
- }
-
+ read_sixteen(z);
tfm_temp = getc(tfm_file);
z = z * 256 + tfm_temp;
tfm_temp = getc(tfm_file);
for (k = fmem_ptr; k <= width_base[f] - 1; k++)
{
- {
- tfm_temp = getc(tfm_file);
- a = tfm_temp;
- qw.b0 = a;
- tfm_temp = getc(tfm_file);
- b = tfm_temp;
- qw.b1 = b;
- tfm_temp = getc(tfm_file);
- c = tfm_temp;
- qw.b2 = c;
- tfm_temp = getc(tfm_file);
- d = tfm_temp;
- qw.b3 = d;
- font_info[k].qqqq = qw;
- }
+ store_four_quarters(font_info[k].qqqq);
if ((a >= nw) || (b / 16 >= nh) || (b % 16 >= nd) || (c / 4 >= ni))
goto lab11;
switch (c % 4)
{
- case 1 :
+ case lig_tag:
if (d >= nl)
goto lab11;
break;
- case 3 :
+ case ext_tag:
if (d >= ne)
goto lab11;
break;
- case 2 :
+ case list_tag:
{
{
- if ((d < bc)||(d > ec))
+ if ((d < bc) || (d > ec))
goto lab11;
}
while (d < k + bc - fmem_ptr)
{
- qw = font_info[char_base[f]+ d].qqqq;
+ qw = char_info(f, d);
- if (((qw.b2)% 4)!= 2)
+ if (char_tag(qw) != list_tag)
goto lab45;
- d = qw.b3;
+ d = rem_byte(qw);
}
if (d == k + bc - fmem_ptr)
break;
}
}
+
{
{
alpha = 16;
if (font_info[italic_base[f]].cint != 0)
goto lab11;
}
-/* read ligature/kern program */
- bchlabel = 32767; /* '77777 */
+
+ bch_label = 32767; /* '77777 */
bchar = 256;
if (nl > 0)
{
for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128) - 1; k++)
{
- {
- tfm_temp = getc(tfm_file);
- a = tfm_temp;
- qw.b0 = a;
- tfm_temp = getc(tfm_file);
- b = tfm_temp;
- qw.b1 = b;
- tfm_temp = getc(tfm_file);
- c = tfm_temp;
- qw.b2 = c;
- tfm_temp = getc(tfm_file);
- d = tfm_temp;
- qw.b3 = d;
- font_info[k].qqqq = qw; /* store_four_quarters(font_info[k].qqqq */
- }
+ store_four_quarters(font_info[k].qqqq);
if (a > 128)
{
}
else if (256 * (c - 128) + d >= nk)
goto lab11; /* error in TFM, abort */
+
if (a < 128)
if (k - lig_kern_base[f] + a + 1 >= nl)
goto lab11; /* error in TFM, abort */
}
if (a == 255)
- bchlabel = 256 * c + d;
+ bch_label = 256 * c + d;
}
for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
font_info[k].cint = sw - alpha;
else goto lab11;
}
-/* read extensible character recipes */
-/* for k:=exten_base[f] to param_base[f]-1 do */
+
+ /* read extensible character recipes */
for (k = exten_base[f]; k <= param_base[f] - 1; k++)
{
- {
- tfm_temp = getc(tfm_file);
- a = tfm_temp;
- qw.b0 = a;
- tfm_temp = getc(tfm_file);
- b = tfm_temp;
- qw.b1 = b;
- tfm_temp = getc(tfm_file);
- c = tfm_temp;
- qw.b2 = c;
- tfm_temp = getc(tfm_file);
- d = tfm_temp;
- qw.b3 = d;
-/* store_four_quarters(font_info[k].qqqq); */
- font_info[k].qqqq = qw;
- }
+ store_four_quarters(font_info[k].qqqq);
if (a != 0)
{
if (!(qw.b0 > 0))
goto lab11;
}
+
{
{
if ((d < bc) || (d > ec))
goto lab11;
}
}
+
{
for (k = 1; k <= np; k++)
if (k == 1)
font_info[param_base[f] + k - 1].cint = sw - alpha;
else goto lab11;
}
-/* use test_eof() here instead ? */
+
if (feof(tfm_file))
goto lab11;
for (k = np + 1; k <= 7; k++)
font_info[param_base[f] + k - 1].cint = 0;
}
-/* @<Make final adjustments...@>= l.11174 */
+
if (np >= 7)
font_params[f] = np;
else
hyphen_char[f] = default_hyphen_char;
skew_char[f] = default_skew_char;
- if (bchlabel < nl)
- bchar_label[f] = bchlabel + lig_kern_base[f];
+ if (bch_label < nl)
+ bchar_label[f] = bch_label + lig_kern_base[f];
else
- bchar_label[f]= non_address; /* i.e. 0 --- 96/Jan/15 */
+ bchar_label[f] = non_address;
font_bchar[f] = bchar;
font_false_bchar[f] = bchar;
font_area[f] = aire;
font_bc[f] = bc;
font_ec[f] = ec;
- font_glue[f] = 0; /* font_glue[f]:=null; l.11184 */
+ font_glue[f] = 0;
char_base[f] = char_base[f];
width_base[f] = width_base[f];
lig_kern_base[f] = lig_kern_base[f];
font_ptr = f;
g = f;
goto lab30;
+
lab11:
print_err("Font ");
sprint_cs(u);
print_char('=');
- print_file_name(nom, aire, 335); /* "" */
+ print_file_name(nom, aire, 335);
if (s >= 0)
{
print_int(- (integer) s);
}
- if (fileopened)
+ if (file_opened)
print_string(" not loadable: Bad metric (TFM) file");
else
print_string(" not loadable: Metric (TFM) file not found");
- if (aire == 335) /* "" only if path not specified */
+ if (aire == 335)
{
if (show_texinput_flag)
- show_tex_fonts(); /* 98/Jan/31 */
+ show_tex_fonts();
}
help5("I wasn't able to read the size data for this font,",
"You might try inserting a different font spec;",
"e.g., type `I\\font<same font id>=<substitute font name>'.");
error();
+
lab30:
- if (fileopened)
+ if (file_opened)
b_close(tfm_file);
return g;