OSDN Git Service

modified some WINDOWS-only codes.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Thu, 8 May 2014 19:50:55 +0000 (03:50 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Thu, 8 May 2014 19:50:55 +0000 (03:50 +0800)
14 files changed:
src/texsourc/coerce.h
src/texsourc/itex.c
src/texsourc/local.c
src/texsourc/openinou.c
src/texsourc/subroute.c
src/texsourc/tex0.c
src/texsourc/tex1.c
src/texsourc/tex2.c
src/texsourc/tex3.c
src/texsourc/tex4.c
src/texsourc/texd.h
src/texsourc/texmf.h
src/texsourc/yandy_pdf_backend.c
src/texsourc/yandytex.h

index c894131..65285ea 100644 (file)
 /* 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);
@@ -555,11 +540,6 @@ void give_err_help(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);
index 92f4bc3..9ce9672 100644 (file)
 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)
 {
@@ -164,6 +163,7 @@ 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
@@ -246,14 +246,17 @@ void initialize (void)
   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;
@@ -270,19 +273,13 @@ void initialize (void)
     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[] */
@@ -1011,7 +1008,7 @@ void prefixed_command (void)
   while (cur_cmd == prefix)
   {
     if (!odd(a / cur_chr))
-      a = a + cur_chr;      /*   small_number a;  */
+      a = a + cur_chr;
 
     do
       {
@@ -1897,6 +1894,7 @@ bool load_fmt_file (void)
       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)
@@ -2319,11 +2317,10 @@ int texbody (void)
 {
   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))
@@ -2372,8 +2369,7 @@ int texbody (void)
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
   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;
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
@@ -2398,7 +2394,7 @@ int texbody (void)
 
   if (format_default_length > PATHMAX)
     bad = 31;
-/*  if (2 * 262143L < mem_top - mem_min) */
+
   if (max_halfword < (mem_top - mem_min) / 2)
     bad = 41;
 
@@ -2409,7 +2405,7 @@ int texbody (void)
     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
   }
@@ -2429,7 +2425,7 @@ int texbody (void)
   }
 #endif
 
-  ready_already = 314159L;      /* magic number */
+  ready_already = 314159L; /* magic number */
 
 lab1:
   selector = term_only;
@@ -2437,11 +2433,13 @@ lab1:
   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)
@@ -2526,8 +2524,8 @@ lab1:
 
     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;
@@ -2580,7 +2578,6 @@ lab9999:
 
 #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;
@@ -2588,7 +2585,7 @@ void add_variable_space(int size)
   integer t;
 
   if (mem_min == 0)
-    t = mem_min;  /* bottom of present block */
+    t = mem_min;
   else
     t = mem_min + 1;
 
@@ -2602,16 +2599,16 @@ void add_variable_space(int size)
     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
@@ -2646,7 +2643,7 @@ void reset_hyphen (void)
   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;
@@ -2834,10 +2831,7 @@ void do_initex (void)
   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;
@@ -2845,7 +2839,7 @@ void do_initex (void)
   eq_type(end_write) = outer_call;
   equiv(end_write) = 0;
 }
-#endif /* INITEX */
+#endif
 
 #ifdef INITEX
 /* sec 0047 */
@@ -3115,7 +3109,6 @@ void first_fit_ (trie_pointer p)
     {
       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
index e540dcd..a1800c7 100644 (file)
@@ -584,7 +584,11 @@ void *ourrealloc (void *old, size_t new_size)
   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)
   {
@@ -1792,24 +1796,6 @@ int allocate_memory (void)
   }
 #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;
@@ -2276,10 +2262,6 @@ void check_fixed_align (int flag)
   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"); */
index 67ffeec..e079dea 100644 (file)
    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"
index a493c49..84cba11 100644 (file)
@@ -21,8 +21,6 @@
 
 #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)
 {
index c7dcf10..0586036 100644 (file)
@@ -57,6 +57,7 @@ INLINE void dvi_out_(ASCII_code op)
 {
   dvi_buf[dvi_ptr] = op;
   incr(dvi_ptr);
+
   if (dvi_ptr == dvi_limit)
     dvi_swap();
 }
@@ -69,10 +70,12 @@ INLINE void succumb (void)
   {
     error();
   }
+
 #ifdef DEBUG
   if (interaction > 0)
     debug_help();
 #endif
+
   history = 3;
   jump_out();
 }
index 25c6dcf..47012b0 100644 (file)
@@ -19,9 +19,8 @@
 
 #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;
@@ -44,7 +43,7 @@ void show_box_(halfword p)
   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);
@@ -52,7 +51,7 @@ void delete_token_ref_(halfword 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);
@@ -60,11 +59,12 @@ void delete_glue_ref_(halfword p)
     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))
@@ -226,25 +226,27 @@ void flush_node_list_(halfword 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)) 
@@ -385,8 +387,7 @@ halfword copy_node_list_(halfword p)
   q = link(h);
   free_avail(h);
 
-  Result = q;
-  return Result;
+  return q;
 }
 /* sec 0211 */
 void print_mode_(integer m)
@@ -428,6 +429,7 @@ void print_mode_(integer m)
       }
     }
   }
+
   print_string(" mode");
 }
 /* sec 0216 */
@@ -441,7 +443,7 @@ void push_nest (void)
     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
@@ -449,11 +451,12 @@ void push_nest (void)
 #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();
@@ -2347,11 +2350,11 @@ halfword id_lookup_(integer j, integer l)
         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; 
     } 
@@ -2385,6 +2388,7 @@ void new_save_level_(group_code c)
      }
 #endif
   }
+
   save_type(save_ptr) = level_boundary;
   save_level(save_ptr) = (quarterword) cur_group; 
   save_index(save_ptr) = cur_boundary;
index 9b3f011..97a8847 100644 (file)
@@ -20,7 +20,6 @@
 #include "texd.h"
 
 /* following bit used to be end of tex1.c */
-
 #ifdef STAT
 /* sec 0284 */
 void restore_trace_(halfword p, char * s)
@@ -33,7 +32,7 @@ void restore_trace_(halfword p, char * s)
   print_char('}');
   end_diagnostic(false);
 }
-#endif /* STAT */
+#endif
 /* sec 0281 */
 void unsave (void)
 {
@@ -90,7 +89,7 @@ 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");
@@ -138,6 +137,7 @@ void prepare_mag (void)
     int_error(mag);
     geq_word_define(int_base + mag_code, 1000);
   }
+
   mag_set = mag;
 }
 /* sec 0295 */
@@ -433,7 +433,7 @@ void show_context (void)
 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)
 {
@@ -507,7 +507,7 @@ 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) 
 { 
@@ -1689,8 +1689,8 @@ void find_font_dimen_(bool writing)
     }
   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; */
   }
@@ -2602,4 +2602,4 @@ lab40:
         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
index 39b1949..df2b9ea 100644 (file)
@@ -1676,8 +1676,6 @@ void show_all_strings (void)
     show_string(k);
 }
 
-// int notfirst=0;    // debugging only
-
 /********************************** 2000 August 15 end ****************************/
 /* sec 0517 */
 void end_name (void) 
@@ -1935,9 +1933,9 @@ void scan_file_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 == '"')
     {
@@ -1950,20 +1948,16 @@ void scan_file_name (void)
   {
     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;
@@ -2022,7 +2016,7 @@ void show_tex_inputs (void)
 
 /**********************************************************************/
 /* 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;
@@ -2433,7 +2427,6 @@ void show_tex_fonts (void)
 }
 
 /**********************************************************************/
-
 /* called only from tex8.c */
 /* sec 0560 */
 internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
index 5d62c3a..7158a2b 100644 (file)
@@ -140,7 +140,6 @@ void dvi_four_(integer x)
   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)
 {
@@ -149,7 +148,6 @@ 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)
 {
@@ -407,30 +405,17 @@ lab30:
     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);
@@ -446,6 +431,7 @@ void special_out_(halfword p)
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
   show_token_list(link(write_tokens(p)), 0, pool_size - pool_ptr);
 #endif
+
   selector = old_setting;
   str_room(1);
 
@@ -590,7 +576,6 @@ void out_what_(halfword p)
       break;
   }
 }
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
 /* sec 0619 */
 void hlist_out (void)
 {
@@ -898,7 +883,6 @@ lab15:
 
   decr(cur_s);
 }
-/* following needs access to dvi_buf=zdvibuf see coerce.h */
 /* sec 0629 */
 void vlist_out (void)
 {
@@ -1141,8 +1125,6 @@ lab15:
   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;
index 306e6e9..9c48015 100644 (file)
@@ -751,13 +751,7 @@ EXTERN scaled rule_ht, rule_dp, rule_wd;
 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; 
index afa261b..c30c8f2 100644 (file)
@@ -23,8 +23,6 @@
 
 #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. */
@@ -47,13 +42,6 @@ typedef FILE * word_file;
 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'.  */
index ebb307a..26574e5 100644 (file)
@@ -51,10 +51,10 @@ int tfm_cmp(void * a, void * b)
   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)
@@ -107,16 +107,15 @@ int get_font_index(char * name)
   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)
@@ -343,6 +342,20 @@ void pdf_begin_string(internal_font_number f)
 
 //  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",
@@ -366,9 +379,9 @@ void pdf_font_def(internal_font_number f)
   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);
@@ -383,7 +396,7 @@ void pdf_font_def(internal_font_number f)
       yandy_font[k] = HPDF_GetFont(yandy_pdf, fnt_name, NULL);
     }
   }
-*/
+
   HPDF_Page_SetFontAndSize(yandy_page, yandy_font[0], (font_size[f] / 65535));
 }
 
@@ -992,9 +1005,9 @@ lab14:
       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;
index e5c2c5d..2f6ad9a 100644 (file)
 #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"