OSDN Git Service

memory aligning.
[putex/putex.git] / src / texsourc / tex1.c
index 1068d98..7344bab 100644 (file)
@@ -1,31 +1,26 @@
-#ifdef _WINDOWS
-  #define NOCOMM
-  #define NOSOUND
-  #define NODRIVERS
-  #define STRICT
-  #pragma warning(disable:4115) // kill rpcasync.h complaint
-  #include <windows.h>
-  #define MYLIBAPI __declspec(dllexport)
-#endif
+/* Copyright 2014 Clerk Ma
 
-#include "texwin.h"
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-#pragma warning(disable:4996)
-#pragma warning(disable:4131) // old style declarator
-#pragma warning(disable:4135) // conversion between different integral types 
-#pragma warning(disable:4127) // conditional expression is constant
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
 
-#include <setjmp.h>
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301 USA.  */
 
 #define EXTERN extern
 
 #include "texd.h"
 
-#pragma warning(disable:4244)       /* 96/Jan/10 */
-
-/* *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
 /* sec 0198 */
-void show_box_(halfword p)
+void show_box_(pointer p)
 {
   depth_threshold = show_box_depth;
   breadth_max = show_box_breadth;
@@ -48,7 +43,7 @@ void show_box_(halfword p)
   print_ln();
 }
 /* sec 0200 */
-void delete_token_ref_(halfword p)
+void delete_token_ref_(pointer p)
 {
   if (token_ref_count(p) == 0)
     flush_list(p);
@@ -56,7 +51,7 @@ void delete_token_ref_(halfword p)
     decr(token_ref_count(p));
 }
 /* sec 0201 */
-void delete_glue_ref_(halfword p)
+void delete_glue_ref_(pointer p)
 {
   if (glue_ref_count(p) == 0)
     free_node(p, glue_spec_size);
@@ -64,11 +59,12 @@ void delete_glue_ref_(halfword p)
     decr(glue_ref_count(p));
 }
 /* sec 0202 */
-void flush_node_list_(halfword p)
+void flush_node_list_(pointer p)
 {
-  halfword q;
+  pointer q;
 
-  while (p != 0) {      /* while p<>null */
+  while (is_char_node(p))
+  {
     q = link(p);
 
     if (is_char_node(p))
@@ -131,10 +127,10 @@ void flush_node_list_(halfword p)
           break;
         case glue_node:
           {
-            if (mem[mem[p + 1].hh.v.LH].hh.v.RH == 0)
-              free_node(mem[p + 1].hh.v.LH, 4);
+            if (mem[mem[p + 1].hh.lh].hh.rh == 0)
+              free_node(mem[p + 1].hh.lh, 4);
             else
-              decr(mem[mem[p + 1].hh.v.LH].hh.v.RH);
+              decr(mem[mem[p + 1].hh.lh].hh.rh);
           }
 
           if (leader_ptr(p) != 0)
@@ -230,25 +226,27 @@ void flush_node_list_(halfword p)
           }
           break;
       }
+
       free_node(p, small_node_size);
 lab30:;
     }
+
     p = q;
   }
 }
 /* sec 0204 */
-halfword copy_node_list_(halfword p)
+pointer copy_node_list_(pointer p)
 {
-  register halfword Result;
-  halfword h;
-  halfword q;
-  halfword r;
+  pointer h;
+  pointer q;
+  pointer r;
   char words;
 
   h = get_avail();
   q = h;
 
-  while (p != 0) {      /* while p<>null do l.3969 */
+  while (p != 0)
+  {
     words = 1;
 
     if ((p >= hi_mem_min)) 
@@ -389,8 +387,7 @@ halfword copy_node_list_(halfword p)
   q = link(h);
   free_avail(h);
 
-  Result = q;
-  return Result;
+  return q;
 }
 /* sec 0211 */
 void print_mode_(integer m)
@@ -432,6 +429,7 @@ void print_mode_(integer m)
       }
     }
   }
+
   print_string(" mode");
 }
 /* sec 0216 */
@@ -445,7 +443,7 @@ void push_nest (void)
     if (nest_ptr == current_nest_size)
       nest = realloc_nest_stack(increment_nest_size);
 
-    if (nest_ptr == current_nest_size) /* check again after allocation */
+    if (nest_ptr == current_nest_size)
     {
       overflow("semantic nest size", current_nest_size);
       return;     // abort_flag set
@@ -453,11 +451,12 @@ void push_nest (void)
 #else
     if (nest_ptr == nest_size)
     {
-      overflow("semantic nest size", nest_size); /* semantic next size - not dynamic */
+      overflow("semantic nest size", nest_size);
       return;     // abort_flag set
     }
 #endif
   }
+
   nest[nest_ptr]= cur_list;
   incr(nest_ptr);
   head = get_avail();
@@ -604,14 +603,14 @@ void show_activities (void)
       case 1:
         {
           print_nl("spacefactor ");
-          print_int(a.hh.v.LH);
+          print_int(a.hh.lh);
 
           if (m > 0)
           {
-            if (a.hh.v.RH > 0)
+            if (a.hh.rh > 0)
             {
               print_string(", current language ");
-              print_int(a.hh.v.RH);
+              print_int(a.hh.rh);
             }
           }
         }
@@ -2178,7 +2177,7 @@ void show_eqtb_(halfword n)
 
                     print_char('=');
                     print_esc("");
-                    print(hash[font_id_base + equiv(n)].v.RH);
+                    print(hash[font_id_base + equiv(n)].rh);
                   }
                   else
                     if (n < math_code_base)
@@ -2351,14 +2350,14 @@ halfword id_lookup_(integer j, integer l)
         if (trace_flag)
         {
           str_pool[pool_ptr] = '\0';
-          sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr-l-d]);
+          sprintf(log_line, " tex1 cs_count++ '%s' ", &str_pool[pool_ptr - l - d]);
           show_line(log_line, 0);      /* debugging */
         }
 #endif /* STAT */
-      } 
+      }
 
       goto lab40; 
-    } 
+    }
     p = next(p);
   } 
 
@@ -2389,6 +2388,7 @@ void new_save_level_(group_code c)
      }
 #endif
   }
+
   save_type(save_ptr) = level_boundary;
   save_level(save_ptr) = (quarterword) cur_group; 
   save_index(save_ptr) = cur_boundary;