OSDN Git Service

update_terminal().
[putex/putex.git] / src / texsourc / tex5.c
index a17c4db..b464432 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "texd.h"
 
-/* rebox_ used to be in tex4.c */
 /* sec 0715 */
 halfword rebox_(halfword b, scaled w)
 {
@@ -34,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)));
@@ -144,7 +143,7 @@ halfword clean_box_(halfword p, small_number s)
     case sub_box:
       {
         q = info(p);
-        goto lab40;
+        goto found;
       }
       break;
 
@@ -155,7 +154,7 @@ halfword clean_box_(halfword p, small_number s)
     default:
       {
         q = new_null_box();
-        goto lab40;
+        goto found;
       }
     break;
   }
@@ -175,8 +174,8 @@ 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;
@@ -185,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);
@@ -273,8 +272,9 @@ void make_vcenter_(halfword q)
   if (type(v) != vlist_node)
   {
     confusion("vcenter");
-    return;         // abort_flag set
+    return;
   }
+
   delta = height(v) + depth(v);
   height(v) = axis_height(cur_size) + half(delta);
   depth(v) = delta - height(v);
@@ -313,7 +313,7 @@ void make_math_accent_(halfword q)
   integer a;
   quarterword c;
   internal_font_number f;
-  ffour_quarters i;
+  four_quarters i;
   scaled s;
   scaled h;
   scaled delta;
@@ -350,18 +350,18 @@ 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 +369,20 @@ 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;
+        goto done;
 
       if (char_width(f, i) > w)
-        goto lab30;
+        goto done;
 
       c = y;
     }
-lab30:;
+done:;
     if (h < x_height(f))
       delta = h;
     else
@@ -535,7 +535,7 @@ void make_ord_(halfword q)
   integer a;
   halfword p, r;
 
-lab20:
+restart:
   if (math_type(subscr(q)) == 0)
     if (math_type(supscr(q)) == 0)
       if (math_type(nucleus(q)) == math_char)
@@ -624,7 +624,7 @@ lab20:
                             return;
 
                           math_type(nucleus(q)) = math_char;
-                          goto lab20;
+                          goto restart;
                         }
 
                     if (skip_byte(cur_i) >= stop_flag)
@@ -669,7 +669,7 @@ small_number make_left_right_(halfword q, small_number style, scaled max_d, scal
 void mlist_to_hlist (void)
 {
   halfword mlist;
-  bool penalties;
+  boolean penalties;
   small_number style;
   small_number save_style;
   halfword q;
@@ -704,7 +704,7 @@ void mlist_to_hlist (void)
 
   while (q != 0)
   {
-lab21:
+reswitch:
     delta = 0;
 
     switch (type(q))
@@ -720,7 +720,7 @@ lab21:
           case left_noad:
             {
               type(q) = ord_noad;
-              goto lab21;
+              goto reswitch;
             }
             break;
 
@@ -739,18 +739,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 +759,7 @@ lab21:
           delta = make_op(q);
 
           if (subtype(q) == limits)
-            goto lab82;
+            goto check_dimensions;
         }
         break;
 
@@ -805,7 +805,7 @@ lab21:
             cur_mu = x_over_n(math_quad(cur_size), 18);
           }
 
-          goto lab81;
+          goto done_with_node;
         }
         break;
 
@@ -861,7 +861,7 @@ lab21:
 
             link(p) = z;
           }
-          goto lab81;
+          goto done_with_node;
         }
         break;
 
@@ -871,7 +871,7 @@ lab21:
       case whatsit_node:
       case penalty_node:
       case disc_node:
-        goto lab81;
+        goto done_with_node;
         break;
 
       case rule_node:
@@ -882,7 +882,7 @@ lab21:
           if (depth(q) > max_d)
             max_d = depth(q);
 
-          goto lab81;
+          goto done_with_node;
         }
         break;
 
@@ -908,21 +908,21 @@ 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;
     }
@@ -985,7 +985,7 @@ lab21:
       default:
         {
           confusion("mlist2");
-          return;       // abort_flag set
+          return;
         }
         break;
     }
@@ -993,10 +993,10 @@ 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 +1006,10 @@ 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);
   }
 
@@ -1102,7 +1102,7 @@ lab81:
             cur_mu = x_over_n(math_quad(cur_size), 18);
           }
 
-          goto lab83;
+          goto delete_q;
         }
         break;
 
@@ -1120,14 +1120,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 +1168,7 @@ lab81:
         default:
           {
             confusion("mlist4");
-            return;       // abort_flag set
+            return;
           }
           break;
       }
@@ -1211,11 +1211,11 @@ lab81:
         }
 
     r_type = t;
-lab83:
+delete_q:
     r = q;
     q = link(q);
     free_node(r, s);
-lab30:;
+done:;
   }
 }
 /* sec 0772 */
@@ -1255,7 +1255,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 +1272,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,7 +1285,7 @@ lab20:
     else
       eq_define(glue_base + tab_skip_code, glue_ref, cur_val);
 
-    goto lab20;
+    goto restart;
   }
 }
 /* sec 0774 */
@@ -1334,7 +1334,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 +1344,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 +1356,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,7 +1366,7 @@ void init_align (void)
       }
     }
 
-lab31:
+done1:
     link(cur_align) = new_null_box();
     cur_align = link(cur_align);
     info(cur_align) = end_span;
@@ -1377,11 +1377,11 @@ lab31:
 
     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 +1390,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,14 +1398,14 @@ 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);
 
@@ -1422,7 +1422,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 +1438,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;
@@ -1506,7 +1506,7 @@ void fin_align (void)
   if (cur_group != align_group)
   {
     confusion("align1");
-    return;       // abort_flag set
+    return;
   }
 
   unsave();
@@ -1514,7 +1514,7 @@ void fin_align (void)
   if (cur_group != align_group)
   {
     confusion("align0");
-    return;       // abort_flag set
+    return;
   }
 
   unsave();
@@ -1637,7 +1637,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,7 +1785,7 @@ void fin_align (void)
             r = link(link(r));
             s = link(link(s));
           }
-        while(!(r == 0));
+        while (!(r == 0));
       }
       else if (type(q) == rule_node)
       {
@@ -1853,7 +1853,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,20 +1865,11 @@ 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 */
-bool fin_col (void)
+boolean fin_col (void)
 {
   halfword p;
   halfword q, r;
@@ -1891,7 +1882,7 @@ bool fin_col (void)
   if (cur_align == 0)
   {
     confusion("endv");
-    return 0;       // abort_flag set
+    return 0;
   }
 
   q = link(cur_align);
@@ -1899,13 +1890,13 @@ bool 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 +1904,6 @@ bool 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 +1952,6 @@ bool fin_col (void)
   if (extra_info(cur_align) != span_code)
   {
     unsave();
-
     new_save_level(align_group);
 
     {
@@ -1996,8 +1984,8 @@ bool 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;
@@ -2080,7 +2068,7 @@ scaled make_op_(halfword q)
   scaled delta;
   halfword p, v, x, y, z;
   quarterword c;
-  ffour_quarters i;
+  four_quarters i;
   scaled shift_up, shift_down;
 
   if ((subtype(q) == normal) && (cur_style < text_style))
@@ -2191,7 +2179,7 @@ void make_scripts_(halfword q, scaled delta)
 
   p = new_hlist(q);
 
-  if ((p >= hi_mem_min))
+  if (is_char_node(p))
   {
     shift_up = 0;
     shift_down = 0;