diff -ruN klic-3.003-2002-01-06/runtime/print.c klic-3.003-2002-01-06a/runtime/print.c
--- klic-3.003-2002-01-06/runtime/print.c	Tue Jan  1 14:17:47 2002
+++ klic-3.003-2002-01-06a/runtime/print.c	Sun Jan  6 13:30:38 2002
@@ -17,23 +17,15 @@
 
 #ifdef DEBUGLIB
 #include "trace.h"  /* subterm_sp, fprint_goal */
-#endif
 
-print_partially(x, depth, length)
-     q x;
-     unsigned long depth, length;
-{
-  fprint_partially(stdout, x, depth, length);
-}
-
-#ifdef DEBUGLIB
 int verbose_print;
 #endif
 
+extern void
 fprint_partially(stream, x, depth, length)
-     FILE *stream;
-     q x;
-     unsigned long depth, length;
+  FILE* stream;
+  q x;
+  unsigned long depth, length;
 {
   declare_globals;
   int leng = length;
@@ -41,16 +33,16 @@
   deref_and_switch(x, var, atomic, cons, composite);
 
  atomic:
-  switch (atagof(x)) {
+  switch( atagof(x) ){
   case INT:
     klic_fprintf(stream, "%ld", intval(x));
     return;
   case SYM:
-    if (x == NILATOM) {
+    if( x == NILATOM ){
       klic_fprintf(stream, "[]");
-    } else if (x == PERIODATOM) {
+    }else if( x == PERIODATOM ){
       klic_fprintf(stream, ".");
-    } else {
+    }else{
       klic_fprintf(stream, "%s", namestringof(x));
     }
     return;
@@ -59,62 +51,63 @@
  var:
   klic_fprintf(stream, "_%X", (q*)x-new_space_top);
 #ifdef DEBUGLIB
- if (verbose_print) {
-   if (derefone(x) != x) {
-     struct susprec *susp = suspp(derefone(x));
-     if (is_generator_susp(susp->u)) {
-       struct generator_object *gobj =
-	 untag_generator_susp(generator_suspp(susp)->u.o);
-       klic_putc('(', stream);
-       verbose_print = 0;
-       subterm_sp = 0;
-       method_table_of(gobj)->print(gobj, stream, depth, length);
-       verbose_print = 1;
-       klic_putc(')', stream);
-     } else {
-       struct hook *second_hook = susp->u.first_hook.next;
-       struct hook *loophook = second_hook;
-      
-       do {
-	 union goal_or_consumer u;
-	 u = loophook->u;
-	 if (u.l != 0 && !is_consumer_hook(u) && isint(u.g->next)) {
-	   klic_putc('(', stream);
-	   verbose_print = 0;
-	   subterm_sp = 0;
-	   fprint_goal(stream, u.g, NULL, depth, length, 0);
-	   verbose_print = 1;
-	   klic_putc(')', stream);
-	 }
-	 loophook = loophook->next;
-       } while (loophook != second_hook);
-     }
-   }
- }
+  if( verbose_print ){
+    if( derefone(x) != x ){
+      struct susprec* susp = suspp(derefone(x));
+      if( is_generator_susp(susp->u) ){
+	struct generator_object* gobj =
+	  untag_generator_susp(generator_suspp(susp)->u.o);
+	klic_putc('(', stream);
+	verbose_print = 0;
+	subterm_sp = 0;
+	method_table_of(gobj)->print(gobj, stream, depth, length);
+	verbose_print = 1;
+	klic_putc(')', stream);
+      }else{
+	struct hook* second_hook = susp->u.first_hook.next;
+	struct hook* loophook = second_hook;
+
+	do{
+	  union goal_or_consumer u;
+	  u = loophook->u;
+	  if( u.l != 0 && !is_consumer_hook(u) && isint(u.g->next) ){
+	    klic_putc('(', stream);
+	    verbose_print = 0;
+	    subterm_sp = 0;
+	    fprint_goal(stream, u.g, NULL, depth, length, 0);
+	    verbose_print = 1;
+	    klic_putc(')', stream);
+	  }
+	  loophook = loophook->next;
+	}while( loophook != second_hook );
+      }
+    }
+  }
 #endif
   return;
-  
-  cons:
+
+ cons:
 #ifdef GCDEBUG
-    klic_fprintf(stream, " %x", x);
+  klic_fprintf(stream, " %x", x);
 #endif
-    klic_fprintf(stream, "[");
-    if(depth ==0){
-      klic_fprintf(stream, "..]");
-      return;
-    }
-    while (1) {
-      fprint_partially(stream, car_of(x), depth-1, length);
-      x = cdr_of(x);
-      deref_and_switch(x, othercdr, atomiccdr, conscdr, othercdr);
+  klic_fprintf(stream, "[");
+  if( depth == 0 ){
+    klic_fprintf(stream, "..]");
+    return;
+  }
+  for(;;){
+    fprint_partially(stream, car_of(x), depth-1, length);
+    x = cdr_of(x);
+    deref_and_switch(x, othercdr, atomiccdr, conscdr, othercdr);
   conscdr:
-      klic_fprintf(stream, ",");
-      if(--leng) continue;
-      klic_fprintf(stream, "..");
-      goto listtail;
+    klic_fprintf(stream, ",");
+    leng--;
+    if( leng != 0 ) continue;
+    klic_fprintf(stream, "..");
+    goto listtail;
   }
  atomiccdr:
-  if (issym(x) && symval(x) == 0) goto listtail;
+  if( issym(x) && symval(x) == 0 ) goto listtail;
  othercdr:
   klic_fprintf(stream, "|");
   fprint_partially(stream, x, depth-1, length);
@@ -129,16 +122,16 @@
 #ifdef GCDEBUG
     klic_fprintf(stream, " %x", x);
 #endif
-    if (isatomic(f)) {
+    if( isatomic(f) ){
       klic_fprintf(stream, "%s(",functoratomname(f));
-      if(depth == 0) {
+      if( depth == 0 ){
 	klic_fprintf(stream, "..)");
 	return;
       }
-      for (i = 0; i < arityof(f)-1; i++) {
+      for( i = 0; i < arityof(f)-1; i++ ){
 	fprint_partially(stream, arg(x,i), depth-1, length);
 	klic_fprintf(stream, ",");
-	if(i>length){
+	if( i>length ){
 	  klic_fprintf(stream, "..");
 	  goto funct_tail;
 	}
@@ -146,41 +139,44 @@
       fprint_partially(stream, arg(x,arityof(f)-1), depth-1, length);
     funct_tail:
       klic_fprintf(stream, ")");
-    }else if(isref(f)){
-      generic_print(((struct data_object *)(functorp(x))),
+    }else if( isref(f) ){
+      generic_print((struct data_object*) functorp(x),
 		    stream, depth, length);
-    } else {
+    }else{
       klic_fprintf(stderr, "Invalid functor : %x\n", f);
     }
   }
-
   return;
 }
 
+extern void
 fprint(stream, x)
-     FILE *stream;
-     q x;
+  FILE* stream;
+  q x;
 {
-  fprint_partially(stream, x, (unsigned long)-1, (unsigned long)-1);
+  fprint_partially(stream, x, -1uL, -1uL);
 }
-     
+
+extern void
 print(x)
   q x;
 {
-  fprint_partially(stdout, x, (unsigned long)-1, (unsigned long)-1);
+  fprint_partially(stdout, x, -1uL, -1uL);
 }
 
-void printl(x)
-q x;
+extern void
+printl(x)
+  q x;
 {
   print(x);
   klic_putc('\n',stdout);
 }
 
+extern void
 general_print(a, stream, depth, length)
-     q *a;
-     FILE *stream;
-     unsigned long depth, length;
+  q* a;
+  FILE* stream;
+  unsigned long depth, length;
 {
   fprint_partially(stream, a, depth, length);
 }
diff -ruN klic-3.003-2002-01-06/runtime/profile.c klic-3.003-2002-01-06a/runtime/profile.c
--- klic-3.003-2002-01-06/runtime/profile.c	Sun Jan  6 12:04:02 2002
+++ klic-3.003-2002-01-06a/runtime/profile.c	Sun Jan  6 13:29:43 2002
@@ -16,13 +16,14 @@
 #include "interpe.h"
 #include "rmon.h"
 
+extern void output_profile_information();
+
 static int gather_prof_ready = 1;
 
 /*
  * Profiler support routines
  * static q* decode_send_profile(inbuf, allocp)
  * static void encode_send_profile(buffer)
- * int send_profile(allocp, sig)
  * int send_profile_signal(allocp, sig)
  */
 
@@ -30,120 +31,122 @@
   SEND_PROFILE (from WORKERs to SHOEN)
   */
 
-void output_profile_information();
-
 static q*
 decode_send_profile(inbuf, allocp)
-combuf *inbuf;
-q *allocp;
+  combuf* inbuf;
+  q* allocp;
 {
   static int gathered_count = 0;
-    declare_globals;
-    long node;
-    node = GET_BUFFER(inbuf);
-
-    shoen_profile[node].stimes = GET_BUFFER(inbuf);
-    shoen_profile[node].itimes = GET_BUFFER(inbuf);
-    shoen_profile[node].gctimes = GET_BUFFER(inbuf);
-    shoen_profile[node].mstimes = GET_BUFFER(inbuf);
-    shoen_profile[node].mrtimes = GET_BUFFER(inbuf);
-    gathered_count++;
-
-    if(gathered_count == total_node){
-	output_profile_information(); /* This routine is machine dependent */
-	gathered_count = 0;
-	gather_prof_ready = 1;
-    }
 
-    return(allocp);
+  declare_globals;
+  long node;
+  node = GET_BUFFER(inbuf);
+
+  shoen_profile[node].stimes = GET_BUFFER(inbuf);
+  shoen_profile[node].itimes = GET_BUFFER(inbuf);
+  shoen_profile[node].gctimes = GET_BUFFER(inbuf);
+  shoen_profile[node].mstimes = GET_BUFFER(inbuf);
+  shoen_profile[node].mrtimes = GET_BUFFER(inbuf);
+  gathered_count++;
+
+  if( gathered_count == total_node ){
+    output_profile_information();  /* This routine is machine dependent */
+    gathered_count = 0;
+    gather_prof_ready = 1;
+  }
+
+  return allocp;
 }
 
 static void
 encode_send_profile(buffer)
-combuf *buffer;
+  combuf* buffer;
 {
-    declare_globals;
-/*    iosprintf("Node %d: encode_send_profile it_c = %d, id_c = %d gc_c = %d, ms_c = %d, mr_c = %d\n",
-		 my_node,intr_count,perfmon_counter.idle_count,perfmon_counter.gc_count,perfmon_counter.ms_count,perfmon_counter.mr_count);*/
-
-    PUT_BUFFER(buffer, decode_send_profile);
-    PUT_BUFFER(buffer, my_node);
-    PUT_BUFFER(buffer, perfmon_counter.intr_count);
-    PUT_BUFFER(buffer, perfmon_counter.idle_count);
-    PUT_BUFFER(buffer, perfmon_counter.gc_count);
-    PUT_BUFFER(buffer, perfmon_counter.ms_count);
-    PUT_BUFFER(buffer, perfmon_counter.mr_count);
-
-    perfmon_counter.intr_count = 0;
-    perfmon_counter.idle_count = 0;
-    perfmon_counter.gc_count = 0;
-    perfmon_counter.ms_count = 0;
-    perfmon_counter.mr_count = 0;
+  declare_globals;
+  /* iosprintf("Node %d: encode_send_profile" \
+   *   "it_c = %d, id_c = %d gc_c = %d, ms_c = %d, mr_c = %d\n",
+   *   my_node, intr_count, perfmon_counter.idle_count,
+   *   perfmon_counter.gc_count, perfmon_counter.ms_count,
+   *   perfmon_counter.mr_count );
+   */
+
+  PUT_BUFFER(buffer, decode_send_profile);
+  PUT_BUFFER(buffer, my_node);
+  PUT_BUFFER(buffer, perfmon_counter.intr_count);
+  PUT_BUFFER(buffer, perfmon_counter.idle_count);
+  PUT_BUFFER(buffer, perfmon_counter.gc_count);
+  PUT_BUFFER(buffer, perfmon_counter.ms_count);
+  PUT_BUFFER(buffer, perfmon_counter.mr_count);
+
+  perfmon_counter.intr_count = 0;
+  perfmon_counter.idle_count = 0;
+  perfmon_counter.gc_count = 0;
+  perfmon_counter.ms_count = 0;
+  perfmon_counter.mr_count = 0;
 }
 
-void
+extern int
 send_profile()
 {
-    declare_globals;
-    combuf *buffer = NODE_TO_BUFFER(SHOEN_NODE);
-    
-    INT_CL_DEBUG_X(ioprintf("%d:send_message\n", my_node));
-    
-    encode_send_profile(buffer);
-    
-    /* Cannot use send_message routine, 
-       because it may send request_wtc message after sending the message. */
-    
-    send_message_without_wtc_chk(SHOEN_NODE, buffer);
+  declare_globals;
+  combuf* buffer = NODE_TO_BUFFER(SHOEN_NODE);
+
+  INT_CL_DEBUG_X(ioprintf("%d:send_message\n", my_node));
+
+  encode_send_profile(buffer);
 
+  /* Cannot use send_message routine,
+   * because it may send request_wtc message after sending the message. */
+
+  send_message_without_wtc_chk(SHOEN_NODE, buffer);
+  return 0;
 }
 
 
-/* 
+/*
   SEND_PROFILE_TRIGGER (from WORKERs to SHOEN)
   */
 
 static q*
 decode_profile_trigger(inbuf, allocp)
-combuf *inbuf;
-q *allocp;
+  combuf* inbuf;
+  q* allocp;
 {
-    send_profile();
-    return(allocp);
+  send_profile();
+  return allocp;
 }
 
-static
-void encode_profile_trigger(buffer)
-combuf *buffer;
+static void
+encode_profile_trigger(buffer)
+  combuf* buffer;
 {
-    PUT_BUFFER(buffer, decode_profile_trigger);
+  PUT_BUFFER(buffer, decode_profile_trigger);
 }
 
-void
+static void
 send_profile_trigger_message(node)
-     long node;
+  long node;
 {
-    combuf *buffer = NODE_TO_BUFFER(node);
-    encode_profile_trigger(buffer);
-    send_message_without_wtc_chk(node, buffer);
+  combuf* buffer = NODE_TO_BUFFER(node);
+  encode_profile_trigger(buffer);
+  send_message_without_wtc_chk(node, buffer);
 }
 
-int
+extern int
 send_profile_trigger(allocp, sig)
-q *allocp;
-int sig;
+  q* allocp;
+  int sig;
 {
-    declare_globals;
-    long i;
+  declare_globals;
+  long i;
 
-    if (gather_prof_ready) {
-	for (i = 0; i < total_node ; i++){
-	    send_profile_trigger_message(i);
-	}
-	gather_prof_ready = 0;
+  if( gather_prof_ready ){
+    for( i = 0; i < total_node; i++ ){
+      send_profile_trigger_message(i);
     }
+    gather_prof_ready = 0;
+  }
 
-    heapp = allocp;
-    return 0;
+  heapp = allocp;
+  return 0;
 }
-
diff -ruN klic-3.003-2002-01-06/runtime/random.c klic-3.003-2002-01-06a/runtime/random.c
--- klic-3.003-2002-01-06/runtime/random.c	Tue Jan  1 14:17:47 2002
+++ klic-3.003-2002-01-06a/runtime/random.c	Sun Jan  6 13:29:43 2002
@@ -7,9 +7,9 @@
 /*
   random number generator
 */
-#include <klic/basic.h>  /* fatalf */
 
 #ifdef NRAND48
+#include <klic/basic.h>  /* fatalf */
 #include <klic/struct.h>
 #include <klic/g_methtab.h>
 #include <klic/g_basic.h>
@@ -21,14 +21,8 @@
 #define GG_CLASS_NAME()		random__numbers
 #define GG_OBJ_TYPE		struct random_number_generator
 
-static q *unify();
-static q generate();
-static long print();
-static q *gc();
-q *do_unify();
-
 GG_OBJ_TYPE {
-  struct generator_object_method_table *method_table;
+  struct generator_object_method_table* method_table;
   long range;
   long max;
   unsigned short state[3];
@@ -47,16 +41,16 @@
   q res;
   q var;
   long one_random;
-  struct generator_susp *s;
+  struct generator_susp* s;
 
   GG_TRY_TO_ALLOC(cons, makecons, 2, gc_request);
   GG_TRY_TO_ALLOC(var, makeref, 1, gc_request);
-  GG_TRY_TO_ALLOC(s, (struct generator_susp *),
+  GG_TRY_TO_ALLOC(s, (struct generator_susp*),
 		  sizeof(struct generator_susp)/sizeof(q), gc_request);
 
-  do {
+  do{
     one_random = nrand48(GG_SELF->state);
-  } while (one_random >= GG_SELF->max);
+  }while( one_random >= GG_SELF->max );
 
   car_of(cons) = makeint(one_random % GG_SELF->range);
   derefone(var) = makeref(s);
@@ -80,8 +74,8 @@
 GGDEF_GC()
 {
   G_STD_DECL;
-  q *newself = g_allocp;
-  
+  q* newself = g_allocp;
+
   BCOPY(GG_SELF, g_allocp, sizeof(GG_OBJ_TYPE));
   g_allocp += sizeof(GG_OBJ_TYPE)/sizeof(q);
   gcsp = g_sp;
@@ -106,26 +100,26 @@
   GG_STD_DECL_FOR_NEW;
   q res;
   q var;
-  GG_OBJ_TYPE *obj;
+  GG_OBJ_TYPE* obj;
   long seed;
   long range;
 
-  if (GG_ARGC < 1 || GG_ARGC > 2) {
+  if( GG_ARGC < 1 || 2 < GG_ARGC ){
     fatalf("Wrong number of arguments (%d) in creation of random number generator",
 	   GG_ARGC);
   }
 
   GGSET_INTARG_FOR_NEW(range, GG_ARGV[0]);
-  if (GG_ARGC > 1) {
+  if( GG_ARGC > 1 ){
     GGSET_INTARG_FOR_NEW(seed, GG_ARGV[1]);
-  } else {
+  }else{
     seed = 0;
   }
-  if (range <1) {
+  if( range <1 ){
     fatalf("Invalid first argument (%d) in creation of random number generator",
 	   range);
   }
-  GGSET_NEWOBJ_FOR_NEW(obj, (GG_OBJ_TYPE *));
+  GGSET_NEWOBJ_FOR_NEW(obj, (GG_OBJ_TYPE*));
 
   obj->state[0] = seed >> (sizeof(seed)*4);
   obj->state[1] = seed >> (sizeof(seed)*2);
@@ -134,4 +128,4 @@
   obj->max = ((((unsigned long)(~0))<<1)>>1)/range*range;
   GG_RETURN_FROM_NEW(GG_MAKE_HOOK_VAR(obj));
 }
-#endif
+#endif  /* NRAND48 */
diff -ruN klic-3.003-2002-01-06/runtime/recsusp.c klic-3.003-2002-01-06a/runtime/recsusp.c
--- klic-3.003-2002-01-06/runtime/recsusp.c	Tue Jan  1 14:17:47 2002
+++ klic-3.003-2002-01-06a/runtime/recsusp.c	Sun Jan  6 13:29:43 2002
@@ -17,23 +17,24 @@
 struct susp_count_ent {
   const struct predicate* pred;
   long counter;
-  struct susp_count_ent *next;
+  struct susp_count_ent* next;
 };
 
-static struct susp_count_ent *suspension_count_table[SUSPTABLESIZE];
-static struct susp_count_ent *free_ent = 0;
+static struct susp_count_ent* suspension_count_table[SUSPTABLESIZE];
+static struct susp_count_ent* free_ent = NULL;
 static int susp_count_ent_num = 0;
 
-static Inline struct susp_count_ent *
-allocate_count_ent_bulk() {
-  struct susp_count_ent *ent = 
-    (struct susp_count_ent *)
+static Inline struct susp_count_ent*
+allocate_count_ent_bulk()
+{
+  struct susp_count_ent* ent =
+    (struct susp_count_ent*)
       calloc(SUSPTABLESIZE, sizeof(struct susp_count_ent));
-  struct susp_count_ent *top = ent;
+  struct susp_count_ent* top = ent;
   int i;
 
-  for (i = 0; i < SUSPTABLESIZE-1; ++i) {
-    struct susp_count_ent *next = ent+1;
+  for( i = 0; i < SUSPTABLESIZE-1; ++i ){
+    struct susp_count_ent* next = ent+1;
     ent->next = next;
     ent = next;
   }
@@ -41,11 +42,12 @@
   return top;
 }
 
-static Inline struct susp_count_ent *
-alloc_ent() {
-  struct susp_count_ent *tmp;
+static Inline struct susp_count_ent*
+alloc_ent()
+{
+  struct susp_count_ent* tmp;
   ++susp_count_ent_num;
-  if (!free_ent) {
+  if( free_ent == NULL ){
     free_ent = allocate_count_ent_bulk();
   }
   tmp = free_ent;
@@ -56,24 +58,24 @@
 
 static Inline unsigned long
 hash_pred(pred)
-     struct predicate *pred;
+  struct predicate* pred;
 {
   return ((unsigned long)pred >> 3) % SUSPTABLESIZE;
 }
 
-void
+extern void
 record_suspended_pred(goal)
-     struct goalrec *goal;
+  struct goalrec* goal;
 {
   const struct predicate* pred = goal->pred;
   unsigned int key = hash_pred(pred);
-  
-  if (suspension_count_table[key]) {
-    struct susp_count_ent *ent;
-    for (ent = suspension_count_table[key];
-	 ent != 0;
-	 ent = ent->next) {
-      if (ent->pred == pred) {
+
+  if( suspension_count_table[key] != NULL ){
+    struct susp_count_ent* ent;
+    for( ent = suspension_count_table[key];
+	 ent != NULL;
+	 ent = ent->next ){
+      if( ent->pred == pred ){
 	ent->counter++;
 	return;
       }
@@ -81,7 +83,7 @@
   }
   /* the predicate has not been registered yet */
   {	
-    struct susp_count_ent *newent = alloc_ent();
+    struct susp_count_ent* newent = alloc_ent();
     newent->pred = pred;
     newent->next = suspension_count_table[key];
     suspension_count_table[key] = newent;
@@ -90,39 +92,41 @@
 
 static int
 entcomp(a, b)
-     struct susp_count_ent **a;
-     struct susp_count_ent **b;
+  const struct susp_count_ent** a;
+  const struct susp_count_ent** b;
 {
   return (*b)->counter - (*a)->counter;
 }
 
-void scan_suspended_pred() {
-  struct susp_count_ent **sort_table;
-  struct susp_count_ent **sptr;
-
-  if(susp_count_ent_num) {
-    sort_table = (struct susp_count_ent **)
-      malloc(sizeof(struct susp_count_ent *) * susp_count_ent_num);
+extern void
+scan_suspended_pred()
+{
+  struct susp_count_ent** sort_table;
+  struct susp_count_ent** sptr;
+
+  if( susp_count_ent_num > 0 ){
+    sort_table = (struct susp_count_ent**)
+      malloc(sizeof(struct susp_count_ent*) * susp_count_ent_num);
     sptr = sort_table;
     {
       int i;
-      struct susp_count_ent *ent;
+      struct susp_count_ent* ent;
 
-      for (i=0; i<SUSPTABLESIZE; ++i) {
+      for( i=0; i<SUSPTABLESIZE; ++i ){
 	ent = suspension_count_table[i];
-	while(ent) {
+	while( ent != NULL ){
 	  *sptr++ = ent;
 	  ent = ent->next;
 	}
       }
 
       qsort(sort_table, susp_count_ent_num,
-	    sizeof(struct susp_count_ent *), entcomp);
+	    sizeof(struct susp_count_ent*), entcomp);
 
       {
 	int i;
-	struct susp_count_ent **ent = sort_table;
-	for (i=0; i<susp_count_ent_num; ++i, ++ent) {
+	struct susp_count_ent** ent = sort_table;
+	for( i=0; i<susp_count_ent_num; ++i, ++ent ){
 	  klic_fprintf(stderr, "%8d: ", (*ent)->counter);
 	  fprint_pred(stderr, (*ent)->pred);
 	  klic_putc('\n', stderr);
@@ -132,10 +136,11 @@
   }
 }
 
-void
-initialize_suspension_count_table() {
+extern void
+initialize_suspension_count_table()
+{
   int i;
-  for (i=0; i<SUSPTABLESIZE; ++i) {
-    suspension_count_table[i] = 0;
+  for( i=0; i<SUSPTABLESIZE; ++i ){
+    suspension_count_table[i] = NULL;
   }
 }
