/* in this case, just let mem be alias for zmem */
/* BUT: allow continued use of register for eqtb at least ! */
#define mem zmem
-#ifndef ALLOCATEZEQTB
-/* if eqtb is NOT allocated, can just let eqtb be an alias for zeqtb */
-//#define eqtb zeqtb /* EXPERIMENT 1996/JAN/18 */
-#else
-/* uncomment `register memory_word *eqtb=zeqtb' */
-/* but with present compiler its faster to not do it this way 99/Jan/18 */
-#endif
-
-#ifndef ALLOCATEDVIBUF
-/* if dvi_buf is NOT allocated, can just let dvi_buf be an alias for zdvibuf */
- #define dvi_buf zdvibuf /* EXPERIMENT 1996/JAN/18 */
-#else
-/* uncomment `register memory_word *dvi_buf=zdvibuf' */
-/* but with present compiler its faster to not do it this way 99/Jan/18 */
-#endif
void print_err (const char * s);
void initialize (void);
bool open_fmt_file(void);
bool load_fmt_file(void);
void close_files_and_terminate(void);
-#ifdef ALLOCATEDVIBUF
- #define closefilesandterminate_regmem register eight_bits *dvi_buf=zdvibuf;
-#else
- #define closefilesandterminate_regmem /* register memory_word *eqtb=zeqtb; */
-#endif
void final_cleanup(void);
void init_prim(void);
void debug_help(void);
extern clock_t start_time, main_time, finish_time; /* in local.c */
#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)
{
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
}
}
#endif
- ready_already = 314159L; /* magic number */
+ ready_already = 314159L; /* magic number */
lab1:
selector = term_only;
term_offset = 0;
file_offset = 0;
show_line(tex_version, 0);
-#ifdef _M_AMD64
- sprintf(log_line, " (%s %s/x64)", application, yandyversion);
+
+#ifdef _WIN64
+ sprintf(log_line, " (%s %s/Windows 64bit)", application, yandyversion);
#else
- sprintf(log_line, " (%s %s/x86)", application, yandyversion);
+ sprintf(log_line, " (%s %s/Windows 32bit)", application, yandyversion);
#endif
+
show_line(log_line, 0);
if (format_ident > 0)
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;
#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 = 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 */
{
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
if (old_size >= new_size && old_size < new_size + 4)
return old;
+#ifdef MSDOS
mnew = _expand (old, new_size); /* first try and expand in place MSVC */
+#else
+ mnew = realloc (old, new_size);
+#endif
if (mnew != NULL)
{
}
#endif
-/* no real reason to allocate dvi_buf - no need to ever grow it */
-#ifdef ALLOCATEDVIBUF
-/* zdvibuf = NULL; */
- zdvibuf = allocatedvibuf (dvi_buf_size);
- if (zdvibuf == NULL) return -1;
-#endif
-
-#ifdef ALLOCATEZEQTB
-/* zeqtb = NULL; */
-#ifdef INCREASEFONTS
-/* zeqtb = allocatezeqtb (13507 + eqtb_extra); */ /* 94/Mar/29 */
- zeqtb = allocatezeqtb (hash_size + 4007 + eqtb_extra); /* 94/Mar/29 */
-#else
-/* zeqtb = allocatezeqtb (13507); */
- zeqtb = allocatezeqtb (hash_size + 4007);
-#endif
-#endif
-
#ifdef ALLOCATEINPUTSTACK
input_stack = NULL; /* new 1999/Jan/21 */
current_stack_size = 0;
test_align ((int) &depth_threshold, 4, "depth_threshold");
test_align ((int) &breadth_max, 4, "breadth_max");
test_align ((int) &nest, sizeof(nest[0]), "nest");
-
-#ifdef ALLOCZEQTB
- test_align ((int) &zeqtb, sizeof(zeqtb[0]), "zeqtb"); /* not any more ? */
-#endif
/* test_align ((int) &xeq_level, sizeof(xeq_level[0]), "xeq_level"); */
test_align ((int) &zzzad, sizeof(zzzad[0]), "zzzad");
/* test_align ((int) &hash, sizeof(hash[0]), "hash"); */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA. */
-#ifdef MSDOS
- #include <direct.h> /* for _getcwd() */
-#else
- #include <unistd.h>
-#endif
-
#define EXTERN extern
#include "texd.h"
#define PATH_SEP '/'
-// used only in jump_out in tex0.c, and in texbody in itex.c
-// and main in texmf.c and a few other abort situations in texmf.c
// texk/web2c/lib/uexit.c
void uexit (int unix_code)
{
{
dvi_buf[dvi_ptr] = op;
incr(dvi_ptr);
+
if (dvi_ptr == dvi_limit)
dvi_swap();
}
{
error();
}
+
#ifdef DEBUG
if (interaction > 0)
debug_help();
#endif
+
history = 3;
jump_out();
}
#include "texd.h"
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
/* sec 0198 */
-void show_box_(halfword p)
+void show_box_(pointer p)
{
depth_threshold = show_box_depth;
breadth_max = show_box_breadth;
print_ln();
}
/* sec 0200 */
-void delete_token_ref_(halfword p)
+void delete_token_ref_(pointer p)
{
if (token_ref_count(p) == 0)
flush_list(p);
decr(token_ref_count(p));
}
/* sec 0201 */
-void delete_glue_ref_(halfword p)
+void delete_glue_ref_(pointer p)
{
if (glue_ref_count(p) == 0)
free_node(p, glue_spec_size);
decr(glue_ref_count(p));
}
/* sec 0202 */
-void flush_node_list_(halfword p)
+void flush_node_list_(pointer p)
{
- halfword q;
+ pointer q;
- while (p != 0) { /* while p<>null */
+ while (is_char_node(p))
+ {
q = link(p);
if (is_char_node(p))
}
break;
}
+
free_node(p, small_node_size);
lab30:;
}
+
p = q;
}
}
/* sec 0204 */
-halfword copy_node_list_(halfword p)
+pointer copy_node_list_(pointer p)
{
- register halfword Result;
- halfword h;
- halfword q;
- halfword r;
+ pointer h;
+ pointer q;
+ pointer r;
char words;
h = get_avail();
q = h;
- while (p != 0) { /* while p<>null do l.3969 */
+ while (p != 0)
+ {
words = 1;
if ((p >= hi_mem_min))
q = link(h);
free_avail(h);
- Result = q;
- return Result;
+ return q;
}
/* sec 0211 */
void print_mode_(integer m)
}
}
}
+
print_string(" mode");
}
/* sec 0216 */
if (nest_ptr == current_nest_size)
nest = realloc_nest_stack(increment_nest_size);
- if (nest_ptr == current_nest_size) /* check again after allocation */
+ if (nest_ptr == current_nest_size)
{
overflow("semantic nest size", current_nest_size);
return; // abort_flag set
#else
if (nest_ptr == nest_size)
{
- overflow("semantic nest size", nest_size); /* semantic next size - not dynamic */
+ overflow("semantic nest size", nest_size);
return; // abort_flag set
}
#endif
}
+
nest[nest_ptr]= cur_list;
incr(nest_ptr);
head = get_avail();
if (trace_flag)
{
str_pool[pool_ptr] = '\0';
- sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr-l-d]);
+ sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr - l - d]);
show_line(log_line, 0); /* debugging */
}
#endif /* STAT */
- }
+ }
goto lab40;
}
}
#endif
}
+
save_type(save_ptr) = level_boundary;
save_level(save_ptr) = (quarterword) cur_group;
save_index(save_ptr) = cur_boundary;
#include "texd.h"
/* following bit used to be end of tex1.c */
-
#ifdef STAT
/* sec 0284 */
void restore_trace_(halfword p, char * s)
print_char('}');
end_diagnostic(false);
}
-#endif /* STAT */
+#endif
/* sec 0281 */
void unsave (void)
{
else if (xeq_level[p] != level_one)
{
eqtb[p] = save_stack[save_ptr];
- xeq_level[p] = l; /* l may be used without having been ... */
+ xeq_level[p] = l;
#ifdef STAT
if (tracing_restores > 0)
restore_trace(p, "restoring");
int_error(mag);
geq_word_define(int_base + mag_code, 1000);
}
+
mag_set = mag;
}
/* sec 0295 */
lab30:
cur_input = input_stack[input_ptr];
}
-#pragma optimize("g", off) /* 98/Dec/10 experiment */
+//#pragma optimize("g", off) /* 98/Dec/10 experiment */
/* sec 0323 */
void begin_token_list_ (halfword p, quarterword t)
{
else
cur_input.loc_field = p;
}
-#pragma optimize("", on) /* 98/Dec/10 experiment */
+//#pragma optimize("", on) /* 98/Dec/10 experiment */
/* sec 0324 */
void end_token_list (void)
{
}
else if (n > 0)
cur_val = n + param_base[f]; /* 98/Oct/5 */
- else
- cur_val = (&font_check[f] - &font_info[0]); /* 98/Oct/5 */
+// else
+// cur_val = (&font_check[f] - &font_info[0]); /* 98/Oct/5 */
/* checksum = (((font_check[f].b0) << 8 | font_check[f].b1) << 8 |
font_check[f].b2) << 8 | font_check[f].b3; */
}
goto lab20;
}
}
-#pragma optimize ("", on) /* 96/Sep/12 */
\ No newline at end of file
+//#pragma optimize ("", on) /* 96/Sep/12 */
\ No newline at end of file
show_string(k);
}
-// int notfirst=0; // debugging only
-
/********************************** 2000 August 15 end ****************************/
/* sec 0517 */
void end_name (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;
}
/**********************************************************************/
-
/* called only from tex8.c */
/* sec 0560 */
internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
dvi_out(x / 0400); // dvi_out((x >> 8));
dvi_out(x % 0400); // dvi_out(x & 255);
}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0601 */
void zdvipop(integer l)
{
else
dvi_out(142);
}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0602 */
void dvi_font_def_(internal_font_number f)
{
free_node(p, movement_node_size);
}
}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 1368 */
void special_out_(halfword p)
{
char old_setting;
pool_pointer k;
- if (cur_h != dvi_h)
- {
- movement(cur_h - dvi_h, right1);
- dvi_h = cur_h;
- }
-
- if (cur_v != dvi_v)
- {
- movement(cur_v - dvi_v, down1);
- dvi_v = cur_v;
- }
-
+ synch_h();
+ synch_v();
old_setting = selector;
selector = new_string;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/* About output \special{...} make some space in string pool 97/Mar/9 */
#ifdef ALLOCATESTRING
if (pool_ptr + 32000 > current_pool_size)
str_pool = realloc_str_pool (increment_pool_size);
/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
show_token_list(link(write_tokens(p)), 0, pool_size - pool_ptr);
#endif
+
selector = old_setting;
str_room(1);
break;
}
}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0619 */
void hlist_out (void)
{
decr(cur_s);
}
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
/* sec 0629 */
void vlist_out (void)
{
decr(cur_s);
}
/* sec 0638 */
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
-/* sec 0638 */
void dvi_ship_out_(halfword p)
{
integer page_loc;
EXTERN halfword g;
EXTERN integer lq, lr;
-#ifdef ALLOCATEDVIBUF
- EXTERN eight_bits *zdvibuf;
-#else
- /* EXTERN eight_bits dvi_buf[dvi_buf_size + 1]; */
- /* EXTERN eight_bits dvi_buf[dvi_buf_size + 4]; */ /* padded out */
- EXTERN eight_bits zdvibuf[dvi_buf_size + 4]; /* padded out 1996/Jan/18 */
-#endif
+EXTERN eight_bits dvi_buf[dvi_buf_size + 4];
EXTERN dvi_index half_buf;
EXTERN dvi_index dvi_limit;
#include "yandytex.h"
-#include <stdarg.h>
-
#ifdef _MSC_VER
#define INLINE __inline
#else
#ifdef TeX
#define dump_file fmt_file
- #define dump_path TEXFORMATPATH
- #define mwrite_out write_dvi
#define out_file dvi_file
- #define out_buf dvi_buf
#endif /* not TeX */
/* File types. */
extern bool input_line (FILE *);
#define input_ln(stream, flag) input_line(stream)
-/* We need to read an integer from stdin if we're debugging. */
-#ifdef DEBUG
- #define getint() inputint(stdin)
-#else
- #define getint()
-#endif
-
/* `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'. */
char * aa = ((struct tfm_map *) (a))->tfm_name;
char * bb = ((struct tfm_map *) (b))->tfm_name;
- if (!aa || !bb)
- return 0;
+ //if (aa == NULL || bb == NULL)
+ // return 0;
- return (strcmp(aa, bb));
+ return (strcmp(aa, bb)) ;
}
void tfm_print(void *d)
struct tfm_map nn;
nn.tfm_name = name;
- nn.key = 0;
+ nn.key = -1;
if (is_present(avl_tree, &nn))
{
- get_data(avl_tree, &nn, sizeof(struct tfm_map));
-
- return nn.key;
+ if (get_data(avl_tree, &nn, sizeof(struct tfm_map)))
+ return nn.key;
}
-
- return 0;
+ else
+ return -1;
}
// report error.
void pdf_error(const char * t, const char * p)
// if (cur_v - pdf_v >= )
}
+// end a text section.
+void pdf_end_text()
+{
+ if (pdf_doing_text)
+ {
+ pdf_end_string();
+ HPDF_Page_EndText(yandy_page);
+ pdf_doing_text = false;
+ }
+}
+// draw a rule.
+void pdf_set_rule(scaled x, scaled y, scaled w, scaled h)
+{
+}
void pdf_error_handler (HPDF_STATUS error_no, HPDF_STATUS detail_no, void * user_data)
{
printf ("Y&Y TeX error: error_no=%04X, detail_no=%u\n",
memcpy(duffer, (const char *) str_pool + str_start[font_name[f]], length(font_name[f]));
memcpy(cuffer, (const char *) str_pool + str_start[font_name[f]], length(font_name[f]));
- k = 0;//get_font_index(buffer);
+ k = get_font_index(buffer);
//printf("PDF_FONT_DEF2: %d--%s.\n", k, buffer);
-/*
+
if (k == 0)
{
afm_name = kpse_find_file(strcat(buffer, ".afm"), kpse_afm_format, 1);
yandy_font[k] = HPDF_GetFont(yandy_pdf, fnt_name, NULL);
}
}
-*/
+
HPDF_Page_SetFontAndSize(yandy_page, yandy_font[0], (font_size[f] / 65535));
}
if ((rule_ht > 0) && (rule_wd > 0))
{
HPDF_Page_SetLineWidth(yandy_page, rule_ht / 65535);
- HPDF_Page_MoveTo (yandy_page, (cur_h / 65535 + 72), (841.89 - cur_v / 65535 - 72));
- HPDF_Page_LineTo (yandy_page, (cur_h / 65535 + 72 + rule_wd / 65535), (841.89 - cur_v / 65535 - 72));
- HPDF_Page_Stroke (yandy_page);
+ HPDF_Page_MoveTo(yandy_page, (cur_h / 65535 + 72), (841.89 - cur_v / 65535 - 72));
+ HPDF_Page_LineTo(yandy_page, (cur_h / 65535 + 72 + rule_wd / 65535), (841.89 - cur_v / 65535 - 72));
+ HPDF_Page_Stroke(yandy_page);
}
goto lab15;
#include <kpathsea/tex-file.h>
#include <kpathsea/variable.h>
#include <kpathsea/absolute.h>
+#include <stdarg.h>
#include <setjmp.h>
#include <time.h>
#include <signal.h>
-#include <conio.h>
+#ifdef MSDOS
+ #include <direct.h> /* for _getcwd() */
+ #include <conio.h> /* for _getch() */
+ #define getch _getch
+#else
+ #include <unistd.h>
+#endif
#include "hpdf.h"
#include "hpdf_utils.h"
#include "avl.h"