OSDN Git Service

code clean in tex3.c.
[putex/putex.git] / src / texsourc / tex3.c
index 3943cca..4c0d551 100644 (file)
 /* sec 0440 */
 void scan_int (void)
 {
-  bool negative;
+  boolean negative;
   integer m;
   small_number d;
-  bool vacuous;
-  bool OKsofar;
+  boolean vacuous;
+  boolean OKsofar;
 
   radix = 0;
   OKsofar = true;
@@ -118,9 +118,9 @@ void scan_int (void)
         else if ((cur_tok <= other_A_token + 5) && (cur_tok >= other_A_token))
           d = cur_tok - other_A_token;
         else
-          goto lab30;
+          goto done;
       else
-        goto lab30;
+        goto done;
 
       vacuous = false;
 
@@ -140,7 +140,7 @@ void scan_int (void)
         cur_val = cur_val * radix + d;
       get_x_token();
     }
-lab30:;
+done:;
 
     if (vacuous)
     {
@@ -158,9 +158,9 @@ lab30:;
     cur_val = - (integer) cur_val;
 }
 /* sec 0448 */
-void scan_dimen_(bool mu, bool inf, bool shortcut)
+void scan_dimen_(boolean mu, boolean inf, boolean shortcut)
 {
-  bool negative;
+  boolean negative;
   integer f;
   integer num, denom;
   small_number k, kk;
@@ -207,7 +207,7 @@ void scan_dimen_(bool mu, bool inf, bool shortcut)
         }
 
         if (cur_val_level == mu_val)
-          goto lab89;
+          goto attach_sign;
 
         if (cur_val_level != int_val)
           mu_error();
@@ -217,7 +217,7 @@ void scan_dimen_(bool mu, bool inf, bool shortcut)
         scan_something_internal(dimen_val, false);
 
         if (cur_val_level == dimen_val)
-          goto lab89;
+          goto attach_sign;
       }
     }
     else
@@ -251,7 +251,7 @@ void scan_dimen_(bool mu, bool inf, bool shortcut)
           get_x_token();
 
           if ((cur_tok > zero_token + 9) || (cur_tok < zero_token))
-            goto lab31;
+            goto done1;
 
           if (k < 17)
           {
@@ -262,7 +262,7 @@ void scan_dimen_(bool mu, bool inf, bool shortcut)
             incr(k);
           }
         }
-lab31:
+done1:
         for (kk = k; kk >= 1; kk--)
         {
           dig[kk - 1] = info(p);
@@ -296,14 +296,14 @@ lab31:
         if (cur_order == filll)
         {
           print_err("Illegal unit of measure (");
-          print_string("replaced by filll)");
+          prints("replaced by filll)");
           help1("I dddon't go any higher than filll.");
           error();
         }
         else
           incr(cur_order);
       }
-      goto lab88;
+      goto attach_fraction;
     }
   }
 
@@ -341,18 +341,18 @@ lab31:
     }
 
     v = cur_val;
-    goto lab40;
+    goto found;
   }
 
   if (mu)
-    goto lab45;
+    goto not_found;
 
   if (scan_keyword("em"))
     v = quad(cur_font);
   else if (scan_keyword("ex"))
     v = x_height(cur_font);
   else
-    goto lab45;
+    goto not_found;
 
   {
     get_x_token();
@@ -360,24 +360,26 @@ lab31:
     if (cur_cmd != spacer)
       back_input();
   }
-lab40:
+
+found:
   cur_val = mult_and_add(savecurval, v, xn_over_d(v, f, 65536L), 1073741823L);   /* 2^30 - 1 */
-  goto lab89;
-lab45:
+  goto attach_sign;
+
+not_found:
   if (mu)
   {
     if (scan_keyword("mu"))
-      goto lab88;
+      goto attach_fraction;
     else
     {
       print_err("Illegal unit of measure (");
-      print_string("mu inserted)");
+      prints("mu inserted)");
       help4("The unit of measurement in math glue must be mu.",
           "To recover gracefully from this error, it's best to",
           "delete the erroneous units; e.g., type `2' to delete",
           "two letters. (See Chapter 27 of The TeXbook.)");
       error();
-      goto lab88;
+      goto attach_fraction;
     }
   }
 
@@ -395,59 +397,32 @@ lab45:
   }
 
   if (scan_keyword("pt"))
-    goto lab88;
+    goto attach_fraction;
 
   if (scan_keyword("in"))
-  {
-    num = 7227;
-    denom = 100;
-  }
+    set_conversion(7227, 100);
   else if (scan_keyword("pc"))
-  {
-    num = 12;
-    denom = 1;
-  }
+    set_conversion(12, 1);
   else if (scan_keyword("cm"))
-  {
-    num = 7227;
-    denom = 254;
-  }
+    set_conversion(7227, 254);
   else if (scan_keyword("mm"))
-  {
-    num = 7227;
-    denom = 2540;
-  }
+    set_conversion(7227, 2540);
   else if (scan_keyword("bp"))
-  {
-    num = 7227;
-    denom = 7200;
-  }
+    set_conversion(7227, 7200);
   else if (scan_keyword("dd"))
-  {
-    num = 1238;
-    denom = 1157;
-  }
+    set_conversion(1238, 1157);
   else if (scan_keyword("cc"))
-  {
-    num = 14856;
-    denom = 1157;
-  }
+    set_conversion(14856, 1157);
   else if (scan_keyword("Q"))
-  {
-    num = 7227;
-    denom = 10160;
-  }
+    set_conversion(7227, 10160);
   else if (scan_keyword("H"))
-  {
-    num = 7227;
-    denom = 10160;
-  }
+    set_conversion(7227, 10160);
   else if (scan_keyword("sp"))
-    goto lab30;
+    goto done;
   else
   {
     print_err("Illegal unit of measure (");
-    print_string("pt inserted)");
+    prints("pt inserted)");
     help6("Dimensions can be in units of em, ex, in, pt, pc,",
       "cm, mm, dd, cc, bp, or sp; but yours is a new one!",
       "I'll assume that you meant to say pt, for printer's points.",
@@ -455,34 +430,37 @@ lab45:
       "delete the erroneous units; e.g., type `2' to delete",
       "two letters. (See Chapter 27 of The TeXbook.)");
     error();
-    goto lab32;
+    goto done2;
   }
 
   cur_val = xn_over_d(cur_val, num, denom);
   f = (num * f + 65536L * tex_remainder) / denom;
   cur_val = cur_val +(f / 65536L);
   f = f % 65536L;
-lab32:;
-lab88:
+
+done2:
+attach_fraction:
   if (cur_val >= 16384)     /* 2^14 */
     arith_error = true;
   else
-    cur_val = cur_val * 65536L + f;
-lab30:;
+    cur_val = cur_val * unity + f;
+
+done:
   {
     get_x_token();
 
     if (cur_cmd != spacer)
       back_input();
   }
-lab89:
+
+attach_sign:
   if (arith_error || (abs(cur_val) >= 1073741824L)) /* 2^30 */
   {
     print_err("Dimension too large");
     help2("I can't work with sizes bigger than about 19 feet.",
         "Continue and I'll use the largest value I can.");
     error();
-    cur_val = 1073741823L;  /* 2^30 - 1 */
+    cur_val = max_dimen;
     arith_error = false;
   }
 
@@ -492,9 +470,9 @@ lab89:
 /* sec 0461 */
 void scan_glue_(small_number level)
 {
-  bool negative;
+  boolean negative;
   halfword q;
-  bool mu;
+  boolean mu;
 
   mu = (level == mu_val);
   negative = false;
@@ -579,27 +557,27 @@ halfword scan_rule_spec (void)
     depth(q) = 0;
   }
 
-lab21:
+reswitch:
 
   if (scan_keyword("width"))
   {
     scan_dimen(false, false, false);
     width(q) = cur_val;
-    goto lab21;
+    goto reswitch;
   }
 
   if (scan_keyword("height"))
   {
     scan_dimen(false, false, false);
     height(q) = cur_val;
-    goto lab21;
+    goto reswitch;
   }
 
   if (scan_keyword("depth"))
   {
     scan_dimen(false, false, false);
     depth(q) = cur_val;
-    goto lab21;
+    goto reswitch;
   }
 
   return q;
@@ -625,27 +603,11 @@ halfword str_toks_(pool_pointer b)
       t = space_token;
     else
       t = other_token + t;
-    {
-      {
-        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 = t;
-      p = q;
-    }
+    fast_store_new_token(t);
     incr(k);
   }
+
   pool_ptr = b;
 
   return p;
@@ -653,7 +615,6 @@ halfword str_toks_(pool_pointer b)
 /* sec 0465 */
 halfword the_toks (void)
 {
-  register halfword Result;
   char old_setting;
   halfword p, q, r;
   pool_pointer b;
@@ -663,43 +624,23 @@ halfword the_toks (void)
 
   if (cur_val_level >= ident_val)
   {
-    p = temp_head; 
+    p = temp_head;
     link(p) = 0;
 
     if (cur_val_level == ident_val)
-    {
-      q = get_avail();
-      mem[p].hh.v.RH = q;
-      mem[q].hh.v.LH = cs_token_flag + cur_val;
-      p = q;
-    }
+      store_new_token(cs_token_flag + cur_val);
     else if (cur_val != 0)
     {
       r = link(cur_val);
 
-      while (r != 0) { /*   while r<>null do l.9178 */
-        {
-          {
-            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 = mem[r].hh.v.LH;
-          p = q;
-        }
+      while (r != 0)
+      {
+        fast_store_new_token(info(r));
         r = link(r);
       }
     }
-    Result = p;
+
+    return p;
   }
   else
   {
@@ -712,18 +653,21 @@ halfword the_toks (void)
       case int_val:
         print_int(cur_val);
         break;
+
       case dimen_val:
         {
           print_scaled(cur_val);
-          print_string("pt");
+          prints("pt");
         }
         break;
+
       case glue_val:
         {
           print_spec(cur_val, "pt");
           delete_glue_ref(cur_val);
         }
         break;
+
       case mu_val:
         {
           print_spec(cur_val, "mu");
@@ -731,24 +675,23 @@ halfword the_toks (void)
         }
         break;
     }
+
     selector = old_setting;
-    Result = str_toks(b);
+    return str_toks(b);
   }
-
-  return Result;
 }
 /* sec 0467 */
 void ins_the_toks (void) 
 { 
   link(garbage) = the_toks();
-  begin_token_list(link(temp_head), 4);
+  ins_list(link(temp_head));
 }
 /* sec 0470 */
 void conv_toks (void)
 {
   char old_setting;
   char c;
-  small_number savescannerstatus;
+  small_number save_scanner_status;
   pool_pointer b;
 
   c = cur_chr;
@@ -762,10 +705,10 @@ void conv_toks (void)
 
     case string_code:
     case meaning_code:
-      savescannerstatus = scanner_status;
+      save_scanner_status = scanner_status;
       scanner_status = 0;
       get_token();
-      scanner_status = savescannerstatus;
+      scanner_status = save_scanner_status;
       break;
 
     case font_name_code:
@@ -808,9 +751,9 @@ void conv_toks (void)
 
       if (font_size[cur_val] != font_dsize[cur_val])
       {
-        print_string(" at ");
+        prints(" at ");
         print_scaled(font_size[cur_val]);
-        print_string("pt");
+        prints("pt");
       }
       break;
 
@@ -824,17 +767,16 @@ void conv_toks (void)
   begin_token_list(link(temp_head), 4);
 }
 /* sec 0473 */
-halfword scan_toks_(bool macrodef, bool xpand)
+halfword scan_toks_(boolean macro_def, boolean xpand)
 {
-  register halfword Result;
   halfword t;
   halfword s;
   halfword p;
   halfword q;
   halfword unbalance;
-  halfword hashbrace;
+  halfword hash_brace;
 
-  if (macrodef)
+  if (macro_def)
     scanner_status = defining;
   else
     scanner_status = absorbing;
@@ -843,17 +785,17 @@ halfword scan_toks_(bool macrodef, bool xpand)
   def_ref = get_avail();
   token_ref_count(def_ref) = 0;
   p = def_ref;
-  hashbrace = 0;
+  hash_brace = 0;
   t = zero_token;
 
-  if (macrodef)
+  if (macro_def)
   {
     while (true)
     {
       get_token();
 
       if (cur_tok < right_brace_limit)
-        goto lab31;
+        goto done1;
 
       if (cur_cmd == mac_param)
       {
@@ -862,20 +804,10 @@ halfword scan_toks_(bool macrodef, bool xpand)
 
         if (cur_cmd == left_brace)
         {
-          hashbrace = cur_tok;
-          {
-            q = get_avail();
-            mem[p].hh.v.RH = q;
-            mem[q].hh.v.LH = cur_tok;
-            p = q;
-          }
-          {
-            q = get_avail();
-            mem[p].hh.v.RH = q;
-            mem[q].hh.v.LH = end_match_token;
-            p = q;
-          }
-          goto lab30;
+          hash_brace = cur_tok;
+          store_new_token(cur_tok);
+          store_new_token(end_match_token);
+          goto done;
         }
 
         if (t == zero_token + 9)
@@ -895,24 +827,17 @@ halfword scan_toks_(bool macrodef, bool xpand)
                 "Type `1' to delete what you did use.");
             back_error();
           }
+
           cur_tok = s;
         }
       }
-      {
-        q = get_avail();
-        mem[p].hh.v.RH = q;
-        mem[q].hh.v.LH = cur_tok;
-        p = q;
-      }
-    }
-lab31:
-    {
-      q = get_avail();
-      mem[p].hh.v.RH = q;
-      mem[q].hh.v.LH = end_match_token;
-      p = q;
+
+      store_new_token(cur_tok);
     }
 
+done1:
+    store_new_token(end_match_token);
+
     if (cur_cmd == right_brace)
     {
       print_err("Missing { inserted");
@@ -920,9 +845,9 @@ lab31:
       help2("Where was the left brace? You said something like `\\def\\a}',",
           "which I'm going to interpret as `\\def\\a{}'.");
       error();
-      goto lab40;
+      goto found;
     }
-lab30:;
+done:;
   }
   else
   {
@@ -940,7 +865,7 @@ lab30:;
         get_next();
 
         if (cur_cmd <= max_command)
-          goto lab32;
+          goto done2;
 
         if (cur_cmd != the)
         {
@@ -957,7 +882,7 @@ lab30:;
           }
         }
       }
-lab32:
+done2:
       x_token();
     }
     else
@@ -971,10 +896,10 @@ lab32:
         decr(unbalance);
 
         if (unbalance == 0)
-          goto lab40;
+          goto found;
       }
     else if (cur_cmd == mac_param)
-      if (macrodef)
+      if (macro_def)
       {
         s = cur_tok;
 
@@ -997,25 +922,16 @@ lab32:
           else
             cur_tok = out_param_token - '0' + cur_chr;
       }
-    {
-      q = get_avail();
-      mem[p].hh.v.RH = q;
-      mem[q].hh.v.LH = cur_tok;
-      p = q;
-    }
+
+    store_new_token(cur_tok);
   }
-lab40:
+found:
   scanner_status = 0;
 
-  if (hashbrace != 0)
-  {
-    q = get_avail();
-    mem[p].hh.v.RH = q;
-    mem[q].hh.v.LH = hashbrace;
-    p = q;
-  }
-  Result = p;
-  return Result;
+  if (hash_brace != 0)
+    store_new_token(hash_brace);
+
+  return p;
 }
 /* used only in ITEX.C */
 /* sec 0482 */
@@ -1032,13 +948,7 @@ void read_toks_(integer n, halfword r)
   def_ref = get_avail();
   token_ref_count(def_ref) = 0;
   p = def_ref;
-
-  {
-    q = get_avail();
-    mem[p].hh.v.RH = q;
-    mem[q].hh.v.LH = end_match_token;
-    p = q;
-  }
+  store_new_token(end_match_token);
 
   if ((n < 0) || (n > 15))
     m = 16;
@@ -1051,29 +961,23 @@ void read_toks_(integer n, halfword r)
   do
     {
       begin_file_reading();
-      cur_input.name_field = m + 1;
+      name = m + 1;
 
       if (read_open[m] == closed)
         if (interaction > nonstop_mode)
           if (n < 0)
-          {
-            print_string("");
-            term_input("", 0);
-          }
+            prompt_input("");
           else
           {
             print_ln();
             sprint_cs(r);
-            {
-              print_string("=");
-              term_input("=", 0);
-            }
+            prompt_input("=");
             n = -1;
           }
         else
         {
           fatal_error("*** (cannot \\read from terminal in nonstop modes)");
-          return;     // abort_flag set
+          return;
         }
       else if (read_open[m] == 1)
         if (input_ln(read_file[m], false))
@@ -1102,23 +1006,23 @@ void read_toks_(integer n, halfword r)
         }
       }
 
-      cur_input.limit_field = last;
+      limit = last;
 
-      if ((end_line_char < 0) || (end_line_char > 255))
-        decr(cur_input.limit_field);
+      if (end_line_char_inactive())
+        decr(limit);
       else
-        buffer[cur_input.limit_field] = end_line_char;
+        buffer[limit] = end_line_char;
 
-      first = cur_input.limit_field + 1;
-      cur_input.loc_field = cur_input.start_field;
-      cur_input.state_field = new_line;
+      first = limit + 1;
+      loc = start;
+      state = new_line;
 
       while (true)
       {
         get_token();
 
         if (cur_tok == 0)
-          goto lab30;
+          goto done;
 
         if (align_state < 1000000L)
         {
@@ -1126,23 +1030,18 @@ void read_toks_(integer n, halfword r)
             {
               get_token();
             }
-          while(!(cur_tok == 0));
+          while (!(cur_tok == 0));
 
           align_state = 1000000L;
-          goto lab30;
+          goto done;
         }
 
-        {
-          q = get_avail();
-          mem[p].hh.v.RH = q;
-          mem[q].hh.v.LH = cur_tok;
-          p = q;
-        }
+        store_new_token(cur_tok);
       }
-lab30:
+done:
       end_file_reading();
     }
-  while(!(align_state == 1000000L));
+  while (!(align_state == 1000000L));
 
   cur_val = def_ref;
   scanner_status = normal;
@@ -1152,9 +1051,9 @@ lab30:
 void pass_text (void)
 {
   integer l;
-  small_number savescannerstatus;
+  small_number save_scanner_status;
 
-  savescannerstatus = scanner_status;
+  save_scanner_status = scanner_status;
   scanner_status = skipping;
   l = 0;
   skip_line = line;
@@ -1166,7 +1065,7 @@ void pass_text (void)
     if (cur_cmd == fi_or_else)
     {
       if (l == 0)
-        goto lab30;
+        goto done;
 
       if (cur_chr == 2)
         decr(l);
@@ -1174,8 +1073,8 @@ void pass_text (void)
     else if (cur_cmd == if_test)
       incr(l);
   }
-lab30:
-  scanner_status = savescannerstatus;
+done:
+  scanner_status = save_scanner_status;
 }
 /* sec 0497 */
 void change_if_limit_(small_number l, halfword p)
@@ -1193,7 +1092,7 @@ void change_if_limit_(small_number l, halfword p)
       if (q == 0)
       {
         confusion("if");
-        return;       // abort_flag set
+        return;
       }
 
       if (link(q) == p)
@@ -1210,13 +1109,13 @@ void change_if_limit_(small_number l, halfword p)
 /* sec 0498 */
 void conditional (void)
 {
-  bool b;
+  boolean b;
   char r;
   integer m, n;
   halfword p, q;
-  small_number savescannerstatus;
-  halfword savecondptr;
-  small_number thisif;
+  small_number save_scanner_status;
+  halfword save_cond_ptr;
+  small_number this_if;
 
   {
     p = get_node(if_node_size);
@@ -1230,10 +1129,10 @@ void conditional (void)
     if_line = line;
   }
 
-  savecondptr = cond_ptr;
-  thisif = cur_chr;
+  save_cond_ptr = cond_ptr;
+  this_if = cur_chr;
 
-  switch (thisif)
+  switch (this_if)
   {
     case if_char_code:
     case if_cat_code:
@@ -1276,7 +1175,7 @@ void conditional (void)
           cur_chr = 256;
         }
 
-        if (thisif == if_char_code)
+        if (this_if == if_char_code)
           b = (n == cur_chr); 
         else
           b = (m == cur_cmd);
@@ -1286,7 +1185,7 @@ void conditional (void)
     case if_int_code:
     case if_dim_code:
       {
-        if (thisif == if_int_code)
+        if (this_if == if_int_code)
           scan_int();
         else
           scan_dimen(false, false, false);
@@ -1297,20 +1196,20 @@ void conditional (void)
           {
             get_x_token();
           }
-        while(!(cur_cmd != spacer));
+        while (!(cur_cmd != spacer));
 
         if ((cur_tok >= other_token + '<') && (cur_tok <= other_token + '>'))
           r = cur_tok - other_token;
         else
         {
           print_err("Missing = inserted for ");
-          print_cmd_chr(if_test, thisif);
+          print_cmd_chr(if_test, this_if);
           help1("I was expecting to see `<', `=', or `>'. Didn't.");
           back_error();
           r = '=';
         }
 
-        if (thisif == if_int_code)
+        if (this_if == if_int_code)
           scan_int();
         else 
           scan_dimen(false, false, false);
@@ -1338,15 +1237,15 @@ void conditional (void)
       break;
 
     case if_vmode_code:
-      b = (abs(mode) == 1);
+      b = (abs(mode) == vmode);
       break;
 
     case if_hmode_code:
-      b = (abs(mode) == 102);
+      b = (abs(mode) == hmode);
       break;
 
     case if_mmode_code:
-      b = (abs(mode) == 203);
+      b = (abs(mode) == mmode);
       break;
 
     case if_inner_code:
@@ -1360,11 +1259,11 @@ void conditional (void)
         scan_eight_bit_int();
         p = box(cur_val);
 
-        if (thisif == if_void_code)
+        if (this_if == if_void_code)
           b = (p == 0);
         else if (p == 0)
           b = false;
-        else if (thisif == if_hbox_code)
+        else if (this_if == if_hbox_code)
           b = (type(p) == hlist_node);
         else
           b = (type(p) == vlist_node);
@@ -1373,7 +1272,7 @@ void conditional (void)
 
     case ifx_code:
       {
-        savescannerstatus = scanner_status;
+        save_scanner_status = scanner_status;
         scanner_status = 0;
         get_next();
         n = cur_cs;
@@ -1407,7 +1306,7 @@ void conditional (void)
           }
         }
 
-        scanner_status = savescannerstatus;
+        scanner_status = save_scanner_status;
       }
       break;
 
@@ -1434,7 +1333,7 @@ void conditional (void)
         if (tracing_commands > 1)
         {
           begin_diagnostic();
-          print_string("{case ");
+          prints("{case ");
           print_int(n); 
           print_char('}');
           end_diagnostic(false);
@@ -1444,11 +1343,11 @@ void conditional (void)
         {
           pass_text();
 
-          if (cond_ptr == savecondptr)
+          if (cond_ptr == save_cond_ptr)
             if (cur_chr == or_code)
               decr(n);
             else 
-              goto lab50;
+              goto common_ending;
           else if (cur_chr == fi_code)
           {
             p = cond_ptr;
@@ -1460,7 +1359,7 @@ void conditional (void)
           }
         }
 
-        change_if_limit(or_code, savecondptr);
+        change_if_limit(or_code, save_cond_ptr);
         return;
       }
       break;
@@ -1471,16 +1370,16 @@ void conditional (void)
     begin_diagnostic();
 
     if (b)
-      print_string("{true}");
+      prints("{true}");
     else
-      print_string("{false}");
+      prints("{false}");
 
     end_diagnostic(false);
   }
 
-  if (b)     /* b may be used without ... */
+  if (b)
   {
-    change_if_limit(else_code, savecondptr);
+    change_if_limit(else_code, save_cond_ptr);
     return;
   }
 
@@ -1488,10 +1387,10 @@ void conditional (void)
   {
     pass_text();
 
-    if (cond_ptr == savecondptr)
+    if (cond_ptr == save_cond_ptr)
     {
       if (cur_chr != or_code)
-        goto lab50;
+        goto common_ending;
 
       print_err("Extra ");
       print_esc("or");
@@ -1509,7 +1408,7 @@ void conditional (void)
     }
   }
 
-lab50:
+common_ending:
   if (cur_chr == fi_code)
   {
     p = cond_ptr;
@@ -1525,8 +1424,8 @@ lab50:
 /* sec 0515 */
 void begin_name (void)
 {
-  area_delimiter = 0; /* index between `file area' and `file name' */
-  ext_delimiter = 0;  /* index between `file name' and `file extension' */
+  area_delimiter = 0;
+  ext_delimiter = 0;
 }
 /* This gathers up a file name and makes a string of it */
 /* Also tries to break it into `file area' `file name' and `file extension' */
@@ -1534,7 +1433,7 @@ void begin_name (void)
 /* We assume tilde has been converted to pseudo_tilde and space to pseudo_space */
 /* returns false if it is given a space character - end of file name */
 /* sec 0516 */
-bool more_name_(ASCII_code c)
+boolean more_name_(ASCII_code c)
 {
   if (quoted_file_name == 0 && c == ' ')
     return false;
@@ -1544,139 +1443,22 @@ bool more_name_(ASCII_code c)
     return true;    /* accept ending quote, but throw away */
   }
   else
-  {
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-/*  convert pseudo tilde back to '~' 95/Sep/26 */ /* moved here 97/June/5 */
-/*  if (pseudo_tilde != 0 && c == pseudo_tilde) c = '~'; */
-/*  convert pseudo space back to ' ' 97/June/5 */ /* moved here 97/June/5 */
-/*  if (pseudo_space != 0 && c == pseudo_space) c = ' '; */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */      
+  {   
     str_room(1);
     append_char(c);
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
-//  if ((c == 47))   /* / */
-//  for DOS/Windows
-    if ((c == '/' || c == '\\' || c == ':')) /* 94/Mar/1 */
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+    //  for DOS/Windows
+    if ((c == '/' || c == '\\' || c == ':')) 
     {
       area_delimiter = cur_length;
       ext_delimiter = 0;
     } 
     else if (c == '.')
       ext_delimiter = cur_length;
-    return true;
-  }
-}
-/******************************** 2000 August 15th start ***********************/
-
-// The following code is to save string space used by TeX for filenames
-// Not really critical in a system that has dynamic memory allocation
-// And may slow it down slightly - although this linear search only
-// occurs when opening a file, which is somewhat slow inany case...
 
-// see if string from str_pool[start] to str_pool[end]
-// occurs elsewhere in string pool - returns string number
-// returns -1 if not found in string pool 2000 Aug 15
-
-int find_string (int start, int end)
-{
-  int k, nlen = end - start;
-  char *s;
-
-//  int trace_flag = 1;     // debugging only
-
-  if (trace_flag)
-  {
-    sprintf(log_line, "\nLOOKING for string (str_ptr %d nlen %d) ", str_ptr, end - start);
-    s = log_line + strlen(log_line);
-    strncpy(s, (const char *) str_pool + start, nlen);
-    strcpy(s + nlen, "");
-    show_line(log_line, 0);
-  }
-
-//  avoid problems with(cur_name == flushablestring)by going only up to str_ptr-1
-//  code in new_font (tex8.c) will take care of reuse of font name already
-  for (k = 0; k < str_ptr - 1; k++)
-  {
-    if (length(k) != nlen)
-      continue;
-
-    if (strncmp((const char *) str_pool + start, (const char *) str_pool + str_start[k], nlen) == 0)
-    {
-      if (trace_flag)
-      {
-        sprintf(log_line, "\nFOUND the string %d (%d) ", k, str_start[k+1]-str_start[k]);
-        s = log_line + strlen(log_line);
-        strncpy(s, (const char *)str_pool + start, nlen);
-        strcpy(s+nlen, "\n");
-        show_line(log_line, 0);
-      }
-      return k;     // return number of matching string
-    }
-  }
-
-  if (trace_flag)
-  {
-    sprintf(log_line, "\nNOT FOUND string ");
-    s = log_line + strlen(log_line);
-    strncpy(s, (const char*)str_pool + start, nlen);
-    strcpy(s + nlen, "\n");
-    show_line(log_line, 0);
-  }
-
-  return -1;          // no match found
-}
-
-// snip out the string from str_pool[start] to str_pool[end]
-// and move everything above it down 2000 Aug 15
-
-void remove_string (int start, int end)
-{
-  int nlen = pool_ptr - end;  // how many bytes to move down
-  char *s;
-  
-//  int trace_flag=1;   // debugging only
-//  if (end < start) show_line("\nEND < START", 1);
-//  if (pool_ptr < end) show_line("\nPOOLPTR < END", 1);
-
-  if (trace_flag)
-  {
-    int n = end - start;
-    sprintf(log_line, "\nSTRIPPING OUT %d %d ", n, nlen);
-    s = log_line + strlen(log_line);
-    strncpy(s, (const char *)str_pool + start, n);
-    strcpy(s + n, "\n");
-    show_line(log_line, 0);
+    return true;
   }
-
-  if (nlen > 0)
-    memcpy(str_pool + start, str_pool + end, nlen);
-
-  pool_ptr = start + nlen;    // poolprt - (end-start);
-}
-
-void show_string (int k)
-{
-  int nlen = length(k);
-  char *s;
-  
-  sprintf(log_line, "\nSTRING %5d (%3d) %5d--%5d ",
-      k, nlen, str_start[k], str_start[k+1]);
-  s = log_line + strlen(log_line);      
-  strncpy(s, (const char *)str_pool + str_start[k], nlen);
-  strcpy(s + nlen, "");
-  show_line(log_line, 0);
 }
 
-void show_all_strings (void)
-{
-  int k;
-
-  for (k = 0; k < str_ptr; k++)
-    show_string(k);
-}
-
-/********************************** 2000 August 15 end ****************************/
 /* sec 0517 */
 void end_name (void) 
 {
@@ -1686,77 +1468,37 @@ void end_name (void)
 
   if (str_ptr + 3 > current_max_strings)
   {
-    overflow("number of strings", current_max_strings - init_str_ptr);  /* 97/Mar/7 */
-    return;     // abort_flag set
+    overflow("number of strings", current_max_strings - init_str_ptr);
+    return;
   }
 #else
   if (str_ptr + 3 > max_strings)
   {
-    overflow("number of strings", max_strings - init_str_ptr); /* number of strings */
-    return;     // abort_flag set
+    overflow("number of strings", max_strings - init_str_ptr);
+    return;
   }
 #endif
 
-//  if (notfirst++ == 0) show_all_strings();  // debugging only
-  
   if (area_delimiter == 0)   // no area delimiter ':' '/' or '\' found
     cur_area = 335;     // "" default area 
   else
   {
-    if (save_strings_flag && (cur_area = find_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter)) > 0)
-    {
-      remove_string(str_start[str_ptr], str_start[str_ptr] + area_delimiter);
-      area_delimiter = 0; // area_delimiter - area_delimiter;
-
-      if (ext_delimiter != 0)
-        ext_delimiter = ext_delimiter - area_delimiter;
-
-//      str_start[str_ptr + 1]= str_start[str_ptr]+ area_delimiter; // test only
-//      incr(str_ptr);    // test only
-    }
-    else         // carve out string for "cur_area"
-    {
-      cur_area = str_ptr; 
-      str_start[str_ptr + 1] = str_start[str_ptr] + area_delimiter; 
-      incr(str_ptr);
-    }
+    cur_area = str_ptr;
+    str_start[str_ptr + 1] = str_start[str_ptr] + area_delimiter;
+    incr(str_ptr);
   }
 
   if (ext_delimiter == 0) // no extension delimiter '.' found
   {
     cur_ext = 335;        // "" default extension 
-
-    if (save_strings_flag && (cur_name = find_string(str_start[str_ptr], pool_ptr)) > 0)
-    {
-      remove_string(str_start[str_ptr], pool_ptr);
-//    (void) make_string();  // test only
-    }
-    else            // Make string from str_start[str_ptr]to pool_ptr
-      cur_name = make_string();
+    cur_name = make_string();
   } 
   else            // did find an extension
   {
-    if (save_strings_flag &&
-      (cur_name = find_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter-1)) > 0)
-    {
-      remove_string(str_start[str_ptr], str_start[str_ptr] + ext_delimiter - area_delimiter - 1);
-//    str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1;   // test only
-//    incr(str_ptr);    // test only
-    }
-    else             // carve out string for "cur_name"
-    {
-      cur_name = str_ptr;
-      str_start[str_ptr + 1]= str_start[str_ptr]+ ext_delimiter - area_delimiter - 1;
-      incr(str_ptr);
-    }
-
-    if (save_strings_flag && (cur_ext = find_string(str_start[str_ptr], pool_ptr)) > 0)
-    {
-      remove_string(str_start[str_ptr], pool_ptr);
-//    (void) make_string();  // test only
-    }
-    else            // Make string from str_start[str_ptr]to pool_ptr
-      cur_ext = make_string();
+    cur_name = str_ptr;
+    str_start[str_ptr + 1] = str_start[str_ptr] + ext_delimiter - area_delimiter - 1;
+    incr(str_ptr);
+    cur_ext = make_string();
   }
 }
 
@@ -1776,7 +1518,7 @@ void pack_file_name_(str_number n, str_number a, str_number e)
     c = str_pool[j];
     incr(k);
 
-    if (k <= PATHMAX)
+    if (k <= file_name_size)
       name_of_file[k] = xchr[c];
   }
 
@@ -1785,7 +1527,7 @@ void pack_file_name_(str_number n, str_number a, str_number e)
     c = str_pool[j];
     incr(k);
 
-    if (k <= PATHMAX)
+    if (k <= file_name_size)
       name_of_file[k] = xchr[c];
   }
 
@@ -1794,27 +1536,27 @@ void pack_file_name_(str_number n, str_number a, str_number e)
     c = str_pool[j];
     incr(k);
 
-    if (k <= PATHMAX)
+    if (k <= file_name_size)
       name_of_file[k] = xchr[c];
   }
 
-  if (k < PATHMAX)
+  if (k < file_name_size)
     name_length = k;
   else
-    name_length = PATHMAX - 1;
+    name_length = file_name_size - 1;
 
 /*  pad it out with spaces ... what for ? in case we modify and forget  ? */
-  for (k = name_length + 1; k <= PATHMAX; k++)
+  for (k = name_length + 1; k <= file_name_size; k++)
     name_of_file[k] = ' ';
 
-  name_of_file[PATHMAX] = '\0';    /* paranoia 94/Mar/24 */
+  name_of_file[file_name_size] = '\0';    /* paranoia 94/Mar/24 */
 
   {
     name_of_file [name_length+1] = '\0';
 
     if (trace_flag)
     {
-      sprintf(log_line, " pack_file_name `%s' (%d) ", name_of_file + 1, name_length); /* debugging */
+      sprintf(log_line, " pack_file_name `%s' (%lld) ", name_of_file + 1, name_length); /* debugging */
       show_line(log_line, 0);
     }
 
@@ -1831,8 +1573,8 @@ void pack_buffered_name_(small_number n, integer a, integer b)
   ASCII_code c;
   integer j;
 
-  if (n + b - a + 5 > PATHMAX)
-    b = a + PATHMAX - n - 5;
+  if (n + b - a + 5 > file_name_size)
+    b = a + file_name_size - n - 5;
 
   k = 0;
 
@@ -1842,7 +1584,7 @@ void pack_buffered_name_(small_number n, integer a, integer b)
     c = xord[TEX_format_default[j]];
     incr(k);
 
-    if (k <= PATHMAX)
+    if (k <= file_name_size)
       name_of_file[k] = xchr[c];
   }
 /*  This loop kicks in when we want a specififed format name */
@@ -1851,7 +1593,7 @@ void pack_buffered_name_(small_number n, integer a, integer b)
     c = buffer[j];
     incr(k);
 
-    if (k <= PATHMAX)
+    if (k <= file_name_size)
       name_of_file[k] = xchr[c];
   }
 
@@ -1861,20 +1603,20 @@ void pack_buffered_name_(small_number n, integer a, integer b)
     c = xord[TEX_format_default[j]];
     incr(k);
 
-    if (k <= PATHMAX)
+    if (k <= file_name_size)
       name_of_file[k] = xchr[c];
   }
 
-  if (k < PATHMAX)
+  if (k < file_name_size)
     name_length = k;
   else
-    name_length = PATHMAX - 1;
+    name_length = file_name_size - 1;
 
  /*  pad it out with spaces ... what for ? */
-  for (k = name_length + 1; k <= PATHMAX; k++)
+  for (k = name_length + 1; k <= file_name_size; k++)
     name_of_file[k]= ' ';
 
-  name_of_file[PATHMAX] = '\0';    /* paranoia 94/Mar/24 */
+  name_of_file[file_name_size] = '\0';    /* paranoia 94/Mar/24 */
 }
 /* sec 0525 */
 str_number make_name_string (void)
@@ -1904,17 +1646,20 @@ str_number make_name_string (void)
   }
 }
 /* sec 0525 */
-str_number a_make_name_string_(alpha_file * f)
+//str_number a_make_name_string_(alpha_file * f)
+str_number a_make_name_string_(void)
 {
   return make_name_string();
 }
 /* sec 0525 */
-str_number b_make_name_string_(byte_file * f)
+//str_number b_make_name_string_(byte_file * f)
+str_number b_make_name_string_(void)
 {
   return make_name_string(); 
 }
 /* sec 0525 */
-str_number w_make_name_string_(word_file * f)
+//str_number w_make_name_string_(word_file * f)
+str_number w_make_name_string_(void)
 {
   return make_name_string();
 }
@@ -1939,7 +1684,7 @@ void scan_file_name (void)
   {
     if (cur_chr == '"')
     {
-      quoted_file_name = 1;
+      quoted_file_name = true;
       get_x_token();
     }
   }
@@ -1949,16 +1694,16 @@ void scan_file_name (void)
     if ((cur_cmd > other_char) || (cur_chr > 255)) 
     {
       back_input();
-      goto lab30
+      goto done
     } 
 
     if (!more_name(cur_chr))    /* up to next white space */
-      goto lab30;
+      goto done;
 
     get_x_token();
   }
 
-lab30:
+done:
   end_name();
   name_in_progress = false;
 }
@@ -1971,57 +1716,14 @@ void pack_job_name_(str_number s)
   cur_name = job_name;
   pack_file_name(cur_name, cur_area, cur_ext);
 }
-
-/**********************************************************************/
-/* show TEXINPUTS=... or format specific  */
-/* only show this if name was not fully qualified ? */
-void show_tex_inputs (void)
-{
-  char *s, *t, *v;
-
-  s = "TEXINPUTS";        /* default */
-
-  if (format_specific)
-  {
-    s = format_name;                /* try specific */
-
-    if (grabenv(s) == NULL)
-      s = "TEXINPUTS";  /* no format specific */
-  }
-
-  if (grabenv(s) == NULL)
-    s = "TEXINPUT";     /* 94/May/19 */
-
-  print_nl("  ");
-  print_char(' ');
-  print_char('(');
-  t = s;
-
-  while (*t > '\0')
-    print_char(*t++);
-
-  print_char('=');
-  v = grabenv(s);
-
-  if (v != NULL)
-  {
-    t = v;
-
-    while (*t > '\0')
-      print_char(*t++);
-  }
-
-  print_char(')');
-}
-
-/**********************************************************************/
 /* sec 0530 */
 /* s - what can't be found, e - default */
 void prompt_file_name_(char * s, str_number e) 
 {
   integer k;
 
-  if (interaction == scroll_mode);
+  if (interaction == scroll_mode)
+    do_nothing();
 
   if (!strcmp("input file name", s))
     print_err("I can't find file `");
@@ -2029,27 +1731,18 @@ void prompt_file_name_(char * s, str_number e)
     print_err("I can't write on file `");
 
   print_file_name(cur_name, cur_area, cur_ext);
-  print_string("'.");
-
-  if (!strcmp("input file name", s))
-  {
-    if (cur_area == 335) /* "" only if path not specified */
-    {
-      if (show_texinput_flag)
-        show_tex_inputs();
-    }
-  }
+  prints("'.");
 
   if (e == 785)    /* .tex */
     show_context();
 
   print_nl("Please type another ");
-  print_string(s); 
+  prints(s); 
 
   if (interaction < 2)
   {
     fatal_error("*** (job aborted, file error in nonstop mode)");
-    return;     // abort_flag set
+    return;
   }
 
   if (!knuth_flag)
@@ -2058,10 +1751,9 @@ void prompt_file_name_(char * s, str_number e)
 #else
     show_line(" (or Ctrl-Z to exit)", 0);
 #endif
-  {
-    print_string(": ");
-    term_input(": ", 0);
-  }
+
+  prompt_input(": ");
+
 /*  should we deal with tilde and space in file name here ??? */
   {
     begin_name();
@@ -2084,7 +1776,7 @@ void prompt_file_name_(char * s, str_number e)
     while (true)
     {
       if (k == last)
-        goto lab30;
+        goto done;
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
 /*  convert tilde '~' to pseudo tilde */
       if (pseudo_tilde != 0 && buffer[k]== '~')
@@ -2094,11 +1786,11 @@ void prompt_file_name_(char * s, str_number e)
         buffer[k] = pseudo_space;
 /* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
       if (!more_name(buffer[k]))
-        goto lab30;
+        goto done;
 
       incr(k);
     }
-lab30:
+done:
     end_name();
   }
 
@@ -2143,13 +1835,12 @@ void open_log_file (void)
       (void) fputs(log_line, log_file);
     }
     
-    (void) fputs(tex_version, log_file); 
-    (void) fprintf(log_file, " (%s %s)", application, yandyversion);
+    fprintf(log_file, "%s (%s %s)", tex_version, application, yandyversion);
 
     if (format_ident > 0)
       slow_print(format_ident);
 
-    print_string("  ");
+    prints("  ");
 
     if (civilize_flag)
       print_int(year);
@@ -2160,7 +1851,7 @@ void open_log_file (void)
     months = " JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC";
 
     for (k = 3 * month - 2; k <= 3 * month; k++)
-      (void) putc(months[k],  log_file);
+      putc(months[k],  log_file);
 
     print_char(' ');
 
@@ -2200,7 +1891,6 @@ void open_log_file (void)
   selector = old_setting + 2;
 }
 
-/**************************** start of insertion 98/Feb/7 **************/
 // Attempt to deal with foo.bar.tex given as foo.bar on command line
 // Makes copy of job_name with extension
 
@@ -2248,83 +1938,33 @@ int end_name_copy(void)
 
   return make_string();
 }
-
-void job_name_append (void)
-{ 
-  int k, n;
-
-  k = str_start[job_name];
-  n = str_start[job_name + 1];
-
-  while (k < n)
-    more_name_copy(str_pool[k++]);
-
-  k = str_start[cur_ext];
-  n = str_start[cur_ext + 1];
-
-  while (k < n)
-    more_name_copy(str_pool[k++]);
-
-  job_name = end_name_copy();
-}
-
-/**************************** end of insertion 98/Feb/7 **************/
 /* sec 0537 */
 void start_input(void)
 {
-  bool added_extension = false;
-
   scan_file_name();
   pack_file_name(cur_name, cur_area, cur_ext); 
 
   while (true)
   {
-    added_extension = false;
-    begin_file_reading(); 
-
-    if ((cur_ext != 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
-      goto lab30;
-
-    if ((cur_ext != 785) && (name_length + 5 < PATHMAX))
-    {
-      name_of_file[name_length + 1] = '.';
-      name_of_file[name_length + 2] = 't';
-      name_of_file[name_length + 3] = 'e';
-      name_of_file[name_length + 4] = 'x';
-      name_of_file[name_length + 5] = ' ';
-      name_length = name_length + 4;
-
-      added_extension = true;
-
-      if (a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
-        goto lab30;
-
-      name_length = name_length - 4;
-      name_of_file[name_length + 1] = ' ';
-      added_extension = false;
-    }
-
-    if ((cur_ext == 335) && a_open_in(input_file[cur_input.index_field], TEXINPUTPATH))
-      goto lab30;
+    begin_file_reading();
+    
+    if (a_open_in(cur_file, TEXINPUTPATH))
+      goto done;
 
     end_file_reading();
     prompt_file_name("input file name", ".tex");
   }
 
-lab30
-  cur_input.name_field = a_make_name_string(input_file[cur_input.index_field]);
+done
+  name = a_make_name_string(cur_file);
 
   if (job_name == 0)
   {
     job_name = cur_name;
-
-    if (cur_ext != 335 && added_extension)
-      job_name_append();
-
     open_log_file();
   }
 
-  if (term_offset + length(cur_input.name_field) > max_print_line - 2)
+  if (term_offset + length(name) > max_print_line - 2)
     print_ln();
   else if ((term_offset > 0) || (file_offset > 0))
     print_char(' ');
@@ -2335,224 +1975,103 @@ lab30:
   if (open_parens > max_open_parens)
     max_open_parens = open_parens;
 
-  slow_print(cur_input.name_field);
-
-#ifndef _WINDOWS
-  fflush(stdout);
-#endif
-
-  cur_input.state_field = new_line;
+  slow_print(name);
+  update_terminal();
+  state = new_line;
 
   {
     line = 1;
 
-    if (input_ln(input_file[cur_input.index_field], false));
+    if (input_ln(cur_file, false))
+      do_nothing();
 
     firm_up_the_line();
 
-    if ((end_line_char < 0) || (end_line_char > 255))
-      decr(cur_input.limit_field);
+    if (end_line_char_inactive())
+      decr(limit);
     else
-      buffer[cur_input.limit_field] = end_line_char;
+      buffer[limit] = end_line_char;
 
-    first = cur_input.limit_field + 1;
-    cur_input.loc_field = cur_input.start_field;
+    first = limit + 1;
+    loc = start;
   }
 }
-
-/**********************************************************************/
-/* show TEXFONTS=... or format specific  */
-/* only show this if name was not fully qualified ? */
-void show_tex_fonts (void)
-{
-  char *s, *t, *v, *u;
-  int n;
-
-  s = "TEXFONTS";
-
-  if (encoding_specific)
-  {
-    u = encoding_name;                /* try specific */
-
-    if ((t = grabenv(u)) != NULL)
-    {
-      if (strchr(t, ':') != NULL && sscanf(t, "%d", &n) == 0)
-      {
-        s = u;        /* look here instead of TEXFONTS=... */
-      }
-    }
-  }
-
-  print_nl("  ");
-  print_char(' ');
-  print_char('(');
-  t = s;
-
-  while (*t > '\0')
-    print_char(*t++);
-
-  print_char('=');
-  v = grabenv(s);
-
-  if (v != NULL)
-  {
-    t = v;
-
-    while (*t > '\0')
-      print_char(*t++);
-  }
-
-  print_char(')');
-}
 /* sec 0560 */
 internal_font_number read_font_info_(halfword u, str_number nom, str_number aire, scaled s)
 {
   font_index k;
-  bool fileopened;
-/*  halfword lf, lh, bc, ec, nw, nh, nd, ni, nl, nk, ne, np;  */
+  boolean file_opened;
   halfword lf, lh, nw, nh, nd, ni, nl, nk, ne, np;
-/*  halfword bc, ec; */
-  int bc, ec;             /* 95/Jan/7 */
+  int bc, ec;
   internal_font_number f;
   internal_font_number g;
   eight_bits a, b, c, d;
-  ffour_quarters qw;
+  four_quarters qw;
   scaled sw;
-  integer bchlabel;
+  integer bch_label;
   short bchar;
   scaled z;
   integer alpha;
   char beta;
 
   g = 0;
-  fileopened = false;
+  file_opened = false;
   pack_file_name(nom, aire, 805); /* .tfm */
 
-  if (!b_open_in(tfm_file)) /* new in C version d */
-  {
-    goto lab11;
-  } 
-/*   was just: goto lab11; */
-  fileopened = true; 
+  if (!b_open_in(tfm_file))
+    goto bad_tfm;
+
+  file_opened = true;
+
   {
-/*  tfm_temp = getc(tfm_file);  */ /* done already in open_input, but why? */
-    //tfm_temp = getc(tfm_file);
-    {
-      lf = tfm_temp;
-      if (lf > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      lf = lf * 256 + tfm_temp;
-    }
+    read_sixteen(lf);
     tfm_temp = getc(tfm_file);
-    {
-      lh = tfm_temp;
-      if (lh > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      lh = lh * 256 + tfm_temp;
-    }
+    read_sixteen(lh);
     tfm_temp = getc(tfm_file);
-    {
-      bc = tfm_temp;
-      if (bc > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      bc = bc * 256 + tfm_temp;
-    }
+    read_sixteen(bc);
     tfm_temp = getc(tfm_file);
-    {
-      ec = tfm_temp;
-      if (ec > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      ec = ec * 256 + tfm_temp;
-    }
-    if ((bc > ec + 1)||(ec > 255))
-      goto lab11;
+    read_sixteen(ec);
+
+    if ((bc > ec + 1) || (ec > 255))
+      goto bad_tfm;
+
     if (bc > 255)
     {
       bc = 1;
       ec = 0;
     }
+
     tfm_temp = getc(tfm_file);
-    {
-      nw = tfm_temp;
-      if (nw > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      nw = nw * 256 + tfm_temp;
-    }
+    read_sixteen(nw);
     tfm_temp = getc(tfm_file);
-    {
-      nh = tfm_temp;
-      if (nh > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      nh = nh * 256 + tfm_temp;
-    }
+    read_sixteen(nh);
     tfm_temp = getc(tfm_file);
-    {
-      nd = tfm_temp;
-      if (nd > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      nd = nd * 256 + tfm_temp;
-    }
+    read_sixteen(nd);
     tfm_temp = getc(tfm_file);
-    {
-      ni = tfm_temp;
-      if (ni > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      ni = ni * 256 + tfm_temp;
-    }
+    read_sixteen(ni);
     tfm_temp = getc(tfm_file);
-    {
-      nl = tfm_temp;
-      if (nl > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      nl = nl * 256 + tfm_temp;
-    }
+    read_sixteen(nl);
     tfm_temp = getc(tfm_file);
-    {
-      nk = tfm_temp;
-      if (nk > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      nk = nk * 256 + tfm_temp;
-    }
+    read_sixteen(nk);
     tfm_temp = getc(tfm_file);
-    {
-      ne = tfm_temp;
-      if (ne > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      ne = ne * 256 + tfm_temp;
-    }
+    read_sixteen(ne);
     tfm_temp = getc(tfm_file);
-    {
-      np = tfm_temp;
-      if (np > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      np = np * 256 + tfm_temp;
-    }
+    read_sixteen(np);
+
     if (lf != 6 + lh + (ec - bc + 1) + nw + nh + nd + ni + nl + nk + ne + np)
-      goto lab11;
+      goto bad_tfm;
 
     if ((nw == 0) || (nh == 0) || (nd == 0) || (ni == 0))
-      goto lab11;
+      goto bad_tfm;
   }
 
   lf = lf - 6 - lh;
 
   if (np < 7)
     lf = lf + 7 - np;
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
+
 #ifdef ALLOCATEFONT
-  if ((fmem_ptr + lf > current_font_mem_size))   /* 93/Nov/28 */
+  if ((fmem_ptr + lf > current_font_mem_size))
     font_info = realloc_font_info (increment_font_mem_size + lf);
 
   if ((font_ptr == font_max) || (fmem_ptr + lf > current_font_mem_size))
@@ -2562,8 +2081,8 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
   {
     if (trace_flag)
     {
-      sprintf(log_line, "font_ptr %d font_max %d fmem_ptr %d lf %d font_mem_size %d\n",
-          font_ptr, font_max, fmem_ptr, lf, font_mem_size); /* debugging */
+      sprintf(log_line, "font_ptr %lld font_max %d fmem_ptr %lld lf %ld font_mem_size %ld\n",
+          font_ptr, font_max, fmem_ptr, lf, font_mem_size);
       show_line(log_line, 0);
     }
 
@@ -2574,23 +2093,23 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
 
     if (s >= 0)
     {
-      print_string(" at ");
+      prints(" at ");
       print_scaled(s);
-      print_string("pt");
+      prints("pt");
     }
     else if (s != -1000)
     {
-      print_string(" scaled ");
+      prints(" scaled ");
       print_int(- (integer) s);
     }
 
-    print_string(" not loaded: Not enough room left");
+    prints(" not loaded: Not enough room left");
     help4("I'm afraid I won't be able to make use of this font,",
         "because my memory for character-size data is too small.",
         "If you're really stuck, ask a wizard to enlarge me.",
         "Or maybe try `I\\font<same font id>=<name of loaded font>'.");
     error();
-    goto lab30;
+    goto done;
   }
 
   f = font_ptr + 1;
@@ -2606,40 +2125,18 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
 
   {
     if (lh < 2)
-      goto lab11;
-/*  build the font checksum now */
-    {
-      tfm_temp = getc(tfm_file);
-      a = tfm_temp;
-      qw.b0 = a;
-      tfm_temp = getc(tfm_file);
-      b = tfm_temp;
-      qw.b1 = b;
-      tfm_temp = getc(tfm_file);
-      c = tfm_temp;
-      qw.b2 = c;
-      tfm_temp = getc(tfm_file);
-      d = tfm_temp;
-      qw.b3 = d;
-      font_check[f] = qw;
-    }
-
+      goto bad_tfm;
+    
+    store_four_quarters(font_check[f]);
     tfm_temp = getc(tfm_file);
-    {
-      z = tfm_temp;
-      if (z > 127)
-        goto lab11;
-      tfm_temp = getc(tfm_file);
-      z = z * 256 + tfm_temp;
-    }
-
+    read_sixteen(z);
     tfm_temp = getc(tfm_file);
     z = z * 256 + tfm_temp;
     tfm_temp = getc(tfm_file);
     z =(z * 16) + (tfm_temp / 16);
 
-    if (z < 65536L)
-      goto lab11
+    if (z < unity)
+      goto bad_tfm
 
     while (lh > 2)
     {
@@ -2663,57 +2160,43 @@ internal_font_number read_font_info_(halfword u, str_number nom, str_number aire
 
   for (k = fmem_ptr; k <= width_base[f] - 1; k++)
   {
-    {
-      tfm_temp = getc(tfm_file);
-      a = tfm_temp;
-      qw.b0 = a;
-      tfm_temp = getc(tfm_file);
-      b = tfm_temp;
-      qw.b1 = b;
-      tfm_temp = getc(tfm_file);
-      c = tfm_temp;
-      qw.b2 = c;
-      tfm_temp = getc(tfm_file);
-      d = tfm_temp;
-      qw.b3 = d;
-      font_info[k].qqqq = qw;
-    }
+    store_four_quarters(font_info[k].qqqq);
 
     if ((a >= nw) || (b / 16 >= nh) || (b % 16 >= nd) || (c / 4 >= ni))
-      goto lab11;
+      goto bad_tfm;
 
     switch (c % 4)
     {
-      case :
+      case lig_tag:
         if (d >= nl)
-          goto lab11;
+          goto bad_tfm;
         break;
 
-      case :
+      case ext_tag:
         if (d >= ne)
-          goto lab11;
+          goto bad_tfm;
         break;
 
-      case :
+      case list_tag:
         {
           {
-            if ((d < bc)||(d > ec))
-              goto lab11;
+            if ((d < bc) || (d > ec))
+              goto bad_tfm;
           }
 
           while (d < k + bc - fmem_ptr)
           {
-            qw = font_info[char_base[f]+ d].qqqq;
+            qw = char_info(f, d);
  
-            if (((qw.b2)% 4)!= 2)
-              goto lab45;
+            if (char_tag(qw) != list_tag)
+              goto not_found;
 
-            d = qw.b3;
+            d = rem_byte(qw);
           }
 
           if (d == k + bc - fmem_ptr)
-            goto lab11;
-lab45:; 
+            goto bad_tfm;
+not_found:; 
         }
         break;
 
@@ -2721,6 +2204,7 @@ lab45:;
         break;
     }
   }
+
   {
     {
       alpha = 16;
@@ -2752,49 +2236,35 @@ lab45:;
       else if (a == 255)
         font_info[k].cint = sw - alpha;
       else
-        goto lab11;
+        goto bad_tfm;
     }
 
     if (font_info[width_base[f]].cint != 0)
-      goto lab11;
+      goto bad_tfm;
 
     if (font_info[height_base[f]].cint != 0)
-      goto lab11;
+      goto bad_tfm;
 
     if (font_info[depth_base[f]].cint != 0)
-      goto lab11;
+      goto bad_tfm;
 
     if (font_info[italic_base[f]].cint != 0)
-      goto lab11;
+      goto bad_tfm;
   }
-/*  read ligature/kern program */
-  bchlabel = 32767;     /* '77777 */
+
+  bch_label = 32767;     /* '77777 */
   bchar = 256;
 
   if (nl > 0)
   {
     for (k = lig_kern_base[f]; k <= kern_base[f] + 256 * (128) - 1; k++)
     {
-      {
-        tfm_temp = getc(tfm_file);
-        a = tfm_temp;
-        qw.b0 = a;
-        tfm_temp = getc(tfm_file);
-        b = tfm_temp;
-        qw.b1 = b;
-        tfm_temp = getc(tfm_file);
-        c = tfm_temp;
-        qw.b2 = c;
-        tfm_temp = getc(tfm_file);
-        d = tfm_temp;
-        qw.b3 = d;
-        font_info[k].qqqq = qw; /* store_four_quarters(font_info[k].qqqq */
-      }
+      store_four_quarters(font_info[k].qqqq);
 
       if (a > 128)
       {
         if (256 * c + d >= nl)
-          goto lab11;       /* error in TFM, abort */
+          goto bad_tfm;
 
         if (a == 255)
           if (k == lig_kern_base[f])
@@ -2803,40 +2273,21 @@ lab45:;
       else
       {
         if (b != bchar)
-        {
-          {
-            if ((b < bc) || (b > ec))  /* check-existence(b) */
-              goto lab11;         /* error in TFM, abort */
-          }
-
-          qw = font_info[char_base[f] + b].qqqq;
-
-          if (!(qw.b0 > 0))
-            goto lab11;         /* error in TFM, abort */
-        }
+          check_existence(b);
 
         if (c < 128)
-        {
-          {
-            if ((d < bc) || (d > ec))  /* check-existence(d) */
-              goto lab11;         /* error in TFM, abort */
-          }
-
-          qw = font_info[char_base[f] + d].qqqq;
-
-          if (!(qw.b0 > 0))
-            goto lab11;         /* error in TFM, abort */
-        }
+          check_existence(d);
         else if (256 * (c - 128) + d >= nk)
-          goto lab11;           /* error in TFM, abort */
+          goto bad_tfm;
+
         if (a < 128)
           if (k - lig_kern_base[f] + a + 1 >= nl)
-            goto lab11;         /* error in TFM, abort */
+            goto bad_tfm;
       }
     }
 
     if (a == 255)
-      bchlabel = 256 * c + d;
+      bch_label = 256 * c + d;
   }
 
   for (k = kern_base[f] + 256 * (128); k <= exten_base[f] - 1; k++)
@@ -2855,79 +2306,26 @@ lab45:;
       font_info[k].cint = sw;
     else if (a == 255)
       font_info[k].cint = sw - alpha;
-    else goto lab11;
+    else
+      goto bad_tfm;
   }
-/*  read extensible character recipes */
-/*  for k:=exten_base[f] to param_base[f]-1 do */
+
   for (k = exten_base[f]; k <= param_base[f] - 1; k++)
   {
-    {
-      tfm_temp = getc(tfm_file);
-      a = tfm_temp;
-      qw.b0 = a;
-      tfm_temp = getc(tfm_file);
-      b = tfm_temp;
-      qw.b1 = b;
-      tfm_temp = getc(tfm_file);
-      c = tfm_temp;
-      qw.b2 = c;
-      tfm_temp = getc(tfm_file);
-      d = tfm_temp;
-      qw.b3 = d;
-/*    store_four_quarters(font_info[k].qqqq); */
-      font_info[k].qqqq = qw;
-    }
+    store_four_quarters(font_info[k].qqqq);
 
     if (a != 0)
-    {
-      {
-        if ((a < bc) || (a > ec))
-          goto lab11;
-      }
-
-      qw = font_info[char_base[f] + a].qqqq;
-
-      if (!(qw.b0 > 0))
-        goto lab11;
-    }
+      check_existence(a);
 
     if (b != 0)
-    {
-      {
-        if ((b < bc) || (b > ec))
-          goto lab11;
-      }
-
-      qw = font_info[char_base[f] + b].qqqq;
-
-      if (!(qw.b0 > 0))
-        goto lab11;
-    }
+      check_existence(b);
 
     if (c != 0)
-    {
-      {
-        if ((c < bc) || (c > ec))
-          goto lab11;
-      }
-
-      qw = font_info[char_base[f] + c].qqqq;
+      check_existence(c);
 
-      if (!(qw.b0 > 0))
-        goto lab11;
-    }
-    {
-      {
-        if ((d < bc) || (d > ec))
-          goto lab11;
-      }
-
-      qw = font_info[char_base[f] + d].qqqq;
-
-      if (!(qw.b0 > 0))
-        goto lab11;
-    }
+    check_existence(d);
   }
+
   {
     for (k = 1; k <= np; k++)
       if (k == 1)
@@ -2961,11 +2359,11 @@ lab45:;
           font_info[param_base[f] + k - 1].cint = sw;
         else if (a == 255)
           font_info[param_base[f] + k - 1].cint = sw - alpha;
-        else goto lab11;
+        else goto bad_tfm;
       }
 
     if (feof(tfm_file))
-      goto lab11;
+      goto bad_tfm;
 
     for (k = np + 1; k <= 7; k++)
       font_info[param_base[f] + k - 1].cint = 0;
@@ -2979,8 +2377,8 @@ lab45:;
   hyphen_char[f] = default_hyphen_char;
   skew_char[f] = default_skew_char;
 
-  if (bchlabel < nl)
-    bchar_label[f] = bchlabel + lig_kern_base[f];
+  if (bch_label < nl)
+    bchar_label[f] = bch_label + lig_kern_base[f];
   else
     bchar_label[f] = non_address;
 
@@ -3010,9 +2408,9 @@ lab45:;
   fmem_ptr = fmem_ptr + lf;
   font_ptr = f;
   g = f;
-  goto lab30;
+  goto done;
 
-lab11:
+bad_tfm:
   print_err("Font ");
   sprint_cs(u); 
   print_char('=');
@@ -3020,26 +2418,20 @@ lab11:
 
   if (s >= 0)
   {
-    print_string(" at ");
+    prints(" at ");
     print_scaled(s);
-    print_string("pt");
+    prints("pt");
   }
   else if (s != -1000)
   {
-    print_string("scaled");
-    print_int(- (integer) s);
+    prints("scaled");
+    print_int(-(integer)s);
   } 
 
-  if (fileopened)
-    print_string(" not loadable: Bad metric (TFM) file");
+  if (file_opened)
+    prints(" not loadable: Bad metric (TFM) file");
   else
-    print_string(" not loadable: Metric (TFM) file not found");
-
-  if (aire == 335)
-  {
-    if (show_texinput_flag)
-      show_tex_fonts();
-  }
+    prints(" not loadable: Metric (TFM) file not found");
 
   help5("I wasn't able to read the size data for this font,",
       "so I will ignore the font specification.",
@@ -3048,8 +2440,8 @@ lab11:
       "e.g., type `I\\font<same font id>=<substitute font name>'.");
   error();
 
-lab30:
-  if (fileopened)
+done:
+  if (file_opened)
     b_close(tfm_file);
 
   return g;