OSDN Git Service

pTeX's primitives.
[putex/putex.git] / src / texsourc / tex2.c
index 97a8847..04f41ce 100644 (file)
@@ -186,7 +186,7 @@ void show_context (void)
 {
   char old_setting;
   integer nn;
-  bool bottomline;
+  boolean bottomline;
   integer i;
   integer j;
   integer l;
@@ -494,7 +494,7 @@ void begin_token_list_ (halfword p, quarterword t)
             break;
 
           default:
-            print_cmd_chr(assign_toks, t + (hash_size + 1307));
+            print_cmd_chr(assign_toks, t - output_text + output_routine_loc);
             break;
         }
 
@@ -814,12 +814,7 @@ void firm_up_the_line (void)
           print(buffer[k]);
 
       first = cur_input.limit_field;
-
-      {
-        ;
-        print_string("=>");
-        term_input("=>", 0);
-      }
+      prompt_input("=>");
 
       if (last > first)
       {
@@ -935,13 +930,7 @@ lab22:
             t = s;
             do
               {
-                {
-                  q = get_avail();
-                  mem[p].hh.v.RH = q;
-                  mem[q].hh.v.LH = mem[t].hh.v.LH;
-                  p = q;
-                }
-
+                store_new_token(info(t));
                 incr(m);
                 u = link(t);
                 v = s;
@@ -1002,27 +991,7 @@ lab30:
 
             while (true)
             {
-              {
-                {
-                  q = avail;
-
-                  if (q == 0)
-                    q = get_avail();
-                  else
-                  {
-                    avail = mem[q].hh.v.RH;
-                    mem[q].hh.v.RH = 0;
-#ifdef STAT
-                    incr(dyn_used);
-#endif /* STAT */
-                  }
-                }
-
-                mem[p].hh.v.RH = q;
-                mem[q].hh.v.LH = cur_tok;
-                p = q;
-              }
-
+              fast_store_new_token(cur_tok);
               get_token();
 
               if (cur_tok == par_token)
@@ -1061,13 +1030,7 @@ lab30:
             }
 lab31:
             rbraceptr = p;
-
-            {
-              q = get_avail();
-              mem[p].hh.v.RH = q;
-              mem[q].hh.v.LH = cur_tok;
-              p = q;
-            }
+            store_new_token(cur_tok);
           }
           else
           {
@@ -1094,12 +1057,7 @@ lab31:
               if (info(r) >= match_token)
                 goto lab22;
 
-          {
-            q = get_avail();
-            mem[p].hh.v.RH = q;   /* p may be used without having ... */
-            mem[q].hh.v.LH = cur_tok;
-            p = q;
-          }
+          store_new_token(cur_tok);
         }
 
         incr(m);          /* m may be used without having been ... */
@@ -1259,12 +1217,7 @@ void expand (void)
             get_x_token();
   
             if (cur_cs == 0)
-            {
-              q = get_avail();
-              mem[p].hh.v.RH = q;
-              mem[q].hh.v.LH = cur_tok;
-              p = q;
-            }
+              store_new_token(cur_tok);
           }
         while(!(cur_cs != 0));
 
@@ -1484,11 +1437,11 @@ void scan_optional_equals (void)
     back_input();
 }
 /* sec 0407 */
-bool scan_keyword_(char * s)
+boolean scan_keyword_(const char * s)
 {
   halfword p;
   halfword q;
-  char * k;
+  const char * k;
 
   p = backup_head;
   link(p) = 0;
@@ -1500,13 +1453,7 @@ bool scan_keyword_(char * s)
 
     if ((cur_cs == 0) && ((cur_chr == (*k)) || (cur_chr == (*k) - 'a' + 'A')))
     {
-      {
-        q = get_avail();
-        mem[p].hh.v.RH = q;
-        mem[q].hh.v.LH = cur_tok;
-        p = q;
-      }
-
+      store_new_token(cur_tok);
       incr(k);
     }
     else if ((cur_cmd != spacer) || (p != backup_head))
@@ -1634,7 +1581,7 @@ void scan_font_ident (void)
   cur_val = f;
 }
 /* sec 0578 */
-void find_font_dimen_(bool writing)
+void find_font_dimen_(boolean writing)
 {
   internal_font_number f;
   integer n;
@@ -1688,17 +1635,12 @@ void find_font_dimen_(bool writing)
       cur_val = fmem_ptr - 1;
     }
   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 */
-/*  checksum =  (((font_check[f].b0) << 8 | font_check[f].b1) << 8 |
-        font_check[f].b2) << 8 | font_check[f].b3; */
+    cur_val = n + param_base[f];
   }
-/* compiler error: '-' : incompatible types - from 'union fmemoryword *' to 'struct fourunsignedchars *' */
+
   if (cur_val == fmem_ptr)
   {
     print_err("Font ");
-/*    print_esc(hash[(hash_size + 524) + f].v.RH); */
     print_esc(""); print(font_id_text(f));
     print_string(" has only ");
     print_int(font_params[f]);
@@ -1708,12 +1650,8 @@ void find_font_dimen_(bool writing)
     error();
   }
 }
-/* NOTE: the above use of /fontdimen0 to access the checksum is a kludge */
-/* In future would be better to do this by allocating one more slot for */
-/* for parameters when a font is read rather than carry checksum separately */
-/* The above gets the value byte order reversed ... 98/Oct/5 */
 /* sec 0413 */
-void scan_something_internal_(small_number level, bool negative)
+void scan_something_internal_(small_number level, boolean negative)
 {
   halfword m;
   integer p;
@@ -1770,7 +1708,7 @@ void scan_something_internal_(small_number level, bool negative)
         }
 
         {
-          cur_val = eqtb[m].hh.v.RH;
+          cur_val = eqtb[m].hh.rh;
           cur_val_level = tok_val;
         }
       }
@@ -1780,7 +1718,7 @@ void scan_something_internal_(small_number level, bool negative)
         scan_font_ident();
 
         {
-          cur_val = font_id_base + cur_val; /* 96/Jan/10 */
+          cur_val = font_id_base + cur_val;
           cur_val_level = ident_val;
         }
       }
@@ -1802,20 +1740,20 @@ void scan_something_internal_(small_number level, bool negative)
 
     case assign_glue:
       {
-        cur_val = eqtb[m].hh.v.RH;
+        cur_val = eqtb[m].hh.rh;
         cur_val_level = glue_val;
       }
       break;
 
     case assign_mu_glue:
       {
-        cur_val = eqtb[m].hh.v.RH;
+        cur_val = eqtb[m].hh.rh;
         cur_val_level = mu_val;
       }
       break;
 
     case set_aux:
-      if (abs(mode)!= m)
+      if (abs(mode) != m)
       {
         print_err("Improper ");
         print_cmd_chr(set_aux, m);
@@ -1859,7 +1797,7 @@ void scan_something_internal_(small_number level, bool negative)
         nest[nest_ptr] = cur_list;
         p = nest_ptr;
 
-        while (abs(nest[p].mode_field)!= vmode)
+        while (abs(nest[p].mode_field) != vmode)
           decr(p);
 
         {
@@ -2091,8 +2029,6 @@ void scan_something_internal_(small_number level, bool negative)
   else if ((cur_val_level >= glue_val) && (cur_val_level <= mu_val))
     add_glue_ref(cur_val);
 }
-/*****************************************************************************/
-/* Moved here to avoid question about pragma optimize 96/Sep/12 */
 /* sec 0341 */
 void get_next (void)
 {
@@ -2483,13 +2419,7 @@ lab40:
 
           print_ln();
           first = cur_input.start_field;
-
-          {
-            ;
-            print_string("*");
-            term_input("*", 0);
-          }
-
+          prompt_input("*");
           cur_input.limit_field = last;
 
           if ((end_line_char < 0) || (end_line_char > 255))
@@ -2601,5 +2531,4 @@ lab40:
         align_state = 1000000L;
         goto lab20;
       }
-}
-//#pragma optimize ("", on)             /* 96/Sep/12 */
\ No newline at end of file
+}
\ No newline at end of file