diff -ruN klic-3.003-2001-12-31/MANIFEST klic-3.003-2002-01-01/MANIFEST
--- klic-3.003-2001-12-31/MANIFEST	Sun Dec 30 17:14:44 2001
+++ klic-3.003-2002-01-01/MANIFEST	Mon Dec 31 15:32:39 2001
@@ -169,6 +169,7 @@
 ./include/klic/predinfo.h
 ./include/klic/primitives.h
 ./include/klic/sighndl.h
+./include/klic/stdc.h
 ./include/klic/struct.h
 ./include/klic/unify.h
 ./klic-version
diff -ruN klic-3.003-2001-12-31/compiler/klic.c klic-3.003-2002-01-01/compiler/klic.c
--- klic-3.003-2001-12-31/compiler/klic.c	Thu Dec 27 19:15:58 2001
+++ klic-3.003-2002-01-01/compiler/klic.c	Mon Dec 31 13:16:55 2001
@@ -5,7 +5,7 @@
 %       (Read COPYRIGHT-JIPDEC for detailed information.)
 ----------------------------------------------------------- */
 #include <stdio.h>
-#include <string.h>
+#include <klic/stdc.h>
 #include <ctype.h>
 #include <unistd.h>
 #include <sys/types.h>
diff -ruN klic-3.003-2001-12-31/include/klic/g_methtab.h klic-3.003-2002-01-01/include/klic/g_methtab.h
--- klic-3.003-2001-12-31/include/klic/g_methtab.h	Thu Dec 27 19:15:58 2001
+++ klic-3.003-2002-01-01/include/klic/g_methtab.h	Mon Dec 31 12:49:56 2001
@@ -78,29 +78,29 @@
 /*
   Generator Object
 */
+		    
+struct generator_object {
+  struct generator_object_method_table* method_table;
+};
 
 struct generator_object_method_table {
-  q *(*active_unify)(/* q self,
+  q* (*active_unify)(/* q self,
 			q other,
-			q  *allocp */);
-  q (*generate)(/* struct generator_object *self,
-		q *allocp */);
-  q (*suspend)(/* q reference, struct goalrec *goal */);
-  long (*print)/* print what ? */ (/* struct generator_object *self,
-		  FILE *out_stream,
+			q* allocp */);
+  q (*generate)(/* struct generator_object* self,
+		q* allocp */);
+  q (*suspend)(/* q reference, struct goalrec* goal */);
+  long (*print)/* print what ? */ (/* struct generator_object* self,
+		  FILE* out_stream,
 		  unsigned long max_depth,
 		  unsigned long max_length */);
-  q *(*gc)( /* struct generator_object *self,
-	       q *allocp,
-	       q **sp */);
-  long (*regist)(/* struct generator_object *self */);
-  long (*deallocate)(/* struct generator_object *self */);
-  q *(*close)(/* struct generator_object *self */);
-  q (*encode)(/* struct generator_object *self, long node */);
-};
-		    
-struct generator_object {
-  struct generator_object_method_table *method_table;
+  q* (*gc)( /* struct generator_object* self,
+	       q* allocp,
+	       q** sp */);
+  long (*regist)(/* struct generator_object* self */);
+  long (*deallocate)(/* struct generator_object* self */);
+  q* (*close)(/* struct generator_object* self */);
+  q (*encode)(/* struct generator_object* self, long node */);
 };
 
 #endif /* _KLIC_G_METHTAB_H_ */
diff -ruN klic-3.003-2001-12-31/include/klic/stdc.h klic-3.003-2002-01-01/include/klic/stdc.h
--- klic-3.003-2001-12-31/include/klic/stdc.h	Mon Dec 31 12:07:56 2001
+++ klic-3.003-2002-01-01/include/klic/stdc.h	Mon Dec 31 13:13:56 2001
@@ -31,4 +31,19 @@
 #define VA_ARGS(A)	()
 #endif  /* !__STDC__ */
 
+
+#ifdef STRINGH
+#include <string.h>
+#else
+#include <strings.h>
+#endif
+
+#ifdef STDDEFH
+#include <stddef.h>
+#else
+#ifndef size_t
+#define size_t  unsigned int
+#endif
+#endif
+
 #endif  /* _KLIC_STDC_H_ */
diff -ruN klic-3.003-2001-12-31/runtime/asyncio.c klic-3.003-2002-01-01/runtime/asyncio.c
--- klic-3.003-2001-12-31/runtime/asyncio.c	Sun Dec 30 17:15:19 2001
+++ klic-3.003-2002-01-01/runtime/asyncio.c	Mon Dec 31 13:18:27 2001
@@ -14,7 +14,6 @@
 
 #ifdef USESIG
 #include <stdio.h>  /* NULL */
-#include <string.h>  /* strlen */
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/types.h>
diff -ruN klic-3.003-2001-12-31/runtime/atomt.kl1 klic-3.003-2002-01-01/runtime/atomt.kl1
--- klic-3.003-2001-12-31/runtime/atomt.kl1	Thu Dec 27 19:15:57 2001
+++ klic-3.003-2002-01-01/runtime/atomt.kl1	Mon Dec 31 13:12:48 2001
@@ -5,15 +5,7 @@
 %       (Read COPYRIGHT-JIPDEC for detailed information.)
 % ----------------------------------------------------------- */
 
-:- inline:"
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
-extern unsigned long enter_atom_string();
-".
+:- inline:"extern unsigned long enter_atom_string();".
 
 :- module atom_table.
 
diff -ruN klic-3.003-2001-12-31/runtime/cntlmsg.c klic-3.003-2002-01-01/runtime/cntlmsg.c
--- klic-3.003-2001-12-31/runtime/cntlmsg.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/cntlmsg.c	Mon Dec 31 14:59:43 2001
@@ -28,6 +28,10 @@
 #include "rmon.h"
 #include "ge_exref.h"
 
+#ifdef DEBUGLIB
+#include "trace.h"  /* trace_flag, trace_goal */
+#endif
+
 /*
   Distributed unification
   ANSWER VALUE		void send_answer_value(data, node, index, wec)
@@ -46,7 +50,6 @@
 
 extern q search_exptbl();
 extern q reply_hook_g_new();
-struct goalrec *trace_goal();
 extern void encode_data();
 extern void send_message();
 extern void send_message_without_wtc_chk();
@@ -504,7 +507,6 @@
 struct goalrec *oldqp;
 {
   declare_globals;
-  extern int trace_flag;
   combuf *buffer;
 
   INT_CL_DEBUG_X(iosprintf("%d:send_throw_goal\n", my_node));
@@ -521,7 +523,7 @@
 #ifdef DEBUGLIB
     if (trace_flag) {
       static long throw_trace_count = 0;
-      goal = trace_goal(goal, (node+1)*100000+throw_trace_count, 0);
+      goal = trace_goal(goal, (node+1)*100000+throw_trace_count, NULL);
       throw_trace_count++;
     }
 #endif
diff -ruN klic-3.003-2001-12-31/runtime/config/pvm/distio.c klic-3.003-2002-01-01/runtime/config/pvm/distio.c
--- klic-3.003-2001-12-31/runtime/config/pvm/distio.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/config/pvm/distio.c	Mon Dec 31 13:18:48 2001
@@ -12,7 +12,6 @@
 #include <klic/distio.h>
 #include <signal.h>
 #include <unistd.h>
-#include <string.h>
 #include <malloc.h>
 /*
   For io-node
diff -ruN klic-3.003-2001-12-31/runtime/config/pvm/distproc.c klic-3.003-2002-01-01/runtime/config/pvm/distproc.c
--- klic-3.003-2001-12-31/runtime/config/pvm/distproc.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/config/pvm/distproc.c	Mon Dec 31 13:11:51 2001
@@ -19,11 +19,6 @@
 #include <sys/processor.h>
 #include <sys/procset.h>
 #endif
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
 
 #include "options.h"
 
diff -ruN klic-3.003-2001-12-31/runtime/config/shm/distproc.c klic-3.003-2002-01-01/runtime/config/shm/distproc.c
--- klic-3.003-2001-12-31/runtime/config/shm/distproc.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/config/shm/distproc.c	Mon Dec 31 13:12:10 2001
@@ -25,11 +25,6 @@
 #include <sys/processor.h>
 #include <sys/procset.h>
 #endif
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
 
 #include "options.h"
 #include <klic/distpkt.h>
diff -ruN klic-3.003-2001-12-31/runtime/debug.c klic-3.003-2002-01-01/runtime/debug.c
--- klic-3.003-2001-12-31/runtime/debug.c	Mon Dec 31 12:04:47 2001
+++ klic-3.003-2002-01-01/runtime/debug.c	Mon Dec 31 13:19:12 2001
@@ -8,7 +8,6 @@
 #include <setjmp.h>
 #include <ctype.h>
 #include <errno.h>
-#include <string.h>
 
 /* fatal, fatalf, fatalp, debug_printf, debug_fprintf, klic_fprintf,
  * klic_putc, VA_ARGS
diff -ruN klic-3.003-2001-12-31/runtime/faisus.c klic-3.003-2002-01-01/runtime/faisus.c
--- klic-3.003-2001-12-31/runtime/faisus.c	Mon Dec 31 12:04:47 2001
+++ klic-3.003-2002-01-01/runtime/faisus.c	Mon Dec 31 15:12:14 2001
@@ -16,6 +16,8 @@
 #include "gobj.h"
 
 #ifdef DEBUGLIB
+#include "trace.h"  /* trace_flag, trace_susp, trace_failure */
+
 extern int count_suspension;
 #endif
 
@@ -195,9 +197,8 @@
     /* OK, the goal should really be suspended */
 #ifdef DEBUGLIB
     {
-      extern int stepping_flag, trace_flag;
+      extern int stepping_flag;
       q *step_susp();
-      struct goalrec *trace_susp();
       if (reasonp > reasons) {
 	if (stepping_flag) {
 	  allocp = step_susp(allocp, goal, reasonp, 0);
diff -ruN klic-3.003-2001-12-31/runtime/gc.c klic-3.003-2002-01-01/runtime/gc.c
--- klic-3.003-2001-12-31/runtime/gc.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/gc.c	Mon Dec 31 15:14:03 2001
@@ -13,11 +13,17 @@
 #include "gobj.h"
 #include "susp.h"
 
+#ifdef DEBUGLIB
+#include "trace.h"  /* trace_deadlock */
+#endif
+
 #ifdef DIST
 #include "interpe.h"
 #endif
+
 #ifdef SHM
 #include "shm.h"
+
 /* a following line is for debugging of reverse pointer problem. */
 static int hirata_bug1;
   
@@ -29,8 +35,7 @@
   }                                                     \
   *(sp)++ = (q*)(addr);                                 \
 }
-
-#endif
+#endif  /* SHM */
 
 extern struct goalrec goal_queue_tail;
 
diff -ruN klic-3.003-2001-12-31/runtime/gcode.c klic-3.003-2002-01-01/runtime/gcode.c
--- klic-3.003-2001-12-31/runtime/gcode.c	Mon Dec 31 12:08:39 2001
+++ klic-3.003-2002-01-01/runtime/gcode.c	Mon Dec 31 13:13:15 2001
@@ -19,12 +19,6 @@
 #include "atom.h"
 #include "funct.h"  /* arities, arityof, FUNCTORNUMBERBASE */
 
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
 #define GD_CLASS_NAME() predicate
 #define GD_OBJ_TYPE struct predicate_object
 #define GD_OBJ_SIZE(obj) G_SIZE_IN_Q(GD_OBJ_TYPE)
diff -ruN klic-3.003-2001-12-31/runtime/gfloat.c klic-3.003-2002-01-01/runtime/gfloat.c
--- klic-3.003-2001-12-31/runtime/gfloat.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/gfloat.c	Mon Dec 31 13:13:34 2001
@@ -17,12 +17,6 @@
 #include "atom.h"
 #include "funct.h"
 
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
 #define GD_CLASS_NAME() float
 #define GD_OBJ_TYPE struct float_object
 #define GD_OBJ_SIZE(obj) (G_SIZE_IN_Q(GD_OBJ_TYPE))
diff -ruN klic-3.003-2001-12-31/runtime/ggoal.c klic-3.003-2002-01-01/runtime/ggoal.c
--- klic-3.003-2001-12-31/runtime/ggoal.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/ggoal.c	Mon Dec 31 15:05:33 2001
@@ -12,12 +12,6 @@
 #include "atom.h"
 #include "funct.h"
 
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
 #define GD_CLASS_NAME() goal
 #define GD_OBJ_TYPE struct goal_object
 #define GD_OBJ_SIZE(obj) G_SIZE_IN_Q(GD_OBJ_TYPE)
@@ -26,6 +20,7 @@
 #include <klic/gmodule.h>
 #include <klic/predinfo.h>
 #include <klic/g_vector.h>
+#include "trace.h"  /* untrace_goal */
 
 extern struct data_object_method_table
   predicate_g_data_method_table,
@@ -325,7 +320,6 @@
 {
   declare_globals;
   struct goal_object *obj = (struct goal_object *) allocp;
-  extern int untrace_goal();
   (void) untrace_goal(goal);
   obj->method_table = &goal_g_data_method_table;
   obj->goal = goal;
diff -ruN klic-3.003-2001-12-31/runtime/gmodule.c klic-3.003-2002-01-01/runtime/gmodule.c
--- klic-3.003-2001-12-31/runtime/gmodule.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/gmodule.c	Mon Dec 31 13:14:34 2001
@@ -21,12 +21,6 @@
 #include "atom.h"
 #include "funct.h"
 
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
 #define GD_CLASS_NAME() module
 #define GD_OBJ_TYPE struct module_object
 #define GD_OBJ_SIZE(obj) (sizeof(struct module_object))/sizeof(q)
diff -ruN klic-3.003-2001-12-31/runtime/gstring.c klic-3.003-2002-01-01/runtime/gstring.c
--- klic-3.003-2001-12-31/runtime/gstring.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/gstring.c	Mon Dec 31 13:15:18 2001
@@ -7,16 +7,10 @@
 
 #include <stdio.h>
 #include <ctype.h>
-#include <klic/alloc.h>  /* malloc_check */
-#include <klic/gdobject.h>  /* fatal, debug_printf */
+#include <klic/gdobject.h>  /* malloc_check, fatal, debug_printf */
 #include <klic/g_string.h>
 #include "atom.h"
 #include "funct.h"
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
 
 #ifdef SHM
 #include "shm.h"
diff -ruN klic-3.003-2001-12-31/runtime/gunix.kl1 klic-3.003-2002-01-01/runtime/gunix.kl1
--- klic-3.003-2001-12-31/runtime/gunix.kl1	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/gunix.kl1	Mon Dec 31 13:19:32 2001
@@ -6,7 +6,6 @@
 ----------------------------------------------------------- */
 
 :- inline:"
-#include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <sys/param.h>
diff -ruN klic-3.003-2001-12-31/runtime/interpe.h klic-3.003-2002-01-01/runtime/interpe.h
--- klic-3.003-2001-12-31/runtime/interpe.h	Fri Dec 28 13:46:47 2001
+++ klic-3.003-2002-01-01/runtime/interpe.h	Mon Dec 31 13:20:09 2001
@@ -15,7 +15,7 @@
 extern void* calloc();
 extern void* realloc();
 #endif
-#include <string.h>
+#include <klic/stdc.h>
 
 #include <klic/distpkt.h>
 
diff -ruN klic-3.003-2001-12-31/runtime/intrpt.c klic-3.003-2002-01-01/runtime/intrpt.c
--- klic-3.003-2001-12-31/runtime/intrpt.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/intrpt.c	Mon Dec 31 15:07:42 2001
@@ -18,6 +18,9 @@
 #ifdef SHM
 #include "shm.h"
 #endif
+#ifdef DEBUGLIB
+#include "trace.h"  /* trace_flag, trace_after */
+#endif
 
 int sigint_interrupt = 0;
 
@@ -43,17 +46,13 @@
   declare_globals;
   long retry;
   extern q *klic_signal_handler();
-#ifdef DEBUGLIB
-  extern int trace_flag;
-  extern struct goalrec *trace_after();
-#endif
 
   qp = enqueue_resumed_goals(qp);
 
 #ifdef DEBUGLIB
   {
-    extern int trace_flag, stepping_flag;
-    extern struct goalrec *trace_after(), *step_after();
+    extern int stepping_flag;
+    extern struct goalrec* step_after();
     if (stepping_flag) {
       qp = step_after(qp, allocp);
       allocp = heapp;
diff -ruN klic-3.003-2001-12-31/runtime/kmain.c klic-3.003-2002-01-01/runtime/kmain.c
--- klic-3.003-2001-12-31/runtime/kmain.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/kmain.c	Mon Dec 31 15:02:54 2001
@@ -20,7 +20,6 @@
 #include "timing.h"
 #include <klic/functorstuffs.h>  /* arityof */
 
-#include <string.h>
 #include <stdio.h>
 #include <setjmp.h>
 #include <errno.h>
@@ -33,7 +32,6 @@
 #endif
 
 #ifdef DIST
-/* #include "trace.h" */
 #include <time.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -46,10 +44,14 @@
 q* gc_exp_table();
 q* gc_decode_stack();
 q* scan_imp_table();
-
 #endif
+
 #include "options.h"
 
+#ifdef DEBUGLIB
+#include "trace.h"  /* trace_goal */
+#endif
+
 #define klic_local_fprintf fprintf
 
 
@@ -111,9 +113,6 @@
   void init_virtualized_timer();
   void init_klic_timer_handling();
 #endif
-#ifdef DEBUGLIB
-  extern struct goalrec *trace_goal();
-#endif
 #ifdef SHM
   struct timeval time_before;
   struct timezone tzp;
@@ -267,7 +266,7 @@
 #ifdef DIST
 	  if (IS_MASTER_NODE(my_node))
 #endif
-	    qp = trace_goal(qp, 1, 0);
+	    qp = trace_goal(qp, 1, NULL);
 	  start_tracing = 0;
       }
       initialize_suspension_count_table();
diff -ruN klic-3.003-2001-12-31/runtime/newatom.c klic-3.003-2002-01-01/runtime/newatom.c
--- klic-3.003-2001-12-31/runtime/newatom.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/newatom.c	Mon Dec 31 13:15:34 2001
@@ -13,12 +13,6 @@
 #include <klic/functorstuffs.h>  /* functors, arities, FUNCTORNUMBERBASE */
 #include <klic/newatom.h>
 
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
-
 #define Hashsize 1024
 #define Namesize  1024
 
diff -ruN klic-3.003-2001-12-31/runtime/options.c klic-3.003-2002-01-01/runtime/options.c
--- klic-3.003-2001-12-31/runtime/options.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/options.c	Mon Dec 31 13:20:50 2001
@@ -4,7 +4,7 @@
 %   (C)1996, 1997, 1998, 1999 Japan Information Processing Development Center
 %       (Read COPYRIGHT-JIPDEC for detailed information.)
 ----------------------------------------------------------- */
-#include <string.h>
+
 #include <klic/basic.h>
 #include "options.h"
 static char *
diff -ruN klic-3.003-2001-12-31/runtime/pipedio.c klic-3.003-2002-01-01/runtime/pipedio.c
--- klic-3.003-2001-12-31/runtime/pipedio.c	Thu Dec 27 19:15:57 2001
+++ klic-3.003-2002-01-01/runtime/pipedio.c	Mon Dec 31 13:21:10 2001
@@ -10,7 +10,7 @@
 #include <sys/socket.h>
 #include <stdio.h>
 #include <errno.h>
-#include <string.h>
+#include <klic/stdc.h>
 #include <termios.h>
 #include <unistd.h>
 
diff -ruN klic-3.003-2001-12-31/runtime/print.c klic-3.003-2002-01-01/runtime/print.c
--- klic-3.003-2001-12-31/runtime/print.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/print.c	Mon Dec 31 15:19:19 2001
@@ -15,6 +15,10 @@
 #include "gobj.h"
 #include "susp.h"
 
+#ifdef DEBUGLIB
+#include "trace.h"  /* subterm_sp, fprint_goal */
+#endif
+
 print_partially(x, depth, length)
      q x;
      unsigned long depth, length;
@@ -33,9 +37,6 @@
 {
   declare_globals;
   int leng = length;
-#ifdef DEBUGLIB
-  extern int subterm_sp;
-#endif
 
   deref_and_switch(x, var, atomic, cons, composite);
 
@@ -81,7 +82,7 @@
 	   klic_putc('(', stream);
 	   verbose_print = 0;
 	   subterm_sp = 0;
-	   fprint_goal(stream, u.g, 0);
+	   fprint_goal(stream, u.g, NULL, depth, length, 0);
 	   verbose_print = 1;
 	   klic_putc(')', stream);
 	 }
diff -ruN klic-3.003-2001-12-31/runtime/random.c klic-3.003-2002-01-01/runtime/random.c
--- klic-3.003-2001-12-31/runtime/random.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/random.c	Mon Dec 31 13:33:36 2001
@@ -25,7 +25,6 @@
 static q generate();
 static long print();
 static q *gc();
-q *resume_goals();
 q *do_unify();
 
 GG_OBJ_TYPE {
diff -ruN klic-3.003-2001-12-31/runtime/recsusp.c klic-3.003-2002-01-01/runtime/recsusp.c
--- klic-3.003-2001-12-31/runtime/recsusp.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/recsusp.c	Mon Dec 31 15:15:34 2001
@@ -4,9 +4,12 @@
 %   (C)1996, 1997, 1998, 1999 Japan Information Processing Development Center
 %       (Read COPYRIGHT-JIPDEC for detailed information.)
 ----------------------------------------------------------- */
+
 #include <klic/basic.h>  /* klic_fprinf, klic_putc */
 #include <klic/struct.h>
 #include <stdio.h>
+#include "trace.h"  /* fprint_pred */
+
 #define SUSPTABLESIZE 256
 
 extern char *calloc(), *malloc();
diff -ruN klic-3.003-2001-12-31/runtime/sched.c klic-3.003-2002-01-01/runtime/sched.c
--- klic-3.003-2001-12-31/runtime/sched.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/sched.c	Mon Dec 31 14:53:41 2001
@@ -14,7 +14,7 @@
 
 #include <stdio.h>
 #ifdef DEBUGLIB
-#include "trace.h"
+#include "trace.h"  /* enqueue_trace_rec, trace_enqueued_goals, trace_flag */
 #endif
 #ifdef SHM
 #include <setjmp.h>
@@ -143,18 +143,17 @@
     qp = gp;
   } else {
 #ifdef DEBUGLIB
-    extern int trace_flag;
-    extern struct enqueue_trace_rec *trace_enqueued_goals;
     if (trace_flag) {
-      struct enqueue_trace_rec *tr;
-      tr = (struct enqueue_trace_rec *)
+      struct enqueue_trace_rec* tr;
+      tr = (struct enqueue_trace_rec*)
 	malloc_check(sizeof(struct enqueue_trace_rec));
       tr->next = trace_enqueued_goals;
       tr->g = gp;
       tr->prio = prio;
       trace_enqueued_goals = tr;
-    } else {
+    } else
 #endif
+    {
       struct prioqrec *pq = &prioq;
       while (pq->next->prio > prio) {
 	pq = pq->next;
@@ -180,9 +179,7 @@
 	higher_priority_goal = 1;
 	heaplimit = 0;
       }
-#ifdef DEBUGLIB
     }
-#endif
   }
   return qp;
 }
diff -ruN klic-3.003-2001-12-31/runtime/shm_throw.c klic-3.003-2002-01-01/runtime/shm_throw.c
--- klic-3.003-2001-12-31/runtime/shm_throw.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/shm_throw.c	Mon Dec 31 15:04:06 2001
@@ -15,8 +15,11 @@
 #include "shm.h"
 #include <signal.h>
 
+#ifdef DEBUGLIB
+#include "trace.h"  /* trace_flag, trace_goal */
+#endif
+
 q last_shm_var;
-struct goalrec *trace_goal();
 
 /* throw_goal_routine(qp,gp,Logical_process_number)
 */
@@ -25,7 +28,6 @@
 struct goalrec *qp,*gp;
 {
   declare_globals;
-  extern int trace_flag;
   struct goalrec *ng;
   int k;
   if ( is_shmconnect(N) ) {
@@ -38,7 +40,7 @@
 #ifdef DEBUGLIB
     if (trace_flag) {
       static long throw_trace_count = 0;
-      gp = trace_goal(gp, (num+1)*100000+throw_trace_count,0);
+      gp = trace_goal(gp, (num+1)*100000+throw_trace_count, NULL);
       throw_trace_count++;
     }
 #endif
diff -ruN klic-3.003-2001-12-31/runtime/trace.c klic-3.003-2002-01-01/runtime/trace.c
--- klic-3.003-2001-12-31/runtime/trace.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/trace.c	Mon Dec 31 14:41:48 2001
@@ -12,15 +12,10 @@
 #include <klic/generic.h>
 #include <klic/functorstuffs.h>  /* arityof */
 #include "susp.h"
-#ifdef STRINGH
-#include <string.h>
-#else
-#include <strings.h>
-#endif
 #include <stdio.h>
 #include <setjmp.h>
 
-#include "trace.h"
+#include "trace.h"  /* trace_flag, trace_enqueued_goals, subterm_sp */
 #include "traceio.h"
 #ifdef DIST
 #include <klic/distio.h>
@@ -29,12 +24,48 @@
 #include "shm.h"
 #endif
 
+
+#define Leaping(info)		((info)->leaping)
+#define Spying(info)		((info)->spying)
+#define EnabledPorts(info)	((info)->enabled)
+#define LeashedPorts(info)	((info)->leashed)
+#define Enabled(info,port)	((EnabledPorts(info) >> (int)(port)) & 1)
+#define Leashed(info,port)	((LeashedPorts(info) >> (int)(port)) & 1)
+#define Verbose(info)		((info)->verbose)
+#define Depth(info)		((info)->print_depth)
+#define Length(info)		((info)->print_length)
+
+#define InStream(info)		((info)->in)
+#define OutStream(info)		((info)->out)
+
+
+/* Name Tables */
+
+struct mod_table_entry {
+  module(* func)();
+  const unsigned char* name;
+};
+
+struct pred_table_entry {
+  const struct predicate* pred;
+  const struct mod_table_entry* mte;
+  const unsigned char* name;
+  char spied;
+  char default_trace;
+};
+
+
+/* Trace Control */
+
+enum trace_port { Call, Susp, Redu, Fail, AllPorts, NoMorePort, UnknownPort };
+
+
 extern module wait_penum_routine();
 
-extern char *calloc();
+extern char* calloc();
 extern void free();
 
-static struct trace_info_rec *trace_info_recs;
+static struct trace_info_rec* trace_info_recs;
 static long num_info_recs, info_rec_size;
 
 #define DefaultTraceInfo     (&trace_info_recs[0])
@@ -48,7 +79,7 @@
 /* For remembering goals resumed during reduction */
 
 static int n_resumed;
-static struct goalrec **different_prio_resume;
+static struct goalrec** different_prio_resume;
 static int max_different_prio_resume = 0;
 
 #ifndef DIST
@@ -62,7 +93,8 @@
 #include <sys/socket.h>
 #include <errno.h>
 
-static void open_window(in, out, id)
+static void
+open_window(in, out, id)
      FILE **in, **out;
      long id;
 {
@@ -109,8 +141,8 @@
     *out = fdopen(outfd, "w");
   }
 }
-#endif
-#endif
+#endif  /* XTERM */
+#endif  /* not DIST */
 
 /****************************************
   Predicate and Module Tables
@@ -121,29 +153,35 @@
 
 static unsigned int n_mod, n_pred;
 
-static mod_compare_names(x, y)
+static int
+mod_compare_names(x, y)
      struct mod_table_entry *x, *y;
 {
   return strcmp((char *)x->name, (char *)y->name);
 }
 
-static mod_compare_addr(x, y)
+static int
+mod_compare_addr(x, y)
      struct mod_table_entry **x, **y;
 {
   return (long)(*x)->func - (long)(*y)->func;
 }
 
-static pred_compare_names(x, y)
+static int
+pred_compare_names(x, y)
      struct pred_table_entry *x, *y;
 {
-  int result;
-  if (!(result = strcmp((char *)x->mte->name, (char *)y->mte->name)))
-    if (!(result = strcmp((char *)x->name, (char *)y->name)))
+  int result = strcmp((char*) x->mte->name, (char*) y->mte->name);
+  if( result == 0 ){
+    result = strcmp((char*) x->name, (char*) y->name);
+    if( result == 0 )
       result = x->pred->arity - y->pred->arity;
+  }
   return result;
-}  
+}
 
-static struct mod_table_entry *get_mte(pred)
+static struct mod_table_entry*
+get_mte(pred)
      struct predicate *pred;
 {
   module mod = (module)pred->func;
@@ -153,18 +191,21 @@
   }
   if (mid == high) {
     fprintf(stderr, "get_mte(): not found(bug).\n");  /* for debug */
-    return 0;
+    return NULL;
   } else return mod_index[mid];
 }
 
-static struct pred_hash_entry {
+struct pred_hash_entry {
   struct predicate *pred;
   struct pred_table_entry *pte;
-} *pred_hash;
+};
+
+static struct pred_hash_entry* pred_hash;
 
 static unsigned long pred_hash_mask;
 
-static enter_pred_hash(pred, pte)
+static void
+enter_pred_hash(pred, pte)
      struct predicate *pred;
      struct pred_table_entry *pte;
 {
@@ -176,7 +217,8 @@
   pred_hash[h].pte = pte;
 }  
 
-static struct pred_table_entry *get_pte(pred)
+static struct pred_table_entry*
+get_pte(pred)
      struct predicate *pred;
 {
   long h = ((((unsigned long) pred) >> 2) & pred_hash_mask);
@@ -197,7 +239,8 @@
 
 extern const struct modinfo defined_modules[];
 
-static make_name_tables()
+static void
+make_name_tables()
 {
   declare_globals;
   int k;
@@ -296,9 +339,10 @@
 static module trace_trigger_routine();
 static struct predicate trace_trigger_preds[MAXSTDARGS+1];
 static unsigned int trace_seq;
-struct enqueue_trace_rec *trace_enqueued_goals;
+struct enqueue_trace_rec* trace_enqueued_goals;
 
-void initiate_trace()
+extern void
+initiate_trace()
 {
   int k;
   make_name_tables();
@@ -366,7 +410,8 @@
 #define Traced(g)				\
   ((g)->pred->func == trace_trigger_routine)
 
-struct goalrec *trace_goal(g, seq, info)
+extern struct goalrec*
+trace_goal(g, seq, info)
      struct goalrec *g;
      unsigned int seq;
      struct trace_info_rec *info;
@@ -396,11 +441,12 @@
   }
 }
 
-unsigned int untrace_goal(g)
+extern unsigned
+untrace_goal(g)
      struct goalrec *g;
 {
   if (Traced(g)) {
-    unsigned int real_arity = g->pred->arity-ExtraArgs;
+    unsigned real_arity = g->pred->arity-ExtraArgs;
     g->pred = (struct predicate *)consp(g->args[real_arity]);
     return intval(g->args[real_arity+1]);
   } else {
@@ -408,22 +454,6 @@
   }
 }
 
-/*
-static struct goalrec *
-copy_traced_goal(g)
-     struct goalrec *g;
-{
-  int k;
-  struct goalrec *cg =
-    (struct goalrec *)malloc_check((g->pred->arity+2)*sizeof(q*));
-  cg->pred = g->pred;
-  for (k=0; k!=g->pred->arity; k++) {
-    cg->args[k] = g->args[k];
-  }
-  return cg;
-}
-*/
-
 static int
   call_port_command(), reduce_port_command(),
   susp_port_command(), fail_port_command();
@@ -513,7 +543,8 @@
   return traced_pred->func(glbl, qp, allocp, traced_pred);
 }
 
-struct goalrec *trace_after(qp, allocp)
+extern struct goalrec*
+trace_after(qp, allocp)
      struct goalrec *qp;
      q *allocp;
 {
@@ -571,7 +602,7 @@
   subgoals = k;
   n_resumed = 0;
 
-  if (Enabled(info, Reduce) &&
+  if (Enabled(info, Redu) &&
       (!Leaping(info) || Spying(info))) {
     TRACE_ATTACHIO();
     for (;;) {
@@ -606,7 +637,7 @@
 	  print_priority(tr->prio, info);
 	}
       }
-      if (Leashed(info,Reduce) || Spying(info)) {
+      if (Leashed(info,Redu) || Spying(info)) {
 	if (!reduce_port_command(subgoals, qp, get_mte(parent->pred), &info)) {
 	  break;
 	}
@@ -657,7 +688,8 @@
   return qp;
 }
 
-struct goalrec *trace_susp(qp, reasonp, spontaneous)
+extern struct goalrec*
+trace_susp(qp, reasonp, spontaneous)
      struct goalrec *qp;
      q *reasonp;
      int spontaneous;
@@ -695,6 +727,7 @@
   return qp;
 }
 
+extern void
 trace_resumption(qp)
      struct goalrec *qp;
 {
@@ -712,6 +745,7 @@
   different_prio_resume[n_resumed-1] = qp;
 }
 
+extern void
 trace_failure(qp)
      struct goalrec *qp;
 {
@@ -746,6 +780,7 @@
   trace_flag = 0;
 }
 
+extern void
 trace_deadlock(qp)
      struct goalrec *qp;
 {
@@ -911,7 +946,7 @@
   } port_table[] = {
     { Call, "c" }, { Call, "call" },
     { Susp, "s" }, { Susp, "susp" }, { Susp, "suspend" },
-    { Reduce, "r" }, { Reduce, "redu" }, { Reduce, "reduce" },
+    { Redu, "r" }, { Redu, "redu" }, { Redu, "reduce" },
     { Fail, "f" }, { Fail, "fail"},
     { AllPorts, "a" }, { AllPorts, "all" },
     { UnknownPort, port_name }
@@ -1585,12 +1620,12 @@
   trace_printf(info, "\tenabled:  %c    %c    %c    %c\n",
 	       plusminus[Enabled(info,Call)],
 	       plusminus[Enabled(info,Susp)],
-	       plusminus[Enabled(info,Reduce)],
+	       plusminus[Enabled(info,Redu)],
 	       plusminus[Enabled(info,Fail)]);
   trace_printf(info, "\tleashed:  %c    %c    %c    %c\n",
 	       plusminus[Leashed(info,Call)],
 	       plusminus[Leashed(info,Susp)],
-	       plusminus[Leashed(info,Reduce)],
+	       plusminus[Leashed(info,Redu)],
 	       plusminus[Leashed(info,Fail)]);
 }
 
@@ -1647,6 +1682,7 @@
 
 /* #ifdef DIST */
 #if 0
+static void
 io_print_goal(g, mod, depth, length, verbose)
      struct goalrec *g;
      module mod;
@@ -1678,12 +1714,14 @@
 }
 #endif
 
+static void
 trace_fflush(info)
      struct trace_info_rec *info;
 {
   klic_fflush(OutStream(info));
 }
 
+static void
 trace_printf(info, format, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab)
      struct trace_info_rec *info;
      char *format;
@@ -1693,6 +1731,7 @@
 		a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, aa, ab);
 }
 
+static void
 trace_fgets(buf, n, info)
      char *buf;
      int n;
@@ -1701,6 +1740,7 @@
   klic_fgets(buf, n, InStream(info));
 }
 
+static void
 print_priority(prio, info)
      long prio;
      struct trace_info_rec *info;
@@ -1713,6 +1753,7 @@
   }
 }
 
+static void
 print_goal(g, mod, info)
      struct goalrec *g;
      module mod;
@@ -1727,6 +1768,7 @@
 #endif
 }
 
+extern void
 fprint_goal(stream, g, mod, depth, length, verbose)
      FILE *stream;
      struct goalrec *g;
@@ -1929,7 +1971,7 @@
   }
 }
 
-void
+extern void
 fprint_pred(fp, pred)
      FILE *fp;
      struct predicate *pred;
diff -ruN klic-3.003-2001-12-31/runtime/trace.h klic-3.003-2002-01-01/runtime/trace.h
--- klic-3.003-2001-12-31/runtime/trace.h	Fri Dec 28 13:46:47 2001
+++ klic-3.003-2002-01-01/runtime/trace.h	Mon Dec 31 14:41:43 2001
@@ -8,10 +8,7 @@
 #ifndef _KLIC_TRACE_H_
 #define _KLIC_TRACE_H_
 
-/*
-  Tracer Status Information
-*/
-
+/* Tracer Status Information */
 struct trace_info_rec {
   FILE* in;
   FILE* out;
@@ -21,51 +18,35 @@
   unsigned long print_depth, print_length;
 };
 
-#define Leaping(info)		((info)->leaping)
-#define Spying(info)		((info)->spying)
-#define EnabledPorts(info)	((info)->enabled)
-#define LeashedPorts(info)	((info)->leashed)
-#define Enabled(info,port)	((EnabledPorts(info) >> (int)(port)) & 1)
-#define Leashed(info,port)	((LeashedPorts(info) >> (int)(port)) & 1)
-#define Verbose(info)		((info)->verbose)
-#define Depth(info)		((info)->print_depth)
-#define Length(info)		((info)->print_length)
-
-#define InStream(info)		((info)->in)
-#define OutStream(info)		((info)->out)
-
-/*
-  Info on Enqueued Goals
-*/
-
+/* Info on Enqueued Goals */
 struct enqueue_trace_rec {
   struct enqueue_trace_rec* next;
   struct goalrec* g;
   long prio;
 };
 
-/*
-  Name Tables
-*/
-
-struct mod_table_entry {
-  module(* func)();
-  const unsigned char* name;
-};
 
-struct pred_table_entry {
-  const struct predicate* pred;
-  const struct mod_table_entry* mte;
-  const unsigned char* name;
-  char spied;
-  char default_trace;
-};
+/* trace.c */
 
-/*
-  Trace Control
-*/
+extern struct enqueue_trace_rec* trace_enqueued_goals;
+extern int trace_flag;
+extern int subterm_sp;
+
+extern struct goalrec*
+  trace_goal(struct goalrec* g, unsigned seq, struct trace_info_rec* info);
+
+extern unsigned untrace_goal(struct goalrec* g);
+
+extern struct goalrec* trace_after(struct goalrec* qp, q* allocp);
+extern struct goalrec* trace_susp(struct goalrec* qp, q* reasonp, int spontaneous);
+extern void trace_resumption(struct goalrec* qp);
+extern void trace_failure(struct goalrec* qp);
+extern void trace_deadlock(struct goalrec* qp);
+
+extern void fprint_pred(FILE* fp, struct predicate* pred);
+extern void fprint_goal
+  ( FILE* stream, struct goalrec* g, module mod,
+    unsigned long depth, unsigned long length, int verbose );
 
-enum trace_port {
-  Call, Susp, Reduce, Fail, AllPorts, NoMorePort, UnknownPort };
 
 #endif /* _KLIC_TRACE_H_ */
diff -ruN klic-3.003-2001-12-31/runtime/unify.c klic-3.003-2002-01-01/runtime/unify.c
--- klic-3.003-2001-12-31/runtime/unify.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/unify.c	Mon Dec 31 15:11:25 2001
@@ -13,8 +13,11 @@
 #include <klic/gb.h>
 #include "gobj.h"
 #include "susp.h"
+#include <klic/unify.h>  /* do_unify* */
+#ifdef DEBUGLIB
+#include "trace.h"  /* trace_flag, trace_resumption */
+#endif
 
-q *do_unify(), *do_unify_value();
 extern struct predicate predicate_unify__term__dcode_xunify_2;
 extern struct predicate predicate_unify__term__dcode_xunify__goal_2;
 
@@ -42,7 +45,8 @@
 
 /* Resume a goal with the same priority as current */
 
-Inline void resume_same_prio(gp)
+extern void
+resume_same_prio(gp)
      struct goalrec *gp;
 {
   declare_globals;
@@ -61,7 +65,8 @@
   by the unification with `y'
 */
 
-Inline q *resume_goals(allocp, x, y)
+static Inline q*
+resume_goals(allocp, x, y)
      q * allocp;
      q x;
      q y;
@@ -112,16 +117,9 @@
   } else {
     struct hook *top = susprecord->u.first_hook.next;
     struct hook *loopp = top;
-#ifdef UNIFYDEBUG
-    void dump_suspension_structure();
-    klic_fprintf(stdout, "\nResume with ");
-    print(y);
-    klic_putc('\n', stdout);
-    dump_suspension_structure(top);
-#endif
-  
+
     derefone(susprecord->backpt) = y;
-  
+
     do {
       union goal_or_consumer u;
       u = loopp->u;
@@ -173,7 +171,7 @@
 	} else if (isint(u.g->next)) {
 	  long gp = intval(u.g->next);
 #ifdef DEBUGLIB
-	  extern int stepping_flag, trace_flag;
+	  extern int stepping_flag;
 	  if (stepping_flag) {
 	    extern void step_wokenup();
 	    u.g->next = 0;	/* to nullify deadlock check */
@@ -297,7 +295,8 @@
   return allocp;
 }
 
-q *do_unify(allocp, x, y)
+extern q*
+do_unify(allocp, x, y)
      q * allocp;
      q x, y;
 {
@@ -393,7 +392,8 @@
   return allocp;
 }
 
-q *do_shallow_unify(allocp, x, y)
+extern q*
+do_shallow_unify(allocp, x, y)
      q * allocp;
      q x, y;
 {
@@ -471,7 +471,8 @@
   return allocp;
 }
 
-q *do_unify2(allocp, x, y, z, w)
+extern q*
+do_unify2(allocp, x, y, z, w)
      q *allocp;
      q x, y, z, w;
 {
@@ -479,7 +480,8 @@
   return do_unify(allocp, z, w);
 }
 
-q *do_unify3(allocp, x, y, z, w, s, t)
+extern q*
+do_unify3(allocp, x, y, z, w, s, t)
      q *allocp;
      q x, y, z, w, s, t;
 {
@@ -488,7 +490,8 @@
   return do_unify(allocp, s, t);
 }
 
-q *do_unify4(allocp, x, y, z, w, s, t, u, v)
+extern q*
+do_unify4(allocp, x, y, z, w, s, t, u, v)
      q *allocp;
      q x, y, z, w, s, t, u, v;
 {
@@ -502,7 +505,8 @@
   do_unify_value(allocp, x, y)
 	"do_unify" for when "y" is known to be instantiated.
 */
-q *do_unify_value(allocp, x, y)
+extern q*
+do_unify_value(allocp, x, y)
      q * allocp;
      q x, y;
 {
@@ -536,7 +540,8 @@
   return do_unify(allocp, x, y);
 }
 
-q *do_shallow_unify_value(allocp, x, y)
+extern q*
+do_shallow_unify_value(allocp, x, y)
      q * allocp;
      q x, y;
 {
@@ -570,7 +575,8 @@
   return do_shallow_unify(allocp, x, y);
 }
 
-q *do_unify_value2(allocp, x, y, z, w)
+extern q*
+do_unify_value2(allocp, x, y, z, w)
      q *allocp;
      q x, y, z, w;
 {
@@ -578,7 +584,8 @@
   return do_unify_value(allocp, z, w);
 }
 
-q *do_unify_value3(allocp, x, y, z, w, s, t)
+extern q*
+do_unify_value3(allocp, x, y, z, w, s, t)
      q *allocp;
      q x, y, z, w, s, t;
 {
@@ -587,7 +594,8 @@
   return do_unify_value(allocp, s, t);
 }
 
-q *do_unify_value4(allocp, x, y, z, w, s, t, u, v)
+extern q*
+do_unify_value4(allocp, x, y, z, w, s, t, u, v)
      q *allocp;
      q x, y, z, w, s, t, u, v;
 {
@@ -596,50 +604,3 @@
   allocp = do_unify_value(allocp, s, t);
   return do_unify_value(allocp, u, v);
 }
-
-#ifdef UNIFYDEBUG
-#define dumpgoal(g) \
-{ \
-  if(g){ \
-    klic_fprintf(stdout, "\tgoal:\t"); \
-    klic_fprintf(stdout, \
-		 "%x:%d/%d\n", g->pred->func, g->pred->pred, g->pred->arity); \
-  } else { \
-    klic_fprintf(stdout, "Invalid goal !: %x\n", g); \
-  } \
-}
-
-void
-dump_suspension_structure(x)
-q *x;
-{
-  q *i = x;
-  klic_fprintf(stdout, "Dump suspension structure : %x\n", x);
-  do{
-    switch(ptagof(*i)){
-     case SSUSP:
-      {
-	struct shook *s = shookp(i);
-	struct goalrec *g = s->goals;
-	klic_fprintf(stdout, "Single suspension record : %x\n", s);
-	dumpgoal(g);
-      }
-      break;
-     case MSUSP:
-      {
-	struct mhook *m = mhookp(i);
-	struct goalrec *g = m->goals;
-	klic_fprintf(stdout, "Multiple suspension record : %x\n", m);
-	dumpgoal(g);
-	klic_fprintf(stdout, "back pointer:\t");
-	klic_fprintf(stdout, "%x\n", m->back);
-	klic_fprintf(stdout, "related record:\t%x\n", m->next);
-      }
-      break;
-     default:
-      klic_fprintf(stdout, "Merger\n");
-    }
-    i = (q*)getnexthook(i);
-  }while(getnexthook(i) != x);
-}
-#endif
diff -ruN klic-3.003-2001-12-31/runtime/unify2.c klic-3.003-2002-01-01/runtime/unify2.c
--- klic-3.003-2001-12-31/runtime/unify2.c	Sat Dec 29 12:46:20 2001
+++ klic-3.003-2002-01-01/runtime/unify2.c	Mon Dec 31 13:27:53 2001
@@ -18,15 +18,16 @@
   General Guard Unification
 
   return value:
-  0 : failed
-  1 : succeeded
+  0 : succeeded
+  1 : failed
   other : suspended
 */
 
 #define SUCCEEDED ((q)0)
 #define FAILED ((q)1)
 
-q eq_terms_body(x,y)
+extern q
+eq_terms_body(x,y)
      q x, y;
 {
  loop_entry:
@@ -41,8 +42,8 @@
       long i;
       long size = arity - 1;
       for(i=0; i<size; ++i){
-	q retval;
-	if ((retval = eq_terms_body(arg(x, i), arg(y, i))) != SUCCEEDED) {
+	q retval = eq_terms_body(arg(x, i), arg(y, i));
+	if (retval != SUCCEEDED) {
 	  return retval;
 	}
       }
@@ -59,8 +60,8 @@
  x_cons:
   deref_and_switch(y, susp_y, fail, cons_ok, fail);
   cons_ok: {
-    q retval;
-    if ((retval = eq_terms_body(car_of(x), car_of(y))) == SUCCEEDED) {
+    q retval = eq_terms_body(car_of(x), car_of(y));
+    if (retval == SUCCEEDED) {
       x = cdr_of(x);
       y = cdr_of(y);
       goto loop_entry;
diff -ruN klic-3.003-2001-12-31/runtime/xio.c klic-3.003-2002-01-01/runtime/xio.c
--- klic-3.003-2001-12-31/runtime/xio.c	Mon Dec 31 12:04:47 2001
+++ klic-3.003-2002-01-01/runtime/xio.c	Mon Dec 31 13:05:20 2001
@@ -9,14 +9,7 @@
 #include <stdio.h>
 #include <errno.h>
 
-#ifdef STDDEFH
-#include <stddef.h>
-#else
-#ifndef _SIZE_T
-typedef unsigned int   size_t;
-#define _SIZE_T
-#endif
-#endif
+#include <klic/stdc.h>  /* size_t */
 
 #ifdef DIST
 #include <klic/distio.h>
