diff -ruN klic-3.003-2001-11-19/FOR-DEVELOPERS.j klic-3.003-2001-11-20/FOR-DEVELOPERS.j
--- klic-3.003-2001-11-19/FOR-DEVELOPERS.j	Fri Jul 28 11:01:40 2000
+++ klic-3.003-2001-11-20/FOR-DEVELOPERS.j	Mon Nov 19 10:17:40 2001
@@ -38,7 +38,7 @@
 れる.cファイルなどを消す。つまり、KLICコンパイラがないともうKLICを再度
 installすることはできない。
 
-・make veryfy: 現在の.cファイルと、compiler ディレクトリにあるcompiler
+・make verify: 現在の.cファイルと、compiler ディレクトリにあるcompiler
 でコンパイルした.cファイルとを比較する。違いがある時には要注意。
 
 							以上
diff -ruN klic-3.003-2001-11-19/Makefile.tail klic-3.003-2001-11-20/Makefile.tail
--- klic-3.003-2001-11-19/Makefile.tail	Thu May  3 23:23:53 2001
+++ klic-3.003-2001-11-20/Makefile.tail	Mon Nov 19 10:11:24 2001
@@ -264,7 +264,7 @@
 distclean:
 	cd compiler; $(MAKE) distclean
 	cd include; $(MAKE) distclean
-	cd runtime; $(MAKE) distclean LN="$(LN)"
+	cd runtime; $(MAKE) distclean LN="$(LN)" DLLIBS="$(DLLIBS)"
 	cd test; $(MAKE) distclean
 	cd disttest; $(MAKE) distclean
 	cd shmtest; $(MAKE) distclean
@@ -277,7 +277,7 @@
 realclean:
 	cd compiler; $(MAKE) realclean
 	cd include; $(MAKE) realclean
-	cd runtime; $(MAKE) realclean LN="$(LN)"
+	cd runtime; $(MAKE) realclean LN="$(LN)" DLLIBS="$(DLLIBS)"
 	cd test; $(MAKE) realclean
 	cd disttest; $(MAKE) realclean
 	cd shmtest; $(MAKE) realclean
diff -ruN klic-3.003-2001-11-19/README.j klic-3.003-2001-11-20/README.j
--- klic-3.003-2001-11-19/README.j	Fri Jul 28 11:01:40 2000
+++ klic-3.003-2001-11-20/README.j	Mon Nov 19 10:21:05 2001
@@ -138,7 +138,7 @@
 
 [4] $B%U%!%$%k(B
 
-$B%U%!%$%k$K$D$$$F$O(B MANIFEST $B$H8fMw2<$5$$(B.
+$B%U%!%$%k$K$D$$$F$O(B MANIFEST $B$r8fMw2<$5$$(B.
 
 [5] $B%$%s%9%H!<%k(B
 
diff -ruN klic-3.003-2001-11-19/include/klic/alloc.h klic-3.003-2001-11-20/include/klic/alloc.h
--- klic-3.003-2001-11-19/include/klic/alloc.h	Sun Nov 18 21:21:45 2001
+++ klic-3.003-2001-11-20/include/klic/alloc.h	Mon Nov 19 20:57:23 2001
@@ -8,19 +8,19 @@
 #ifndef _KLIC_ALLOC_H_
 #define _KLIC_ALLOC_H_
 
-q *klic_interrupt();
+extern q *klic_interrupt();
 
 /* Reverse allocation from "heaptop" */
 
-#define revalloc(s, words, maketype)\
-{\
-  (s) = maketype(heapbottom -= (words));\
-  real_heaplimit -= (words);\
-  if (heaplimit && interrupt_off) heaplimit = real_heaplimit;\
+#define revalloc(s, words, maketype) \
+do{ \
+  (s) = maketype(heapbottom -= (words)); \
+  real_heaplimit -= (words); \
+  if (heaplimit && interrupt_off) heaplimit = real_heaplimit; \
   else heaplimit = 0; \
-}
+}while(0)
 
-#define heapalloc(s, words, maketype)\
-  revalloc(s, words, maketype)
+#define heapalloc(s, words, maketype) \
+  revalloc((s), (words), maketype)
 
 #endif /* _KLIC_ALLOC_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/atomstuffs.h klic-3.003-2001-11-20/include/klic/atomstuffs.h
--- klic-3.003-2001-11-19/include/klic/atomstuffs.h	Sun Nov 18 21:22:35 2001
+++ klic-3.003-2001-11-20/include/klic/atomstuffs.h	Mon Nov 19 11:20:14 2001
@@ -11,7 +11,7 @@
 /* atomnumber staffs */
 extern unsigned char **atomname;
 #define ATOMNUMBERBASE 2
-#define functoratomname(f) atomname[functoratom(f) - ATOMNUMBERBASE]
-#define namestringof(a) atomname[symval(a) - ATOMNUMBERBASE]
+#define functoratomname(f)  (atomname[functoratom(f) - ATOMNUMBERBASE])
+#define namestringof(a)  (atomname[symval(a) - ATOMNUMBERBASE])
 
 #endif /* _KLIC_ATOMSTUFFS_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/basic.h klic-3.003-2001-11-20/include/klic/basic.h
--- klic-3.003-2001-11-19/include/klic/basic.h	Sun Nov 18 21:22:56 2001
+++ klic-3.003-2001-11-20/include/klic/basic.h	Mon Nov 19 11:22:38 2001
@@ -12,8 +12,8 @@
 
 #ifdef MAIN
 #define Extern
-#define Init(x)		= x
-#define Size(size)	size
+#define Init(x)		= (x)
+#define Size(size)	(size)
 #else
 #define Extern		extern
 #define Init(x)
@@ -46,10 +46,7 @@
 /*
   PARALLEL flag is DIST || SHM.
 */
-#ifdef DIST
-#define PARALLEL
-#endif
-#ifdef SHM
+#if defined(DIST) || defined(SHM)
 #define PARALLEL
 #endif
 
diff -ruN klic-3.003-2001-11-19/include/klic/bb.h klic-3.003-2001-11-20/include/klic/bb.h
--- klic-3.003-2001-11-19/include/klic/bb.h	Sun Nov 18 21:23:14 2001
+++ klic-3.003-2001-11-20/include/klic/bb.h	Mon Nov 19 12:16:33 2001
@@ -17,47 +17,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_add(x, y, z)					\
-{ z = bblt_add_3(x, y); }
+do{ (z) = bblt_add_3((x), (y)); }while(0)
 
 #define bblt_add_no_check_x(x, y, z)				\
-{ bblt_add(x, y, z); }
+do{ bblt_add((x), (y), (z)); }while(0)
 
 #define bblt_add_no_check_y(x, y, z)				\
-{ bblt_add(x, y, z); }
+do{ bblt_add((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_add(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_add_3(x, y);					\
+    (z) = bblt_add_3((x), (y));					\
   } else {							\
-    bblt_add_no_check(x, y, z);					\
+    bblt_add_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_add_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_add_3(x, y);					\
+    (z) = bblt_add_3((x), (y));					\
   } else {							\
-    bblt_add_no_check(x, y, z);					\
+    bblt_add_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_add_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_add_3(x, y);					\
+    (z) = bblt_add_3((x), (y));					\
   } else {							\
-    bblt_add_no_check(x, y, z);					\
+    bblt_add_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_add_no_check(x, y, z)				\
-{ z = (q)((unsigned long)(x) + (unsigned long)(y) - INT); }
+do{ (z) = (q) ((unsigned long)(x) + (unsigned long)(y) - INT); }while(0)
 
 /*
   Subtraction
@@ -68,47 +68,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_sub(x, y, z)					\
-{ z = bblt_sub_3(x, y); }
+do{ (z) = bblt_sub_3((x), (y)); }while(0)
 
 #define bblt_sub_no_check_x(x, y, z)				\
-{ bblt_sub(x, y, z); }
+do{ bblt_sub((x), (y), (z)); }while(0)
 
 #define bblt_sub_no_check_y(x, y, z)				\
-{ bblt_sub(x, y, z); }
+do{ bblt_sub((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_sub(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_sub_3(x, y);					\
+    (z) = bblt_sub_3((x), (y));					\
   } else {							\
-    bblt_sub_no_check(x, y, z);					\
+    bblt_sub_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_sub_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_sub_3(x, y);					\
+    (z) = bblt_sub_3((x), (y));					\
   } else {							\
-    bblt_sub_no_check(x, y, z);					\
+    bblt_sub_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_sub_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_sub_3(x, y);					\
+    (z) = bblt_sub_3((x), (y));					\
   } else {							\
-    bblt_sub_no_check(x, y, z);					\
+    bblt_sub_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_sub_no_check(x, y, z)				\
-{ z = (q)((unsigned long)(x) - ((unsigned long)(y) - INT)); }
+do{ (z) = (q) ((unsigned long)(x) - ((unsigned long)(y) - INT)); }while(0)
 
 /*
   Multiplication
@@ -119,45 +119,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_mult(x, y, z)					\
-{ z = bblt_mult_3(x, y); }
+do{ (z) = bblt_mult_3((x), (y)); }while(0)
+
 #define bblt_mult_no_check_x(x, y, z)				\
-{ bblt_mult(x, y, z); }
+do{ bblt_mult((x), (y), (z)); }while(0)
+
 #define bblt_mult_no_check_y(x, y, z)				\
-{ bblt_mult(x, y, z); }
+do{ bblt_mult((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_mult(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_mult_3(x, y);					\
+    (z) = bblt_mult_3((x), (y));				\
   } else {							\
-    bblt_mult_no_check(x, y, z);				\
+    bblt_mult_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_mult_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_mult_3(x, y);					\
+    (z) = bblt_mult_3((x), (y));				\
   } else {							\
-    bblt_mult_no_check(x, y, z);				\
+    bblt_mult_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_mult_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_mult_3(x, y);					\
+    (z) = bblt_mult_3((x), (y));				\
   } else {							\
-    bblt_mult_no_check(x, y, z);				\
+    bblt_mult_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_mult_no_check(x, y, z)				\
-{ z = (q)(((long)(x) - INT) * (intval(y)) + INT); }
+do{ (z) = (q) (((long)(x) - INT) * (intval(y)) + INT); }while(0)
 
 /*
   Division
@@ -168,47 +170,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_div(x, y, z)					\
-{ z = bblt_div_3(x, y); }
+do{ (z) = bblt_div_3((x), (y)); }while(0)
 
 #define bblt_div_no_check_x(x, y, z)				\
-{ bblt_div(x, y, z); }
+do{ bblt_div((x), (y), (z)); }while(0)
 
 #define bblt_div_no_check_y(x, y, z)				\
-{ bblt_div(x, y, z); }
+do{ bblt_div((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_div(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_div_3(x, y);					\
+    (z) = bblt_div_3((x), (y));					\
   } else {							\
-    bblt_div_no_check(x, y, z);					\
+    bblt_div_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_div_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_div_3(x, y);					\
+    (z) = bblt_div_3((x), (y));					\
   } else {							\
-    bblt_div_no_check(x, y, z);					\
+    bblt_div_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_div_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_div_3(x, y);					\
+    (z) = bblt_div_3((x), (y));					\
   } else {							\
-    bblt_div_no_check(x, y, z);					\
+    bblt_div_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_div_no_check(x, y, z)				\
-{ z = makeint(((long)(x) - INT)/((long)(y) - INT)); }
+do{ (z) = makeint(((long)(x) - INT) / ((long)(y) - INT)); }while(0)
 
 /*
   Modulo
@@ -219,47 +221,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_mod(x, y, z)					\
-{ z = bblt_mod_3(x, y); }
+do{ (z) = bblt_mod_3((x), (y)); }while(0)
 
 #define bblt_mod_no_check_x(x, y, z)				\
-{ bblt_mod(x, y, z); }
+do{ bblt_mod((x), (y), (z)); }while(0)
 
 #define bblt_mod_no_check_y(x, y, z)				\
-{ bblt_mod(x, y, z); }
+do{ bblt_mod((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_mod(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_mod_3(x, y);					\
+    (z) = bblt_mod_3((x), (y));					\
   } else {							\
-    bblt_mod_no_check(x, y, z);					\
+    bblt_mod_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_mod_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_mod_3(x, y);					\
+    (z) = bblt_mod_3((x), (y));					\
   } else {							\
-    bblt_mod_no_check(x, y, z);					\
+    bblt_mod_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_mod_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_mod_3(x, y);					\
+    (z) = bblt_mod_3((x), (y));					\
   } else {							\
-    bblt_mod_no_check(x, y, z);					\
+    bblt_mod_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_mod_no_check(x, y, z)				\
-{ z = (q)(((long)(x) - INT) % ((long)(y) - INT) + INT); }
+do{ (z) = (q) (((long)(x) - INT) % ((long)(y) - INT) + INT); }while(0)
 
 /*
   Bitwise Logical And
@@ -270,47 +272,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_and(x, y, z)					\
-{ z = bblt_and_3(x, y); }
+do{ (z) = bblt_and_3((x), (y)); }while(0)
 
 #define bblt_and_no_check_x(x, y, z)				\
-{ bblt_and(x, y, z); }
+do{ bblt_and((x), (y), (z)); }while(0)
 
 #define bblt_and_no_check_y(x, y, z)				\
-{ bblt_and(x, y, z); }
+do{ bblt_and((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_and(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_and_3(x, y);					\
+    (z) = bblt_and_3((x), (y));					\
   } else {							\
-    bblt_and_no_check(x, y, z);					\
+    bblt_and_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_and_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_and_3(x, y);					\
+    (z) = bblt_and_3((x), (y));					\
   } else {							\
-    bblt_and_no_check(x, y, z);					\
+    bblt_and_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_and_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_and_3(x, y);					\
+    (z) = bblt_and_3((x), (y));					\
   } else {							\
-    bblt_and_no_check(x, y, z);					\
+    bblt_and_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_and_no_check(x, y, z)				\
-{ z = (q)((long)(x) & (long)(y)); }
+do{ (z) = (q) ((long)(x) & (long)(y)); }while(0)
 
 /*
   Bitwise Logical Or
@@ -321,47 +323,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_or(x, y, z)					\
-{ z = bblt_or_3(x, y); }
+do{ (z) = bblt_or_3((x), (y)); }while(0)
 
 #define bblt_or_no_check_x(x, y, z)				\
-{ bblt_or(x, y, z); }
+do{ bblt_or((x), (y), (z)); }while(0)
 
 #define bblt_or_no_check_y(x, y, z)				\
-{ bblt_or(x, y, z); }
+do{ bblt_or((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_or(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_or_3(x, y);					\
+    (z) = bblt_or_3((x), (y));					\
   } else {							\
-    bblt_or_no_check(x, y, z);					\
+    bblt_or_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_or_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_or_3(x, y);					\
+    (z) = bblt_or_3((x), (y));					\
   } else {							\
-    bblt_or_no_check(x, y, z);					\
+    bblt_or_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #define bblt_or_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_or_3(x, y);					\
+    (z) = bblt_or_3((x), (y));					\
   } else {							\
-    bblt_or_no_check(x, y, z);					\
+    bblt_or_no_check((x), (y), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_or_no_check(x, y, z)				\
-{ z = (q)((long)(x) | (long)(y)); }
+do{ (z) = (q) ((long)(x) | (long)(y)); }while(0)
 
 /*
   Bitwise Logical Exclusive Or
@@ -372,47 +374,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_exclusive_or(x, y, z)				\
-{ z = bblt_exclusive_or_3(x, y); }
+do{ (z) = bblt_exclusive_or_3((x), (y)); }while(0)
 
 #define bblt_exclusive_or_no_check_x(x, y, z)			\
-{ bblt_exclusive_or(x, y, z); }
+do{ bblt_exclusive_or((x), (y), (z)); }while(0)
 
 #define bblt_exclusive_or_no_check_y(x, y, z)			\
-{ bblt_exclusive_or(x, y, z); }
+do{ bblt_exclusive_or((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_exclusive_or(x, y, z)				\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_exclusive_or_3(x, y);				\
+    (z) = bblt_exclusive_or_3((x), (y));			\
   } else {							\
-    bblt_exclusive_or_no_check(x, y, z);			\
+    bblt_exclusive_or_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #define bblt_exclusive_or_no_check_x(x, y, z)			\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_exclusive_or_3(x, y);				\
+    (z) = bblt_exclusive_or_3((x), (y));			\
   } else {							\
-    bblt_exclusive_or_no_check(x, y, z);			\
+    bblt_exclusive_or_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #define bblt_exclusive_or_no_check_y(x, y, z)			\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_exclusive_or_3(x, y);				\
+    (z) = bblt_exclusive_or_3((x), (y));			\
   } else {							\
-    bblt_exclusive_or_no_check(x, y, z);			\
+    bblt_exclusive_or_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_exclusive_or_no_check(x, y, z)			\
-{ z = (q)(((long)(x) ^ (long)(y)) + INT); }
+do{ (z) = (q) (((long)(x) ^ (long)(y)) + INT); }while(0)
 
 /*
   Right Shift
@@ -423,47 +425,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_rshift(x, y, z)					\
-{ z = bblt_rshift_3(x, y); }
+do{ (z) = bblt_rshift_3((x), (y)); }while(0)
 
 #define bblt_rshift_no_check_x(x, y, z)				\
-{ bblt_rshift(x, y, z); }
+do{ bblt_rshift((x), (y), (z)); }while(0)
 
 #define bblt_rshift_no_check_y(x, y, z)				\
-{ bblt_rshift(x, y, z); }
+do{ bblt_rshift((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_rshift(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_rshift_3(x, y);					\
+    (z) = bblt_rshift_3((x), (y));				\
   } else {							\
-    bblt_rshift_no_check(x, y, z);				\
+    bblt_rshift_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #define bblt_rshift_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_rshift_3(x, y);					\
+    (z) = bblt_rshift_3((x), (y));				\
   } else {							\
-    bblt_rshift_no_check(x, y, z);				\
+    bblt_rshift_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #define bblt_rshift_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_rshift_3(x, y);					\
+    (z) = bblt_rshift_3((x), (y));				\
   } else {							\
-    bblt_rshift_no_check(x, y, z);				\
+    bblt_rshift_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_rshift_no_check(x, y, z)				\
-{ z = makeint(intval(x) >> intval(y)); }
+do{ (z) = makeint(intval(x) >> intval(y)); }while(0)
 
 /*
   Left Shift
@@ -474,47 +476,47 @@
 #ifdef COMPACTCODE
 
 #define bblt_lshift(x, y, z)					\
-{ z = bblt_lshift_3(x, y); }
+do{ (z) = bblt_lshift_3((x), (y)); }while(0)
 
 #define bblt_lshift_no_check_x(x, y, z)				\
-{ bblt_lshift(x, y, z); }
+do{ bblt_lshift((x), (y), (z)); }while(0)
 
 #define bblt_lshift_no_check_y(x, y, z)				\
-{ bblt_lshift(x, y, z); }
+do{ bblt_lshift((x), (y), (z)); }while(0)
 
 #else
 
 #define bblt_lshift(x, y, z)					\
-{								\
+do{								\
   if (!isint(x) || !isint(y)) {					\
-    z = bblt_lshift_3(x, y);					\
+    (z) = bblt_lshift_3((x), (y));				\
   } else {							\
-    bblt_lshift_no_check(x, y, z);				\
+    bblt_lshift_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #define bblt_lshift_no_check_x(x, y, z)				\
-{								\
+do{								\
   if (!isint(y)) {						\
-    z = bblt_lshift_3(x, y);					\
+    (z) = bblt_lshift_3((x), (y));				\
   } else {							\
-    bblt_lshift_no_check(x, y, z);				\
+    bblt_lshift_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #define bblt_lshift_no_check_y(x, y, z)				\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_lshift_3(x, y);					\
+    (z) = bblt_lshift_3((x), (y));				\
   } else {							\
-    bblt_lshift_no_check(x, y, z);				\
+    bblt_lshift_no_check((x), (y), (z));			\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_lshift_no_check(x, y, z)				\
-{ z = (q)((((long)(x) - INT) << intval(y)) + INT); }
+do{ (z) = (q) ((((long)(x) - INT) << intval(y)) + INT); }while(0)
 
 /*
   Bitwise Complement
@@ -525,23 +527,23 @@
 #ifdef COMPACTCODE
 
 #define bblt_complement(x, z)					\
-{ z = bblt_complement_2(x); }
+do{ (z) = bblt_complement_2(x); }while(0)
 
 #else
 
 #define bblt_complement(x, z)					\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_complement_2(x);					\
+    (z) = bblt_complement_2(x);					\
   } else {							\
-    bblt_complement_no_check(x, z);				\
+    bblt_complement_no_check((x), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_complement_no_check(x, z)				\
-{ z = ((long)(x) ^ ((-1l) << ATAGBITS)); }
+do{ (z) = ((long)(x) ^ ((-1L) << ATAGBITS)); }while(0)
 
 /*
   Unary Plus
@@ -552,23 +554,23 @@
 #ifdef COMPACTCODE
 
 #define bblt_plus(x, z)						\
-{ z = bblt_plus_2(x); }
+do{ (z) = bblt_plus_2(x); }while(0)
 
 #else
 
 #define bblt_plus(x, z)						\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_plus_2(x);						\
+    (z) = bblt_plus_2(x);					\
   } else {							\
-    bblt_plus_no_check(x, z);					\
+    bblt_plus_no_check((x), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_plus_no_check(x, z)				\
-{ z = (x); }
+do{ (z) = (x); }while(0)
 
 /*
   Unary Minus
@@ -579,23 +581,23 @@
 #ifdef COMPACTCODE
 
 #define bblt_minus(x, z)					\
-{ z = bblt_minus_2(x); }
+do{ (z) = bblt_minus_2(x); }while(0)
 
 #else
 
 #define bblt_minus(x, z)					\
-{								\
+do{								\
   if (!isint(x)) {						\
-    z = bblt_minus_2(x);					\
+    (z) = bblt_minus_2(x);					\
   } else {							\
-    bblt_minus_no_check(x, z);					\
+    bblt_minus_no_check((x), (z));				\
   }								\
-}
+}while(0)
 
 #endif
 
 #define bblt_minus_no_check(x, z)				\
-{ z = (q)(2*INT-(long)(x)); }
+do{ (z) = (q) (2L*INT - (long)(x)); }while(0)
 
 /*
   Floating Point
@@ -604,15 +606,15 @@
 extern q bblt_fix_2();
 
 #define bblt_fix(x, z)						\
-{								\
+do{								\
   extern struct data_object_method_table TableName(float);	\
   if (!isfunctor(x) || !isgobj(x) ||				\
-      functor_of(x) != (q)&TableName(float)) {			\
-    z = bblt_fix_2(x);						\
+      functor_of(x) != (q) &TableName(float)) {			\
+    (z) = bblt_fix_2(x);					\
   } else {							\
-    z = makeint((long)(float_value(x)));			\
+    (z) = makeint((long) (float_value(x)));			\
   }								\
-}
+}while(0)
 
 
 /*
@@ -620,7 +622,10 @@
 */
 
 #define bblt_current_node_no_check(x, y) \
-{  x = makeint(my_node);  y = makeint(total_node); }
+do{ \
+  (x) = makeint(my_node); \
+  (y) = makeint(total_node); \
+}while(0)
 
 
 #endif /* _KLIC_BB_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/control.h klic-3.003-2001-11-20/include/klic/control.h
--- klic-3.003-2001-11-19/include/klic/control.h	Sun Nov 18 21:23:34 2001
+++ klic-3.003-2001-11-20/include/klic/control.h	Mon Nov 19 12:38:11 2001
@@ -9,36 +9,36 @@
 #define _KLIC_CONTROL_H_
 
 /* Reasons of interruption */
-#define EXTEVENT	makeint(0)
-#define FAILURE		makeint(1)
+#define EXTEVENT	(makeint(0))
+#define FAILURE		(makeint(1))
 
 extern q *interrupt_goal();
-int check_stack_for_alternatively();
-struct goalrec *enqueue_goal();
-struct goalrec *enqueue_after_waiting();
-struct goalrec *enqueue_throw_goal();
+extern int check_stack_for_alternatively();
+extern struct goalrec *enqueue_goal();
+extern struct goalrec *enqueue_after_waiting();
+extern struct goalrec *enqueue_throw_goal();
 
 #define enqueue_at_priority(p,q0,q)			\
-{							\
-  qp = enqueue_after_waiting(q0, (p), q, allocp, 0);	\
-}
+do{							\
+  qp = enqueue_after_waiting((q0), (p), (q), allocp, 0);	\
+}while(0)
 
 #define enqueue_at_priority_no_check(x,q0,q)		\
-{							\
+do{							\
   long prio = intval(x);				\
-  qp = enqueue_goal(q0, prio, q, glbl);			\
-}
+  qp = enqueue_goal((q0), prio, (q), glbl);		\
+}while(0)
 
 #define enqueue_at_lower_priority(p,q0,q)		\
-{							\
-  qp = enqueue_after_waiting(q0, (p), q, allocp, 1);	\
-}
+do{							\
+  qp = enqueue_after_waiting((q0), (p), (q), allocp, 1);	\
+}while(0)
 
 #define enqueue_at_lower_priority_no_check(x,q0,q)	\
-{							\
-  long prio = current_prio-intval(x);			\
-  qp = enqueue_goal(q0, prio, q, glbl);			\
-}
+do{							\
+  long prio = current_prio - intval(x);			\
+  qp = enqueue_goal((q0), prio, (q), glbl);		\
+}while(0)
 
 #define switch_on_pred()	switch (toppred->pred)
 
@@ -46,58 +46,51 @@
 
 #define last_case_pred(p, label) default: goto label;
 
-#if ( defined(DIST) && defined(USE_REDUCTION_COUNT) )
-#define loop_within_module(f)				\
-{ \
-  module (*func)(); \
-  if (++reduction_count > REDUCTION_COUNTS) {heaplimit = 0; reduction_count = 0;}\
-  if (allocp >= heaplimit) { \
-    allocp = klic_interrupt(allocp, qp); \
-    qp = current_queue; \
+#if defined(DIST) && defined(USE_REDUCTION_COUNT)
+#define _INC_REDUCTION_COUNT(maxcount) \
+do{ \
+  if (reduction_count < (maxcount)) { \
+    reduction_count++; \
+  } else { \
+    reduction_count = 0; \
+    heaplimit = 0; \
   } \
-  if ((func = (toppred = qp->pred)->func) == (f)) \
-    goto module_top; \
-  heapp = allocp; \
-  current_queue = qp; \
-  return (module) func; \
-}
-#else
+while(0)
+#else /* !defined(DIST) || !defined(USE_REDUCTION_COUNT) */
+#define _INC_REDUCTION_COUNT(maxcount)
+#endif
+
 #define loop_within_module(f)				\
-{ \
+do{ \
   module (*func)(); \
+  _INC_REDUCTION_COUNT(REDUCTION_COUNTS); \
   if (allocp >= heaplimit) { \
     allocp = klic_interrupt(allocp, qp); \
     qp = current_queue; \
   } \
-  if ((func = (toppred = qp->pred)->func) == (f)) \
+  toppred = qp->pred; \
+  func = toppred->func; \
+  if (func == (f)) \
     goto module_top; \
   heapp = allocp; \
   current_queue = qp; \
   return (module) func; \
-}
-#endif
+}while(0)
 
-#if ( defined(DIST) && defined(USE_REDUCTION_COUNT) )
-#define execute(label)\
-{\
-  if (++reduction_count > 500) {heaplimit = 0; reduction_count = 0;}\
-  if (allocp < heaplimit) goto label;\
-}
-#else
-#define execute(label)\
-{\
-  if (allocp < heaplimit) goto label;\
-}
-#endif
+#define execute(label) \
+do{ \
+  _INC_REDUCTION_COUNT(500); \
+  if (allocp < heaplimit) goto label; \
+}while(0)
 
 #define proceed()		\
-{				\
+do{				\
   goto proceed_label;		\
-}
+}while(0)
 
 #define throw_goal(node, oldqp, goal) \
-{ \
+do{ \
   qp = enqueue_throw_goal((node), (goal), (oldqp), allocp);\
-}
+}while(0)
 
 #endif /* _KLIC_CONTROL_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/functorstuffs.h klic-3.003-2001-11-20/include/klic/functorstuffs.h
--- klic-3.003-2001-11-19/include/klic/functorstuffs.h	Sun Nov 18 21:24:20 2001
+++ klic-3.003-2001-11-20/include/klic/functorstuffs.h	Mon Nov 19 12:39:06 2001
@@ -12,7 +12,7 @@
 extern unsigned long *arities;
 extern unsigned long *functors;
 #define FUNCTORNUMBERBASE 0
-#define functoratom(f) functors[symval(f) - FUNCTORNUMBERBASE]
-#define arityof(f) arities[symval(f) - FUNCTORNUMBERBASE]
+#define functoratom(f)  (functors[symval(f) - FUNCTORNUMBERBASE])
+#define arityof(f)  (arities[symval(f) - FUNCTORNUMBERBASE])
 
 #endif /* _KLIC_FUNCTORSTUFFS_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/g_basic.h klic-3.003-2001-11-20/include/klic/g_basic.h
--- klic-3.003-2001-11-19/include/klic/g_basic.h	Sun Nov 18 21:24:42 2001
+++ klic-3.003-2001-11-20/include/klic/g_basic.h	Mon Nov 19 20:58:37 2001
@@ -77,50 +77,53 @@
 #define G_body0(class,fa) G_body1(class,fa)
 
 #define G_HEAPALLOC(from,size,type) \
-{ \
-  from = type(g_allocp); \
-  g_allocp += size; \
-}
+do{ \
+  (from) = type(g_allocp); \
+  g_allocp += (size); \
+}while(0)
 
 #define G_HEAPALLOC_WITH_CHECK(from,size,type,allocp,res) \
-{ \
-  if ((long)real_heaplimit <= (long)((allocp)+(size))) { \
+do{ \
+  if ((long) real_heaplimit <= (long) ((allocp) + (size))) { \
     this_more_space += (size); \
     heaplimit = 0; \
     (res) = GENERIC_GCREQUEST; \
   } else { \
-    G_HEAPALLOC((from),(size),type); \
+    G_HEAPALLOC((from), (size), type); \
     (res) = GENERIC_SUCCEEDED; \
   } \
-}
+}while(0)
 
 #define G_MAKE_VAR(x) \
-{ G_HEAPALLOC(x,1,(q)); derefone(x) = x; }
+do{ \
+  G_HEAPALLOC((x), 1, (q)); \
+  derefone(x) = (x); \
+}while(0)
 
 #define G_STD_DECL struct global_variables *glbl = My_glbl
 
-#define G_SIZE_IN_Q(type) ((sizeof(type)+sizeof(q)-1)/sizeof(q))
+#define G_SIZE_IN_Q(type) ((sizeof(type)+sizeof(q)-1) / sizeof(q))
 
 extern q** make_larger_stack();
 
 #define G_COPY_KL1_TERM_TO_NEWGEN(from,to) \
-{ \
+do{ \
   if ((g_sp) == gcmax) { \
     (g_sp) = make_larger_stack(g_sp); \
   } \
   if(isref(from)) { \
     q *newword = g_allocp++; \
-    derefone(newword) = from; \
-    to = makeref(newword); \
+    derefone(newword) = (from); \
+    (to) = makeref(newword); \
     *(g_sp++) = newword; \
   } else { \
-    to = from; \
+    (to) = (from); \
     *(g_sp++) = &(to); \
   } \
-}
+}while(0)
 
 #define G_PUSH_GOAL(goal) \
-{ resume_same_prio(goal); }
+do{ resume_same_prio(goal); }while(0)
 
 #define G_PUSH_GOAL_TO_SPECIAL_QUEUE(goal) \
   G_PUSH_GOAL(goal)
diff -ruN klic-3.003-2001-11-19/include/klic/g_float.h klic-3.003-2001-11-20/include/klic/g_float.h
--- klic-3.003-2001-11-19/include/klic/g_float.h	Sun Nov 18 21:25:55 2001
+++ klic-3.003-2001-11-20/include/klic/g_float.h	Mon Nov 19 12:48:52 2001
@@ -8,15 +8,15 @@
 #ifndef _KLIC_G_FLOAT_H_
 #define _KLIC_G_FLOAT_H_
 
-struct float_object {
+typedef struct float_object {
   struct data_object_method_table *method_table;
   double value;
-};
+} float_structure_type;
 
-#define float_structure_type	struct float_object
 #define declare_float_constant(value) \
-{ &float_g_data_method_table, value }
-#define makefloat(x)		makefunctor(&x)
-#define float_value(x) (((float_structure_type *)functorp(x))->value)
+{ &float_g_data_method_table, (value) }
+
+#define makefloat(x)	makefunctor(&(x))
+#define float_value(x)  (((float_structure_type *) functorp(x))->value)
 
 #endif /* _KLIC_G_FLOAT_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/g_methtab.h klic-3.003-2001-11-20/include/klic/g_methtab.h
--- klic-3.003-2001-11-19/include/klic/g_methtab.h	Sun Nov 18 21:26:21 2001
+++ klic-3.003-2001-11-20/include/klic/g_methtab.h	Mon Nov 19 12:47:37 2001
@@ -8,9 +8,9 @@
 #ifndef _KLIC_G_METHTAB_H_
 #define _KLIC_G_METHTAB_H_
 
-#define GENERIC_SUCCEEDED (q)0
-#define GENERIC_FAILED    (q)1
-#define GENERIC_GCREQUEST (q)2
+#define GENERIC_SUCCEEDED  ((q) 0L)
+#define GENERIC_FAILED     ((q) 1L)
+#define GENERIC_GCREQUEST  ((q) 2L)
 
 /*
   Data Object
@@ -49,7 +49,7 @@
 };
 
 #define data_objectp(obj) \
-     ((struct data_object *)(((unsigned long)(obj)) - FUNCTOR))
+  ((struct data_object *) (((unsigned long)(obj)) - FUNCTOR))
 
 
 /*
diff -ruN klic-3.003-2001-11-19/include/klic/g_string.h klic-3.003-2001-11-20/include/klic/g_string.h
--- klic-3.003-2001-11-19/include/klic/g_string.h	Sun Nov 18 21:27:00 2001
+++ klic-3.003-2001-11-20/include/klic/g_string.h	Mon Nov 19 12:48:32 2001
@@ -22,19 +22,19 @@
   unsigned char *body;
 };
 
+typedef struct byte_string_object string_structure_type_8;
+
 #define STRING_SHALLOW_MARK	(makeint(0))
 #define IS_SHALLOW_STRING(s)	((s)->next == STRING_SHALLOW_MARK)
 
-#define string_structure_type_8 struct byte_string_object
-
 #define declare_string_constant_8(body, length)		\
 {      							\
   &byte__string_g_data_method_table,			\
   STRING_SHALLOW_MARK,		/* next */		\
-  length,			/* index */		\
+  (length),			/* index */		\
   1,				/* iscnst */		\
   0,				/* ismbdiff */		\
-  (unsigned char *)body		/* body */		\
+  (unsigned char *) (body)	/* body */		\
 }
 
 #endif /* _KLIC_G_STRING_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/g_vector.h klic-3.003-2001-11-20/include/klic/g_vector.h
--- klic-3.003-2001-11-19/include/klic/g_vector.h	Sun Nov 18 21:27:37 2001
+++ klic-3.003-2001-11-20/include/klic/g_vector.h	Mon Nov 19 12:49:27 2001
@@ -8,7 +8,7 @@
 #ifndef _KLIC_G_VECTOR_H_
 #define _KLIC_G_VECTOR_H_
 
-struct vector_object {
+typedef struct vector_object {
   struct data_object_method_table *method_table;
   q next;
   int index:(8*sizeof(int)-1); /* size or index */
@@ -19,20 +19,18 @@
     when deep, i.e., for difference records, the element that differs.
     */
   q *body;
-};
+} vector_structure_type;
 
 #define VECTOR_SHALLOW_MARK	(makeint(0))
 #define IS_SHALLOW_VECTOR(v)	((v)->next == VECTOR_SHALLOW_MARK)
 
-#define vector_structure_type struct vector_object
-
 #define declare_vector_constant(body, length)		\
 {      							\
   &vector_g_data_method_table,				\
   VECTOR_SHALLOW_MARK,		/* next */		\
-  length,			/* index */		\
+  (length),			/* index */		\
   1,				/* iscnst */		\
-  (q *) body			/* body */		\
+  (q *) (body)			/* body */		\
 }
 
 extern q create_vector();
diff -ruN klic-3.003-2001-11-19/include/klic/gb.h klic-3.003-2001-11-20/include/klic/gb.h
--- klic-3.003-2001-11-19/include/klic/gb.h	Sun Nov 18 21:27:58 2001
+++ klic-3.003-2001-11-20/include/klic/gb.h	Mon Nov 19 20:59:24 2001
@@ -12,24 +12,28 @@
 extern q builtin_hash_term();
 
 #define gblt_compare(x, y, r, fail) \
-  r = builtin_compare_terms((x), (y)); \
+do{ \
+  (r) = builtin_compare_terms((x), (y)); \
   if (isref(r)) { \
-    *reasonp++ = r; \
+    *reasonp++ = (r); \
     goto fail; \
-  }
+  } \
+}while(0)
 
 #define gblt_hash(x, r, fail) \
-  r = builtin_hash_term(x, 0)
+  ((r) = builtin_hash_term((x), 0))
 
 #define gblt_deep_hash(x, l, r, fail) \
-  r = builtin_hash_term(x, intval(l)); \
+do{ \
+  (r) = builtin_hash_term((x), intval(l)); \
   if (isref(r)) { \
-    *reasonp++ = r; \
+    *reasonp++ = (r); \
     goto fail; \
-  }
+  } \
+}while(0)
 
 #define gblt_current_prio(p, fail) \
-  p = makeint(current_prio)
+  ((p) = makeint(current_prio))
 
 #define gblt_wait( x, susp )
 
@@ -46,114 +50,118 @@
 /* Multitude Comparison */
 
 #define gblt_greater( x, y, fail ) \
-    if ((long)(x) <= (long)(y)) goto fail;
+do{ if ((long) (x) <= (long) (y)) goto fail; }while(0)
 
 #define gblt_greater_or_eq( x, y, fail ) \
-    if ((long)(x) < (long)(y)) goto fail;
+do{ if ((long) (x) < (long) (y)) goto fail; }while(0)
 
 #define gblt_less( x, y, fail ) \
-    if ((long)(x) >= (long)(y)) goto fail;
+do{ if ((long) (x) >= (long) (y)) goto fail; }while(0)
 
 #define gblt_less_or_eq( x, y, fail ) \
-    if ((long)(x) > (long)(y)) goto fail;
+do{ if ((long) (x) > (long) (y)) goto fail; }while(0)
 
 #define gblt_eq( x, y,  fail ) \
-    if ((long)(x) != (long)(y)) goto fail;
+do{ if ((long) (x) != (long) (y)) goto fail; }while(0)
 
 /* Arithmetical/Logical Operations on Integers */
 
 #define gblt_and( x, y, z, fail ) \
-    z = (q)((unsigned long)(x) & (unsigned long)(y));
+do{ (z) = (q) ((unsigned long)(x) & (unsigned long)(y)); }while(0)
 
 #define gblt_or( x, y, z, fail ) \
-    z = (q)((unsigned long)(x) | (unsigned long)(y));
+do{ (z) = (q) ((unsigned long)(x) | (unsigned long)(y)); }while(0)
 
 #define gblt_exclusive_or( x, y, z, fail ) \
-    z = (q)(((unsigned long)(x) ^ (unsigned long)(y)) + INT);
+do{ (z) = (q) (((unsigned long)(x) ^ (unsigned long)(y)) + INT); }while(0)
 
 #define gblt_rshift( x, y, z, fail ) \
-    z =  makeint((unsigned long)(intval(x)) >> intval(y));
+do{ (z) =  makeint((unsigned long) (intval(x)) >> intval(y)); }while(0)
 
 #define gblt_lshift( x, y, z, fail ) \
-    z =  (q)((((long)(x) - INT) << intval(y)) + INT);
+do{ (z) = (q) ((((long)(x) - INT) << intval(y)) + INT); }while(0)
 
 #define gblt_add( x, y, z, fail ) \
-    z = (q)((unsigned long)(x) + ((unsigned long)(y) - INT));
+do{ (z) = (q) ((unsigned long)(x) + ((unsigned long)(y) - INT)); }while(0)
 
 #define gblt_subtract( x, y, z, fail ) \
-    z = (q)((unsigned long)(x) - ((unsigned long)(y) - INT)); 
+do{ (z) = (q) ((unsigned long)(x) - ((unsigned long)(y) - INT)); }while(0)
 
 #define gblt_multiply( x, y, z, fail ) \
-    z = (q)(((long)(x) - INT) * (intval(y)) + INT);
+do{ (z) = (q) (((long)(x) - INT) * (intval(y)) + INT); }while(0)
 
 #define gblt_divide( x, y, z, fail ) \
-{ \
+do{ \
   long macrotemp = (long)(y) - INT; \
   if (macrotemp == 0) goto fail; \
-  z = makeint(((long)(x) - INT)/macrotemp); \
-}
+  (z) = makeint(((long)(x) - INT) / macrotemp); \
+}while(0)
 
 #define gblt_modulo( x, y, z, fail ) \
-{ \
+do{ \
   long macrotemp = (long)(y) - INT; \
   if (macrotemp == 0) goto fail; \
-  z = (q)(((long)(x) - INT) % macrotemp + INT); \
-}
+  (z) = (q) (((long)(x) - INT) % macrotemp + INT); \
+}while(0)
 
 #define gblt_complement( x, z, fail ) \
-    z = makeint((long)(x) ^ ((-1l) << ATAGBITS));
+do{ (z) = makeint((long)(x) ^ ((-1L) << ATAGBITS)); }while(0)
 
 #define gblt_plus( x, z, fail ) \
-    z = x;
+do{ (z) = (x); }while(0)
 
 #define gblt_minus( x, z, fail ) \
-    z = (q)(2*INT-(long)(x));
+do{ (z) = (q) (2*INT - (long)(x)); }while(0)
 
 #define gblt_fix( x, z, fail ) \
-    z = makeint((long)float_value(x));
+do{ (z) = makeint((long) float_value(x)); }while(0)
 
 /* Functor Manipulation */
 
 #define gblt_pfunctor( x, f, fail) \
-    if (isatomic(x)) { \
-      f = x; \
-    } else if (iscons(x)) { \
-      f = PERIODATOM; \
-    } else if (!isref(functorp(x)->functor)) { \
-      f = makesym(functoratom(functorp(x)->functor)); \
-    } else  { \
-      f = x; \
-    }
+do{ \
+  if (isatomic(x)) { \
+    (f) = (x); \
+  } else if (iscons(x)) { \
+    (f) = PERIODATOM; \
+  } else if (!isref(functorp(x)->functor)) { \
+    (f) = makesym(functoratom(functorp(x)->functor)); \
+  } else  { \
+    (f) = (x); \
+  } \
+}while(0)
 
 #define gblt_arity( x, a, fail) \
-    if (isatomic(x)) { \
-      a = makeint(0); \
-    } else if (iscons(x)) { \
-      a = makeint(2); \
-    } else if (!isref(functorp(x)->functor)) { \
-      a = makeint(arityof(functorp(x)->functor)); \
-    } else { \
-      a = makeint(0); \
-    }
+do{ \
+  if (isatomic(x)) { \
+    (a) = makeint(0); \
+  } else if (iscons(x)) { \
+    (a) = makeint(2); \
+  } else if (!isref(functorp(x)->functor)) { \
+    (a) = makeint(arityof(functorp(x)->functor)); \
+  } else { \
+    (a) = makeint(0); \
+  } \
+}while(0)
 
 #define gblt_arg( n, x, a, fail) \
-    if (isatomic(x)) { \
-      goto fail; \
-    } else if (iscons(x)) { \
-      if (n == makeint(1)) { \
-	a = car_of(x); \
-      } else if (n == makeint(2)) { \
-	a = cdr_of(x); \
-      } else { \
-	goto fail; \
-      } \
-    } else if (!isref(functorp(x)->functor)) { \
-      long temp = intval(n); \
-      if (temp <= 0 || temp > arityof(functorp(x)->functor)) goto fail; \
-      a = arg(x, temp-1); \
-    } else { \
-      goto fail; \
-    }
+do{ \
+  long _n = intval(n); \
+  if (isatomic(x)) { \
+    goto fail; \
+  } else if (iscons(x)) { \
+    switch (_n) { \
+    case 1:  (a) = car_of(x);  break; \
+    case 2:  (a) = cdr_of(x);  break; \
+    default:  goto fail; \
+    } \
+  } else if (!isref(functorp(x)->functor)) { \
+    if (_n <= 0 || arityof(functorp(x)->functor) < _n) goto fail; \
+    (a) = arg((x), _n-1); \
+  } else { \
+    goto fail; \
+  } \
+}while(0)
 
 /* Generic Object Manipulation */
 
@@ -164,88 +172,93 @@
 #endif
 
 #define jump_if_not_in_class(x, class, lab)				\
-{									\
+do{									\
   extern struct data_object_method_table TableName(class);		\
-  if (!isgobj(x) || functor_of(x) != (q)&TableName(class))		\
+  if (!isgobj(x) || functor_of(x) != (q) &TableName(class))		\
     goto lab;								\
-}
+}while(0)
 
 #define gblt_size_of_vector(v, s, faillab)				\
-{									\
+do{									\
   extern q size_of_vector();						\
-  s = size_of_vector(v);						\
-}
+  (s) = size_of_vector(v);						\
+}while(0)
 
 #define gblt_element_of_vector(v, k, e, faillab)			\
-{									\
+do{									\
   extern q element_of_vector();						\
-  e = element_of_vector(v,k);						\
-  if ((long)e == 0) goto faillab;					\
-}
+  (e) = element_of_vector((v), (k));					\
+  if ((long) (e) == 0) goto faillab;					\
+}while(0)
 
 #define gblt_is_string(s, faillab)					\
-{ jump_if_not_in_class((s), byte__string, faillab); }
+do{ jump_if_not_in_class((s), byte__string, faillab); }while(0)
 
 #define gblt_size_of_string(v, s, faillab)				\
-{									\
+do{									\
   extern q size_of_string();						\
-  s = size_of_string(v);						\
-}
+  (s) = size_of_string(v);						\
+}while(0)
 
 #define gblt_element_size_of_string(v, es, faillab)			\
-  es = makeint(8);
+do{ (es) = makeint(8); }while(0)
 
 #define gblt_element_of_string(v, k, e, faillab)			\
-{									\
+do{									\
   extern q element_of_string();						\
-  e = element_of_string(v,k);						\
-  if ((long)e == 0) goto faillab;					\
-}
+  (e) = element_of_string((v), (k));					\
+  if ((long) (e) == 0) goto faillab;					\
+}while(0)
 
 /* Guard General Unification */
 
 q eq_terms_body();
 
 #define if_not_equal(x, y, faillab) \
-if ((x)!=(y) || isref(x)) { \
-  q retval; \
-  switch((long)(retval = eq_terms_body((x), (y)))){ \
-  case 0: break; \
-  default: *reasonp++ = retval; /* fall thru */ \
-  case 1: goto faillab; \
+do{ \
+  if ((x)!=(y) || isref(x)) { \
+    q retval = eq_terms_body((x), (y)); \
+    switch((long) retval){ \
+    case 0:  break; \
+    default:  *reasonp++ = retval; /* fall thru */ \
+    case 1:  goto faillab; \
+    } \
   } \
-}
+}while(0)
 
 /* Clause Grouping */
 
 #define otherwise(lab) \
-{ if (reasonp != reasons) goto lab; }
+do{ if (reasonp != reasons) goto lab; }while(0)
 
 #define alternative(lab) \
-{ \
+do{ \
   if (reasonp != reasons) { \
     int macrotmp = check_stack_for_alternatively(allocp, reasonp); \
     allocp = heapp; \
     if (macrotmp != 0) goto lab; \
   } \
-}
+}while(0)
 
 /* Misc */
 
-#define gblt_assign( x, y, fail )  x =  y; 
+#define gblt_assign( x, y, fail )  do{ (x) = (y); }while(0)
 
 #define gblt_not_eq( x, y, fail ) \
-    if ((long)(x) == (long)(y)) goto fail;
-
-#define gblt_diff( x, y, fail ) 				\
-    if ((isatomic(y) || isatomic(x) ? (x) == (y) :		\
-	 (iscons(y) ? iscons(x) :				\
-	  (isfunctor(x) && functor_of(x) == functor_of(y)))))	\
-	goto fail;
-
-#define gblt_display_console(w,fail)  printl(w);
+do{ if ((long)(x) == (long)(y)) goto fail; }while(0)
 
-#define gblt_tag(x, y, faillab)   y = makeint(ptagof(x))
-#define gblt_value(x, y, faillab) y = makeint(((unsigned long)x)>>ATAGBITS)
+#define gblt_diff( x, y, fail )	\
+do{ \
+  if ((isatomic(y) || isatomic(x) ? (x) == (y) : \
+      (iscons(y) ? iscons(x) : \
+        (isfunctor(x) && functor_of(x) == functor_of(y))))) \
+          goto fail; \
+}while(0)
+
+#define gblt_display_console(w,fail)  printl(w)
+
+#define gblt_tag(x, y, faillab)   ((y) = makeint(ptagof(x)))
+#define gblt_value(x, y, faillab) \
+  ((y) = makeint(((unsigned long) (x)) >> ATAGBITS))
 
 #endif /* _KLIC_GB_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/gc_macro.h klic-3.003-2001-11-20/include/klic/gc_macro.h
--- klic-3.003-2001-11-19/include/klic/gc_macro.h	Sun Nov 18 21:28:24 2001
+++ klic-3.003-2001-11-20/include/klic/gc_macro.h	Mon Nov 19 20:59:46 2001
@@ -74,61 +74,74 @@
 
 #define    GC_FAIL(errmsg)    fatal(errmsg)
 #define	   GC_ERROR_IN_NEW(errmsg) \
-  G_error(errmsg, "creation", "consumer", GC_CLASS_NAME_STRING)
+  G_error((errmsg), "creation", "consumer", GC_CLASS_NAME_STRING)
 #define    GC_SUCCEEDED       GENERIC_SUCCEEDED
 #define    GC_GCREQUEST       GENERIC_GCREQUEST
-#define    GC_RETURN      { method_result = 0; return(g_allocp); }
+
+#define    GC_RETURN \
+do{ \
+  method_result = 0; \
+  return g_allocp; \
+}while(0)
+
 #define    GC_RETURN_WITH_HOOK(x) \
-     { \
-       method_result = GC_SUCCEEDED; \
-       rest_of_stream = x; \
-       return(g_allocp); \
-      }
+do{ \
+  method_result = GC_SUCCEEDED; \
+  rest_of_stream = (x); \
+  return g_allocp; \
+}while(0)
+
 #define    GC_RETURN_FROM_GENERIC \
-     { if (G_ISREF(GC_TERM)) {GC_RETURN_WITH_HOOK(GC_TERM);} \
-       else if (G_ISREF(G_CDR_OF(GC_TERM))) \
-         {GC_RETURN_WITH_HOOK(G_CDR_OF(GC_TERM));} \
-       else if (G_CDR_OF(GC_TERM) == NILATOM) { GC_TERMINATE;} \
-       else { debug_printf("### %k ###", GC_TERM); fatal("Illegal data"); } \
-      }
+do{ \
+  if (G_ISREF(GC_TERM)) { \
+    GC_RETURN_WITH_HOOK(GC_TERM); \
+  } else if (G_ISREF(G_CDR_OF(GC_TERM))) { \
+    GC_RETURN_WITH_HOOK(G_CDR_OF(GC_TERM)); \
+  } else if (G_CDR_OF(GC_TERM) == NILATOM) { \
+    GC_TERMINATE; \
+  } else { \
+    debug_printf("### %k ###", GC_TERM); \
+    fatal("Illegal data"); \
+  } \
+}while(0)
 
 #define GC_TERMINATE \
-     { \
-       method_result = GC_SUCCEEDED;\
-       rest_of_stream = 0; \
-       return(g_allocp); \
-      }
+do{ \
+  method_result = GC_SUCCEEDED; \
+  rest_of_stream = 0; \
+  return g_allocp; \
+}while(0)
 
 #define GC_SUSPEND(var) \
-     { \
-       q newvar, tmp; \
-       q argv[2]; \
-       method_result = GC_SUCCEEDED; \
-       G_MAKE_VAR(newvar); \
-       rest_of_stream = newvar; \
-       argv[0] = GC_TERM; \
-       argv[1] = newvar; \
-       tmp = GC_wakeup_g_new(2,argv,g_allocp); \
-       g_allocp = heapp; \
-       GC_KL1_UNIFY(var,tmp); \
-       return(g_allocp); \
-     }
+do{ \
+  q newvar, tmp; \
+  q argv[2]; \
+  method_result = GC_SUCCEEDED; \
+  G_MAKE_VAR(newvar); \
+  rest_of_stream = newvar; \
+  argv[0] = GC_TERM; \
+  argv[1] = newvar; \
+  tmp = GC_wakeup_g_new(2, argv, g_allocp); \
+  g_allocp = heapp; \
+  GC_KL1_UNIFY((var), tmp); \
+  return g_allocp; \
+}while(0)
 
 /**************************************************/
 
 #define GC_DEREF_AND_TEST(x, susp) \
-{ \
+do{ \
   q temp0 = derefone(x); \
   if(!isref(temp0) || (x) != derefone(temp0)) { \
     (x) = temp0; \
   } else { \
     goto susp; \
   } \
-}
+}while(0)
 
 
 #define GC_SWITCH_ON_TERM(cons,atomic,funct,dobj,susp) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(GC_TERM)) { \
       if (atomicnotref(GC_TERM)) { \
@@ -149,34 +162,36 @@
         } \
     } else goto cons; \
   } \
-}
+}while(0)
 
 #define GC_SWITCH_ON_METHOD_BEFORE(atomic,list,functor,generic,susp,illegal_data) \
- while (1) {\
- switch(ptagof(GC_TERM)) { \
- case CONS: \
-  { \
-   q g_car = G_CAR_OF(GC_TERM); \
-   switch(ptagof(g_car)) { \
-   case ATOMIC: goto atomic; \
-   case CONS: goto list; \
-   case FUNCTOR: \
-     if (isref(G_FUNCTOR_OF(g_car))) goto generic; \
-     else goto functor; \
-   default: \
-     GC_SUSPEND(g_car); \
-   } \
+do{ \
+  while (1) { \
+    switch(ptagof(GC_TERM)) { \
+    case CONS: \
+    { \
+      q g_car = G_CAR_OF(GC_TERM); \
+      switch(ptagof(g_car)) { \
+      case ATOMIC: goto atomic; \
+      case CONS: goto list; \
+      case FUNCTOR: \
+        if (isref(G_FUNCTOR_OF(g_car))) goto generic; \
+        else goto functor; \
+      default: \
+        GC_SUSPEND(g_car); \
+      } \
+    } \
+    case ATOMIC: \
+      if (GC_TERM == NILATOM) { \
+        GC_TERMINATE; \
+      } else goto illegal_data; \
+    case FUNCTOR: goto functor; \
+    case VARREF: \
+      GC_DEREF_AND_TEST(GC_TERM, susp); \
+    default: goto illegal_data; \
+    } \
   } \
- case ATOMIC: \
-  if (GC_TERM == NILATOM) { \
-      GC_TERMINATE; \
-  } else goto illegal_data; \
- case FUNCTOR: goto functor; \
- case VARREF: \
-    GC_DEREF_AND_TEST(GC_TERM, susp); \
- default: goto illegal_data; \
- } \
-}
+}while(0)
 
 #define GC_SWITCH_ON_ATOM_METHOD switch((unsigned long)(G_CAR_OF(GC_TERM)))
 
@@ -202,7 +217,7 @@
 /***************************************************************************/
 
 #define GC_DEREF(x) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(x)) { \
       if (atomicnotref(x)) { \
@@ -220,26 +235,26 @@
       break; \
     } \
   } \
-}
+}while(0)
 
 
-#define GC_TRY_TO_ALLOC(new,type,size,gc_request) \
-{ \
+#define GC_TRY_TO_ALLOC(new, type, size, gc_request) \
+do{ \
   q res; \
-  G_HEAPALLOC_WITH_CHECK(new,size,type,g_allocp,res); \
+  G_HEAPALLOC_WITH_CHECK((new), (size), type, g_allocp, res); \
   if (GC_GCREQUEST == res) goto gc_request; \
-}
+}while(0)
 
 
-#define GC_UNIFY(x,y)  g_allocp = do_shallow_unify(g_allocp,x,y)
-#define GC_UNIFY_VALUE(x,y)					\
-{								\
+#define GC_UNIFY(x,y)  (g_allocp = do_shallow_unify(g_allocp, (x), (y)))
+#define GC_UNIFY_VALUE(x, y)					\
+do{								\
   if (!isref(x) || derefone(x) != (x)) {			\
-    g_allocp = do_shallow_unify_value(g_allocp, (x), (y));		\
+    g_allocp = do_shallow_unify_value(g_allocp, (x), (y));	\
   } else {							\
     derefone(x) = (y);						\
   }								\
-}
+}while(0)
 
 /**************************************************************************/
 
@@ -259,7 +274,7 @@
     q *g_allocp;
 
 #define GC_DEREF_FOR_NEW(x) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(x)) { \
       if (atomicnotref(x)) { \
@@ -282,26 +297,29 @@
       break; \
     } \
   } \
-}
+}while(0)
 
 
 #define GCSET_NEWOBJ_FOR_NEW(newgobj,size) \
-  { \
-    q res; \
-    G_HEAPALLOC_WITH_CHECK(newgobj,size,(GC_OBJ_TYPE *),g_allocp,res); \
-    if(GC_GCREQUEST == res){ \
-      q var; \
-      struct goalrec *goal; \
-      g_allocp = \
-	G_MAKE_THE_NEW_GOAL(&var,&goal,g_myself,GC_ARGC,GC_ARGV,g_allocp); \
-      G_PUSH_GOAL_TO_SPECIAL_QUEUE(goal); \
-      GC_RETURN_FROM_NEW(var); \
-    } \
-  newgobj->method_table = &GC_method_table; \
- }
+do{ \
+  q res; \
+  G_HEAPALLOC_WITH_CHECK((newgobj), (size), (GC_OBJ_TYPE *), g_allocp, res); \
+  if(GC_GCREQUEST == res){ \
+    q var; \
+    struct goalrec *goal; \
+    g_allocp = \
+      G_MAKE_THE_NEW_GOAL(&var,&goal,g_myself,GC_ARGC,GC_ARGV,g_allocp); \
+    G_PUSH_GOAL_TO_SPECIAL_QUEUE(goal); \
+    GC_RETURN_FROM_NEW(var); \
+  } \
+  (newgobj)->method_table = &GC_method_table; \
+}while(0)
 
 #define GC_RETURN_FROM_NEW(x) \
-{ heapp = g_allocp; return(x); }
+do{ \
+  heapp = g_allocp; \
+  return (x); \
+}while(0)
 
 
 /****************************************************/
@@ -323,23 +341,24 @@
     q *g_allocp;
 
 #define GCSET_NEWOBJ(newgobj) \
-  { \
-    GD_ALLOC_AREA(newgobj,(GC_OBJ_TYPE *),GC_OBJ_SIZE(GC_SELF)); \
-    newgobj->method_table = GC_SELF->method_table; \
-  }
-
-#define GC_SUSPEND_GOAL(var,goal) \
-{ g_allocp = GC_suspend_goal(var,goal,g_allocp); }
-#define GCSET_UNIFY_GOAL(goalp,x,y) \
-{ g_allocp = GC_make_unify_goal(goalp,x,y,g_allocp); }
+do{ \
+  GD_ALLOC_AREA((newgobj), (GC_OBJ_TYPE *), GC_OBJ_SIZE(GC_SELF)); \
+  (newgobj)->method_table = GC_SELF->method_table; \
+}while(0)
+
+#define GC_SUSPEND_GOAL(var, goal) \
+do{ g_allocp = GC_suspend_goal((var), (goal), g_allocp); }while(0)
+
+#define GCSET_UNIFY_GOAL(goalp, x, y) \
+do{ g_allocp = GC_make_unify_goal((goalp), (x), (y), g_allocp); }while(0)
 
 #define GC_GSUCCESS GENERIC_SUCCEEDED
 #define GC_GFAILURE    GENERIC_FAILED
 
-#define GC_GRETURN(x) return((q) x)
+#define GC_GRETURN(x)  do{ return (q) (x); }while(0)
 
-#define GC_GFAIL return((q) GC_GFAILURE)
-#define GC_GSUCCEED return((q) GC_GSUCCESS)
+#define GC_GFAIL  do{ return (q) GC_GFAILURE; }while(0)
+#define GC_GSUCCEED  do{ return (q) GC_GSUCCESS; }while(0)
 
 /**********************************************************************/
 
@@ -359,9 +378,9 @@
 
 #define GC_PRINT(x) klic_fprintf(g_fp, (x))
 
-#define GC_PUTC(x) klic_putc(x,g_fp)
+#define GC_PUTC(x)  klic_putc((x), g_fp)
 
-#define GC_RETURN_FROM_PRINT return(1L)
+#define GC_RETURN_FROM_PRINT  do{ return 1L; }while(0)
 
 #define GCDEF_PRINT() \
   static \
@@ -373,14 +392,14 @@
     unsigned long g_length;
 
 #define GC_PRINT_KL1_TERMS(x,b,s) \
-{ \
+do{ \
   int i; \
   general_print((((q *)(x))+(b)),g_fp,g_depth,g_length); \
   for(i=(b)+1; i<(b)+(s); i++){ \
     klic_fprintf(g_fp,","); \
     general_print((((q *)(x))+i),g_fp,g_depth,g_length); \
   } \
-}
+}while(0)
 
 /******************************************************************/
 
@@ -393,20 +412,20 @@
     q **g_sp;
 
 #define GCSET_NEWOBJ_IN_NEWGEN(newobj) \
-  { \
-    unsigned long size = GC_OBJ_SIZE(GC_SELF); \
-    *g_allocp = (q) GC_SELF->method_table; \
-    newobj = (GC_OBJ_TYPE *) g_allocp; \
-    g_allocp += size; \
-    if(g_allocp > real_heaplimit) fatal("not enough space collected"); \
-  }
+do{ \
+  unsigned long size = GC_OBJ_SIZE(GC_SELF); \
+  *g_allocp = (q) GC_SELF->method_table; \
+  (newobj) = (GC_OBJ_TYPE *) g_allocp; \
+  g_allocp += size; \
+  if(g_allocp > real_heaplimit) fatal("not enough space collected"); \
+}while(0)
 
 #define GC_RETURN_FROM_GC(newgobj) \
-{ \
+do{ \
   gcsp  = g_sp; \
   heapp = g_allocp; \
-  return(((q *)(newgobj))); \
-}
+  return (q *) (newgobj); \
+}while(0)
 
 #define GCDEF_REGIST() \
   static \
@@ -436,46 +455,46 @@
 /*******************************************/
 
 #define GCSET_INTARG_FOR_NEW(var,argv_i) \
-{ \
+do{ \
   GC_DEREF_FOR_NEW(argv_i); \
   if(!G_ISINT(argv_i)) GC_FAIL("not integer"); \
   (var) = G_INTVAL(argv_i); \
-}
+}while(0)
 
 #define GCSET_INTARG(var,argv_i) \
-{ \
+do{ \
   GC_DEREF(argv_i); \
   if(!G_ISINT(argv_i)) GC_FAIL("not integer"); \
   (var) = G_INTVAL(argv_i); \
-}
+}while(0)
 
 #define GCSET_INTARG_WITHIN_RANGE(var,argv_i,llim,ulim) \
-{ \
+do{ \
   GC_DEREF(argv_i); \
   if(!G_ISINT(argv_i)) GC_FAIL("not integer"); \
   (var) = G_INTVAL(argv_i); \
-  if( (llim>(var)) || ((var)>=ulim) ) GC_FAIL("out of range"); \
-}
+  if((var) < (llim) || (ulim) <= (var)) GC_FAIL("out of range"); \
+}while(0)
 
 #define GCSET_MESSAGE(message)					\
-{								\
-  message = G_CAR_OF(GC_TERM);					\
+do{								\
+  (message) = G_CAR_OF(GC_TERM);				\
   while (G_ISREF(message)) {					\
     q temp = G_DEREFONE(message);				\
     if (G_ISREF(temp) &&					\
-	(temp == message || G_DEREFONE(temp) == message)) {	\
-      reason = message;						\
+	(temp == (message) || G_DEREFONE(temp) == (message))) {	\
+      reason = (message);					\
       GC_SELF->stream = GC_TERM;				\
       goto suspend;						\
     } else {							\
-      message = temp;						\
+      (message) = temp;						\
     }								\
   }								\
-}
+}while(0)
 
 #define GCSET_MESSAGE_INT_ARG(arg, message, pos)		\
-{								\
-  q temp = G_ARG(message, pos);					\
+do{								\
+  q temp = G_ARG((message), (pos));				\
   while (!G_ISINT(temp)) {					\
     if (G_ISREF(temp)) {					\
       q temp1 = G_DEREFONE(temp);				\
@@ -489,12 +508,12 @@
       goto message_error;					\
     }								\
   }								\
-  arg = G_INTVAL(temp);						\
-}
+  (arg) = G_INTVAL(temp);					\
+}while(0)
 
 #define GCSET_MESSAGE_STR_ARG(arg, message, pos)		\
-{								\
-  q temp = G_ARG(message, pos);					\
+do{								\
+  q temp = G_ARG((message), (pos));				\
   while (!G_ISGOBJ(temp) ||					\
 	 (struct data_object_method_table *)			\
 	 G_FUNCTOR_OF(temp) !=					\
@@ -511,22 +530,22 @@
       goto message_error;					\
     }								\
   }								\
-  arg = (struct byte_string_object *)G_FUNCTORP(temp);		\
-}
+  (arg) = (struct byte_string_object *) G_FUNCTORP(temp);	\
+}while(0)
 
 #define GCSET_NEW_CONS(var)  G_HEAPALLOC(var,2,makecons)
 
-#define GCSET_VAR(self) self = G_MAKEREF(&self)
+#define GCSET_VAR(self)  ((self) = G_MAKEREF(&(self)))
 
 extern struct predicate predicate_unify__term__dcode_xunify__goal_2;
 #define GC_KL1_UNIFY(x, y) \
-{ \
+do{ \
   struct goalrec *gp; \
   G_HEAPALLOC(gp, 4, (struct goalrec *)); \
   gp->pred = &predicate_unify__term__dcode_xunify__goal_2; \
-  gp->args[0] = x; \
-  gp->args[1] = y; \
+  gp->args[0] = (x); \
+  gp->args[1] = (y); \
   resume_same_prio(gp); \
-}
+}while(0)
 
 #endif /* _KLIC_GC_MACRO_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/gd_macro.h klic-3.003-2001-11-20/include/klic/gd_macro.h
--- klic-3.003-2001-11-19/include/klic/gd_macro.h	Sun Nov 18 21:29:25 2001
+++ klic-3.003-2001-11-20/include/klic/gd_macro.h	Mon Nov 19 21:00:01 2001
@@ -42,29 +42,29 @@
 #define GD_UNIFY_FAIL \
   G_error("Failure", "active unification", "data", GD_CLASS_NAME_STRING)
 #define GD_ERROR_IN_NEW(errmsg) \
-  G_error(errmsg, "creation", "data", GD_CLASS_NAME_STRING)
+  G_error((errmsg), "creation", "data", GD_CLASS_NAME_STRING)
 #define GD_ERROR_IN_UNIFY(errmsg) \
-  G_error(errmsg, "unification", "data", GD_CLASS_NAME_STRING)
+  G_error((errmsg), "unification", "data", GD_CLASS_NAME_STRING)
 #define GD_ERROR_IN_METHOD(errmsg, methodname) \
-  G_error(errmsg, methodname, "data", GD_CLASS_NAME_STRING)
+  G_error((errmsg), (methodname), "data", GD_CLASS_NAME_STRING)
 
-#define GD_RETURN return(g_allocp) 
+#define GD_RETURN  do{ return g_allocp; }while(0)
 #define GD_GCREQUEST GENERIC_GCREQUEST
 
-#define GD_GSUCCESS (long)GENERIC_SUCCEEDED
-#define GD_GFAILURE (long)GENERIC_FAILED
+#define GD_GSUCCESS  ((long) GENERIC_SUCCEEDED)
+#define GD_GFAILURE  ((long) GENERIC_FAILED)
 
-#define GD_GRETURN(x) return((q) x)
+#define GD_GRETURN(x)  do{ return (q) (x); }while(0)
 
 #define GD_GUNIFY_FAIL GD_GFAIL
-#define GD_GFAIL return((q) GD_GFAILURE)
-#define GD_GSUCCEED return((q) GD_GSUCCESS)
+#define GD_GFAIL  do{ return (q) GD_GFAILURE; }while(0)
+#define GD_GSUCCEED  do{ return (q) GD_GSUCCESS; }while(0)
 
 /**************************************************/
 #define GD_ALLOC_AREA(new,type,size) \
-{ \
+do{ \
   q res; \
-  G_HEAPALLOC_WITH_CHECK(new,size,type,g_allocp,res); \
+  G_HEAPALLOC_WITH_CHECK((new), (size), type, g_allocp, res); \
   if(GD_GCREQUEST == res){ \
     struct goalrec *goal; \
     g_allocp = \
@@ -73,12 +73,12 @@
     G_PUSH_GOAL(goal); \
     GD_RETURN; \
   } \
-}
+}while(0)
 
 #define GD_ALLOC_AREA_FOR_NEW(new,type,size) \
-{ \
+do{ \
   q res; \
-  G_HEAPALLOC_WITH_CHECK(new,size,type,g_allocp,res); \
+  G_HEAPALLOC_WITH_CHECK((new), (size), type, g_allocp, res); \
   if(GD_GCREQUEST == res){ \
     q var; \
     struct goalrec *goal; \
@@ -87,12 +87,12 @@
     G_PUSH_GOAL_TO_SPECIAL_QUEUE(goal); \
     GD_SUSPEND_NEW(var); \
   } \
-}
+}while(0)
 
 /***************************************************************************/
 
 #define GDSET_NEWOBJ_FOR_NEW(newgobj,size) \
-{ \
+do{ \
   q res; \
   G_HEAPALLOC_WITH_CHECK((newgobj),(size),(GD_OBJ_TYPE *),g_allocp,res); \
   if(GENERIC_GCREQUEST == res){ \
@@ -103,13 +103,13 @@
     G_PUSH_GOAL_TO_SPECIAL_QUEUE(goal); \
     GD_SUSPEND_NEW(var); \
   } \
-  newgobj->method_table = &GD_method_table; \
-}
+  (newgobj)->method_table = &GD_method_table; \
+}while(0)
 
 #define GDSET_NEWOBJ(newgobj) \
-{ \
+do{ \
   q res; \
-  G_HEAPALLOC_WITH_CHECK(newgobj,(GD_OBJ_SIZE(GD_SELF)), \
+  G_HEAPALLOC_WITH_CHECK((newgobj), GD_OBJ_SIZE(GD_SELF), \
 			 (GD_OBJ_TYPE *),g_allocp,res); \
   if (GD_GCREQUEST == res) { \
     struct goalrec *goal; \
@@ -119,21 +119,21 @@
     G_PUSH_GOAL(goal); \
     GD_RETURN; \
   } \
-  newgobj->method_table = GD_SELF->method_table; \
-}
+  (newgobj)->method_table = GD_SELF->method_table; \
+}while(0)
 
 #define GDSET_NEWOBJ_IN_NEWGEN(newobj) \
-  { \
+do{ \
     unsigned long size = GD_OBJ_SIZE(GD_SELF); \
-    newobj = (GD_OBJ_TYPE *) g_allocp; \
-    newobj->method_table = GD_SELF->method_table; \
+    (newobj) = (GD_OBJ_TYPE *) g_allocp; \
+    (newobj)->method_table = GD_SELF->method_table; \
     g_allocp += size; \
     if((g_allocp) > real_heaplimit) fatal("not enough space collected"); \
-  }
+}while(0)
 
 /***************************************************************************/
 #define GD_GDEREF(x) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(x)) { \
       if (atomicnotref(x)) { \
@@ -150,10 +150,10 @@
       break; \
     } \
   } \
-}
+}while(0)
 
 #define GD_DEREF_AND_HOOK(obj,method_functor,argv) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(obj)) { \
       if (atomicnotref(obj)) { \
@@ -163,7 +163,7 @@
 	if(isref(temp0) && (obj) == derefone(temp0)) { \
           struct goalrec *goal; \
           g_allocp = \
-	    GD_MAKE_GENERIC_GOAL(&goal,(obj),method_functor,argv,g_allocp); \
+	    GD_MAKE_GENERIC_GOAL(&goal, (obj), (method_functor), (argv), g_allocp); \
 	  g_allocp = G_SUSPEND((obj),goal,g_allocp); \
           GD_RETURN; \
 	} else { \
@@ -174,10 +174,10 @@
       break; \
     } \
   } \
-}
+}while(0)
 
 #define GD_DEREF(x) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(x)) { \
       if (atomicnotref(x)) { \
@@ -199,12 +199,12 @@
       break; \
     } \
   } \
-}
+}while(0)
 
 
 
 #define GD_DEREF_FOR_NEW(x) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(x)) { \
       if (atomicnotref(x)) { \
@@ -227,7 +227,7 @@
       break; \
     } \
   } \
-}
+}while(0)
 
 
 /**************************************************************************/
@@ -239,10 +239,16 @@
     q *g_allocp;
 
 #define GD_SUSPEND_NEW(v) \
-{ heapp = g_allocp; return(v); }
+do{ \
+  heapp = g_allocp; \
+  return (v); \
+}while(0)
 
 #define GD_RETURN_FROM_NEW(x) \
-{ heapp = g_allocp; return(makefunctor(x)); }
+do{ \
+  heapp = g_allocp; \
+  return makefunctor(x); \
+}while(0)
 
 #define GD_STD_DECL_FOR_NEW \
   G_STD_DECL; \
@@ -254,15 +260,17 @@
 /**************************************************************************/
 #define GD_GUNIFY(x,y) eq_terms_body(x,y)
 
-#define GD_UNIFY(x,y)  { g_allocp = do_shallow_unify(g_allocp,x,y); }
+#define GD_UNIFY(x,y) \
+do{ g_allocp = do_shallow_unify(g_allocp, (x), (y)); }while(0)
+
 #define GD_UNIFY_VALUE(x,y) \
-{								\
+do{								\
   if (!isref(x) || derefone(x) != (x)) {			\
     g_allocp = do_shallow_unify_value(g_allocp, (x), (y));	\
   } else {							\
     derefone(x) = (y);						\
   }								\
-}
+}while(0)
 
 /****************************************************/
 #define GD_SWITCH_ON_METHOD switch(g_method_functor)
@@ -320,9 +328,9 @@
     GD_OBJ_TYPE * GD_OTHER; \
     q *g_allocp;
 
-#define GD_PUTC(x) klic_putc(x,g_fp)
+#define GD_PUTC(x)  klic_putc((x), g_fp)
 
-#define GD_RETURN_FROM_PRINT return(1L)
+#define GD_RETURN_FROM_PRINT  do{ return 1L; }while(0)
 
 #define GDDEF_PRINT() \
   static long \
@@ -335,20 +343,20 @@
 #define GD_PRINT(x) klic_fprintf(g_fp, (x))
 
 #define GD_PRINTF(s, arg) \
-{ klic_fprintf(g_fp, s, arg); }
+do{ klic_fprintf(g_fp, (s), (arg)); }while(0)
 
 #define GD_PRINT_KL1_TERM(x) \
-{ general_print(x, g_fp, g_depth, g_length); }
+do{ general_print((x), g_fp, g_depth, g_length); }while(0)
 
 #define GD_PRINT_KL1_TERMS(x,b,s) \
-{ \
+do{ \
   int i; \
   general_print((((q *)(x))+(b)),g_fp,g_depth,g_length); \
   for(i=(b)+1; i<(b)+(s); i++){ \
     klic_fprintf(g_fp,","); \
     general_print((((q *)(x))+i),g_fp,g_depth,g_length); \
   } \
-}
+}while(0)
 
 /******************************************************************/
 
@@ -371,11 +379,11 @@
     q **g_sp;
 
 #define GD_RETURN_FROM_GC(newgobj) \
-{ \
+do{ \
   gcsp = g_sp; \
   heapp = g_allocp; \
   return(((q *)(newgobj))); \
-}
+}while(0)
 
 #define GD_COPY_KL1_TERM_TO_NEWGEN(from,to) G_COPY_KL1_TERM_TO_NEWGEN(from,to) 
 
@@ -437,7 +445,7 @@
 /*******************************************/
 /* utility */
 #define GDSET_INTARG_FOR_NEW(var,argv_i) \
-{ \
+do{ \
   while (!G_ISINT(argv_i)) { \
     if (!G_ISREF(argv_i)) { \
       GD_ERROR_IN_NEW("Non-integer parameter"); \
@@ -445,10 +453,10 @@
     GD_DEREF_FOR_NEW(argv_i); \
   } \
   (var) = G_INTVAL(argv_i); \
-}
+}while(0)
 
 #define GDSET_INTARG(var,argv_i) \
-{ \
+do{ \
   while (!G_ISINT(argv_i)) { \
     if (!G_ISREF(argv_i)) { \
       GD_ERROR_IN_METHOD("Non-integer paramter", 0); \
@@ -456,63 +464,63 @@
     GD_DEREF(argv_i); \
   } \
   (var) = G_INTVAL(argv_i); \
-}
+}while(0)
 
 #define GDSET_SYMARG_FOR_NEW(var, arg) \
-{ \
+do{ \
   while (!G_ISSYM(arg)) { \
     if (!G_ISREF(arg)) GD_ERROR_IN_NEW("Non-atom paramter"); \
     GD_DEREF_FOR_NEW(arg); \
   } \
   (var) = (arg); \
-}
+}while(0)
 
 #define GDSET_SYMARG(var, arg) \
-{ \
+do{ \
   while (!G_ISSYM(arg)) { \
     if (!G_ISREF(arg)) GD_ERROR_IN_METHOD("Non-atom paramter", 0); \
     GD_DEREF(arg); \
   } \
   (var) = (arg); \
-}
+}while(0)
 
 #define GDSET_INTARG_WITHIN_RANGE(var,argv_i,llim,ulim) \
-{ \
+do{ \
   while (!G_ISINT(argv_i)) { \
     if (!G_ISREF(argv_i)) GD_ERROR_IN_METHOD("Non-integer paramter", 0); \
     GD_DEREF(argv_i); \
   } \
   (var) = G_INTVAL(argv_i); \
-  if ((llim>(var)) || ((var)>=ulim)) \
+  if ((var) < (llim) || (ulim) <= (var)) \
     GD_ERROR_IN_METHOD("out of range", 0); \
-}
+}while(0)
 
 #define GDSET_GINTARG_WITHIN_RANGE(var,x,from,to) \
-{ \
+do{ \
   while (!G_ISINT(x)) { \
     if (!G_ISREF(x)) GD_GFAIL; \
     GD_GDEREF(x); \
   } \
-  var = G_INTVAL(x); \
-  if( ((from)>var) || (var>=(to)) ) GD_GFAIL; \
-}
+  (var) = G_INTVAL(x); \
+  if((var) < (from) || (to) <= (var)) GD_GFAIL; \
+}while(0)
 
 /*******************************************/
 #define GD_IS_CLASS(class,obj) \
    ((struct data_object_method_table *)(&(GD_method_table0(class))) == ((struct data_object_method_table *)functor_of(obj)))
 
 #define GD_CALL_GMETHOD(obj,method,argv) \
-     (q)((((struct data_object *)functorp(obj))->method_table)->g_generic) \
-             ((struct data_object *)functorp(obj), G_functor(method),argv)
-	 
+  ((q) ((((struct data_object *)functorp(obj))->method_table)->g_generic) \
+         ((struct data_object *)functorp(obj), G_functor(method), (argv)))
+
 #define GD_CALL_METHOD(obj,method,argv) \
-     g_allocp = ((((struct data_object *)functorp(obj))-> \
+  (g_allocp = ((((struct data_object *)functorp(obj))-> \
 		  method_table)->body_generic) \
 		  ((struct data_object *)functorp(obj), \
-                        G_functor(method),argv,g_allocp)
+                        G_functor(method), (argv), g_allocp))
 
 #define GD_NEW(class,argc,argv) \
-     (q) GD_rappend(class,new) (argc,argv,g_allocp)
+  ((q) GD_rappend(class,new) ((argc), (argv), g_allocp))
 
 
 #define GDDEF_ENCODE() \
diff -ruN klic-3.003-2001-11-19/include/klic/generic.h klic-3.003-2001-11-20/include/klic/generic.h
--- klic-3.003-2001-11-19/include/klic/generic.h	Sun Nov 18 21:30:33 2001
+++ klic-3.003-2001-11-20/include/klic/generic.h	Mon Nov 19 14:18:45 2001
@@ -13,13 +13,16 @@
 extern q *gd_generic();
 
 #define new_generic(name,argc,out,offset)  \
-  { out = name(argc,generic_arg,allocp+offset); allocp = heapp; }
+do{ \
+  (out) = (name)((argc), generic_arg, allocp+offset); \
+  allocp = heapp; \
+}while(0)
 
 #define call_generic(obj,funct,offset) \
-  allocp = (q *)gd_generic(allocp+(offset),(obj),(funct),generic_arg)
+  (allocp = (q *) gd_generic(allocp+(offset),(obj),(funct),generic_arg))
 
 #define guard_generic(object,mf,inargc,label) \
-{ \
+do{ \
   q *obj = (q *)functorp(object); \
   q retval = ((struct data_object_method_table *) \
                   (*obj))->g_generic( obj, (mf), generic_arg); \
@@ -28,7 +31,7 @@
     if( retval == GENERIC_FAILED ) { goto label ; } \
     else{     *reasonp++ = retval;   goto label ; } \
   } \
-}
+}while(0)
 
 #define isgobj(x)  (isref(functor_of(x)))
 
diff -ruN klic-3.003-2001-11-19/include/klic/gg_macro.h klic-3.003-2001-11-20/include/klic/gg_macro.h
--- klic-3.003-2001-11-19/include/klic/gg_macro.h	Sun Nov 18 21:30:57 2001
+++ klic-3.003-2001-11-20/include/klic/gg_macro.h	Mon Nov 19 21:00:24 2001
@@ -41,38 +41,38 @@
 
 #define GG_FAIL(errmsg) fatal(errmsg)
 #define GG_ERROR_IN_NEW(errmsg) \
-  G_error(errmsg, "creation", "generator", GG_CLASS_NAME_STRING)
+  G_error((errmsg), "creation", "generator", GG_CLASS_NAME_STRING)
 #define GG_SUCCEEDED GENERIC_SUCCEEDED
 #define GG_GCREQUEST GENERIC_GCREQUEST
-#define GG_RETURN { return(g_allocp); }
+#define GG_RETURN  do{ return g_allocp; }while(0)
 /* GG_RETUTN_FROM_GENERIC ? */
 
 #define GG_DEREF_AND_TEST(x, susplab) \
-{ \
+do{ \
   q temp0 = derefone(x); \
   if(!isref(temp0) || (x) != derefone(temp0)) { \
     (x) = temp0; \
   } else { \
     goto susp; \
   } \
-}
+}while(0)
 
-#define GG_TERMINATE return(g_allocp)
+#define GG_TERMINATE  do{ return g_allocp; }while(0)
 
 #define GG_SUSPEND(var) \
-{ \
+do{ \
   q newvar, tmp; \
   q argv[2]; \
   G_MAKE_VAR(newvar); \
   argv[0] = GG_TERM; \
   argv[1] = newvar; \
   tmp = GC_wakeup_g_new(2,argv,g_allocp); \
-  GG_KL1_UNIFY(var,tmp); \
+  GG_KL1_UNIFY((var), tmp); \
   return(g_allocp); \
-}
+}while(0)
 
 #define GG_SWITCH_ON_TERM(cons,atomic,funct,dobj,susp) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(GG_TERM)) { \
       if (atomicnotref(GG_TERM)) { \
@@ -93,12 +93,12 @@
         } \
     } else goto cons; \
   } \
-}
+}while(0)
 
 /***************************************************************************/
 
 #define GG_DEREF(x) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(x)) { \
       if (atomicnotref(x)) { \
@@ -116,17 +116,17 @@
       break; \
     } \
   } \
-}
+}while(0)
 
 #define GG_TRY_TO_ALLOC(new,type,size,label) \
-{ \
-  G_HEAPALLOC(new, size, type); \
+do{ \
+  G_HEAPALLOC((new), (size), type); \
   if((long)real_heaplimit <= (long)(g_allocp)) { \
     goto label; \
   } \
-}
+}while(0)
 
-#define GG_UNIFY(x,y) g_allocp = do_shallow_unify(g_allocp, x, y)
+#define GG_UNIFY(x,y)  (g_allocp = do_shallow_unify(g_allocp, (x), (y)))
 
 /**************************************************************************/
 
@@ -143,7 +143,7 @@
     q   *g_allocp;
 
 #define GG_DEREF_FOR_NEW(x) \
-{ \
+do{ \
   while (1) { \
     if (!isstruct(x)) { \
       if (atomicnotref(x)) { \
@@ -166,12 +166,12 @@
       break; \
     } \
   } \
-}
+}while(0)
 
 #define GGSET_NEWOBJ_FOR_NEW(newgobj, type) \
-{ \
+do{ \
   q res; \
-  G_HEAPALLOC_WITH_CHECK(newgobj,GG_OBJ_SIZE, \
+  G_HEAPALLOC_WITH_CHECK((newgobj), GG_OBJ_SIZE, \
 			 type, g_allocp, res); \
   if(GG_GCREQUEST == res) { \
     q var; \
@@ -181,21 +181,25 @@
     G_PUSH_GOAL_TO_SPECIAL_QUEUE(goal); \
     GG_RETURN_FROM_NEW(var); \
   } \
-  newgobj->method_table = &GG_method_table; \
-}
+  (newgobj)->method_table = &GG_method_table; \
+}while(0)
 
-#define GG_RETURN_FROM_NEW(var) { heapp = g_allocp; return(var); }
+#define GG_RETURN_FROM_NEW(var) \
+do{ \
+  heapp = g_allocp; \
+  return (var); \
+}while(0)
 
 /****************************************************/
 #define GGSET_NEWOBJ(newgobj) \
-{ \
-  GD_ALLOC_AREA(newgobj, (GG_OBJ_TYPE *),GG_OBJ_SIZE); \
-  newgobj->method_able = GG_SELF->method_table; \
-}
+do{ \
+  GD_ALLOC_AREA((newgobj), (GG_OBJ_TYPE *), GG_OBJ_SIZE); \
+  (newgobj)->method_able = GG_SELF->method_table; \
+}while(0)
 
 /* temporary */
 #define GG_SUSPEND_GOAL(var,goal) \
-{ g_allocp = GC_suspend_goal(var,goal,g_allocp); }
+do{ g_allocp = GC_suspend_goal((var), (goal), g_allocp); }while(0)
 
 /* temporary
 #define GGSET_UNIFY_GOAL(goal,x,y) \
@@ -232,9 +236,9 @@
 
 #define GG_PRINT(x) klic_fprintf(g_fp, (x))
 
-#define GG_PUTC(x) klic_fputc(x,g_fp)
+#define GG_PUTC(x)  klic_fputc((x), g_fp)
 
-#define GG_RETURN_FROM_PRINT return(1L)
+#define GG_RETURN_FROM_PRINT  do{ return 1L; }while(0)
 
 #define GGDEF_PRINT() \
   static \
@@ -246,14 +250,14 @@
     unsigned long g_length;
 
 #define GG_PRINT_KL1_TERMS(x,b,s) \
-{ \
+do{ \
   int i; \
   general_print((((q *)(x))+(b)),g_fp,g_depth,g_length); \
   for(i=(b)+1; i<(b)+(s); i++){ \
     klic_fprintf(g_fp,","); \
     general_print((((q *)(x))+i),g_fp,g_depth,g_length); \
   } \
-}
+}while(0)
 
 /******************************************************************/
 
@@ -266,20 +270,20 @@
   q **g_sp;
 
 #define GGSET_NEWOBJ_IN_NEWGEN(newobj) \
-  { \
+do{ \
     unsigned long size = GG_OBJ_SIZE; \
     *g_allocp = (q) GG_SELF->method_table; \
-    newobj = (GG_OBJ_TYPE *) g_allocp; \
+    (newobj) = (GG_OBJ_TYPE *) g_allocp; \
     g_allocp += size; \
     if(g_allocp > real_heaplimit) fatal("not enough space collected"); \
-  }
+}while(0)
 
 #define GG_RETURN_FROM_GC(newgobj) \
-{ \
+do{ \
   gcsp  = g_sp; \
   heapp = g_allocp; \
   return(((q *)(newgobj))); \
-}
+}while(0)
 
 #define GGDEF_REGIST() \
   static \
@@ -309,41 +313,41 @@
 /*******************************************/
 
 #define GGSET_INTARG_FOR_NEW(var,argv_i) \
-{ \
+do{ \
   GG_DEREF_FOR_NEW(argv_i); \
   if(!G_ISINT(argv_i)) GG_FAIL("not integer"); \
   (var) = G_INTVAL(argv_i); \
-}
+}while(0)
 
 #define GGSET_INTARG(var,argv_i) \
-{ \
+do{ \
   GG_DEREF(argv_i); \
   if(!G_ISINT(argv_i)) GG_FAIL("not integer"); \
   (var) = G_INTVAL(argv_i); \
-}
+}while(0)
 
 #define GGSET_INTARG_WITHIN_RANGE(var,argv_i,llim,ulim) \
-{ \
+do{ \
   GG_DEREF(argv_i); \
   if(!G_ISINT(argv_i)) GG_FAIL("not integer"); \
   (var) = G_INTVAL(argv_i); \
-  if( (llim>(var)) || ((var)>=ulim) ) GG_FAIL("out of range"); \
-}
+  if((var) < (llim) || (ulim) <= (var)) GG_FAIL("out of range"); \
+}while(0)
 
-#define GGSET_NEW_CONS(var)  G_HEAPALLOC(var,2,makecons)
+#define GGSET_NEW_CONS(var)  G_HEAPALLOC((var), 2, makecons)
 
-#define GGSET_VAR(self) self = G_MAKEREF(&self)
+#define GGSET_VAR(self)  ((self) = G_MAKEREF(&(self)))
 
 extern struct predicate predicate_unify__term__dcode_xunify__goal_2;
 #define GG_KL1_UNIFY(x, y) \
-{ \
+do{ \
   struct goalrec *gp; \
   G_HEAPALLOC(gp, 4, (struct goalrec *)); \
   gp->pred = &predicate_unify__term__dcode_xunify__goal_2; \
-  gp->args[0] = x; \
-  gp->args[1] = y; \
+  gp->args[0] = (x); \
+  gp->args[1] = (y); \
   resume_same_prio(gp); \
-}
+}while(0)
 
 /*** for Distribute KLIC system ***/
 
diff -ruN klic-3.003-2001-11-19/include/klic/gmodule.h klic-3.003-2001-11-20/include/klic/gmodule.h
--- klic-3.003-2001-11-19/include/klic/gmodule.h	Sun Nov 18 21:31:33 2001
+++ klic-3.003-2001-11-20/include/klic/gmodule.h	Mon Nov 19 14:30:06 2001
@@ -8,27 +8,26 @@
 #ifndef _KLIC_GMODULE_H_
 #define _KLIC_GMODULE_H_
 
-struct module_object {
+typedef struct module_object {
   struct data_object_method_table *method_table;
   q name;
-};
+} module_structure_type;
 
-#define module_structure_type		struct module_object
 #define declare_module_constant(mod,name)	\
 {						\
   &module_g_data_method_table,			\
   name						\
 }
-#define makemodule(x)		makefunctor(&x)
 
-struct predicate_object {
+#define makemodule(x)	makefunctor(&(x))
+
+typedef struct predicate_object {
   struct data_object_method_table *method_table;
   Const struct predicate *pdesc; /* atom tag */
   q module_obj;
   q predicate_name;
-};
+} predicate_structure_type;
 
-#define predicate_structure_type	struct predicate_object
 #define declare_pred_constant(pred,mod,name)	\
 {						\
   &predicate_g_data_method_table,		\
@@ -37,6 +36,6 @@
   name						\
 }
 
-#define makepred(x)		makefunctor(&x)
+#define makepred(x)	makefunctor(&(x))
 
 #endif /* _KLIC_GMODULE_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/gobj.h klic-3.003-2001-11-20/include/klic/gobj.h
--- klic-3.003-2001-11-19/include/klic/gobj.h	Sun Nov 18 21:32:04 2001
+++ klic-3.003-2001-11-20/include/klic/gobj.h	Mon Nov 19 14:34:05 2001
@@ -16,15 +16,15 @@
 
 #define method_table_of(obj) ((obj)->method_table)
 #define generic_passive_unify(obj, anothor) \
-  (method_table_of(obj)->passive_unify(obj, anothor))
+  (method_table_of(obj)->passive_unify((obj), (anothor)))
 #define generic_active_unify(obj, anothor, allocp) \
-{ \
-  allocp = (method_table_of(obj)->active_unify(obj, anothor, allocp)); \
-}
+do{ \
+  (allocp) = method_table_of(obj)->active_unify((obj), (anothor), (allocp)); \
+}while(0)
 #define generic_print(obj, stream, depth, length) \
-  (method_table_of(obj)->print(obj, stream, depth, length))
+  (method_table_of(obj)->print((obj), (stream), (depth), (length)))
 #define generic_gc(obj, allocp, sp) \
-  (method_table_of(obj)->gc(obj, allocp, sp))
+  (method_table_of(obj)->gc((obj), (allocp), (sp)))
 #define generic_regist(obj) \
   (method_table_of(obj)->regist(obj))
 #define generic_deallocate(obj) \
@@ -33,14 +33,14 @@
   (method_table_of(obj)->close(obj))
 
 #define generic_generate(obj, allocp) \
-  (method_table_of(obj)->generate(obj, allocp))
+  (method_table_of(obj)->generate((obj), (allocp)))
 
 #define generic_suspend(obj, ref, goal) \
-  (method_table_of(obj)->suspend(ref, goal))
+  (method_table_of(obj)->suspend((ref), (goal)))
 
 /*** for Distributed KLIC system ***/
 #define generic_encode(obj, pe, depth) \
-  (method_table_of(obj)->encode(obj, pe, depth))
+  (method_table_of(obj)->encode((obj), (pe), (depth)))
 
 /*** for Shared-memory KLIC system ***/
 #define generic_shmcopy(obj) \
@@ -54,10 +54,10 @@
 /* temporary */
 
 #define general_passive_unify(obj, anothor) \
-  eq_terms_body(obj, anothor)
+  eq_terms_body((obj), (anothor))
 
 #define general_active_unify(obj, anothor, allocp) \
-  allocp = do_shallow_unify(allocp, obj, anothor)
+  ((allocp) = do_shallow_unify((allocp), (obj), (anothor)))
 
 /* extern q general_gc(); */
 
diff -ruN klic-3.003-2001-11-19/include/klic/gobjutil.h klic-3.003-2001-11-20/include/klic/gobjutil.h
--- klic-3.003-2001-11-19/include/klic/gobjutil.h	Sun Nov 18 21:32:25 2001
+++ klic-3.003-2001-11-20/include/klic/gobjutil.h	Mon Nov 19 14:34:42 2001
@@ -11,10 +11,10 @@
 /* temporary */
 
 #define general_passive_unify(obj, anothor) \
-  eq_terms_body(obj, anothor)
+  eq_terms_body((obj), (anothor))
 
 #define general_active_unify(obj, anothor, allocp) \
-  do_shallow_unify(allocp, obj, anothor)
+  do_shallow_unify((allocp), (obj), (anothor))
 
 extern q general_gc( /* q *term, q* allocp */ );
 
diff -ruN klic-3.003-2001-11-19/include/klic/index.h klic-3.003-2001-11-20/include/klic/index.h
--- klic-3.003-2001-11-19/include/klic/index.h	Sun Nov 18 21:32:42 2001
+++ klic-3.003-2001-11-20/include/klic/index.h	Mon Nov 19 14:35:53 2001
@@ -9,7 +9,7 @@
 #define _KLIC_INDEX_H_
 
 #define deref_and_switch(x, susp, atomic, cons, funct)	\
-{ \
+do{ \
   while (1) { \
     if (!isstruct(x)) { \
       if (atomicnotref(x)) { \
@@ -28,10 +28,10 @@
       else goto cons; \
     } \
   } \
-}
+}while(0)
 
 #define deref_and_test(x, susp) \
-{ \
+do{ \
   q temp0 = derefone(x); \
   if(!isref(temp0) || (x) != derefone(temp0)) { \
     (x) = temp0; \
@@ -39,16 +39,16 @@
     *reasonp++ = (x); \
     goto susp; \
   } \
-}
+}while(0)
 
 #define deref_and_jump(x, loop) \
-{ \
+do{ \
   q temp0 = derefone(x); \
   if(!isref(temp0)) { \
     (x) = temp0; \
     goto loop; \
   } \
-}
+}while(0)
 
 #define not_cons(x)		((tag = ptagof(x)) != CONS)
 #define not_functor()		(tag <= CONS)
diff -ruN klic-3.003-2001-11-19/include/klic/interpe.h klic-3.003-2001-11-20/include/klic/interpe.h
--- klic-3.003-2001-11-19/include/klic/interpe.h	Sun Nov 18 21:32:56 2001
+++ klic-3.003-2001-11-20/include/klic/interpe.h	Mon Nov 19 14:38:58 2001
@@ -24,27 +24,27 @@
 #define INT_CL_PROBE
 
 #ifdef	INT_CL_DEBUG
-#  define INT_CL_DEBUG_X(X) X
+#  define INT_CL_DEBUG_X(X)  (X)
 #else
 #  define INT_CL_DEBUG_X(X)
 #endif
 
 #ifdef	INT_CL_PROBE
-#  define INT_CL_PROBE_X(X) X
+#  define INT_CL_PROBE_X(X)  (X)
 #else
 #  define INT_CL_PROBE_X(X)
 #endif
 
 /*********** for bsd libraries */
 #ifdef USEBCOPY
-#  define BCOPY(from,to,len)	bcopy(from,to,len)
+#  define BCOPY(from,to,len)	bcopy((from), (to), (len))
 #else
-#  define BCOPY(from,to,len)	memcpy(to,from,len)
+#  define BCOPY(from,to,len)	memcpy((to), (from), (len))
 #endif
 #ifdef USEBZERO
-#  define BZERO(from,len)		bzero(from,len)
+#  define BZERO(from,len)		bzero((from), (len))
 #else
-#  define BZERO(from,len)		memset(from,0,len)
+#  define BZERO(from,len)		memset((from), 0, (len))
 #endif
 
 /*********** Some convenient macros **************/
diff -ruN klic-3.003-2001-11-19/include/klic/newatom.h klic-3.003-2001-11-20/include/klic/newatom.h
--- klic-3.003-2001-11-19/include/klic/newatom.h	Sun Nov 18 21:33:53 2001
+++ klic-3.003-2001-11-20/include/klic/newatom.h	Mon Nov 19 14:43:31 2001
@@ -8,22 +8,17 @@
 #ifndef _KLIC_NEWATOM_H_
 #define _KLIC_NEWATOM_H_
 
-/* #include <klic/functorstuffs.h> */
-/* functor staffs  */
-#define FUNCTORNUMBERBASE 0
-#define functoratom(f) functors[symval(f) - FUNCTORNUMBERBASE]
-#define arityof(f) arities[symval(f) - FUNCTORNUMBERBASE]
-/* #include <klic/functorstuff.h> end*/
+#include <klic/functorstuffs.h>
 
 #define Hashsize 1024
 #define Namesize  1024
 #define Atomsize 1024
 #define Functorsize 1024
 
-#define YET  -1
+#define YET  (-1)
 #define DONE 0
 
-#define AtomError -1
+#define AtomError (-1)
 
 static int init_atom = YET;
 static int init_functor = YET;
diff -ruN klic-3.003-2001-11-19/include/klic/options.h klic-3.003-2001-11-20/include/klic/options.h
--- klic-3.003-2001-11-19/include/klic/options.h	Sun Nov 18 21:34:06 2001
+++ klic-3.003-2001-11-20/include/klic/options.h	Mon Nov 19 14:46:10 2001
@@ -30,10 +30,11 @@
 /* not copied when spawned */
 #define ARG_SHOULD_NOT_COPY(X)	((int)(X) >= (int)ARG_NOT_USED)
 #define ARG_NOT_COPIED(X) \
-  (enum argtype)((int)(X) + (int)ARG_NOT_USED)
+  ((enum argtype) ((int)(X) + (int)ARG_NOT_USED))
 
 #define ARG_ORIGINAL_TYPE(X) \
-  (enum argtype)(ARG_SHOULD_NOT_COPY(X)?(int)(X)-(int)ARG_NOT_USED:(int)(X))
+  ((enum argtype) \
+    (ARG_SHOULD_NOT_COPY(X) ? (int)(X)-(int)ARG_NOT_USED : (int)(X)))
 
 struct opttable {
     char *opt_str;
diff -ruN klic-3.003-2001-11-19/include/klic/rmon.h klic-3.003-2001-11-20/include/klic/rmon.h
--- klic-3.003-2001-11-19/include/klic/rmon.h	Sun Nov 18 21:35:15 2001
+++ klic-3.003-2001-11-20/include/klic/rmon.h	Mon Nov 19 14:47:31 2001
@@ -36,14 +36,14 @@
 Extern char *rmonnode;
 Extern int rmon_tid;
 
-#define IDLE_ON()  perfmon_state.idle_on = 1
-#define IDLE_OFF() perfmon_state.idle_on = 0
-#define GC_ON()    perfmon_state.gc_on = 1
-#define GC_OFF()   perfmon_state.gc_on = 0
-#define SEND_ON()  perfmon_state.ms_on = 1
-#define SEND_OFF() perfmon_state.ms_on = 0
-#define RECV_ON()  perfmon_state.mr_on = 1
-#define RECV_OFF() perfmon_state.mr_on = 0
+#define IDLE_ON()  (perfmon_state.idle_on = 1)
+#define IDLE_OFF() (perfmon_state.idle_on = 0)
+#define GC_ON()    (perfmon_state.gc_on = 1)
+#define GC_OFF()   (perfmon_state.gc_on = 0)
+#define SEND_ON()  (perfmon_state.ms_on = 1)
+#define SEND_OFF() (perfmon_state.ms_on = 0)
+#define RECV_ON()  (perfmon_state.mr_on = 1)
+#define RECV_OFF() (perfmon_state.mr_on = 0)
 
 Extern int gather_prof_ready Init(1);
 struct profile_rec {
diff -ruN klic-3.003-2001-11-19/include/klic/schedule.h klic-3.003-2001-11-20/include/klic/schedule.h
--- klic-3.003-2001-11-19/include/klic/schedule.h	Sun Nov 18 21:35:32 2001
+++ klic-3.003-2001-11-20/include/klic/schedule.h	Mon Nov 19 14:47:51 2001
@@ -8,12 +8,11 @@
 #ifndef _KLIC_SCHEDULE_H_
 #define _KLIC_SCHEDULE_H_
 
-struct prioqrec
-*more_priorec();
+extern struct prioqrec * more_prioqrec();
 
 extern module topsucceed();
 extern struct goalrec * enqueue_goal();
 extern struct goalrec * get_top_priority_queue();
-void put_top_priority_queue();
+extern void put_top_priority_queue();
 
 #endif /* _KLIC_SCHEDULE_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/shm.h klic-3.003-2001-11-20/include/klic/shm.h
--- klic-3.003-2001-11-19/include/klic/shm.h	Sun Nov 18 21:35:44 2001
+++ klic-3.003-2001-11-20/include/klic/shm.h	Mon Nov 19 15:05:17 2001
@@ -56,7 +56,7 @@
 #define f_key()     (HTBL_base+4)
 #define tr_key()    (HTBL_base+5)
   /* queuing a goal to external process */
-#define p_key(penum) ( HTBL_base + 6 + penum )
+#define p_key(penum)  (HTBL_base + 6 + (penum))
 
   /* global generator hook */
 #define is_genhook(X) ((long)(X) & 0x01)
@@ -70,10 +70,10 @@
 
   /* adjusts the memory boundary */
 #define reckon(sz) ((long)((((sz)+sizeof(long)-1)/sizeof(long))*sizeof(long)))
-#define get_adjust_addr(type,top,inc) ((type*)(((char*)(top)) \
-     + (reckon(sizeof(type))*inc)))
+#define get_adjust_addr(type,top,inc) \
+  (((type)*) (((char*) (top)) + (reckon(sizeof(type)) * (inc))))
 #define get_otherPE_glbl(n) \
-     get_adjust_addr(struct global_variables,top_shm_glbl,n)
+  get_adjust_addr(struct global_variables, top_shm_glbl, (n))
 
   /* shared memory alloc */
 #define galloc(Siz) ( { q* addr = gallocp; \
@@ -81,21 +81,23 @@
 
 
 #define free_local_tbl(ptr) \
-    { TADDRtbl *sl= (TADDRtbl*)ptr; \
-      (sl->prev)->next = sl->next; \
-      (sl->next)->prev = sl->prev; \
-      sl->next = ADDRtbl_free;    \
-      ADDRtbl_free = sl;          \
-    }
-
-#define makeshvar(svar) {\
-   struct generator_susp* vcell;\
-      svar = (q)galloc((sizeof(struct generator_susp)/sizeof(q))+1);\
-      vcell = (struct generator_susp*)(((q*)svar)+1);\
-      vcell->backpt = (q)svar;\
-      vcell->u.o = tag_generator_susp(pSHM_VAR);\
-      *((q*)svar) = (q)vcell;\
-}
+do{ \
+  TADDRtbl* sl = (TADDRtbl*) (ptr); \
+  (sl->prev)->next = sl->next; \
+  (sl->next)->prev = sl->prev; \
+  sl->next = ADDRtbl_free; \
+  ADDRtbl_free = sl; \
+}while(0)
+
+#define makeshvar(svar) \
+do{ \
+  struct generator_susp* vcell; \
+  (svar) = (q) galloc((sizeof(struct generator_susp) / sizeof(q)) + 1); \
+  vcell = (struct generator_susp*) (((q*) svar) + 1); \
+  vcell->backpt = (q) (svar); \
+  vcell->u.o = tag_generator_susp(pSHM_VAR); \
+  *((q*) svar) = (q) vcell; \
+}while(0)
 
 
 #define get_space(X) ( {\
@@ -116,7 +118,7 @@
     xv = get_space(x);      \
     yv = get_space(y);      \
     if ( xv == yv ) {       \
-      if ( x < y ) ret = 1; \
+      if ((x) < (y)) ret = 1; \
       else         ret = 0; \
     } else if ( xv < yv ) { \
        ret = 1;             \
@@ -125,12 +127,13 @@
     }                       \
     ret;} )
 
-#define ck_new_galloc(X) {\
+#define ck_new_galloc(X) \
+do{ \
     int cid = currid;\
     while ( (cid = PLNE_ptr[cid]->direct) != (-1) ) { \
        if ( (unsigned long)((long)(X)-(long)(PLNE_ptr[cid]->top_addr) ) < SHM_SIZE ) { new_galloc(cid); break; }\
     }\
-  }
+}while(0)
 
 
 #define is_cur_space_ptr(X) ( \
@@ -156,12 +159,13 @@
     } while ( (cid = PLNE_ptr[cid]->direct) != (-1) ) ;\
     ok; } )
 
-#define ck_throw_new_galloc(num) {\
+#define ck_throw_new_galloc(num) \
+do{ \
     int cid = currid;\
     while( (cid=PLNE_ptr[cid]->direct) != -1 ) { \
        if ( PLNE_ptr[cid]->proc[num] ) {new_galloc(cid);} \
     }\
-  }
+}while(0)
 
 
 
@@ -242,38 +246,38 @@
 
 /* Declarations of functions */
 /* convert real PE number from Logical PE number */
-int phisc_pe();
+extern int phisc_pe();
 
 /* common routines */
-struct global_variables* shm_init();
+extern struct global_variables* shm_init();
 
 /* copy into shared memory */
-struct ex_goalrec* shm_goal_copy();
+extern struct ex_goalrec* shm_goal_copy();
 
 /* copy argument into shared memory */
-q shm_copy();
+extern q shm_copy();
 
 /* stack a goal */
-int shm_goal_stack();
+extern int shm_goal_stack();
 
-Shvar* create_genhook();
+extern Shvar* create_genhook();
 
-Shvar* shm_add_consumer();
+extern Shvar* shm_add_consumer();
 
-q* shm_ck_request();
-q* shm_resume_goals();
+extern q* shm_ck_request();
+extern q* shm_resume_goals();
 
 
-struct goalrec *get_invoked_goals();
+extern struct goalrec *get_invoked_goals();
 
 /* allocate shared memory routines */
-q* shm_galloc();
+extern q* shm_galloc();
 
 /* GC routines */
-int ck_shm_gc();
-struct goalrec* shm_gc();
+extern int ck_shm_gc();
+extern struct goalrec* shm_gc();
 
-TADDRtbl* create_local_tbl();
+extern TADDRtbl* create_local_tbl();
 
 /* for GC */
 
@@ -283,6 +287,6 @@
 extern int shm_gcstack_size;
 
 /* for debugging */
-#define debug_wait() { while(!*pe_status) {} }
+#define debug_wait()  do{ while(!*pe_status) {} }while(0)
 
 #endif /* _KLIC_SHM_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/shm_machine.h klic-3.003-2001-11-20/include/klic/shm_machine.h
--- klic-3.003-2001-11-19/include/klic/shm_machine.h	Sun Nov 18 21:36:02 2001
+++ klic-3.003-2001-11-20/include/klic/shm_machine.h	Mon Nov 19 15:12:54 2001
@@ -12,8 +12,8 @@
 #ifdef SPARC
 
 #define n_lock(shvp,sadp) ( { \
-    register int* s1 asm ("g4") = (int*)shvp; \
-    register int* s2 asm ("g3") = (int*)sadp; \
+    register int* s1 asm ("g4") = (int*) (shvp); \
+    register int* s2 asm ("g3") = (int*) (sadp); \
     register struct generator_object* befp asm ("g2");          \
     register struct generator_object* genp asm ("g5") = qSHM_BUSY; \
     asm ( "                   \
@@ -38,20 +38,22 @@
         mov %%g5,%%g2;        \
 4:                            \
 " : "=g" (befp), "=g" (s1) : "g" (s1), "g" (s2), "g" (genp)  );    \
-  shvp = (q)s1;               \
+  (shvp) = (q)s1;               \
   befp;                       \
   } )
 
-#define n_unlock(sadp,genh) {     \
-    register int* n1 asm ("g3") = (int*)sadp; \
-    register struct generator_object* n2 asm ("g4") = genh; \
+#define n_unlock(sadp, genh) \
+do{ \
+    register int* n1 asm ("g3") = (int*) (sadp); \
+    register struct generator_object* n2 asm ("g4") = (genh); \
     asm volatile ( "         \
         stbar;               \
         st %%g4,[%%g3 + 4];  \
 " :  : "g" (n1), "g" (n2) ) ;\
-}
+}while(0)
 
-#define s_lock(key) { \
+#define s_lock(key) \
+do{ \
     register int* val asm ("g3") = lockp[key]; \
     asm volatile ( "         \
 0:                           \
@@ -69,25 +71,26 @@
         nop;                 \
 3:                           \
 " :  : "g" (val) : "g2" );   \
-}
+}while(0)
 
-#define s_unlock(key) {      \
+#define s_unlock(key) 
+do{ \
     register int* val asm ("g3") = lockp[key]; \
     asm volatile ( "         \
         stbar;               \
         st %%g0,[%%g3];      \
 " :  : "g" (val) ) ;         \
-}
+}while(0)
 
-#define klic_barrier() {  asm volatile ( "stbar;" : : ); }
+#define klic_barrier()  do{ asm volatile ( "stbar;" : : ); }while(0)
 
 #endif
 
 #ifdef ALPHA
 
 #define n_lock(shvp,sadp) ( { \
-    register long* s1 asm ("$4") = (long*)shvp; \
-    register long* s2 asm ("$3") = (long*)sadp; \
+    register long* s1 asm ("$4") = (long*) (shvp); \
+    register long* s2 asm ("$3") = (long*) (sadp); \
     register struct generator_object* genp asm ("$5") = qSHM_BUSY; \
     register struct generator_object* befp asm ("$2");           \
     asm volatile ( "          \
@@ -109,20 +112,22 @@
 3:                            \
         mb;                   \
 " : "=g" (befp), "=g" (s1) : "g" (s1), "g" (s2), "g" (genp) : "$1" );    \
-  shvp = (q)s1;               \
+  (shvp) = (q)s1;               \
   befp;                       \
   } )
 
-#define n_unlock(sadp,genh) {     \
-    register long* n1 asm ("$3") = (long*)sadp; \
-    register struct generator_object* n2 asm ("$4") = genh; \
+#define n_unlock(sadp, genh) \
+do{ \
+    register long* n1 asm ("$3") = (long*) (sadp); \
+    register struct generator_object* n2 asm ("$4") = (genh); \
     asm volatile ( "         \
         mb;                  \
         stq $4,8($3);        \
 " :  : "g" (n1), "g" (n2) ) ;\
-}
+}while(0)
 
-#define s_lock(key) { \
+#define s_lock(key) \
+do{ \
     register int* val asm ("$3") = lockp[key]; \
     asm volatile ( "        \
 1:                          \
@@ -138,25 +143,26 @@
         br    2b;           \
 3:                          \
 " :  : "g" (val) : "$1","$2" ); \
-}
+}while(0)
 
-#define s_unlock(key) {     \
+#define s_unlock(key) \
+do{ \
     register int* val asm ("$3") = lockp[key]; \
     asm volatile ( "        \
         mb;                 \
         stl $31,0($3);      \
 " :  : "g" (val) ) ;        \
-}
+}while(0)
 
 
-#define klic_barrier() { asm volatile ( "mb;" : : ); }
+#define klic_barrier()  do{ asm volatile ( "mb;" : : ); }while(0)
 
 #endif
 
 #ifdef INTEL
 #define n_lock(shvp, sadp) ({ \
-    register int* s1 asm ("%edx") =  (int *) shvp;  \
-    register int* s2 asm ("%ecx") =  (int *) sadp;  \
+    register int* s1 asm ("%edx") =  (int *) (shvp);  \
+    register int* s2 asm ("%ecx") =  (int *) (sadp);  \
     register struct generator_object* befp asm ("%ebx"); \
     register struct generator_object* genp asm ("%eax") = qSHM_BUSY; \
     asm ( "                     \
@@ -177,17 +183,18 @@
         movl  %%eax,%%ebx;      \
 4:                              \
 " : "=g" (befp), "=g" (s1) : "g" (s1), "g" (s2), "g" (genp)  );    \
-  shvp = (q)s1;               \
+  (shvp) = (q)s1;               \
   befp;                       \
   } )
 
-#define n_unlock(sadp,genh) {     \
-    register int* n1 asm ("%ecx") = (int*)sadp; \
-    register struct generator_object* n2 asm ("%edx") = genh; \
+#define n_unlock(sadp,genh) \
+do{ \
+    register int* n1 asm ("%ecx") = (int*) (sadp); \
+    register struct generator_object* n2 asm ("%edx") = (genh); \
     asm volatile ( "         \
         movl %%edx,4(%%ecx);  \
 " :  : "g" (n1), "g" (n2) ) ;\
-}
+}while(0)
 
 #define s_lock(key) { \
     register int* val asm ("%ecx") = lockp[key]; \
@@ -205,16 +212,17 @@
         jmp 7b;              \
 8:                           \
 " :  : "g" (val) : "%ebx","%edx" );   \
-}
+}while(0)
 
-#define s_unlock(key) {      \
+#define s_unlock(key) \
+do{      \
     register int* val asm ("ecx") = lockp[key]; \
     asm volatile ( "         \
         movl $0,(%%ecx);     \
 " :  : "g" (val) ) ;         \
-}
+}while(0)
 
-#define klic_barrier() {;} 
+#define klic_barrier()  do{;}while(0)
 
 #endif
 
diff -ruN klic-3.003-2001-11-19/include/klic/sighndl.h klic-3.003-2001-11-20/include/klic/sighndl.h
--- klic-3.003-2001-11-19/include/klic/sighndl.h	Sun Nov 18 21:11:57 2001
+++ klic-3.003-2001-11-20/include/klic/sighndl.h	Mon Nov 19 15:13:47 2001
@@ -34,6 +34,6 @@
 extern Volatile struct klic_sgnl_flags *klic_sgnl_flags;
 #endif
 
-#endif
+#endif /* USESIG */
 
 #endif /* _KLIC_SIGHNDL_H_ */
diff -ruN klic-3.003-2001-11-19/include/klic/struct.h klic-3.003-2001-11-20/include/klic/struct.h
--- klic-3.003-2001-11-19/include/klic/struct.h	Sun Nov 18 21:36:41 2001
+++ klic-3.003-2001-11-20/include/klic/struct.h	Mon Nov 19 15:17:34 2001
@@ -164,7 +164,7 @@
 
 /* Variables */
 
-#define makeref(x)	(q) ((unsigned long)(x) + VARREF)
+#define makeref(x)	((q) ((unsigned long)(x) + VARREF))
 #define derefone(x)	(*refp(x))
 
 /* Atomic Values */
@@ -218,8 +218,8 @@
 
 /* Special Atoms */
 
-#define NILATOM		makesym(0)
-#define PERIODATOM	makesym(1)
+#define NILATOM		(makesym(0))
+#define PERIODATOM	(makesym(1))
 
 /* Global Variables */
 
diff -ruN klic-3.003-2001-11-19/include/klic/susp.h klic-3.003-2001-11-20/include/klic/susp.h
--- klic-3.003-2001-11-19/include/klic/susp.h	Sun Nov 18 21:36:55 2001
+++ klic-3.003-2001-11-20/include/klic/susp.h	Mon Nov 19 15:23:22 2001
@@ -49,45 +49,45 @@
 #define suspp(x)	((struct susprec *)((unsigned long)(x) - VARREF))
 
 #define allocnewsusp(var,srec)						\
-{									\
+do{									\
   q *temp;								\
   heapalloc(temp, (sizeof(struct susprec))/sizeof(q)+1, (q *));		\
-  initnewsusp(temp,var,srec);						\
-}
+  initnewsusp(temp, (var), (srec));					\
+}while(0)
 
 #define makenewsusp(var,srec,allocp)					\
-{									\
-  initnewsusp(allocp,var,srec);						\
-  allocp += sizeof(struct susprec)/sizeof(q)+1;				\
-}
+do{									\
+  initnewsusp((allocp), (var), (srec));					\
+  (allocp) += sizeof(struct susprec)/sizeof(q)+1;			\
+}while(0)
 
 #define initnewsusp(temp,var,srec)					\
-{									\
-  var = makeref(temp);							\
-  srec = (struct susprec *) (temp+1);					\
-  derefone(var) = (q)srec;						\
-  srec->backpt = var;							\
-  srec->u.first_hook.next = &srec->u.first_hook;			\
-}
+do{									\
+  (var) = makeref(temp);						\
+  (srec) = (struct susprec *) ((temp) + 1);				\
+  derefone(var) = (q) (srec);						\
+  (srec)->backpt = (var);						\
+  (srec)->u.first_hook.next = &(srec)->u.first_hook;			\
+}while(0)
 
 #define allochook(oldhook,newhook)					\
-{									\
-  heapalloc(newhook, sizeof(struct hook)/sizeof(q), (struct hook *));	\
-  initnewhook(oldhook,newhook);						\
-}
+do{									\
+  heapalloc((newhook), sizeof(struct hook)/sizeof(q), (struct hook *));	\
+  initnewhook((oldhook), (newhook));					\
+}while(0)
 
 #define addhook(oldhook,newhook,allocp)					\
-{									\
-  newhook = (struct hook *) allocp;					\
-  initnewhook(oldhook,newhook);						\
-  allocp += sizeof(struct hook)/sizeof(q);				\
-}
+do{									\
+  (newhook) = (struct hook*) (allocp);					\
+  initnewhook((oldhook), (newhook));					\
+  (allocp) += sizeof(struct hook) / sizeof(q);				\
+}while(0)
 
 #define initnewhook(oldhook,newhook)					\
-{									\
+do{									\
   (newhook)->next= (oldhook)->next;					\
   (oldhook)->next = (newhook);						\
-}
+}while(0)
 
 /*
   generator object support
@@ -115,19 +115,19 @@
   ((struct generator_object *)((long)(obj) - GENERATOR_OBJECT_TAG))
 
 #define allocnewgensusp(var,gsusp) \
-{ \
+do{ \
   q *tmp; \
   heapalloc(tmp, (sizeof(struct generator_susp))/sizeof(q)+1 , (q*)); \
-  initnewgensusp(tmp, var, gsusp); \
-}
+  initnewgensusp(tmp, (var), (gsusp)); \
+}while(0)
 
 #define initnewgensusp(tmp, var, gsusp) \
-{ \
-  var = makeref(tmp); \
-  gsusp = (struct generator_susp *)(tmp+1); \
-  derefone(var) = (q)gsusp; \
-  gsusp->backpt = var; \
-}
+do{ \
+  (var) = makeref(tmp); \
+  (gsusp) = (struct generator_susp*) ((tmp) + 1); \
+  derefone(var) = (q) (gsusp); \
+  (gsusp)->backpt = (var); \
+}while(0)
 
 /* Perpetual Suspension Detection */
 
diff -ruN klic-3.003-2001-11-19/include/klic/timer.h klic-3.003-2001-11-20/include/klic/timer.h
--- klic-3.003-2001-11-19/include/klic/timer.h	Sun Nov 18 21:37:10 2001
+++ klic-3.003-2001-11-20/include/klic/timer.h	Mon Nov 19 15:25:33 2001
@@ -22,28 +22,32 @@
 #define Million 1000000
 
 #define TimeSet(x, s, u)				\
-{ (x).tv_sec = (s); (x).tv_usec = (u); }
+do{ (x).tv_sec = (s); (x).tv_usec = (u); }while(0)
 
 #define TimeIsZero(x)					\
 ((x).tv_sec == 0 && (x).tv_usec == 0)
 
 #define TimeSub(x, y, z)				\
-if ((x).tv_usec-(y).tv_usec >= 0) {			\
-  (z).tv_sec = (x).tv_sec - (y).tv_sec;			\
-  (z).tv_usec = (x).tv_usec - (y).tv_usec;		\
-} else {						\
-  (z).tv_sec = (x).tv_sec - (y).tv_sec - 1;		\
-  (z).tv_usec = Million + (x).tv_usec - (y).tv_usec;	\
-}
+do{ \
+  if ((x).tv_usec-(y).tv_usec >= 0) {			\
+    (z).tv_sec = (x).tv_sec - (y).tv_sec;			\
+    (z).tv_usec = (x).tv_usec - (y).tv_usec;		\
+  } else {						\
+    (z).tv_sec = (x).tv_sec - (y).tv_sec - 1;		\
+    (z).tv_usec = Million + (x).tv_usec - (y).tv_usec;	\
+  } \
+}while(0)
 
 #define TimeAdd(x, y, z)				\
-if ((x).tv_usec+(y).tv_usec < Million) {		\
-  (z).tv_sec = (x).tv_sec + (y).tv_sec;			\
-  (z).tv_usec = (x).tv_usec + (y).tv_usec;		\
-} else {						\
-  (z).tv_sec = (x).tv_sec + (y).tv_sec + 1;		\
-  (z).tv_usec = (x).tv_usec + (y).tv_usec - Million;	\
-}
+do{ \
+  if ((x).tv_usec+(y).tv_usec < Million) {		\
+    (z).tv_sec = (x).tv_sec + (y).tv_sec;			\
+    (z).tv_usec = (x).tv_usec + (y).tv_usec;		\
+  } else {						\
+    (z).tv_sec = (x).tv_sec + (y).tv_sec + 1;		\
+    (z).tv_usec = (x).tv_usec + (y).tv_usec - Million;	\
+  } \
+}while(0)
 
 extern void
   klic_gettod(),
diff -ruN klic-3.003-2001-11-19/include/klic/timing.h klic-3.003-2001-11-20/include/klic/timing.h
--- klic-3.003-2001-11-19/include/klic/timing.h	Sun Nov 18 21:37:28 2001
+++ klic-3.003-2001-11-20/include/klic/timing.h	Mon Nov 19 15:28:15 2001
@@ -20,7 +20,7 @@
 #define  diff_usec(field)\
 (field_diff(field.tv_sec) * 1000000 + field_diff(field.tv_usec))
 
-#define	 timerstruct	struct rusage
+typedef struct rusage timerstruct;
 #define	 measure(x)	getrusage(RUSAGE_SELF, &(x))
 
 #else 
@@ -30,8 +30,8 @@
 
 #define	 tick2msec(n)	((n)*1000.0/HZ)
 
-#define	 timerstruct	struct tms
-#define	 measure(x)	times(&x)
+typedef struct tms timerstruct;
+#define	 measure(x)	times(&(x))
 
 #endif
 
diff -ruN klic-3.003-2001-11-19/include/klic/traceio.h klic-3.003-2001-11-20/include/klic/traceio.h
--- klic-3.003-2001-11-19/include/klic/traceio.h	Sun Nov 18 21:38:23 2001
+++ klic-3.003-2001-11-20/include/klic/traceio.h	Mon Nov 19 15:29:40 2001
@@ -14,9 +14,9 @@
 #else
 # ifdef SHM
 #define TRACE_ATTACHIO() \
-  {if (!shm_trace_lock) {s_lock(tr_key()); shm_trace_lock=1;}}
+  do{ if (!shm_trace_lock) {s_lock(tr_key()); shm_trace_lock=1;} }while(0)
 #define TRACE_DETACHIO() \
-  { shm_trace_lock=0; s_unlock(tr_key()); }
+  do{ shm_trace_lock=0; s_unlock(tr_key()); }while(0)
 # else
 #define TRACE_ATTACHIO()
 #define TRACE_DETACHIO()
diff -ruN klic-3.003-2001-11-19/include/klic/unify.h klic-3.003-2001-11-20/include/klic/unify.h
--- klic-3.003-2001-11-19/include/klic/unify.h	Sun Nov 18 21:38:39 2001
+++ klic-3.003-2001-11-20/include/klic/unify.h	Mon Nov 19 15:31:01 2001
@@ -14,53 +14,53 @@
   *do_unify_value3(), *do_unify_value4();
 
 #define unify(x, y) \
-{ allocp = do_unify(allocp, (x), (y)); }
+do{ allocp = do_unify(allocp, (x), (y)); }while(0)
 
 #define unify2(x, y, z, w) \
-{ allocp = do_unify2(allocp, (x), (y), (z), (w)); }
+do{ allocp = do_unify2(allocp, (x), (y), (z), (w)); }while(0)
 
 #define unify3(x, y, z, w, s, t) \
-{ allocp = do_unify3(allocp, (x), (y), (z), (w), (s), (t)); }
+do{ allocp = do_unify3(allocp, (x), (y), (z), (w), (s), (t)); }while(0)
 
 #define unify4(x, y, z, w, s, t, u, v) \
-{ allocp = do_unify4(allocp, (x), (y), (z), (w), (s), (t), (u), (v)); }
+do{ allocp = do_unify4(allocp, (x), (y), (z), (w), (s), (t), (u), (v)); }while(0)
 
 #ifdef COMPACTCODE
 #define unify_value(x, y) \
-{ allocp = do_unify_value(allocp, (x), (y)); }
+do{ allocp = do_unify_value(allocp, (x), (y)); }while(0)
 #define unify_value2(x, y, z, w) \
-{ allocp = do_unify_value2(allocp, (x), (y), (z), (w) }
+do{ allocp = do_unify_value2(allocp, (x), (y), (z), (w) }while(0)
 #define unify_value3(x, y, z, w, s, t) \
-{ allocp = do_unify_value3(allocp, (x), (y), (z), (w), (s), (t)) }
+do{ allocp = do_unify_value3(allocp, (x), (y), (z), (w), (s), (t)) }while(0)
 #define unify_value4(x, y, z, w, s, t, u, v) \
-{ allocp = do_unify_value4(allocp, (x), (y), (z), (w), (s), (t), (u), (v)) }
+do{ allocp = do_unify_value4(allocp, (x), (y), (z), (w), (s), (t), (u), (v)) }while(0)
 #else
 #define unify_value(x, y)\
-{								\
+do{								\
   if (!isref(x) || derefone(x) != (x)) {			\
     allocp = do_unify_value(allocp, (x), (y));			\
   } else {							\
     derefone(x) = (y);						\
   }								\
-}
+}while(0)
 #define unify_value2(x, y, z, w)\
-{								\
+do{								\
   unify_value((x), (y));					\
   unify_value((z), (w));					\
-}
+}while(0)
 #define unify_value3(x, y, z, w, s, t)\
-{								\
+do{								\
   unify_value((x), (y));					\
   unify_value((z), (w));					\
   unify_value((s), (t));					\
-}
+}while(0)
 #define unify_value4(x, y, z, w, s, t, u, v)\
-{								\
+do{								\
   unify_value((x), (y));					\
   unify_value((z), (w));					\
   unify_value((s), (t));					\
   unify_value((u), (v));					\
-}
+}while(0)
 #endif
 
 #endif /* _KLIC_UNIFY_H_ */
