OSDN Git Service

updated.
authormaqiyuan <maqiyuan@users.sourceforge.jp>
Sat, 7 Jun 2014 08:38:49 +0000 (16:38 +0800)
committermaqiyuan <maqiyuan@users.sourceforge.jp>
Sat, 7 Jun 2014 08:38:49 +0000 (16:38 +0800)
src/texsourc/coerce.h
src/texsourc/itex.c
src/texsourc/local.c
src/texsourc/tex0.c
src/texsourc/tex3.c
src/texsourc/tex9.c
src/texsourc/texd.h
src/texsourc/texmf.h
src/texsourc/yandy_backend_dpx.c
src/texsourc/yandy_pool.c
src/texsourc/yandytex.c

index 0085ae4..379db83 100644 (file)
@@ -176,7 +176,6 @@ void show_eqtb_(halfword);
 #define show_eqtb(n) show_eqtb_((halfword) (n))
 halfword id_lookup_(integer, integer);
 #define id_lookup(j, l) id_lookup_((integer) (j), (integer) (l))
-str_number make_string_pool (char *s);
 void primitive_s (char * s, quarterword c, halfword o);
 void primitive_(str_number, quarterword, halfword);
 #define primitive(s, c, o) primitive_(make_string_pool((char *) s), (quarterword) (c), (halfword) (o))
@@ -513,4 +512,5 @@ void close_files_and_terminate(void);
 void final_cleanup(void);
 void init_prim(void);
 void debug_help(void);
-int texbody(void);
\ No newline at end of file
+int main_program(void);
+int main_init(int, char **);
\ No newline at end of file
index ef8494a..34c98f1 100644 (file)
@@ -2362,7 +2362,7 @@ void show_frozen (void)
   fprintf(log_file, ") ");
 }
 
-int texbody (void)
+int main_program (void)
 {
   history = fatal_error_stop;
 
@@ -2994,21 +2994,6 @@ void sort_avail (void)
 #endif
 
 #ifdef INITEX
-str_number make_string_pool (char *s)
-{
-  int slen = strlen(s);
-
-  if (slen == 1)
-  {
-    return ((str_number)s[0]);
-  }
-  else
-  {
-    memcpy(str_pool + pool_ptr, s, slen);
-    pool_ptr += slen;
-    return (make_string());
-  }
-}
 /* sec 0264 */
 void primitive_ (str_number s, quarterword c, halfword o)
 { 
index 510705f..3af4a76 100644 (file)
@@ -2219,6 +2219,7 @@ void check_fixed_align (int flag)
 #ifdef ALLOCATEDVIBUF
   test_align ((int) &zdvibuf, sizeof(zdvibuf[0]), "zdvibuf"); /* no op */
 #endif
+
   test_align ((int) &total_stretch, sizeof(total_stretch[0]), "total_stretch");
   test_align ((int) &total_shrink, sizeof(total_shrink[0]), "total_shrink");
   test_align ((int) &active_width, sizeof(active_width[0]), "active_width");
@@ -2257,13 +2258,17 @@ void check_alloc_align (int flag)
     show_line("PLEASE RECOMPILE ME!\n", 1);
 
 #ifdef CHECKALIGNMENT
-  if (!flag) return;
+  if (!flag)
+    return;
+
 #ifndef ALLOCZEQTB
   test_align ((int) zeqtb, sizeof(zeqtb[0]), "zeqtb"); 
 #endif
+
 #ifndef ALLOCATEDVIBUF
   test_align ((int) &zdvibuf, sizeof(zdvibuf[0]), "zdvibuf");  /* no op */
 #endif
+
   test_align ((int) str_pool, sizeof(str_pool[0]), "str_pool"); /* no op */
   test_align ((int) str_start, sizeof(str_start[0]), "str_start");
   test_align ((int) zmem, sizeof(zmem[0]), "main memory");
@@ -2282,9 +2287,9 @@ void check_alloc_align (int flag)
 #endif
 }
 
-boolean backwardflag       = false;              /* don't cripple all advanced features */
-boolean shorten_file_name  = false;              /* don't shorten file names to 8+3 for DOS */
-boolean usesourcedirectory = true;               /* use source file directory as local when WorkingDirectory is set */             /* if working directory set in ini */
+boolean backwardflag       = false; /* don't cripple all advanced features */
+boolean shorten_file_name  = false; /* don't shorten file names to 8+3 for DOS */
+boolean usesourcedirectory = true;  /* use source file directory as local when WorkingDirectory is set */
 
 /* cache to prevent allocating twice in a row */
 
@@ -2527,7 +2532,7 @@ int analyze_flag (int c, char *optarg)
     case 'Y':
       reorder_arg_flag = false; /* local */
       break;
-/* *********** following command line options take arguments **************  */
+
     case 'm':
       if (optarg == 0)
         mem_initex = mem_top;
@@ -3106,14 +3111,11 @@ void deslash_all (int ac, char **av)
   }
 }
 
-/* main entry point follows */
 /* note: those optarg == 0 test don't really work ... */
 /* note: optarg starts at = in case of x=... */
 
 int main_init (int ac, char **av)
 {
-  int k;
-
   kpse_set_program_name(av[0], NULL);
   xputenv("engine", "yandytex");
 
@@ -3190,7 +3192,7 @@ int main_init (int ac, char **av)
   closed_already    = 0;
 
   if (trace_flag)
-    show_line("Entering init (local)\n", 0);
+    show_line("Entering init (local.c)\n", 0);
 
   probe_memory(); /* show top address */
   ini_max_address = max_address; /* initial max address */
@@ -3208,18 +3210,18 @@ int main_init (int ac, char **av)
   }
 
   if (allocate_memory() != 0)
-    return -1;         // if failed to allocate
+    return -1;
 
   /* 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);
+    show_line("Leaving init (local.c)\n", 0);
 
   return 0;
 }
 
-#define CLK_TCK  CLOCKS_PER_SEC
+#define CLK_TCK CLOCKS_PER_SEC
 
 void show_inter_val (clock_t inter_val)
 {
@@ -3285,7 +3287,7 @@ int endit (int flag)
 
     if (total_pages > 0)
     {
-      show_inter_val ((finish_time - main_time) / total_pages);
+      show_inter_val((finish_time - main_time) / total_pages);
       show_line(" sec per page.", 0);
     }
 
index fab0461..dadb7b4 100644 (file)
@@ -20,7 +20,7 @@
 #include "texd.h"
 
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-void synch_h(void)
+INLINE void synch_h(void)
 {
   if (cur_h != dvi_h)
   {
@@ -28,7 +28,7 @@ void synch_h(void)
     dvi_h = cur_h;
   }
 }
-void synch_v(void)
+INLINE void synch_v(void)
 {
   if (cur_v != dvi_v)
   {
@@ -36,7 +36,7 @@ void synch_v(void)
     dvi_v = cur_v;
   }
 }
-void set_cur_lang(void)
+INLINE void set_cur_lang(void)
 {
   if (language <= 0)
     cur_lang = 0;
index a58f4ed..9820d75 100644 (file)
@@ -1566,7 +1566,6 @@ void show_all_strings (void)
     show_string(k);
 }
 
-/********************************** 2000 August 15 end ****************************/
 /* sec 0517 */
 void end_name (void) 
 {
index e580edc..fffb646 100644 (file)
@@ -32,8 +32,6 @@ boolean open_fmt_file (void)
 
   j = cur_input.loc_field;
 
-/* For Windows NT, lets allow + instead of & for format specification */
-/*  User specified a format name on the command line                  */
   if (buffer[cur_input.loc_field] == '&' || buffer[cur_input.loc_field] == '+')
   {
     incr(cur_input.loc_field);
@@ -50,7 +48,7 @@ boolean open_fmt_file (void)
   
     if (knuth_flag)
     {
-      (void) sprintf(log_line, "%s;%s\n", "Sorry, I can't find that format",
+      sprintf(log_line, "%s;%s\n", "Sorry, I can't find that format",
         " will try the default.");
       show_line(log_line, 1);
     }
@@ -59,26 +57,14 @@ boolean open_fmt_file (void)
       char *s = log_line;
 
       name_of_file[name_length + 1] = '\0';
-      (void) sprintf(s, "%s (%s);%s\n", "Sorry, I can't find that format",
+      sprintf(s, "%s (%s);%s\n", "Sorry, I can't find that format",
         name_of_file + 1, " will try the default."); 
       name_of_file[name_length + 1] = ' ';
       s += strlen(s);
-      (void) sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n",
+      sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n",
         "TEXFORMATS");
       s += strlen(s);
-      {
-        char *t;            /* extra info 97/June/13 */
-
-        if ((t = grabenv("TEXFORMATS")) != NULL)
-        {
-          sprintf(s, "(%s=%s)\n", "TEXFORMATS", t);
-        }
-        else
-        {
-          sprintf(s, "%s environment variable not set\n", "TEXFORMATS");
-        }
-      }
-      show_line(log_line, 1); // show all three lines at once
+      show_line(log_line, 1);
     }
 
 #ifndef _WINDOWS
@@ -86,14 +72,13 @@ boolean open_fmt_file (void)
 #endif
   }
 
-/* Try the default format (either because no format specified or failed) */
   pack_buffered_name(format_default_length - 4, 1, 0);
 
   if (!w_open_in(fmt_file))
   {
     if (knuth_flag)
     {
-      (void) sprintf(log_line, "%s!\n", "I can't find the default format file");
+      sprintf(log_line, "%s!\n", "I can't find the default format file");
       show_line(log_line, 1);
     }
     else
@@ -101,24 +86,12 @@ boolean open_fmt_file (void)
       char *s = log_line;
 
       name_of_file[name_length + 1] = '\0';
-      (void) sprintf(s, "%s (%s)!\n", "I can't find the default format file", name_of_file + 1);
+      sprintf(s, "%s (%s)!\n", "I can't find the default format file", name_of_file + 1);
       name_of_file[name_length + 1] = ' ';
       s += strlen(s);
-      (void) sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n", "TEXFORMATS");
+      sprintf(s, "(Perhaps your %s environment variable is not set correctly)\n", "TEXFORMATS");
       s += strlen(s);
-      {
-        char *t;            /* extra info 97/June/13 */
-
-        if ((t = grabenv("TEXFORMATS")) != NULL)
-        {
-          sprintf(s, "(%s=%s)\n", "TEXFORMATS", t);
-        }
-        else
-        {
-          sprintf(s, "%s environment variable not set\n", "TEXFORMATS");
-        }
-      }
-      show_line(log_line, 1);   // show all three lines at once
+      show_line(log_line, 1);
     }
 
     return false;
@@ -135,10 +108,8 @@ void print_char_string (unsigned char *s)
   while (*s > 0)
     print_char(*s++);
 }
-void show_font_info (void);   // now in local.c
-extern int closed_already;     // make sure we don't try this more than once
-/* The following needs access to zdvibuf of ALLOCATEDVIBUF 94/Mar/24 */
-/* done in closefilesandterminate_regmem  in coerce.h */
+void show_font_info (void); // now in local.c
+extern int closed_already;  // make sure we don't try this more than once
 /* sec 1333 */
 void close_files_and_terminate (void)
 {
@@ -153,7 +124,6 @@ void close_files_and_terminate (void)
   if (trace_flag)
     show_line("\nclose_files_and_terminate ", 0);
 
-/* close all open files */
   for (k = 0; k <= 15; k++)
     if (write_open[k])
     {
@@ -161,95 +131,101 @@ void close_files_and_terminate (void)
     }
 
 #ifdef STAT
-  if (tracing_stats > 0 || verbose_flag != 0)  /* 93/Nov/30 - bkph */
+  if (tracing_stats > 0 || verbose_flag != 0)
     if (log_opened)
     {
-/* used to output paragraph breaking statistics here */
-      (void) fprintf(log_file, "%c\n", ' ');
-      (void) fprintf(log_file, "\n");
-      (void) fprintf(log_file, "%s%s\n", "Here is how much of TeX's memory", " you used:");
-      (void) fprintf(log_file, "%c%ld%s", ' ', (long)str_ptr - init_str_ptr, " string");
+      fprintf(log_file, "%c\n", ' ');
+      fprintf(log_file, "\n");
+      fprintf(log_file, "%s%s\n", "Here is how much of TeX's memory", " you used:");
+      fprintf(log_file, "%c%ld%s", ' ', str_ptr - init_str_ptr, " string");
+
       if (str_ptr != init_str_ptr + 1)
-        (void) putc('s',  log_file);
+        putc('s',  log_file);
+
 #ifdef ALLOCATESTRING
       if (show_current)
-        (void) fprintf(log_file, "%s%ld\n", " out of ", (long) current_max_strings - init_str_ptr);
+        fprintf(log_file, "%s%ld\n", " out of ", current_max_strings - init_str_ptr);
       else
 #endif
-        (void) fprintf(log_file, "%s%ld\n", " out of ", (long) max_strings - init_str_ptr);
+        fprintf(log_file, "%s%ld\n", " out of ", max_strings - init_str_ptr);
 
 #ifdef ALLOCATESTRING
       if (show_current)
-        (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) pool_ptr - init_pool_ptr, " string characters out of ", (long) current_pool_size - init_pool_ptr);
+        fprintf(log_file, "%c%ld%s%ld\n", ' ', pool_ptr - init_pool_ptr, " string characters out of ", current_pool_size - init_pool_ptr);
       else
 #endif
-        (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) pool_ptr - init_pool_ptr, " string characters out of ", (long) pool_size - init_pool_ptr);
+        fprintf(log_file, "%c%ld%s%ld\n", ' ', pool_ptr - init_pool_ptr, " string characters out of ", pool_size - init_pool_ptr);
 
 #ifdef ALLOCATEMAIN
       if (show_current)
-        (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) lo_mem_max - mem_min + mem_end - hi_mem_min + 2, " words of memory out of ", (long)current_mem_size);
+        fprintf(log_file, "%c%ld%s%ld\n", ' ', (long)lo_mem_max - mem_min + mem_end - hi_mem_min + 2, " words of memory out of ", current_mem_size);
       else
 #endif
-        (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) lo_mem_max - mem_min + mem_end - hi_mem_min + 2, " words of memory out of ", (long)mem_end + 1 - mem_min);
-      (void) fprintf(log_file, "%c%ld%s%ld\n", ' ', (long) cs_count, " multiletter control sequences out of ", (long)(hash_size + hash_extra));
-      (void) fprintf(log_file, "%c%ld%s%ld%s", ' ', (long) fmem_ptr, " words of font info for ", (long) font_ptr - 0, " font");
+        fprintf(log_file, "%c%ld%s%ld\n", ' ', (long)lo_mem_max - mem_min + mem_end - hi_mem_min + 2, " words of memory out of ", mem_end + 1 - mem_min);
+
+      fprintf(log_file, "%c%ld%s%ld\n", ' ', cs_count, " multiletter control sequences out of ", (hash_size + hash_extra));
+      fprintf(log_file, "%c%ld%s%ld%s", ' ', (long)fmem_ptr, " words of font info for ", (long)font_ptr - font_base, " font");
+
       if (font_ptr != 1)
-        (void) putc('s',  log_file);
+        putc('s',  log_file);
 
 #ifdef ALLOCATEFONT
       if (show_current)
-        (void) fprintf(log_file, "%s%ld%s%ld\n", ", out of ", (long)current_font_mem_size, " for ", (long)font_max - 0);
+        fprintf(log_file, "%s%ld%s%ld\n", ", out of ", current_font_mem_size, " for ", font_max - font_base);
       else
 #endif
-        (void) fprintf(log_file, "%s%ld%s%ld\n", ", out of ", (long)font_mem_size, " for ", (long)font_max - 0);
-      (void) fprintf(log_file, "%c%ld%s", ' ', (long)hyph_count, " hyphenation exception");
+        fprintf(log_file, "%s%ld%s%ld\n", ", out of ", font_mem_size, " for ", font_max - font_base);
+
+      fprintf(log_file, "%c%ld%s", ' ', hyph_count, " hyphenation exception");
+
       if (hyph_count != 1)
-        (void) putc('s',  log_file);
+        putc('s',  log_file);
 
-      (void) fprintf(log_file, "%s%ld\n",  " out of ", (long) hyphen_prime);
-      (void) fprintf(log_file, " ");
-      (void) fprintf(log_file, "%ld%s", (long)max_in_stack, "i,");
-      (void) fprintf(log_file, "%ld%s", (long)max_nest_stack, "n,");
-      (void) fprintf(log_file, "%ld%s", (long)max_param_stack, "p,");
-      (void) fprintf(log_file, "%ld%s", (long)max_buf_stack + 1, "b,");
-      (void) fprintf(log_file, "%ld%s", (long)max_save_stack + 6, "s");
-      (void) fprintf(log_file, " stack positions out of ");
+      fprintf(log_file, "%s%ld\n",  " out of ", hyphen_prime);
+      fprintf(log_file, " ");
+      fprintf(log_file, "%ld%s", max_in_stack, "i,");
+      fprintf(log_file, "%ld%s", max_nest_stack, "n,");
+      fprintf(log_file, "%ld%s", max_param_stack, "p,");
+      fprintf(log_file, "%ld%s", max_buf_stack + 1, "b,");
+      fprintf(log_file, "%ld%s", max_save_stack + 6, "s");
+      fprintf(log_file, " stack positions out of ");
 
 #ifdef ALLOCATESAVESTACK
       if (show_current)
-        (void) fprintf(log_file, "%ld%s", (long)current_stack_size, "i,");
+        fprintf(log_file, "%ld%s", current_stack_size, "i,");
       else
 #endif
-        (void) fprintf(log_file, "%ld%s", (long)stack_size, "i,");
+        fprintf(log_file, "%ld%s", stack_size, "i,");
 
 #ifdef ALLOCATENESTSTACK
       if (show_current)
-        (void) fprintf(log_file, "%ld%s", (long)current_nest_size, "n,");
+        fprintf(log_file, "%ld%s", current_nest_size, "n,");
       else
 #endif
-        (void) fprintf(log_file, "%ld%s", (long)nest_size, "n,");
+        fprintf(log_file, "%ld%s", nest_size, "n,");
 
 #ifdef ALLOCATEPARAMSTACK
       if (show_current)
-        (void) fprintf(log_file, "%ld%s", (long)current_param_size, "p,");
+        fprintf(log_file, "%ld%s", current_param_size, "p,");
       else
 #endif
-        (void) fprintf(log_file, "%ld%s", (long)param_size, "p,");
+        fprintf(log_file, "%ld%s", param_size, "p,");
 
 #ifdef ALLOCATEBUFFER
       if (show_current)
-        (void) fprintf(log_file, "%ld%s", (long)current_buf_size, "b,");
+        fprintf(log_file, "%ld%s", current_buf_size, "b,");
       else
 #endif
-        (void) fprintf(log_file, "%ld%s", (long)buf_size, "b,");
+        fprintf(log_file, "%ld%s", buf_size, "b,");
 
 #ifdef ALLOCATESAVESTACK
       if (show_current)
-        (void) fprintf(log_file, "%ld%s", (long)current_save_size, "s");
+        fprintf(log_file, "%ld%s", current_save_size, "s");
       else
 #endif
-        (void) fprintf(log_file, "%ld%s", (long)save_size, "s");
-      (void) fprintf(log_file, "\n");
+        fprintf(log_file, "%ld%s", save_size, "s");
+
+      fprintf(log_file, "\n");
 
       if (!knuth_flag)
         fprintf(log_file, " (i = in_stack, n = nest_stack, p = param_stack, b = buf_stack, s = save_stack)\n");
@@ -257,57 +233,56 @@ void close_files_and_terminate (void)
       if (!knuth_flag)
         fprintf(log_file, " %d inputs open max out of %d\n", high_in_open, max_in_open);
 
-/*  Modified 98/Jan/14 to leave out lines with zero counts */
-      if (show_line_break_stats && first_pass_count > 0) /* 96/Feb/8 */
+      if (show_line_break_stats && first_pass_count > 0)
       {
-        int first_count, secondcount, thirdcount;
+        int first_count, second_count, third_count;
 
-        (void) fprintf(log_file, "\nSuccess at breaking %d paragraph%s:", first_pass_count, (first_pass_count == 1) ? "" : "s");
+        fprintf(log_file, "\nSuccess at breaking %d paragraph%s:", first_pass_count, (first_pass_count == 1) ? "" : "s");
 
         if (single_line > 0)
-          (void) fprintf(log_file, "\n %d single line `paragraph%s'", single_line, (single_line == 1) ? "" : "s");  /* 96/Apr/23 */
+          fprintf(log_file, "\n %d single line `paragraph%s'", single_line, (single_line == 1) ? "" : "s");
 
         first_count = first_pass_count - single_line - second_pass_count;
 
         if (first_count < 0)
           first_count = 0;
 
-        secondcount = second_pass_count - final_pass_count;
-        thirdcount = final_pass_count - paragraph_failed;
+        second_count = second_pass_count - final_pass_count;
+        third_count = final_pass_count - paragraph_failed;
 
         if (first_pass_count > 0)
-          (void) fprintf(log_file, "\n %d first pass (\\pretolerance = %d)", first_pass_count, pretolerance);
+          fprintf(log_file, "\n %d first pass (\\pretolerance = %d)", first_pass_count, pretolerance);
 
         if (second_pass_count > 0)
-          (void) fprintf(log_file, "\n %d second pass (\\tolerance = %d)", second_pass_count, tolerance);
+          fprintf(log_file, "\n %d second pass (\\tolerance = %d)", second_pass_count, tolerance);
 
         if (final_pass_count > 0 || emergency_stretch > 0)
         {
-          (void) fprintf(log_file, "\n %d third pass (\\emergencystretch = %lgpt)", final_pass_count, (double) emergency_stretch / 65536.0);
+          fprintf(log_file, "\n %d third pass (\\emergencystretch = %lgpt)", final_pass_count, (double) emergency_stretch / 65536.0);
         }
 
         if (paragraph_failed > 0)
-          (void) fprintf(log_file, "\n %d failed", paragraph_failed);
+          fprintf(log_file, "\n %d failed", paragraph_failed);
 
-        (void) putc('\n', log_file);
+        putc('\n', log_file);
 
         if (overfull_hbox > 0)
-          (void) fprintf(log_file, "\n %d overfull \\hbox%s", overfull_hbox, (overfull_hbox > 1) ? "es" : "");
+          fprintf(log_file, "\n %d overfull \\hbox%s", overfull_hbox, (overfull_hbox > 1) ? "es" : "");
 
         if (underfull_hbox > 0)
-          (void) fprintf(log_file, "\n %d underfull \\hbox%s", underfull_hbox, (underfull_hbox > 1) ? "es" : "");
+          fprintf(log_file, "\n %d underfull \\hbox%s", underfull_hbox, (underfull_hbox > 1) ? "es" : "");
 
         if (overfull_vbox > 0)
-          (void) fprintf(log_file, "\n %d overfull \\vbox%s", overfull_vbox, (overfull_vbox > 1) ? "es" : "");
+          fprintf(log_file, "\n %d overfull \\vbox%s", overfull_vbox, (overfull_vbox > 1) ? "es" : "");
 
         if (underfull_vbox > 0)
-          (void) fprintf(log_file, "\n %d underfull \\vbox%s", underfull_vbox, (underfull_vbox > 1) ? "es" : "");
+          fprintf(log_file, "\n %d underfull \\vbox%s", underfull_vbox, (underfull_vbox > 1) ? "es" : "");
 
         if (overfull_hbox || underfull_hbox || overfull_vbox || underfull_vbox)
-          (void) putc('\n', log_file);
+          putc('\n', log_file);
       }
-  } /* end of if (log_opened) */ 
-#endif /* STAT */
+  }
+#endif
 
   switch (shipout_flag)
   {
@@ -447,8 +422,8 @@ void close_files_and_terminate (void)
 
   if (log_opened)
   {
-    (void) putc('\n', log_file);
-    (void) a_close(log_file);
+    putc('\n', log_file);
+    a_close(log_file);
     selector = selector - 2;
 
     if (selector == term_only)
@@ -474,111 +449,131 @@ void close_files_and_terminate (void)
 #ifdef DEBUG
 /* sec 1338 */
 void debug_help (void) 
-{/* 888 10 */ 
-  integer k, l, m, n; 
-  while (true) {
- ; 
+{
+  integer k, l, m, n;
+
+  while (true)
+  { 
     print_nl(" debug # (-1 to exit):");
+
 #ifndef _WINDOWS
     fflush(stdout); 
 #endif
+
     read(stdin, m);  // ???
-    if (m < 0)return; 
+
+    if (m < 0)
+      return;
     else if (m == 0)
-    dumpcore(); 
-    else {
-      read(stdin, n);  // ???
+      dumpcore();
+    else
+    {
+      read(stdin, n);
+
       switch(m)
-      {case 1 : 
-  print_word(mem[n]); 
-  break; 
-      case 2 : 
-  print_int(mem[n].hh.lh); 
-  break; 
-      case 3 : 
-  print_int(mem[n].hh.rh); 
-  break; 
-      case 4 : 
-  print_word(eqtb[n]); 
-  break; 
-      case 5 : 
+      {
+        case 1:
+          print_word(mem[n]);
+          break;
+
+        case 2:
+          print_int(mem[n].hh.lh);
+          break;
+          
+        case 3:
+          print_int(mem[n].hh.rh);
+          break;
+        
+        case 4:
+          print_word(eqtb[n]);
+          break;
+
+        case 5:
 #ifdef SHORTFONTINFO
-  print_scaled(font_info[n].sc);  print_char(' ');
-  print_int(font_info[n].qqq.b0);  print_char(':');
-  print_int(font_info[n].qqq.b1);  print_char(':');
-  print_int(font_info[n].qqq.b2);  print_char(':');
-  print_int(font_info[n].qqq.b3);  
+          print_scaled(font_info[n].sc);
+          print_char(' ');
+          print_int(font_info[n].b0);
+          print_char(':');
+          print_int(font_info[n].b1);
+          print_char(':');
+          print_int(font_info[n].b2);
+          print_char(':');
+          print_int(font_info[n].b3);
 #else
-  print_word(font_info[n]); 
+          print_word(font_info[n]); 
 #endif
-  break; 
-      case 6 : 
-  print_word(save_stack[n]); 
-  break; 
-      case 7 : 
-  show_box(n); 
-  break; 
-      case 8 : 
-  {
-    breadth_max = 10000; 
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+          break;
+        
+        case 6:
+          print_word(save_stack[n]);
+          break;
+          
+        case 7:
+          show_box(n);
+          break;
+        
+        case 8:
+          {
+            breadth_max = 10000;
 #ifdef ALLOCATESTRING
-/* About to output node list make some space in string pool 97/Mar/9 */
-  if (pool_ptr + 32000 > current_pool_size)
-    str_pool = realloc_str_pool (increment_pool_size);
-/* We don't bother to check whether this worked */
+            if (pool_ptr + 32000 > current_pool_size)
+              str_pool = realloc_str_pool (increment_pool_size);
 #endif
 #ifdef ALLOCATESTRING
-    depth_threshold = current_pool_size - pool_ptr - 10; 
+            depth_threshold = current_pool_size - pool_ptr - 10;
 #else
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-    depth_threshold = pool_size - pool_ptr - 10; 
+            depth_threshold = pool_size - pool_ptr - 10;
 #endif
-    show_node_list(n); 
-  } 
-  break; 
-      case 9 : 
-  show_token_list(n, 0, 1000); 
-  break; 
-      case 10 : 
-  slow_print(n); 
-  break; 
-      case 11 : 
-  check_mem(n > 0); 
-  break; 
-      case 12 : 
-  search_mem(n); 
-  break; 
-      case 13 : 
-  {
-    read(stdin, l);  // ???
-    print_cmd_chr(n, l); 
-  } 
-  break; 
-      case 14 : 
-  {
-    register integer for_end; 
-    k = 0; 
-    for_end = n; 
-    if (k <= for_end) 
-      do print(buffer[k]); 
-    while(k++ < for_end);
-  } 
-  break; 
-      case 15 : 
-  {
-    font_in_short_display = 0; 
-    short_display(n); 
-  } 
-  break; 
-      case 16 : 
-  panicking = !panicking; 
-  break; 
-  default: 
-  print(63);    /* ? */
-  break; 
-      } 
-    } 
-  } 
-} 
+            show_node_list(n);
+          }
+          break;
+        
+        case 9:
+          show_token_list(n, 0, 1000);
+          break;
+        
+        case 10:
+          slow_print(n);
+          break;
+        
+        case 11:
+          check_mem(n > 0);
+          break;
+        
+        case 12:
+          search_mem(n);
+          break;
+        
+        case 13:
+          {
+            read(stdin, l);
+            print_cmd_chr(n, l);
+          }
+          break;
+        
+        case 14:
+          {
+            for (k = 0; k <= n; k++)
+              print(buffer[k]);
+          }
+          break;
+        
+        case 15:
+          {
+            font_in_short_display = 0;
+            short_display(n);
+          }
+          break;
+        
+        case 16:
+          panicking = !panicking;
+          break;
+        
+        default:
+          print('?');
+          break;
+      }
+    }
+  }
+}
 #endif /* DEBUG */
index 5cd79f4..fb7be91 100644 (file)
@@ -884,10 +884,9 @@ char *unixify (char *);
 #include "coerce.h"
 
 /* sec 79 */
-extern void synch_h(void);
-extern void synch_v(void);
-extern void set_cur_lang(void);
-extern str_number make_string_pool (char *s);
+extern INLINE void synch_h(void);
+extern INLINE void synch_v(void);
+extern INLINE void set_cur_lang(void);
 extern char * md5_file(FILE * in_file);
 extern INLINE void str_room_ (int val);
 #define str_room(a) str_room_((int) a)
@@ -902,7 +901,8 @@ extern INLINE void dvi_out_ (ASCII_code op);
 extern INLINE void free_avail_(halfword p);
 #define free_avail(p) free_avail_((halfword) (p))
 extern INLINE void flush_string (void);
-extern int load_pool_strings (integer spare_size);
+extern str_number load_pool_strings (integer spare_size);
+extern str_number make_string_pool (const char *s);
 #define help0()     tex_help(0)
 #define help1(...)  tex_help(1, __VA_ARGS__)
 #define help2(...)  tex_help(2, __VA_ARGS__)
index 49dee9e..ac71244 100644 (file)
@@ -27,6 +27,7 @@ enum {
   out_dvi_flag = (1 << 0),
   out_pdf_flag = (1 << 1),
   out_xdv_flag = (1 << 2),
+  out_dpx_flag = (1 << 3),
 };
 
 #define INLINE inline
index 5a2fb04..180db44 100644 (file)
 
 #include "texd.h"
 
+double dev_origin_x = 72.0;
+double dev_origin_y = 770.0;
+
 void dpx_ship_out(pointer p)
 {
+//pdf_init_fontmaps();
+//read_config_file(DPX_CONFIG_FILE);
+//pdf_font_set_dpi(font_dpi);
+//dpx_delete_old_cache(image_cache_life);
+//pdf_files_init();
+//pdf_doc_begin_page(1, dev_origin_x, dev_origin_y);
+//pdf_doc_end_page();
 }
 
 void dpx_hlist_out (void)
index 6d52342..f338598 100644 (file)
 static const char *pool_file_arr[] =
 {
 /* 0256 */  "", //"buffer size",
-/* 0257 */  "pool size",
+/* 0257 */  "", //"pool size",
 /* 0258 */  "", //"number of strings",
 /* 0259 */  "" "?" "?" "?",
 /* 0260 */  "m2d5c2l5x2v5i",
 /* 0261 */  "", //"End of file on the terminal!",
-/* 0262 */  "! ",
+/* 0262 */  "", //"! ",
 /* 0263 */  "", //"(That makes 100 errors; please try again.)",
 /* 0264 */  "" "? ",
 /* 0265 */  "", //"Type <return> to proceed, S to scroll future error messages,",
@@ -1060,16 +1060,14 @@ static const char *pool_file_arr[] =
 /* 1292 */  "", //"On this page there's a \\write with fewer real {'s than }'s.",
 /* 1293 */  "", //"ext4",
 /* 1294 */  "", //"output file name",
-/* 1295 */  NULL };
+};
 
-int load_pool_strings (integer spare_size)
+str_number load_pool_strings (integer spare_size)
 {
-  str_number g = 0;
-  int i = 0;
-  int k = 0;
-  int l;
+  str_number g;
+  int k, l, i = 0;
 
-  for (k = 0; k < sizeof(pool_file_arr) / sizeof(char *) - 1; ++k)
+  for (k = 0; k < sizeof(pool_file_arr) / sizeof(char *); k++)
   {
     l = strlen(pool_file_arr[k]);
     i += l;
@@ -1078,11 +1076,25 @@ int load_pool_strings (integer spare_size)
       return 0;
 
     memcpy(str_pool + pool_ptr, pool_file_arr[k], l);
-
     pool_ptr += l;
-
     g = make_string();
   }
 
   return g;
 }
+
+str_number make_string_pool (const char *s)
+{
+  int slen = strlen(s);
+
+  if (slen == 1)
+  {
+    return ((str_number)s[0]);
+  }
+  else
+  {
+    memcpy(str_pool + pool_ptr, s, slen);
+    pool_ptr += slen;
+    return (make_string());
+  }
+}
\ No newline at end of file
index adeeeff..1ae7b17 100644 (file)
@@ -25,7 +25,6 @@
 #define dump_default        " plain.fmt"
 #define dump_ext_length     4
 #define dump_default_length format_default_length
-#define main_program        texbody
 #define edit_value          tex_edit_value
 
 extern char * replacement[];
@@ -40,8 +39,6 @@ char **gargv;   /* char *gargv[] -- bkph ? */
 /* The entry point: set up for reading the command line, which will
    happen in `t_open_in', then call the main body.  */
 
-int main_init(int, char **);     /* in local.c */
-
 int jump_used = 0;
 
 jmp_buf jumpbuffer;
@@ -50,10 +47,6 @@ int main (int ac, char *av[])
 {
   int flag = 0, ret = 0;
 
-#ifndef INI
-  char custom_default[PATH_MAX];
-#endif
-
 #ifdef WIN32
   _setmaxstdio(2048);
 #endif
@@ -77,7 +70,7 @@ int main (int ac, char *av[])
 
     if (trace_flag)
     {
-      sprintf(log_line, "EXITING at %s %d %d %d\n", "MAIN", flag, ret, jump_used);
+      sprintf(log_line, "EXITING at %s: flag = %d, ret = %d, jump_used = %d\n", "main", flag, ret, jump_used);
       show_line(log_line, 0);
     }
   }
@@ -85,7 +78,7 @@ int main (int ac, char *av[])
   {
     if (trace_flag)
     {
-      sprintf(log_line, "EXITING at %s %d %d %d\n", "JUMPOUT", flag, ret, jump_used);
+      sprintf(log_line, "EXITING at %s: flag = %d, ret = %d, jump_used =  %d\n", "jump_out", flag, ret, jump_used);
       show_line(log_line, 0);
     }
   }
@@ -95,12 +88,8 @@ int main (int ac, char *av[])
 
   if (flag == 0)
     return 0;
-
-#ifdef _WINDOWS
-  return flag;
-#else
-  else exit (flag);   // avoid circularity!
-#endif
+  else
+    exit (flag);
 }
 
 /* texk/web2c/lib/texmfmp.c */