Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA. */
-#ifdef _WINDOWS
- #define NOCOMM
- #define NOSOUND
- #define NODRIVERS
- #define STRICT
- #pragma warning(disable:4115) // kill rpcasync.h complaint
- #include <windows.h>
- #define MYLIBAPI __declspec(dllexport)
-#endif
-
-#include "texwin.h"
-
-#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
-
-#include <setjmp.h>
-
#define EXTERN extern
#include "texd.h"
extern clock_t start_time, main_time, finish_time; /* in local.c */
-/* imported from pascal.h */
-/* localized here to avoid conflict with io.h in other code */
-
-#define read(f, b) ((b) = getc (f))
-#define readln(f) { register int c; while ((c = getc (f)) != '\n' && c != EOF); }
-
#ifdef INITEX
- void do_initex (void); /* later in this file */
+ void do_initex (void);
#endif
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/* sec 0004 */
void initialize (void)
{
shown_mode = 0;
page_contents = 0;
page_tail = page_head;
+
#ifdef ALLOCATEMAIN
if (is_initex) /* in iniTeX we did already allocate mem [] */
#endif
cur_loop = 0;
cur_head = 0;
cur_tail = 0;
+
+
/* *not* OK with ALLOCATEHYPHEN, since may not be allocated yet */
#ifndef ALLOCATEHYPHEN
for (z = 0; z <= hyphen_prime; z++)
{
- hyph_word[z]= 0;
- hyph_list[z]= 0;
+ hyph_word[z] = 0;
+ hyph_list[z] = 0;
}
#endif
+
hyph_count = 0;
output_active = false;
insert_penalties = 0;
write_open[k] = false;
edit_name_start = 0;
+
#ifdef INITEX
-/* initex stuff split off for convenience of optimization adjustments */
if (is_initex)
{
do_initex();
}
-#else
-/* trap the -i on command line situation if INITEX was NOT defined */
- if (is_initex)
- {
- show_line("Sorry, somebody forgot to make an INITEX!\n", 1);
- }
-#endif /* not INITEX */
+#endif
}
/* do the part of initialize() that requires mem_top, mem_max or mem[] */
while (cur_cmd == prefix)
{
if (!odd(a / cur_chr))
- a = a + cur_chr; /* small_number a; */
+ a = a + cur_chr;
do
{
sprintf(log_line, "Read from fmt fmem_ptr = %d\n", x);
show_line(log_line, 0);
}
+
if (x > current_font_mem_size) /* 93/Nov/28 dynamic allocate font_info */
{
if (trace_flag)
else
font_ptr = x;
}
- frozenfontptr = font_ptr; /* remember number of fonts frozen into format */
+ frozen_font_ptr = font_ptr; /* remember number of fonts frozen into format */
if (undumpthings(font_check[0], font_ptr + 1))
return -1;
if (undumpthings(font_size[0], font_ptr + 1))
{
history = 3;
- set_paths(TEXFORMATPATHBIT + TEXINPUTPATHBIT + TFMFILEPATHBIT);
-
- if (ready_already == 314159L) /* magic number */
+ if (ready_already == 314159L)
goto lab1;
-/* These tests are almost all compile time tests and so could be eliminated */
+
+ /* 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 (mem_max > mem_top + mem_extra_high) /* not compile time */
bad = 14; /* ha ha */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* if ((0 < 0)||(font_max > 255)) */
+
if ((0 < min_quarterword) || (font_max > max_quarterword)) /* 93/Dec/3 */
bad = 15;
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
if (format_default_length > PATHMAX)
bad = 31;
-/* if (2 * 262143L < mem_top - mem_min) */
+
if (max_halfword < (mem_top - mem_min) / 2)
bad = 41;
show_line(log_line, 1);
if (!knuth_flag)
- bad_formator_pool(format_file, "the format file", "TEXFORMATS"); /* 96/Jan/17 */
+ bad_formator_pool(format_file, "the format file", "TEXFORMATS");
goto lab9999; // abort
}
init_pool_ptr = pool_ptr;
fix_date_and_time();
}
-#endif /* INITEX */
- ready_already = 314159L; /* magic number */
+#endif
+
+ ready_already = 314159L; /* magic number */
-lab1: /* get here directly if ready_already already set ... */
+lab1:
selector = term_only;
tally = 0;
term_offset = 0;
file_offset = 0;
show_line(tex_version, 0);
- sprintf(log_line, " (%s %s)", application, yandyversion);
+
+#ifdef _WIN64
+ sprintf(log_line, " (%s %s/Windows 64bit)", application, yandyversion);
+#else
+ sprintf(log_line, " (%s %s/Windows 32bit)", application, yandyversion);
+#endif
+
show_line(log_line, 0);
if (format_ident > 0)
max_param_stack = 0;
#ifdef ALLOCATEBUFFER
-/* first = current_buf_size; */
- memset (buffer, 0, current_buf_size); /* redundant */
+ memset (buffer, 0, current_buf_size);
#else
-/* first = buf_size; */
- memset (buffer, 0, buf_size); /* redundant ? */
+ memset (buffer, 0, buf_size);
#endif
- first = 0; /* 1999/Jan/22 */
+ first = 0; /* 1999/Jan/22 */
scanner_status = 0;
warning_index = 0; /* warning_index:=null; l.7068 */
first = 1;
cur_input.limit_field = last;
first = last + 1;
}
-/* if ((format_ident == 0)||(buffer[cur_input.loc_field]== 38)) */
+
/* For Windows NT, lets allow + instead of & for format specification */
if ((format_ident == 0) ||
(buffer[cur_input.loc_field] == '&') ||
incr(cur_input.loc_field);
}
-#ifdef CHECKEQTB
- if (debug_flag)
- check_eqtb("after format"); /* debugging 94/Apr/5 */
-#endif
if ((end_line_char < 0) || (end_line_char > 255))
decr(cur_input.limit_field);
else
fix_date_and_time();
- magic_offset = str_start[886] - 9 * ord_noad; /* following: */
-/* "0234000122*4000133**3**344*0400400*000000234000111*1111112341011" */
+ magic_offset = str_start[886] - 9 * ord_noad;
+ /* "0234000122*4000133**3**344*0400400*000000234000111*1111112341011" */
if (interaction == batch_mode)
selector = no_print;
code = 1;
else
code = 0;
-// now return instead of exit to allow cleanup in local.c
+
return code;
-// uexit(code);
}
-} /* end of texbody */
+}
#ifdef ALLOCATEMAIN
/* add a block of variable size node space below mem_bot */
-/* used in tex0.c, local.c, itex.c */
void add_variable_space(int size)
{
halfword p;
integer t;
if (mem_min == 0)
- t = mem_min; /* bottom of present block */
+ t = mem_min;
else
t = mem_min + 1;
mem_min = t - (size + 1); /* first word in new block - 1 */
-/* mem_min = mem_start; */ /* allocate all of it at once */
+
if (mem_min < mem_start) /* sanity test */
{
if (trace_flag)
show_line("WARNING: mem_min < mem_start!\n", 0);
+
mem_min = mem_start;
}
- p = mem[rover + 1].hh.v.LH;
+ p = llink(rover);
q = mem_min + 1;
- mem[mem_min].hh.v.RH = 0; /* insert blank word below ??? */
- mem[mem_min].hh.v.LH = 0; /* insert blank word below ??? */
- mem[p + 1].hh.v.RH = q;
- mem[rover + 1].hh.v.LH = q;
- mem[q + 1].hh.v.RH = rover;
- mem[q + 1].hh.v.LH = p;
- mem[q].hh.v.RH = empty_flag;
- mem[q].hh.v.LH = t - q; /* block size */
+ link(mem_min) = 0; /* insert blank word below ??? */
+ info(mem_min) = 0; /* insert blank word below ??? */
+ rlink(p) = q;
+ llink(rover) = q;
+ rlink(q) = rover;
+ llink(q) = p;
+ link(q) = empty_flag;
+ info(q) = t - q; /* block size */
rover = q;
}
#endif
for (z = 0; z <= hyphen_prime; z++)
{
hyph_word[z] = 0;
- hyph_list[z] = 0; /* hyph_list[z]:=null; l.18131 */
+ hyph_list[z] = 0;
}
hyph_count = 0;
font_glue[null_font] = 0;
font_params[null_font] = 7;
param_base[null_font] = -1;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
- reset_trie(); /* shared 93/Nov/26 */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-
+ reset_trie();
text(frozen_protection) = 1184; /* "inaccessible" */
format_ident = 1251;
text(end_write) = 1290;
eq_type(end_write) = outer_call;
equiv(end_write) = 0;
}
-#endif /* INITEX */
+#endif
#ifdef INITEX
/* sec 0047 */
g = make_string();
}
- g = load_pool_strings(pool_size - stringvacancies);
+ g = load_pool_strings(pool_size - string_vacancies);
if (g == 0)
{
eq_type(cur_val) = c;
equiv(cur_val) = o;
}
-#endif /* INITEX */
-
-/* more weird constants ? page 394 */
+#endif
#ifdef INITEX
/* sec 0944 */
{
if (trie_size <= h + 256)
{
- /* pattern memory - NOT DYNAMIC */
overflow("pattern memory", trie_size);
/* not dynamic ---- but can be set -h=... from command line in ini-TeX */
return; // abort_flag set
primitive("skipdef", shorthand_def, 4);
primitive("muskipdef", shorthand_def, 5);
primitive("toksdef", shorthand_def, 6);
- primitive("catcode", def_code, (hash_size + 1883));
- primitive("mathcode", def_code, (hash_size + 2907));
- primitive("lccode", def_code, (hash_size + 2139));
- primitive("uccode", def_code, (hash_size + 2395));
- primitive("sfcode", def_code, (hash_size + 2651));
+ primitive("catcode", def_code, cat_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, (hash_size + 3474));
primitive("textfont", def_family, (hash_size + 1835));
primitive("scriptfont", def_family, (hash_size + 1851));