OSDN Git Service

updated all sources.
[putex/putex.git] / src / texsourc / tex5.c
index b6fdcc0..992b520 100644 (file)
 
 #define EXTERN extern
 
-#include "texd.h"
+#include "yandytex.h"
 
 /* sec 0715 */
-halfword rebox_(halfword b, scaled w)
+pointer rebox (pointer b, scaled w)
 {
-  halfword p;
+  pointer p;
   internal_font_number f;
   scaled v;
 
@@ -33,7 +33,7 @@ halfword rebox_(halfword b, scaled w)
 
     p = list_ptr(b);
 
-    if (((p >= hi_mem_min)) && (link(p) == 0))
+    if ((is_char_node(p)) && (link(p) == 0))
     {
       f = font(p);
       v = char_width(f, char_info(f, character(p)));
@@ -58,11 +58,10 @@ halfword rebox_(halfword b, scaled w)
     return b;
   }
 }
-/* This is to be the start of tex5.c */
 /* sec 0716 */
-halfword math_glue_(halfword g, scaled m)
+pointer math_glue (pointer g, scaled m)
 {
-  halfword p;
+  pointer p;
   integer n;
   scaled f;
 
@@ -76,25 +75,25 @@ halfword math_glue_(halfword g, scaled m)
   }
 
   p = get_node(glue_spec_size);
-  width(p) = mult_and_add(n, width(g), xn_over_d(width(g), f, 65536L), 1073741823L);  /* 2^30 - 1 */
+  width(p) = mu_mult(width(g));
   stretch_order(p) = stretch_order(g);
 
   if (stretch_order(p) == normal)
-    stretch(p) = mult_and_add(n, stretch(g), xn_over_d(stretch(g), f, 65536L), 1073741823L);  /* 2^30 - 1 */
+    stretch(p) = mu_mult(stretch(g));
   else
     stretch(p) = stretch(g);
 
   shrink_order(p) = shrink_order(g);
 
   if (shrink_order(p) == normal)
-    shrink(p) = mult_and_add(n, shrink(g), xn_over_d(shrink(g), f, 65536L), 1073741823L);  /* 2^30 - 1 */
+    shrink(p) = mu_mult(shrink(g));
   else
     shrink(p) = shrink(g);
 
   return p;
 }
 /* sec 0717 */
-void math_kern_ (halfword p, scaled m)
+void math_kern (pointer p, scaled m)
 {
   integer n;
   scaled f;
@@ -110,7 +109,7 @@ void math_kern_ (halfword p, scaled m)
       f = f + 65536L;
     }
 
-    width(p) = mult_and_add(n, width(p), xn_over_d(width(p), f, 65536L), 1073741823L);  /* 2^30 - 1 */
+    width(p) = mu_mult(width(p));
     subtype(p) = explicit;
   }
 }
@@ -124,14 +123,14 @@ void flush_math (void)
   incompleat_noad = 0;
 }
 /* sec 0720 */
-halfword clean_box_(halfword p, small_number s)
+pointer clean_box (pointer p, small_number s)
 {
-  halfword q;
+  pointer q;
   small_number save_style;
-  halfword x;
-  halfword r;
+  pointer x;
+  pointer r;
 
-  switch(math_type(p))
+  switch (math_type(p))
   {
     case math_char:
       {
@@ -143,7 +142,7 @@ halfword clean_box_(halfword p, small_number s)
     case sub_box:
       {
         q = info(p);
-        goto lab40;
+        goto found;
       }
       break;
 
@@ -154,7 +153,7 @@ halfword clean_box_(halfword p, small_number s)
     default:
       {
         q = new_null_box();
-        goto lab40;
+        goto found;
       }
     break;
   }
@@ -174,8 +173,9 @@ halfword clean_box_(halfword p, small_number s)
 
     cur_mu = x_over_n(math_quad(cur_size), 18);
   }
-lab40:
-  if ((q >= hi_mem_min) || (q == 0))
+
+found:
+  if (is_char_node(q) || (q == 0))
     x = hpack(q, 0, 1);
   else if ((link(q) == 0) && (type(q) <= vlist_node) && (shift_amount(q) == 0))
     x = q;
@@ -184,13 +184,13 @@ lab40:
 
   q = list_ptr(x);
 
-  if ((q >= hi_mem_min))
+  if (is_char_node(q))
   {
     r = link(q);
 
     if (r != 0)
       if (link(r) == 0)
-        if (!(r >= hi_mem_min))
+        if (!is_char_node(r))
           if (type(r) == kern_node)
           {
             free_node(r, small_node_size);
@@ -201,7 +201,7 @@ lab40:
   return x;
 }
 /* sec 0722 */
-void fetch_(halfword a)
+void fetch_(pointer a)
 {
   cur_c = character(a);
   cur_f = fam_fnt(fam(a) + cur_size);
@@ -212,7 +212,7 @@ void fetch_(halfword a)
     print_size(cur_size);
     print_char(' ');
     print_int(fam(a));
-    print_string(" is undefined (character ");
+    prints(" is undefined (character ");
     print(cur_c);
     print_char(')');
     help4("Somewhere in the math formula just ended, you used the",
@@ -230,7 +230,7 @@ void fetch_(halfword a)
     else
       cur_i = null_character;
 
-    if (!((cur_i.b0 > 0)))
+    if (!char_exists(cur_i))
     {
       char_warning(cur_f, cur_c);
       math_type(a) = 0;
@@ -238,23 +238,23 @@ void fetch_(halfword a)
   }
 }
 /* sec 0734 */
-void make_over_(halfword q)
+void make_over (pointer q)
 {
   info(nucleus(q)) = overbar(clean_box(nucleus(q), 2 * (cur_style / 2) + 1),
       3 * default_rule_thickness, default_rule_thickness);
   math_type(nucleus(q)) = sub_box;
 }
 /* sec 0735 */
-void make_under_(halfword q)
+void make_under (pointer q)
 {
-  halfword p, x, y;
+  pointer p, x, y;
   scaled delta;
 
   x = clean_box(nucleus(q), cur_style);
   p = new_kern(3 * default_rule_thickness);
   link(x) = p;
   link(p) = fraction_rule(default_rule_thickness);
-  y = vpackage(x, 0, 1, 1073741823L); /* 2^30 - 1 */
+  y = vpackage(x, 0, 1, max_dimen);
   delta = height(y) + depth(y) + default_rule_thickness;
   height(y) = height(x);
   depth(y) = delta - height(y);
@@ -262,9 +262,9 @@ void make_under_(halfword q)
   math_type(nucleus(q)) = sub_box;
 }
 /* sec 0736 */
-void make_vcenter_(halfword q)
+void make_vcenter (pointer q)
 { 
-  halfword v;
+  pointer v;
   scaled delta;
 
   v = info(nucleus(q));
@@ -272,7 +272,7 @@ void make_vcenter_(halfword q)
   if (type(v) != vlist_node)
   {
     confusion("vcenter");
-    return;         // abort_flag set
+    return;
   }
 
   delta = height(v) + depth(v);
@@ -280,9 +280,9 @@ void make_vcenter_(halfword q)
   depth(v) = delta - height(v);
 }
 /* sec 0737 */
-void make_radical_(halfword q)
+void make_radical (pointer q)
 {
-  halfword x, y;
+  pointer x, y;
   scaled delta, clr;
 
   x = clean_box(nucleus(q), 2 * (cur_style / 2) + 1);
@@ -307,9 +307,9 @@ void make_radical_(halfword q)
   math_type(nucleus(q)) = sub_box;
 }
 /* sec 0738 */
-void make_math_accent_(halfword q)
+void make_math_accent (pointer q)
 {
-  halfword p, x, y;
+  pointer p, x, y;
   integer a;
   quarterword c;
   internal_font_number f;
@@ -321,7 +321,7 @@ void make_math_accent_(halfword q)
 
   fetch(accent_chr(q));
 
-  if ((cur_i.b0 > 0))
+  if (char_exists(cur_i))
   {
     i = cur_i;
     c = cur_c;
@@ -350,18 +350,20 @@ void make_math_accent_(halfword q)
             if (op_byte(cur_i) >= kern_flag)
               if (skip_byte(cur_i) <= stop_flag)
                 s = char_kern(cur_f, cur_i);
-            goto lab31;
+
+            goto done1;
           }
 
           if (skip_byte(cur_i) >= stop_flag)
-            goto lab31;
+            goto done1;
 
           a = a + skip_byte(cur_i) + 1;
           cur_i = font_info[a].qqqq;
         }
       }
     }
-lab31:;
+
+done1:
     x = clean_box(nucleus(q), cramped_style(cur_style));
     w = width(x);
     h = height(x);
@@ -369,20 +371,21 @@ lab31:;
     while (true)
     {
       if (char_tag(i) != list_tag)
-        goto lab30;
+        goto done;
 
       y = rem_byte(i);
       i = char_info(f, y);
 
-      if (!(i.b0 > 0))
-        goto lab30;
+      if (!char_exists(i))
+        goto done;
 
       if (char_width(f, i) > w)
-        goto lab30;
+        goto done;
 
       c = y;
     }
-lab30:;
+
+done:
     if (h < x_height(f))
       delta = h;
     else
@@ -393,9 +396,9 @@ lab30:;
       {
         flush_node_list(x);
         x = new_noad();
-        mem[nucleus(x)]= mem[nucleus(q)];
-        mem[supscr(x)]= mem[supscr(q)];
-        mem[subscr(x)]= mem[subscr(q)];
+        mem[nucleus(x)] = mem[nucleus(q)];
+        mem[supscr(x)] = mem[supscr(q)];
+        mem[subscr(x)] = mem[subscr(q)];
         mem[supscr(q)].hh = empty_field;
         mem[subscr(q)].hh = empty_field;
         math_type(nucleus(q)) = sub_mlist;
@@ -408,10 +411,10 @@ lab30:;
     y = char_box(f, c);
     shift_amount(y) = s + half(w - width(y));
     width(y) = 0;
-    p = new_kern(- (integer) delta);
+    p = new_kern(-(integer) delta);
     link(p) = x;
     link(y) = p;
-    y = vpackage(y, 0, 1, 1073741823L);  /* 2^30 - 1 */
+    y = vpackage(y, 0, 1, max_dimen);
     width(y) = width(x);
 
     if (height(y) < h)
@@ -427,12 +430,12 @@ lab30:;
   }
 }
 /* sec 0743 */
-void make_fraction_(halfword q)
+void make_fraction (pointer q)
 {
-  halfword p, v, x, y, z;
+  pointer p, v, x, y, z;
   scaled delta, delta1, delta2, shift_up, shift_down, clr;
   
-  if (thickness(q) == default_code) /* 2^30 */
+  if (thickness(q) == default_code)
     thickness(q) = default_rule_thickness;
 
   x = clean_box(numerator(q), num_style(cur_style));
@@ -482,7 +485,7 @@ void make_fraction_(halfword q)
 
     delta = half(thickness(q));
     delta1 = clr - ((shift_up - depth(x)) - (axis_height(cur_size) + delta));
-    delta2 = clr -((axis_height(cur_size) - delta) - (height(z) - shift_down));
+    delta2 = clr - ((axis_height(cur_size) - delta) - (height(z) - shift_down));
 
     if (delta1 > 0)
       shift_up = shift_up + delta1;
@@ -526,16 +529,13 @@ void make_fraction_(halfword q)
   link(v) = z;
   new_hlist(q) = hpack(x, 0, 1);
 }
-/***************************************************************************/
-scaled make_op_ (halfword);
-/***************************************************************************/
 /* sec 0752 */
-void make_ord_(halfword q)
+void make_ord (pointer q)
 {
   integer a;
-  halfword p, r;
+  pointer p, r;
 
-lab20:
+restart:
   if (math_type(subscr(q)) == 0)
     if (math_type(supscr(q)) == 0)
       if (math_type(nucleus(q)) == math_char)
@@ -575,12 +575,7 @@ lab20:
                         }
                         else
                         {
-                          {
-                            if (interrupt != 0)
-                            {
-                              pause_for_instructions();
-                            }
-                          }
+                          check_interrupt();
 
                           switch (op_byte(cur_i))
                           {
@@ -624,7 +619,7 @@ lab20:
                             return;
 
                           math_type(nucleus(q)) = math_char;
-                          goto lab20;
+                          goto restart;
                         }
 
                     if (skip_byte(cur_i) >= stop_flag)
@@ -637,11 +632,8 @@ lab20:
               }
       }
 }
-/***************************************************************************/
-void make_scripts_ (halfword, scaled);
-/***************************************************************************/
 /* sec 0762 */
-small_number make_left_right_(halfword q, small_number style, scaled max_d, scaled max_h)
+small_number make_left_right (pointer q, small_number style, scaled max_d, scaled max_h)
 {
   scaled delta, delta1, delta2;
 
@@ -663,22 +655,23 @@ small_number make_left_right_(halfword q, small_number style, scaled max_d, scal
     delta = delta2;
 
   new_hlist(q) = var_delimiter(delimiter(q), cur_size, delta);
+
   return type(q) - (left_noad - open_noad);
 }
 /* sec 0726 */
 void mlist_to_hlist (void)
 {
-  halfword mlist;
+  pointer mlist;
   boolean penalties;
   small_number style;
   small_number save_style;
-  halfword q;
-  halfword r;
-/*  small_number r_type;  */
-  int r_type;            /* 95/Jan/7 */
-/*  small_number t; */
-  int t;              /* 95/Jan/7 */
-  halfword p, x, y, z;
+  pointer q;
+  pointer r;
+  /* small_number r_type; */
+  int r_type;
+  /* small_number t; */
+  int t;
+  pointer p, x, y, z;
   integer pen;
   small_number s;
   scaled max_h, max_d;
@@ -704,7 +697,7 @@ void mlist_to_hlist (void)
 
   while (q != 0)
   {
-lab21:
+reswitch:
     delta = 0;
 
     switch (type(q))
@@ -720,12 +713,12 @@ lab21:
           case left_noad:
             {
               type(q) = ord_noad;
-              goto lab21;
+              goto reswitch;
             }
             break;
 
           default:
-            ;
+            do_nothing();
             break;
         }
         break;
@@ -739,18 +732,18 @@ lab21:
             type(r) = ord_noad;
 
           if (type(q) == right_noad)
-            goto lab80;
+            goto done_with_noad;
         }
         break;
 
       case left_noad:
-        goto lab80;
+        goto done_with_noad;
         break;
 
       case fraction_noad:
         {
           make_fraction(q);
-          goto lab82;
+          goto check_dimensions;
         }
         break;
 
@@ -759,7 +752,7 @@ lab21:
           delta = make_op(q);
 
           if (subtype(q) == limits)
-            goto lab82;
+            goto check_dimensions;
         }
         break;
 
@@ -769,7 +762,7 @@ lab21:
 
       case open_noad:
       case inner_noad:
-        ;
+        do_nothing();
         break;
 
       case radical_noad:
@@ -805,7 +798,7 @@ lab21:
             cur_mu = x_over_n(math_quad(cur_size), 18);
           }
 
-          goto lab81;
+          goto done_with_node;
         }
         break;
 
@@ -814,31 +807,19 @@ lab21:
           switch (cur_style / 2)
           {
             case 0:
-              {
-                p = display_mlist(q);
-                display_mlist(q) = 0;
-              }
+              choose_mlist(display_mlist);
               break;
 
             case 1:
-              {
-                p = text_mlist(q);
-                text_mlist(q) = 0;
-              }
+              choose_mlist(text_mlist);
               break;
 
             case 2:
-              {
-                p = script_mlist(q);
-                script_mlist(q) = 0;
-              }
+              choose_mlist(script_mlist);
               break;
 
             case 3:
-              {
-                p = script_script_mlist(q);
-                script_script_mlist(q) = 0;
-              }
+              choose_mlist(script_script_mlist);
               break;
           }
 
@@ -861,7 +842,8 @@ lab21:
 
             link(p) = z;
           }
-          goto lab81;
+
+          goto done_with_node;
         }
         break;
 
@@ -871,7 +853,7 @@ lab21:
       case whatsit_node:
       case penalty_node:
       case disc_node:
-        goto lab81;
+        goto done_with_node;
         break;
 
       case rule_node:
@@ -882,7 +864,7 @@ lab21:
           if (depth(q) > max_d)
             max_d = depth(q);
 
-          goto lab81;
+          goto done_with_node;
         }
         break;
 
@@ -908,21 +890,22 @@ lab21:
                 flush_node_list(p);
               }
           }
-          goto lab81;
+
+          goto done_with_node;
         }
         break;
 
       case kern_node:
         {
           math_kern(q, cur_mu);
-          goto lab81;
+          goto done_with_node;
         }
         break;
 
       default:
         {
           confusion("mlist1");
-          return;       // abort_flag set
+          return;
         }
         break;
     }
@@ -934,7 +917,7 @@ lab21:
         {
           fetch(nucleus(q));
 
-          if ((cur_i.b0 > 0))
+          if (char_exists(cur_i))
           {
             delta = char_italic(cur_f, cur_i);
             p = new_character(cur_f, cur_c);
@@ -985,7 +968,7 @@ lab21:
       default:
         {
           confusion("mlist2");
-          return;       // abort_flag set
+          return;
         }
         break;
     }
@@ -993,10 +976,11 @@ lab21:
     new_hlist(q) = p;
 
     if ((math_type(subscr(q)) == 0) && (math_type(supscr(q)) == 0))
-      goto lab82;
+      goto check_dimensions;
 
     make_scripts(q, delta);
-lab82:
+
+check_dimensions:
     z = hpack(new_hlist(q), 0, 1);
 
     if (height(z) > max_h)
@@ -1006,10 +990,12 @@ lab82:
       max_d = depth(z);
 
     free_node(z, box_node_size);
-lab80:
+
+done_with_noad:
     r = q;
     r_type = type(r);
-lab81:
+
+done_with_node:
     q = link(q);
   }
 
@@ -1065,7 +1051,7 @@ lab81:
       case vcenter_noad:
       case over_noad:
       case under_noad:
-        ;
+        do_nothing();
         break;
 
       case radical_noad:
@@ -1102,7 +1088,7 @@ lab81:
             cur_mu = x_over_n(math_quad(cur_size), 18);
           }
 
-          goto lab83;
+          goto delete_q;
         }
         break;
 
@@ -1120,14 +1106,14 @@ lab81:
           p = q;
           q = link(q);
           link(p) = 0;
-          goto lab30;
+          goto done;
         }
         break;
 
       default:
         {
           confusion("mlist3");
-          return;       // abort_flag set
+          return;
         }
         break;
     }
@@ -1168,7 +1154,7 @@ lab81:
         default:
           {
             confusion("mlist4");
-            return;       // abort_flag set
+            return;
           }
           break;
       }
@@ -1211,17 +1197,18 @@ lab81:
         }
 
     r_type = t;
-lab83:
+
+delete_q:
     r = q;
     q = link(q);
     free_node(r, s);
-lab30:;
+done:;
   }
 }
 /* sec 0772 */
 void push_alignment (void)
 {
-  halfword p;
+  pointer p;
 
   p = get_node(align_stack_node_size);
   link(p) = align_ptr;
@@ -1238,7 +1225,7 @@ void push_alignment (void)
 /* sec 0772 */
 void pop_alignment (void)
 {
-  halfword p;
+  pointer p;
 
   free_avail(cur_head);
   p = align_ptr;
@@ -1255,7 +1242,7 @@ void pop_alignment (void)
 /* sec 0782 */
 void get_preamble_token (void)
 {
-lab20:
+restart:
   get_token();
 
   while ((cur_chr == span_code) && (cur_cmd == tab_mark))
@@ -1272,7 +1259,7 @@ lab20:
   if (cur_cmd == endv)
   {
     fatal_error("(interwoven alignment preambles are not allowed)");
-    return;     // abort_flag set
+    return;
   }
 
   if ((cur_cmd == assign_glue) && (cur_chr == glue_base + tab_skip_code))
@@ -1285,24 +1272,24 @@ lab20:
     else
       eq_define(glue_base + tab_skip_code, glue_ref, cur_val);
 
-    goto lab20;
+    goto restart;
   }
 }
 /* sec 0774 */
 void init_align (void)
 {
-  halfword save_cs_ptr;
-  halfword p;
+  pointer save_cs_ptr;
+  pointer p;
 
   save_cs_ptr = cur_cs;
   push_alignment();
   align_state = -1000000L;
 
-  if ((mode == mmode) && ((tail != cur_list.head_field) || (incompleat_noad != 0)))
+  if ((mode == mmode) && ((tail != head) || (incompleat_noad != 0)))
   {
     print_err("Improper ");
     print_esc("halign");
-    print_string(" inside $$'s");
+    prints(" inside $$'s");
     help3("Displays can use special alignments (like \\eqalignno)",
         "only if nothing but the alignment itself is between $$'s.",
         "So I've deleted the formulas that preceded this alignment.");
@@ -1334,7 +1321,7 @@ void init_align (void)
     cur_align = link(cur_align);
 
     if (cur_cmd == car_ret)
-      goto lab30;
+      goto done;
 
     p = hold_head;
     link(p) = 0;
@@ -1344,7 +1331,7 @@ void init_align (void)
       get_preamble_token();
 
       if (cur_cmd == mac_param)
-        goto lab31;
+        goto done1;
 
       if ((cur_cmd <= car_ret) && (cur_cmd >= tab_mark) && (align_state == -1000000L))
         if ((p == hold_head) && (cur_loop == 0) && (cur_cmd == tab_mark))
@@ -1356,7 +1343,7 @@ void init_align (void)
               "\\halign or \\valign is being set up. In this case you had",
               "none, so I've put one in; maybe that will work.");
           back_error();
-          goto lab31;
+          goto done1;
         }
       else if ((cur_cmd != spacer) || (p != hold_head))
       {
@@ -1366,22 +1353,22 @@ void init_align (void)
       }
     }
 
-lab31:
+done1:
     link(cur_align) = new_null_box();
     cur_align = link(cur_align);
     info(cur_align) = end_span;
-    width(cur_align) = null_flag;  /* - 2^30 */
+    width(cur_align) = null_flag;
     u_part(cur_align) = link(hold_head);
     p = hold_head;
     link(p) = 0;
 
     while (true)
     {
-lab22:
+continu:
       get_preamble_token();
 
       if ((cur_cmd <= car_ret) && (cur_cmd >= tab_mark) && (align_state == -1000000L))
-        goto lab32;
+        goto done2;
 
       if (cur_cmd == mac_param)
       {
@@ -1390,7 +1377,7 @@ lab22:
             "\\halign or \\valign is being set up. In this case you had",
             "more than one, so I'm ignoring all but the first.");
         error();
-        goto lab22;
+        goto continu;
       }
 
       link(p) = get_avail();
@@ -1398,23 +1385,24 @@ lab22:
       info(p) = cur_tok;
     }
 
-lab32:
+done2:
     link(p) = get_avail();
     p = link(p);
     info(p) = end_template_token;
     v_part(cur_align) = link(hold_head);
   }
 
-lab30:
+done:
   scanner_status = 0;
   new_save_level(align_group);
 
   if (every_cr != 0)
     begin_token_list(every_cr, every_cr_text);
+
   align_peek();
 }
 /* sec 0787 */
-void init_span_ (halfword p)
+void init_span (pointer p)
 {
   push_nest();
 
@@ -1422,7 +1410,7 @@ void init_span_ (halfword p)
     space_factor = 1000;
   else
   {
-    cur_list.aux_field.cint = ignore_depth;
+    prev_depth = ignore_depth;
     normal_paragraph();
   }
 
@@ -1438,7 +1426,7 @@ void init_row (void)
   if (mode == -hmode)
     space_factor = 0;
   else
-    cur_list.aux_field.cint = 0;
+    prev_depth = 0;
 
   tail_append(new_glue(glue_ptr(preamble)));
   subtype(tail) = tab_skip_code + 1;
@@ -1462,7 +1450,7 @@ void init_col (void)
 /* sec 0799 */
 void fin_row (void)
 {
-  halfword p;
+  pointer p;
 
   if (mode == -hmode)
   {
@@ -1478,7 +1466,7 @@ void fin_row (void)
   }
   else
   {
-    p = vpackage(link(head), 0, 1, 1073741823L);   /* 2^30 - 1 */
+    p = vpackage(link(head), 0, 1, max_dimen);
     pop_nest();
     link(tail) = p;
     tail = p;
@@ -1496,7 +1484,7 @@ void fin_row (void)
 /* sec 0800 */
 void fin_align (void)
 {
-  halfword p, q, r, s, u, v;
+  pointer p, q, r, s, u, v;
   scaled t, w;
   scaled o;
   halfword n;
@@ -1506,7 +1494,7 @@ void fin_align (void)
   if (cur_group != align_group)
   {
     confusion("align1");
-    return;       // abort_flag set
+    return;
   }
 
   unsave();
@@ -1514,7 +1502,7 @@ void fin_align (void)
   if (cur_group != align_group)
   {
     confusion("align0");
-    return;       // abort_flag set
+    return;
   }
 
   unsave();
@@ -1532,7 +1520,7 @@ void fin_align (void)
       flush_list(v_part(q));
       p = link(link(q));
 
-      if (width(q) == null_flag) /* - 2^30 */
+      if (width(q) == null_flag)
       {
         width(q) = 0;
         r = link(q);
@@ -1619,7 +1607,7 @@ void fin_align (void)
       }
     while (!(q == 0));
 
-    p = vpackage(preamble, saved(1), saved(0), 1073741823L);  /* 2^30 - 1 */
+    p = vpackage(preamble, saved(1), saved(0), max_dimen);
     q = link(preamble);
 
     do
@@ -1637,7 +1625,7 @@ void fin_align (void)
 
   while (q != 0)
   {
-    if (!(q >= hi_mem_min))
+    if (!is_char_node(q))
       if (type(q) == unset_node)
       {
         if (mode == -vmode)
@@ -1785,17 +1773,17 @@ void fin_align (void)
             r = link(link(r));
             s = link(link(s));
           }
-        while(!(r == 0));
+        while (!(r == 0));
       }
       else if (type(q) == rule_node)
       {
-        if ((width(q) == -1073741824L))  /* 2^30  */
+        if (is_running(width(q)))
           width(q) = width(p);
 
-        if ((height(q) == -1073741824L))  /* 2^30  */
+        if (is_running(height(q)))
           height(q) = height(p);
 
-        if ((depth(q) == -1073741824L))  /* 2^30  */
+        if (is_running(depth(q)))
           depth(q) = depth(p);
 
         if (o != 0)
@@ -1853,7 +1841,7 @@ void fin_align (void)
 
     tail_append(new_penalty(post_display_penalty));
     tail_append(new_param_glue(below_display_skip_code));
-    cur_list.aux_field.cint = aux_save.cint;
+    prev_depth = aux_save.cint;
     resume_after_display();
   }
   else
@@ -1865,25 +1853,16 @@ void fin_align (void)
       tail = q;
 
     if (mode == vmode)
-    {
       build_page();
-    }
   }
 }
-/* used to be align_peek, zfintieshrink, etc in old tex5.c */
-/************************************************************************/
-/* moved down here to avoid questions about pragma optimize */
-/* #pragma optimize("g", off) */
-/* for MC VS compiler */
-/* Moved down here 96/Oct/12 in response to problem with texerror.tex */
-/* pragma optimize("a", off) not strong enough - this may slow things */
 /* sec 0791 */
 boolean fin_col (void)
 {
-  halfword p;
-  halfword q, r;
-  halfword s;
-  halfword u;
+  pointer p;
+  pointer q, r;
+  pointer s;
+  pointer u;
   scaled w;
   glue_ord o;
   halfword n;
@@ -1891,7 +1870,7 @@ boolean fin_col (void)
   if (cur_align == 0)
   {
     confusion("endv");
-    return 0;       // abort_flag set
+    return 0;
   }
 
   q = link(cur_align);
@@ -1899,13 +1878,13 @@ boolean fin_col (void)
   if (q == 0)
   {
     confusion("endv");
-    return 0;       // abort_flag set
+    return 0;
   }
 
   if (align_state < 500000L)
   {
     fatal_error("(interwoven alignment preambles are not allowed)");
-    return 0;     // abort_flag set
+    return 0;
   }
 
   p = link(q);
@@ -1913,8 +1892,6 @@ boolean fin_col (void)
   if ((p == 0) && (extra_info(cur_align) < cr_code))
     if (cur_loop != 0)
     {
-/*  potential problem here if new_null_box causes memory reallocation ??? */
-/*  compiler optimization does not refresh `mem' loaded in registers ? */
       link(q) = new_null_box();
       p = link(q);
       info(p) = end_span;
@@ -1963,7 +1940,6 @@ boolean fin_col (void)
   if (extra_info(cur_align) != span_code)
   {
     unsave();
-
     new_save_level(align_group);
 
     {
@@ -1996,8 +1972,8 @@ boolean fin_col (void)
 
         if (n > max_quarterword)
         {
-          confusion("256 spans");   /* 256 spans --- message wrong now, but ... */
-          return 0;       // abort_flag set
+          confusion("256 spans");
+          return 0;
         }
 
         q = cur_span;
@@ -2075,10 +2051,10 @@ boolean fin_col (void)
   return false;
 }
 /* sec 0749 */
-scaled make_op_(halfword q)
+scaled make_op (pointer q)
 {
   scaled delta;
-  halfword p, v, x, y, z;
+  pointer p, v, x, y, z;
   quarterword c;
   four_quarters i;
   scaled shift_up, shift_down;
@@ -2095,7 +2071,7 @@ scaled make_op_(halfword q)
       c = rem_byte(cur_i);
       i = char_info(cur_f, c);
 
-      if ((i.b0 > 0))
+      if (char_exists(i))
       {
         cur_c = c;
         cur_i = i;
@@ -2183,15 +2159,15 @@ scaled make_op_(halfword q)
   return delta;
 }
 /* sec 0756 */
-void make_scripts_(halfword q, scaled delta)
+void make_scripts (pointer q, scaled delta)
 {
-  halfword p, x, y, z;
+  pointer p, x, y, z;
   scaled shift_up, shift_down, clr;
   small_number t;
 
   p = new_hlist(q);
 
-  if ((p >= hi_mem_min))
+  if (is_char_node(p))
   {
     shift_up = 0;
     shift_down = 0;
@@ -2276,7 +2252,7 @@ void make_scripts_(halfword q, scaled delta)
       p = new_kern((shift_up - depth(x)) - (height(y) - shift_down));
       link(x) = p;
       link(p) = y;
-      x = vpackage(x, 0, 1, 1073741823L);  /* 2^30 - 1 */
+      x = vpackage(x, 0, 1, max_dimen);
       shift_amount(x) = shift_down;
     }
   }