openinou.o: openinou.c $(headers)
$(CC) -c $(CFLAGS) openinou.c
-subroute.o: subroute.o $(headers)
+subroute.o: subroute.c $(headers)
$(CC) -c $(CFLAGS) subroute.c
local.o: local.c $(headers)
/* WARNING: with dynamic allocation cannot use memory_word *mem=zmem */
/* in this case, just let mem be alias for zmem */
/* BUT: allow continued use of register for eqtb at least ! */
-#define mem zmem
+//#define mem zmem
void print_err (const char * s);
void initialize (void);
#include "texd.h"
-#pragma warning(disable:4244) /* 96/Jan/10 */
-
-#include <time.h>
-
#define BEGINFMTCHECKSUM 367403084L
#define ENDFMTCHECKSUM 69069L
hyph_pointer z;
#endif
-/* We already initialized xchr if we are using non_ascii setup */
-/* Normally, there is no translation of character code numbers */
if (!non_ascii)
{
for (i = 0; i <= 255; i++)
xchr[i] = (char) i;
-/* This is a kind of joke, since the characters are given as numeric codes ! */
+
#ifdef JOKE
xchr[32] = ' '; xchr[33] = '!'; xchr[34] = '"'; xchr[35] = '#';
xchr[36] = '$'; xchr[37] = '%'; xchr[38] = '&'; xchr[39] = '\'';
for (i = 127; i <= 255; i++)
xchr[i]= chr(i);
-#endif /* end of JOKE */
+#endif
}
-/* end of plain ASCII case (otherwise have read in xchr vector before) */
-/* Fill in background of `delete' for inverse mapping */
+
for (i = 0; i <= 255; i++)
xord[chr(i)] = 127;
for (i = 0; i <= 126; i++)
xord[xchr[i]] = i;
#endif
-
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* Now invert the xchr mapping to get xord mapping */
+
for (i = 0; i <= 255; i++)
xord[xchr[i]] = (char) i;
- xord[127] = 127; /* hmm, a fixed point ? why ? */
+ xord[127] = 127;
- flag = 0; /* 93/Dec/28 - bkph */
+ flag = 0;
if (trace_flag != 0)
{
-/* entries in xord / xchr */
for (k = 0; k < 256; k++)
if (xord[k] != k)
{
flag = 1;
break;
}
-/* 127 here means mapping undefined */
+
if (flag)
{
show_line("Inverted mapping xord[] pairs:\n", 0);
for (k = 0; k < 256; k++)
{
-/* entries in xord / xchr */
if (xord[k] != 127)
{
sprintf(log_line, "%d => %d\n", k, xord[k]);
}
}
}
-/* may now set in local.c bkph */
- if (interaction < 0)
+
+ if (interaction < batch_mode)
interaction = error_stop_mode;
deletions_allowed = true;
use_err_help = false;
interrupt = 0;
OK_to_interrupt = true;
-/* darn, need to know mem_top, mem_max etc for the following ... */
+
#ifdef DEBUG
was_mem_end = mem_min;
/* was_lo_max = mem_min; */
/* was_hi_min = mem_max; */
was_hi_min = mem_top;
panicking = false;
-#endif /* DEBUG */
+#endif
+
nest_ptr = 0;
max_nest_stack = 0;
mode = 1;
page_tail = page_head;
#ifdef ALLOCATEMAIN
- if (is_initex) /* in iniTeX we did already allocate mem [] */
+ if (is_initex)
#endif
mem[page_head].hh.v.RH = 0;
-/* last_glue = 262143L; */ /* NO! */
+
last_glue = empty_flag;
last_penalty = 0;
last_kern = 0;
q = passive;
- while (q != 0) /* while q<>null do l.16979 */
+ while (q != 0)
{
cur_p = link(q);
free_node(q, 2);
return; // abort_flag set
}
break;
- } /* end of cur_cmd switch */
+ }
lab30:
if (after_token != 0)
show_line(log_line, 0);
{
- char *s; /* extra info 99/April/28 */
+ char *s;
if ((s = grabenv(envvar)) != NULL)
{
show_line(log_line, 0);
}
}
+
#ifndef _WINDOWS
fflush(stdout);
#endif
/* sec 1303 */
bool load_fmt_file (void)
{
- register bool Result;
integer j, k;
halfword p, q;
integer x;
format_ident = x;
}
undump_int(x);
-/* test_eof(fmt_file)? */
- if ((x != ENDFMTCHECKSUM) || feof(fmt_file)) /* magic checksum --- change ? */
+ if ((x != ENDFMTCHECKSUM) || feof(fmt_file))
goto lab6666;
- Result = true;
- return(Result);
+ return true;
lab6666:;
sprintf(log_line, "(Fatal format file error; I'm stymied)\n");
show_line(log_line, 1);
-/* added following bit of explanation 96/Jan/10 */
+
if (!knuth_flag)
bad_formator_pool(format_file, "the format file", "TEXFORMATS");
- Result = false;
- return Result;
+
+ return false;
}
/* sec 1335 */
void final_cleanup (void)
delete_glue_ref(last_glue);
store_fmt_file(); // returns a value ?
}
-#endif /* INITEX */
- if (!is_initex) /* 2000/March/3 */
+#endif
+
+ if (!is_initex)
print_nl("(\\dump is performed only by INITEX)");
}
}
fprintf(log_file, ") ");
}
-/* Main entry point called from texmf.c int main(int ac, char *av[]) */
-/* call from main_program in texmf.c */
-/* This in turn calls initialize() */
-
-#pragma warning(disable:4127) // conditional expression is constant
-
int texbody (void)
{
- history = 3;
+ history = fatal_error_stop;
if (ready_already == 314159L)
goto lab1;
- /* These tests are almost all compile time tests and so could be eliminated */
bad = 0;
if ((half_error_line < 30) || (half_error_line > error_line - 15))
if (dvi_buf_size % 8 != 0)
bad = 3;
- if (1100 > mem_top)
- bad = 4; /* not compile time */
+ if (mem_bot + 1100 > mem_top)
+ bad = 4;
if (hash_prime > (hash_size + hash_extra))
bad = 5;
if (max_in_open >= 128)
- bad = 6; /* p.14 */
+ bad = 6;
- if (mem_top < 267)
- bad = 7; /* where from ? *//* not compile time */
+ if (mem_top < 256 + 11)
+ bad = 7;
#ifdef INITEX
if (is_initex)
if ((mem_min < min_halfword) || (mem_max >= max_halfword) || (mem_bot - mem_min >= max_halfword))
bad = 14;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- if (mem_max > mem_top + mem_extra_high) /* not compile time */
- bad = 14; /* ha ha */
- if ((0 < min_quarterword) || (font_max > max_quarterword)) /* 93/Dec/3 */
+ if (mem_max > mem_top + mem_extra_high)
+ bad = 14;
+
+ if ((0 < min_quarterword) || (font_max > max_quarterword))
bad = 15;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
#ifdef INCREASEFONTS
- if (font_max > 1024) /* 96/Jan/17 */
+ if (font_max > 1024)
#else
if (font_max > 256)
#endif
if (!knuth_flag)
bad_formator_pool(format_file, "the format file", "TEXFORMATS");
- goto lab9999; // abort
+ goto lab9999;
}
initialize();
if (is_initex)
{
if (!get_strings_started())
- goto lab9999; // abort
+ goto lab9999;
init_prim();
init_str_ptr = str_ptr;
}
#endif
- ready_already = 314159L; /* magic number */
+ ready_already = 314159L;
lab1:
selector = term_only;
file_offset = 0;
show_line(tex_version, 0);
-#ifdef _WIN64
- sprintf(log_line, " (%s %s/Windows 64bit)", application, yandyversion);
+ {
+#ifdef _WIN32
+ #ifdef _WIN64
+ sprintf(log_line, " (%s %s/Windows 64bit)", application, yandyversion);
+ #else
+ sprintf(log_line, " (%s %s/Windows 32bit)", application, yandyversion);
+ #endif
#else
- sprintf(log_line, " (%s %s/Windows 32bit)", application, yandyversion);
+ sprintf(log_line, " (%s %s/Linux)", application, yandyversion);
#endif
+ }
show_line(log_line, 0);
input_ptr = 0;
max_in_stack = 0;
in_open = 0;
- high_in_open = 0; /* max_in_open name already used 1999 Jan 17 */
+ high_in_open = 0;
open_parens = 0;
- max_open_parens = 0; /* max_open_parens */
+ max_open_parens = 0;
max_buf_stack = 0;
param_ptr = 0;
max_param_stack = 0;
memset (buffer, 0, buf_size);
#endif
- first = 0; /* 1999/Jan/22 */
+ first = 0;
scanner_status = 0;
- warning_index = 0; /* warning_index:=null; l.7068 */
+ warning_index = 0;
first = 1;
cur_input.state_field = 33;
cur_input.start_field = 1;
align_state = 1000000L;
if (!init_terminal())
- goto lab9999; // abort
+ goto lab9999;
cur_input.limit_field = last;
first = last + 1;
}
-
-/* For Windows NT, lets allow + instead of & for format specification */
+
if ((format_ident == 0) ||
(buffer[cur_input.loc_field] == '&') ||
(buffer[cur_input.loc_field] == '+'))
initialize();
if (!open_fmt_file ())
- goto lab9999; // abort
+ goto lab9999;
if (!load_fmt_file ())
{
w_close(fmt_file);
- goto lab9999; // abort
+ goto lab9999;
}
w_close(fmt_file);
buffer[cur_input.limit_field] = end_line_char;
fix_date_and_time();
-
magic_offset = str_start[886] - 9 * ord_noad;
- /* "0234000122*4000133**3**344*0400400*000000234000111*1111112341011" */
if (interaction == batch_mode)
selector = no_print;
start_input();
}
-/* show font TFMs frozen into format file */
-/* moved here after start_input to ensure the log file is open */
- if (show_tfm_flag && log_opened && font_ptr > 0) /* 98/Sep/28 */
+ if (show_tfm_flag && log_opened && font_ptr > 0)
show_frozen();
main_time = clock();
history = 0;
if (show_cs_names)
- print_cs_names(stdout, 0); /* 98/Mar/31 */
+ print_cs_names(stdout, 0);
- main_control(); /* read-eval-print loop :-) in tex8.c */
+ main_control();
if (show_cs_names)
- print_cs_names(stdout, 1); /* 98/Mar/31 */
+ print_cs_names(stdout, 1);
final_cleanup();
" be verbose (show implementation version number)\n"
" -n do not allow `non ASCII' characters in input files (complain instead)\n"
" --showhex -w\n"
- " do not show `non ASCII' characters in hexadecimal (show as is)\n"
+ " do not show `non ASCII' characters in hexadecimal (show as is)\n"
" -d do not allow DOS style file names - i.e. do not convert \\ to /\n"
" -r do not allow Mac style termination - i.e. do not convert \\r to \\n\n"
" --patterns -p\n"
if (old == NULL)
return malloc (new_size); /* no old block - use malloc */
-#ifdef MSDOS
+#ifdef _WIN32
old_size = _msize (old);
#else
old_size = malloc_usable_size (old);
if (old_size >= new_size && old_size < new_size + 4)
return old;
-#ifdef MSDOS
+#ifdef _WIN32
mnew = _expand (old, new_size); /* first try and expand in place MSVC */
#else
mnew = realloc (old, new_size);
/* Could we avoid this by detecting presence of & before allocating ? */
/* Also, if its already large enough, maybe we can avoid this ? */
/* don't bother if current_mem_size == mem_max - mem_start ? */
- if (mainmemory != NULL)
+ if (main_memory != NULL)
{
if (trace_flag)
show_line("Reallocating initial memory allocation\n", 1);
if (trace_flag)
trace_memory("main memory", n);
-/* mainmemory = (memory_word *) malloc (n); */ /* 94/March/24 */
-/* normally mainmemory == NULL here so acts like malloc ... */
- mainmemory = (memory_word *) REALLOC (mainmemory, n);
+/* main_memory = (memory_word *) malloc (n); */ /* 94/March/24 */
+/* normally main_memory == NULL here so acts like malloc ... */
+ main_memory = (memory_word *) REALLOC (main_memory, n);
- if (mainmemory == NULL)
+ if (main_memory == NULL)
{
memory_error("initial main memory", n);
// exit (1); /* serious error */
if (trace_flag)
{
- sprintf(log_line, "Address main memory == %d\n", mainmemory);
+ sprintf(log_line, "Address main memory == %d\n", main_memory);
show_line(log_line, 0);
}
- zzzaa = mainmemory;
+ mem = main_memory;
if (mem_start != 0 && !is_initex)
- zzzaa = mainmemory - mem_start;
+ mem = main_memory - mem_start;
if (trace_flag)
{
- sprintf(log_line, "Offset address main memory == %d\n", zzzaa);
+ sprintf(log_line, "Offset address main memory == %d\n", mem);
show_line(log_line, 0);
}
- update_statistics ((int) mainmemory, n, (current_mem_size + 1) * sizeof (memory_word));
+ update_statistics ((int) main_memory, n, (current_mem_size + 1) * sizeof (memory_word));
/* current_mem_size = (mem_max - mem_start + 1); */
current_mem_size = mem_max - mem_start; /* total number of words - 1 */
if (trace_flag)
probe_show(); /* 94/Mar/25 */
- return zzzaa; /* same as zmem, mem 94/Jan/24 */
+ return mem;
}
#endif
if (trace_flag)
{
- sprintf(log_line, "Old Address %s == %d\n", "main memory", mainmemory);
+ sprintf(log_line, "Old Address %s == %d\n", "main memory", main_memory);
show_line(log_line, 0);
}
if (trace_flag)
trace_memory("main memory", n);
- newmemory = (memory_word *) REALLOC (mainmemory, n);
+ newmemory = (memory_word *) REALLOC (main_memory, n);
if (newmemory != NULL)
break; /* did we get it ? */
if (newmemory == NULL)
{
memory_error("main memory", n);
- return zzzaa; /* try and continue with TeX !!! */
+ return mem;
}
if (trace_flag)
(current_mem_size + 1) * sizeof(memory_word));
/* could reduce words moved by (mem_max - mem_end) */
}
- mainmemory = newmemory; /* remember for free later */
+ main_memory = newmemory; /* remember for free later */
if (losize > 0)
mem_start = mem_start - losize; /* update lower limit */
if (hisize > 0)
mem_max = mem_max + hisize; /* update upper limit */
- update_statistics ((int) mainmemory, n,
+ update_statistics ((int) main_memory, n,
(current_mem_size + 1) * sizeof (memory_word));
current_mem_size = newsize;
}
if (mem_start != 0)
- zzzaa = mainmemory - mem_start; /* ??? sign ??? */
+ mem = main_memory - mem_start;
else
- zzzaa = mainmemory;
+ mem = main_memory;
if (trace_flag)
- probe_show(); /* 94/Mar/25 */
+ probe_show();
- return zzzaa;
+ return mem;
}
#endif
#endif
#ifdef ALLOCATEINPUTSTACK
- input_stack = NULL; /* new 1999/Jan/21 */
+ input_stack = NULL;
current_stack_size = 0;
input_stack = realloc_input_stack (initial_stack_size); /* + 1 */
#endif
#ifdef ALLOCATENESTSTACK
- nest = NULL; /* new 1999/Jan/21 */
+ nest = NULL;
current_nest_size = 0;
nest = realloc_nest_stack (initial_nest_size); /* + 1 */
#endif
#ifdef ALLOCATEPARAMSTACK
- param_stack = NULL; /* new 1999/Jan/21 */
+ param_stack = NULL;
current_param_size = 0;
param_stack = realloc_param_stack (initial_param_size); /* + 1 */
#endif
#ifdef ALLOCATESAVESTACK
- save_stack = NULL; /* new 1999/Jan/7 */
+ save_stack = NULL;
current_save_size = 0;
save_stack = realloc_save_stack (initial_save_size);
#endif
/* 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);
+ if (trace_flag)
+ show_line("ini TeX pool and string allocation\n", 0);
+
str_pool = realloc_str_pool (initial_pool_size);
str_start = realloc_str_start (initial_max_strings);
}
current_font_mem_size = 0;
/* if not iniTeX, then do initial allocation on fmt file read in itex.c */
/* if ini-TeX we need to do it here - no format file read later */
- if (is_initex) font_info = realloc_font_info (initial_font_mem_size);
+ if (is_initex)
+ font_info = realloc_font_info (initial_font_mem_size);
#endif
-
+
#ifdef ALLOCATEMAIN
- mainmemory = NULL;
- zzzaa = NULL;
+ main_memory = NULL;
+ mem = NULL;
mem_min = mem_bot; /* just to avoid complaints in texbody */
mem_top = mem_initex;
mem_max = mem_top;
{
if (new_hyphen_prime)
hyphen_prime = new_hyphen_prime;
+
if (realloc_hyphen(hyphen_prime)) /* allocate just in case no format */
return -1;
}
/* free in reverse order 93/Nov/26 */
int free_memory (void)
{
- unsigned heap_total = 0;
+ unsigned int heap_total = 0;
if (trace_flag)
show_line("free_memory ", 0);
#ifdef ALLOCATEMAIN
/* if (zzzaa != NULL) free(zzzaa); */ /* NO: zzzaa may be offset ! */
- if (mainmemory != NULL)
- free(mainmemory);
+ if (main_memory != NULL)
+ free(main_memory);
- mainmemory = NULL;
+ main_memory = NULL;
#endif
#ifdef ALLOCATEFONT
if (format_file != NULL)
free(format_file);
- if (string_file != NULL)
- free(string_file);
-
if (source_direct != NULL)
free(source_direct);
- format_file = string_file = source_direct = NULL;
+ format_file = source_direct = NULL;
if (dvi_file_name != NULL)
free(dvi_file_name);
/* following is list of allowed command line flags and args */
-/* only 01234567.9 still left to take ... maybe recycle u */
-
char *allowedargs = "+bcdfijnpqrstvwyzABCDFGIJKLMNOPQRSTVWXYZ023456789?a=e=g=h=k=l=m=o=u=x=E=H=P=U=";
-/* char takeargs="gmueoazhluEH"; */ /* subset that takes args! needed here */
-
void reorderargs (int ac, char **av)
{
int n, m;
char *s, *t;
-// char takeargs[128]; /* large enough for all command line arg chars */
char takeargs[256]; /* large enough for all command line arg chars */
-/* assumes arg pointers av[] are writeable */
-/* for (n = 1; n < ac; n++) sprintf(log_line, "%s ", av[n]); */
-
- if (ac < 3) { /* need more than one arg to reorder anything 94/Feb/25 */
-/* show_line("No arguments?\n", 0); */ /* debugging */
- return; /* no args ! */
+ if (ac < 3)
+ {
+ return; /* no args ! */
}
s = allowedargs;
t = takeargs; /* list of those that take args */
- while (*s != '\0' && *(s+1) != '\0') {
- if (*(s+1) == '=') *t++ = *s++; /* copy over --- without the = */
+
+ while (*s != '\0' && *(s+1) != '\0')
+ {
+ if (*(s+1) == '=')
+ *t++ = *s++; /* copy over --- without the = */
+
s++;
}
+
*t = '\0';
- if (trace_flag) {
+
+ if (trace_flag)
+ {
show_line(takeargs, 0);
show_char('\n');
}
n = 1;
- for (;;) { /* scan to end of command line args */
- if (*av[n] != '-') break;
-/* does it take an argument ? and is this argument next ? */
- if (n+1 < ac &&
- *(av[n]+2) == '\0' &&
-/* strchr("gmuhleoxE", *(av[n]+1)) != NULL) */
- strchr(takeargs, *(av[n]+1)) != NULL)
- n += 2; /* step over it */
- else n++;
- if (n == ac) break;
- }
-
- for (;;) { /* look for more command line args */
- if (n == ac) break;
+
+ for (;;)
+ {
+ if (*av[n] != '-')
+ break;
+
+ if (n + 1 < ac && *(av[n] + 2) == '\0' &&
+ strchr(takeargs, *(av[n]+1)) != NULL)
+ n += 2; /* step over it */
+ else
+ n++;
+
+ if (n == ac)
+ break;
+ }
+
+ for (;;)
+ {
+ if (n == ac)
+ break;
+
m = n;
-/* while (*av[m] != '-' && m < ac) m++; */ /* first command */
- while (m < ac && *av[m] != '-') m++; /* first command */
- if (m == ac) break;
+
+ while (m < ac && *av[m] != '-')
+ m++; /* first command */
+
+ if (m == ac)
+ break;
/* does it take an argument ? and is this argument next ? */
/* check first whether the `-x' is isolated, or arg follows directly */
/* then check whether this is one of those that takes an argument */
- if (m+1 < ac &&
- *(av[m]+2) == '\0' &&
- strchr(takeargs, *(av[m]+1)) != NULL) {
+ if (m+1 < ac && *(av[m]+2) == '\0' &&
+ strchr(takeargs, *(av[m]+1)) != NULL)
+ {
s = av[m]; /* move command down before non-command */
- t = av[m+1];
- for (; m > n; m--) av[m+1] = av[m-1];
+ t = av[m + 1];
+
+ for (; m > n; m--)
+ av[m + 1] = av[m - 1];
+
av[n] = s;
- av[n+1] = t;
+ av[n + 1] = t;
n += 2; /* step over moved args */
}
- else {
+ else
+ {
s = av[m]; /* move command down before non-command */
- for (; m > n; m--) av[m] = av[m-1];
+
+ for (; m > n; m--)
+ av[m] = av[m - 1];
+
av[n] = s;
n++; /* step over moved args */
}
char *lastname = NULL, *lastvalue = NULL;
-/* get value of env var - try first in dviwindo.ini then DOS env */
/* returns allocated string -- these strings are not freed again */
/* is it safe to do that now ? 98/Jan/31 */
char *grabenv (char *varname)
char * xchrfile = NULL;
char * replfile = NULL;
-char * short_options = "m:e:h:0:H:g:P:wvpiKLZMdp2t?uo:l:a:";
+char * short_options = "m:e:h:0:H:g:P:o:l:a:wvpiKLZMdp2t?u";
static struct option long_options[] =
{
{"tab-step", 1, 0, 'H'},
{"percent-grow", 1, 0, 'g'},
{"default-rule", 1, 0, 'P'},
- //{"interaction", 1, 0, 0},
+ {"dvi-dir", 1, 0, 'o'},
+ {"log-dir", 1, 0, 'l'},
+ {"aux-dir", 1, 0, 'a'},
{"showhex", 0, 0, 'w'},
{"verbose", 0, 0, 'v'},
{"patterns", 0, 0, 'p'},
{"trace", 0, 0, 't'},
{"help", 0, 0, '?'},
{"usage", 0, 0, 'u'},
- {"dvi-dir", 1, 0, 'o'},
- {"log-dir", 1, 0, 'l'},
- {"aux-dir", 1, 0, 'a'},
{NULL, 0, 0, 0}
};
xchrfile = xstrdup("xchr.map");
else
xchrfile = xstrdup(optarg);
+
if (xchrfile == NULL || *xchrfile == '\0')
complainarg(c, optarg);
break;
replfile = xstrdup("repl.key");
else
replfile = xstrdup(optarg);
+
if (replfile == NULL || *replfile == '\0')
complainarg(c, optarg);
break;
-/* more obscure stuff - ppssibly recycle */
case 'P':
if (optarg == 0)
- default_rule = 26214; /* 95/Oct/9 */
+ default_rule = 26214;
else
- default_rule = atoi(optarg); /* 95/Oct/9 */
+ default_rule = atoi(optarg);
+
if (default_rule == 0)
complainarg(c, optarg);
break;
{
char *s;
- if ((s = strrchr(pathname, '\\')) != NULL);
- else if ((s = strrchr(pathname, '/')) != NULL);
- else if ((s = strrchr(pathname, ':')) != NULL) s++;
- else s = pathname;
+ if ((s = strrchr(pathname, '\\')) != NULL)
+ ;
+ else if ((s = strrchr(pathname, '/')) != NULL)
+ ;
+ else if ((s = strrchr(pathname, ':')) != NULL)
+ s++;
+ else
+ s = pathname;
*s = '\0';
}
-char *programpath = ""; /* pathname of program */
-
-/* The following does not deslashify arguments ? Do we need to ? */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* try and read commands on command line */
int read_command_line (int ac, char **av)
{
int c;
if (show_use || quitflag == 3)
{
- //stamp_it(log_line);
- //strcat(log_line, "\n");
- //show_line(log_line, 0);
+ stamp_it(log_line);
+ strcat(log_line, "\n");
+ show_line(log_line, 0);
//stampcopy(log_line);
//strcat(log_line, "\n");
//show_line(log_line, 0);
mem_extra_low = 0;
mem_initex = 0;
- programpath = xstrdup(av[0]); /* extract path executable */
- strip_name(programpath); /* strip off yandytex.exe */
-
- format_name = "plain"; /* format name if specified on command line */
+ //format_name = xstrdup(av[0]);
+ format_name = "plain";
encoding_name = "";
/* then makes no sense to avoid them separately for TFM files ... */
/* (that is, the ./ is already omitted from the dir list in that case */
if (!current_flag && !current_tfm)
- current_tfm = true; /* 94/Jan/24 */
+ current_tfm = true;
return 0;
}
kpse_set_program_name(av[0], NULL);
- // compile time test
- // MSVC: __int64 8bytes
- // GCC: long 8bytes
if (sizeof(memory_word) != sizeof(integer) * 2)
{
sprintf(log_line, "ERROR: Bad word size %d!\n", sizeof(memory_word));
initbuffer[0] = '\0'; /* paranoia 94/Apr/10 */
/* reset all allocatable memory pointers to NULL - in case we drop out */
- mainmemory = NULL;
+ main_memory = NULL;
font_info = NULL;
str_pool = NULL;
str_start = NULL;
#endif
#ifdef ALLOCATEBUFFER
- buffer = NULL; /* new 1999/Jan/7 need to do early */
+ buffer = NULL;
current_buf_size = 0;
buffer = realloc_buffer (initial_buf_size);
#endif
reorderargs(ac, av);
if (init_commands(ac, av))
- return -1; // failure
+ return -1;
- check_fixed_align(trace_flag); /* sanity check 1994/Jan/8 */
+ check_fixed_align(trace_flag);
format_file = NULL;
- string_file = NULL;
source_direct = NULL;
dvi_file_name = NULL;
log_file_name = NULL;
overfull_vbox = 0;
underfull_vbox = 0;
- closed_already=0; // so can only do once
+ closed_already = 0;
if (trace_flag)
show_line("Entering init (local)\n", 0);
if (allocate_memory() != 0) /* NOW, try and ALLOCATE MEMORY if needed */
return -1; // if failed to allocate
-/* following is more or less useless since most all things not yet alloc */
- check_alloc_align(trace_flag); /* sanity check 1994/Jan/8 */
+ /* following is more or less useless since most all things not yet alloc */
+ check_alloc_align(trace_flag); /* sanity check 1994/Jan/8 */
if (trace_flag)
show_line("Leaving init (local)\n", 0);
- return 0; // success
+ return 0;
}
#define CLK_TCK CLOCKS_PER_SEC
show_line(log_line, 0);
}
else
- show_line("0", 0); /* 95/Mar/1 */
+ show_line("0", 0);
}
-/* final cleanup opportunity */
-/* flag is non-zero if error exit */
-/* shows various times, warning about missing chars */
int endit (int flag)
{
finish_time = clock();
show_line("\n", 0);
}
- //checkpause(flag);
-
return flag;
}
// printf control sequences' name
}
// prototype
-int compare_strn (int, int, int, int); /* in tex9.c */
+int compare_strn (int, int, int, int);
/* compare two csnames in qsort */
int compare_cs (const void *cp1, const void *cp2)
{
/* Allocate table of indeces to allow sorting on csname */
/* Allocate flags to remember which ones already listed at start */
-/* pass = 0 --> fmt */
+/* pass = 0 --> fmt */
/* pass = 1 --> after */
void print_cs_names (FILE *output, int pass)
{
fprintf(output, log_line);
}
- if (ccount > 0) /* don't bother to get into trouble */
+ if (ccount > 0)
{
cnumtable = (int *) malloc (ccount * sizeof(int));
return;
ccount = 0;
-/* for (h = 515; h < (hash_size + 780); h++) { */
+
for (h = hash_base + 1; h < nfcs; h++)
{
if (pass == 1 && csused[h])
}
codingvector[6] = '\0';
}
-/* sprintf(log_line, "Reconstructed vector %s\n", codingvector); */
- return 0; /* encoding info returned in codingvector */
+
+ return 0;
}
double sclpnt (long x)
}
free((void *)fnumtable);
-}
-
-/* NOTE: current_tfm = false (-c)
- not checking for TFM in current directory saves 0.1 sec
- (0.2 if file_method = false (-G) */
-
-/* NOTE: test_dir_access = false (-b):
- not checking whether readable file is a directory saves maybe 0.5 sec
- BUT only if file_method = false (-G) - otherwise its irrelevant */
-
-/* NOTE: dir_method = false (-D) --- method for checking whether directory
- using fopen instead of _findfirst in dir_p slows job maybe 0.05 sec
- BUT not if current_tfm = false (-c) */
-
-/* NOTE: file_method = false (-G) --- method for checking file accessible
- using _access (readable) instead of _findfirst (file_p) costs 0.5 sec */
-
-/* Fast flag combinations: nothing, bG, bcG, bcDG */
-
-/* buffercopy no longer used */
-
-/* To Knuthian reset right when command line interpreted */
-
+}
\ No newline at end of file
strcpy ((char *) name_of_file + 1, file_name);
*f = xfopen((char *) file_name, fopen_mode);
-#ifdef MSDOS
+#ifdef _WIN32
if (name_of_file[1] == '.' && (name_of_file[2] == PATH_SEP || name_of_file[2] == '\\'))
#else
if (name_of_file[1] == '.' && name_of_file[2] == PATH_SEP)
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;
+ bool 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))
{
- //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_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
if (bchlabel < nl)
bchar_label[f] = bchlabel + 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)
{
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)
b_close(tfm_file);
new_hlist(q) = hpack(x, 0, 1);
}
/***************************************************************************/
-/* moved to end to avoid questions about pragma optimize 96/Sep/12 */
scaled make_op_ (halfword);
/***************************************************************************/
/* sec 0752 */
}
}
/***************************************************************************/
-/* moved to end to avoid questions about pragma optimize 96/Sep/12 */
void make_scripts_ (halfword, scaled);
/***************************************************************************/
/* sec 0762 */
begin_token_list(u_part(cur_align), u_template);
}
}
-/* fin_col() moved to end to hide in pragma (g, "off") */
-/* may need to move more ? everything calling new_null_box() ? */
/* sec 0799 */
void fin_row (void)
{
return false;
}
-/* #pragma optimize ("g", on) */ /* for MC VS compiler */
-/* #pragma optimize ("g",) */ /* 94/Jan/25 */
-/* #pragma optimize ("", on) */ /* 96/Sep/12 */
-/* #pragma optimize("g", off) */ /* for MC VS compiler */
/* sec 0749 */
scaled make_op_(halfword q)
{
return delta;
}
-/* #pragma optimize ("g", on) */ /* for MC VS compiler */
-/* #pragma optimize ("g",) */ /* 94/Jan/25 */
-/* #pragma optimize ("", on) */ /* 96/Sep/12 */
-/* #pragma optimize ("g", off) */
/* sec 0756 */
void make_scripts_(halfword q, scaled delta)
{
link(p) = x;
}
-}
-/* #pragma optimize ("g", on) */ /* 96/Sep/12 */
-/* #pragma optimize ("g") */ /* 94/Jan/25 */
-/* #pragma optimize ("", on) */ /* 96/Sep/12 */
\ No newline at end of file
+}
\ No newline at end of file
init_col();
}
}
-/* used in itex.c only */
/* sec 0826 */
halfword finite_shrink_(halfword p)
{
prev_graf = best_line - 1;
}
-/* Reconstitute ligatures during hyphenation pass */
/* sec 0906 */
small_number reconstitute_(small_number j, small_number n, halfword bchar, halfword hchar)
{
return j;
}
-/* #pragma optimize ("g", off) */ /* not needed for MSVC it seems ... */
/* sec 0895 */
void hyphenate (void)
{
link(s) = q;
flush_list(init_list);
}
-/* #pragma optimize ("g", off) */ /* not needed for MSVC it seems ... */
-/* used only in itex.c */
/* sec 0934 */
void new_hyph_exceptions (void)
{
lab30:
return best_place;
}
-/* called only from tex7.c */
/* sec 0977 */
halfword vsplit_(eight_bits n, scaled h)
{
box_error(n);
}
}
-/* called only from tex7.c */
/* sec 1012 */
void fire_up_(halfword c)
{
ship_out(box(255));
box(255) = 0;
}
-}
-/* used to continue here with build_page etc in tex6.c */
\ No newline at end of file
+}
\ No newline at end of file
#include "texd.h"
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/* sec 0994 */
void build_page (void)
{
link(tail) = q;
tail = q;
}
-/* called from tex8.c only */
/* sec 1047 */
void insert_dollar_sign (void)
{
error();
}
}
-/* only called from tex8.c */
/* sec 1069 */
void extra_right_brace (void)
{
else
ship_out(cur_box);
}
-/* called only from tex8.c */
/* sec 1079 */
void begin_box_(integer box_context)
{
if (nest_ptr == 1)
build_page();
}
-/* procedure indent_in_hmode; l.21058 */
/* sec 1093 */
void indent_in_hmode (void)
{
tail_append(p);
}
}
-/* only called from tex8.c */
/* sec 1095 */
void head_for_vmode (void)
{
error_count = 0;
}
}
-/* only called form tex8.c */
/* sec 1099 */
void begin_insert_or_adjust (void)
{
if (mode == vmode)
build_page();
}
-/* only called from tex8.c */
/* sec 1105 */
void delete_last (void)
{
}
}
}
-/* only called from tex8.c */
-/* procedure unpackage; l.21256 */
/* sec 1110 */
void unpackage (void)
{
space_factor = 1000;
}
}
-/* only called form tex8.c */
/* sec 1119 */
void build_discretionary (void)
{
mode = -hmode;
space_factor = 1000;
}
-/* called only from tex8.c */
/* sec 1123 */
void make_accent (void)
{
"an alignment. Proceed, and I'll ignore this case.");
error();
}
-/* only called from tex8.c */
/* sec 1129 */
void omit_error (void)
{
else
off_save();
}
-/* only called form tex8.c */
/* sec 1135 */
void cs_error (void)
{
}
scan_math(p);
}
-/* used to continue here with math_fraction etc in tex7.c */
-/*****************************************************************************/
-/* moved down here to avoid pragma optimize questions 96/Sep/12 */
/* sec 1086 */
void package_(small_number c)
{
height(cur_box) = h;
}
}
+
pop_nest();
box_end(saved(0));
-}
-//#pragma optimize ("", on) /* 96/Sep/12 */
\ No newline at end of file
+}
\ No newline at end of file
scan_delimiter(right_delimiter(incompleat_noad), false);
}
- switch(c % delimited_code)
+ switch (c % delimited_code)
{
case above_code:
scan_dimen(false, false, false);
if (w + q > z)
{
- if ((e != 0) && ((w - total_shrink[normal] + q <= z) || (total_shrink[fil] != 0) || (total_shrink[fill] != 0) || (total_shrink[filll] != 0)))
+ if ((e != 0) && ((w - total_shrink[normal] + q <= z) || (total_shrink[fil] != 0) ||
+ (total_shrink[fill] != 0) || (total_shrink[filll] != 0)))
{
free_node(b, box_node_size);
b = hpack(p, z - q, 0);
{
get_token();
}
- while (!(cur_tok != space_token));
+ while (!(cur_tok != space_token));
if ((cur_cs == 0) || (cur_cs > frozen_control_sequence))
{
p = cur_chr;
scan_eight_bit_int();
- switch(p)
+ switch (p)
{
case int_val:
l = cur_val + count_base;
break;
}
}
-lab40:;
+lab40:
if (q == tex_register)
scan_optional_equals();
else
eq_define(l, glue_ref, cur_val);
}
}
-/* called only from itex.c */
/* sec 1243 */
void alter_aux (void)
{
nest[nest_ptr] = cur_list;
p = nest_ptr;
- while(abs(nest[p].mode_field) != vmode)
+ while (abs(nest[p].mode_field) != vmode)
decr(p);
scan_optional_equals();
else
{
old_setting = selector;
- selector = 21;
+ selector = new_string;
print_string("FONT");
print(u - active_base);
selector = old_setting;
help2("I can only handle fonts at positive sizes that are",
"less than 2048pt, so I've changed what you said to 10pt.");
error();
- s = 10 * 65536L; /* 10pt */
+ s = 10 * 65536L;
}
}
else if (scan_keyword("scaled"))
flushable_string = str_ptr - 1;
- if (trace_flag) /* debugging stuff only 98/Oct/5 */
+ if (trace_flag)
{
int i, k1, k2, l1, l2;
char *sch = log_line;
}
else if (font_size[f] == xn_over_d(font_dsize[f], - (integer) s, 1000))
{
- if (ignore_frozen == 0 || f > frozen_font_ptr) /* 99/Mar/26 */
+ if (ignore_frozen == 0 || f > frozen_font_ptr)
{
if (trace_flag)
{
scan_file_name();
pack_file_name(cur_name, cur_area, cur_ext);
-/* *** some changes in following in 3.14159 *** */
-/* if current extension is *not* empty, try to open using name as is */
-/* string 335 is "" the empty string */
if ((cur_ext != 335) && a_open_in(read_file[n], TEXINPUTPATH))
read_open[n] = 1;
-/* we get here if extension is "", or file with extension failed to open */
-/* if current extension is not `tex,' and `tex' is not irrelevant, try it */
-/* string 785 is .tex */
else if ((cur_ext != 785) && (name_length + 5 < PATHMAX))
- {
- strncpy((char *) name_of_file + name_length + 1, ".tex ", 5);
- name_length = name_length + 4;
+ {
+ strncpy((char *) name_of_file + name_length + 1, ".tex ", 5);
+ name_length = name_length + 4;
- if (a_open_in(read_file[n], TEXINPUTPATH))
- read_open[n] = just_open;
- else
- {
- name_length = name_length - 4; /* remove ".tex" again */
- name_of_file[name_length + 1] = ' ';
+ if (a_open_in(read_file[n], TEXINPUTPATH))
+ read_open[n] = just_open;
+ else
+ {
+ name_length = name_length - 4;
+ name_of_file[name_length + 1] = ' ';
- if ((cur_ext == 335) && a_open_in(read_file[n], TEXINPUTPATH))
- read_open[n] = 1;
- }
+ if ((cur_ext == 335) && a_open_in(read_file[n], TEXINPUTPATH))
+ read_open[n] = 1;
}
+ }
}
}
/* sec 1279 */
{
halfword p;
- switch(cur_chr)
+ switch (cur_chr)
{
case show_lists:
{
/* sec 1348 */
void do_extension (void)
{
-/* integer i, j, k; */
integer k;
-/* halfword p, q, r; */
halfword p;
switch(cur_chr)
/* free the limit on font memory ! */ /* (2^32 - 1) / sizeof(memory_word) */
#ifdef ALLOCATEFONT
/* #define font_mem_size 262140L */
- #define font_mem_size (max_halfword / sizeof(memory_word) -1)
+ #define font_mem_size (max_halfword / sizeof(memory_word) - 1)
#else
#define font_mem_size 100000L
#endif
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
#ifdef ALLOCATEMAIN
- EXTERN memory_word * mainmemory; /* remembered so can be free() later */
- EXTERN memory_word * zzzaa;
- #define zmem zzzaa
+ EXTERN memory_word * main_memory; /* remembered so can be free() later */
+ EXTERN memory_word * mem;
#else
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
EXTERN memory_word
EXTERN int allow_quoted_names;
EXTERN int default_rule;
EXTERN char * format_file;
-EXTERN char * source_direct; /* 1998/Sep/29 */
-EXTERN char * string_file;
+EXTERN char * source_direct;
EXTERN char * format_name;
EXTERN char * encoding_name;
EXTERN bool format_specific;
buffer[first] = 0; /* In case there are no arguments. */
#ifdef MSDOS
-/* command line arguments? 94/Apr/10 */
if (gargc > optind && optind > 0)
{
for (i = optind; i < gargc; i++)
unsigned int commandlen;
ASCII_code *texfilename;
ASCII_code *log_file_name;
- pool_pointer lgstart; /* 1994/Jan/94 */
- integer lglength; /* 1994/Jan/94 */
+ pool_pointer lgstart;
+ integer lglength;
- if (log_opened) /* 1994/Aug/10 */
+ if (log_opened)
{
lgstart = str_start[texmf_log_name];
lglength = length(texmf_log_name);
log_file_name = stringpool + lgstart;
}
- else /* 1994/Aug/10 */
+ else
{
lglength = 0;
log_file_name = (unsigned char *) "";
}
sdone = ddone = ldone = 0;
-/* filename += fnstart; */
texfilename = stringpool + fnstart;
-/* Close any open input files, since we're going to kill the job. */
-/* and since the editor will need access to them... */
for (i = 1; i <= in_open; i++)
(void) fclose (input_file[i]);
- n = fcloseall(); /* paranoia 1994/Aug/10 */
+ n = fcloseall();
if (n > 0 && verbose_flag)
{
show_line(log_line, 0);
}
-/* Replace the default with the value of the appropriate environment
- variable, if it's set. */
-/* s = getenv (edit_var); */ /* 93/Nov/20 */
s = get_env_shroud (edit_var);
+
if (s != NULL)
- edit_value = s; /* OK, replace wired in default */
+ edit_value = s;
/* Construct the command string. */
/* The `11' is the maximum length a 32 bit integer might be, plus one for null. */
/* remove quotes around [...] string for WinEdt ? */
u = edit_value;
- while ((c = *u++) != 0) {
- if (c == '%') { /* handle special codes */
+
+ while ((c = *u++) != 0)
+ {
+ if (c == '%')
+ {
switch (c = *u++)
{
case 'd':
if (ddone)
{
-#ifdef MSDOS
+#ifdef _WIN32
sprintf(log_line, "! bad command syntax (%c).\n", 'd');
show_line(log_line, 1);
#else
#endif
uexit(1);
}
+
(void) sprintf (s, "%d", linenumber);
+
while (*s != '\0')
s++;
- ddone = 1; /* indicate already used %d */
+
+ ddone = 1;
break;
case 's':
if (sdone)
{
-#ifdef MSDOS
+#ifdef __WIN32
sprintf(log_line, "! bad command syntax (%c).\n", 's');
show_line(log_line, 1);
#else
#endif
uexit(1);
}
+
t = (char *) texfilename;
n = fnlength;
-/* following modified to allow non ASCII - bkph */ /* for file names */
if (non_ascii)
-/* for (i = 0; i < fnlength; i++) *s++ = xchr [filename[i]]; */
for (i = 0; i < n; i++)
*s++ = xchr [*t++];
else
-/* for (i = 0; i < fnlength; i++) *s++ = (char) filename[i]; */
for (i = 0; i < n; i++)
*s++ = (char) *t++;
- sdone = 1; /* indicate already used %s */
+
+ sdone = 1;
break;
- case 'l': /* 1994/Jan/28 */
+ case 'l':
if (ldone)
{
-#ifdef MSDOS
+#ifdef __WIN32
sprintf(log_line, "! bad command syntax (%c).\n", 'l');
show_line(log_line, 1);
#else
#endif
uexit(1);
}
+
t = (char *) log_file_name;
- n = lglength; /* 1994/Jan/28 */
+ n = lglength;
-/* following modified to allow non ASCII - bkph */ /* for file names */
if (non_ascii)
-/* for (i = 0; i < fnlength; i++) *s++ = xchr [filename[i]]; */
for (i = 0; i < n; i++)
*s++ = xchr [*t++];
else
-/* for (i = 0; i < fnlength; i++) *s++ = (char) filename[i]; */
for (i = 0; i < n; i++)
*s++ = (char) *t++;
- ldone = 1; /* indicate already used %l */
+
+ ldone = 1;
break;
- case '\0': /* '%' at end of line */
+ case '\0':
*s++ = '%';
- u--; /* Back up to the null to force termination. */
+ u--;
break;
- default: /* something other than 's', 'd', 'l' follows */
+ default:
*s++ = '%';
*s++ = c;
break;
}
}
- else *s++ = c; /* ordinary character pass it through */
+ else
+ *s++ = c;
}
- *s = 0; /* terminate the command string */
+ *s = 0; /* terminate the command string */
- if (strlen(command) + 1 >= commandlen) /* should not happen! */
+ if (strlen(command) + 1 >= commandlen)
{
sprintf(log_line, "Command too long (%d > %d)\n", strlen(command) + 1, commandlen);
show_line(log_line, 1);
//flushall();
fflush(NULL);
-/* Try and execute the command. */
-/* There may be problem here with long names and spaces ??? */
-/* Use _exec or _spawn instead ??? */
if (system (command) != 0)
{
show_line("\n", 0);
- sprintf(log_line, "! Error in call: %s\n", command); /* shroud ? */
+ sprintf(log_line, "! Error in call: %s\n", command);
show_line(log_line, 1);
-/* errno seems to be 0 typically, so perror says "no error" */
-#ifdef MSDOS
+
+#ifdef __WIN32
if (errno != 0)
- perrormod("! DOS says"); /* 94/Aug/10 - bkph */
+ perrormod("! DOS says");
#endif
+
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);
}
- uexit(1); /* Quit, since we found an error. */
+
+ uexit(1);
}
\f
#include <setjmp.h>
#include <time.h>
#include <signal.h>
-#ifdef MSDOS
-#include <kpathsea/win32lib.h>
-#include <conio.h>
-#define getch _getch
+#ifdef _WIN32
+ #include <kpathsea/win32lib.h>
#else
-#include <unistd.h>
+ #include <unistd.h>
#endif
#include "hpdf.h"
#include "hpdf_utils.h"