diff/for review: changes to runtime for non-gcc C compilers

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jul 14 05:51:11 AEST 1998


I'll commit this now, since the changes are all pretty trivial
(there's just a lot of them), and since I want to be able to include
them in our beta distribution as soon as possible, since
Chris Higgins <c.higgins at ndirect.co.uk>, who is trying to port Mercury
to the Mac, needs them.

But I'd appreciate it if someone could review this for me anyway.
Tyson?

--------------------

Fix some problems that caused compilation errors when compiling with
C compilers other than gcc.

runtime/mercury_engine.c:
runtime/mercury_ho_call.c:
runtime/mercury_memory_handlers.c:
runtime/mercury_signal.c:
runtime/mercury_table_builtins.c:
	Add casts to fix various type errors.

runtime/mercury_heap.h:
	Add LVALUE_CAST()s in hp_alloc() and hp_alloc_atomic()
	to cast MR_hp to Word when calling incr_hp() and incr_hp_atomic().

runtime/mercury_ho_call.c:
runtime/mercury_wrapper.c:
runtime/mercury_engine.c:
runtime/mercury_type_info.c:
runtime/mercury_wrapper.c:
	Delete extraneous semicolons after occurrences
	of the MR_MAKE_STACK_LAYOUT_* macros.

runtime/mercury_tabling.h:
	Delete extraneous semicolons in the definitions of the
	table_allocate(), table_reallocate(), and table_free() macros.
	Use <stdarg.h> instead of <varargs.h> and add missing call
	to va_end().

runtime/mercury_goto.h:
	Change the ANSI C versions of the ENTRY(), STATIC(), LOCAL(),
	and LABEL() macros to cast their results to type `Code *'.
	The reason is that although the `Code *' type is actually `void *',
	there is no implicit conversion from pointer to function
	to pointer to void in ANSI C.

runtime/mercury_tabling.h:

runtime/mercury_context.h:
runtime/mercury_context.c:
	`free_context_list' was declared extern in the header file
	but also declared static in the `.c' file, so I deleted
	the declaration in the header file, and moved the comment
	there into the `.c' file.

runtime/mercury_deep_copy.c:
	Add a missing `static' on the declaration of deep_copy_type_info().

runtime/mercury_trace_external.c:
	Avoid unterminated string literals even inside `#if 0 ... #endif'.

runtime/mercury_types.h:
	Minor changes to a couple of comments.

Index: runtime/mercury_context.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_context.c,v
retrieving revision 1.6
diff -u -r1.6 mercury_context.c
--- mercury_context.c	1998/07/03 05:51:18	1.6
+++ mercury_context.c	1998/07/13 17:25:42
@@ -28,10 +28,16 @@
   MercuryCond	*MR_runqueue_cond;
 #endif
 
-
+/*
+** free_context_list is a global linked list of unused context
+** structures. If the MemoryZone pointers are not NULL,
+** then they point to allocated MemoryZones, which will
+** need to be reinitialized, but have space allocated to
+** them. (see comments in mercury_memory.h about reset_zone())
+*/
 static MR_Context *free_context_list = NULL;
 #ifdef	MR_THREAD_SAFE
-  static	MercuryLock *free_context_list_lock;
+  static MercuryLock *free_context_list_lock;
 #endif
 
 void
Index: runtime/mercury_context.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_context.h,v
retrieving revision 1.5
diff -u -r1.5 mercury_context.h
--- mercury_context.h	1998/06/15 07:00:05	1.5
+++ mercury_context.h	1998/07/13 17:24:33
@@ -129,15 +129,6 @@
 typedef MR_Context Context;	/* for backwards compatibility */
 
 /*
-** free_context_list is a global linked list of unused context
-** structures. If the MemoryZone pointers are not NULL,
-** then they point to allocated MemoryZones, which will
-** need to be reinitialized, but have space allocated to
-** them. (see comments in mercury_memory.h about reset_zone())
-*/
-extern	MR_Context *free_context_list;
-
-/*
 ** the runqueue is a linked list of contexts that are
 ** runnable.
 */
Index: runtime/mercury_deep_copy.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_deep_copy.c,v
retrieving revision 1.9
diff -u -r1.9 mercury_deep_copy.c
--- mercury_deep_copy.c	1998/06/18 04:30:40	1.9
+++ mercury_deep_copy.c	1998/07/13 18:01:01
@@ -319,7 +319,7 @@
 }
 
 
-Word *
+static Word *
 deep_copy_type_info(Word *type_info, Word *lower_limit, Word *upper_limit)
 {
 	if (in_range(type_info)) {
Index: runtime/mercury_engine.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_engine.c,v
retrieving revision 1.9
diff -u -r1.9 mercury_engine.c
--- mercury_engine.c	1998/06/18 04:30:42	1.9
+++ mercury_engine.c	1998/07/13 17:59:29
@@ -33,7 +33,7 @@
 #ifndef USE_GCC_NONLOCAL_GOTOS
   static Code	*engine_done(void);
   static Code	*engine_init_registers(void);
-  MR_MAKE_STACK_LAYOUT_ENTRY(engine_done);
+  MR_MAKE_STACK_LAYOUT_ENTRY(engine_done)
 #endif
 
 bool	debugflag[MAXFLAG];
@@ -396,7 +396,7 @@
 engine_init_registers(void)
 {
 	restore_transient_registers();
-	MR_succip = engine_done;
+	MR_succip = (Code *) engine_done;
 	return NULL;
 }
 
@@ -409,10 +409,9 @@
 
 #define NUM_PREV_FPS	40
 
-typedef	void	(*FuncPtr)(void);
 typedef Code	*Func(void);
 
-static FuncPtr	prev_fps[NUM_PREV_FPS];
+static Code 	*prev_fps[NUM_PREV_FPS];
 static int	prev_fp_index = 0;
 
 void 
@@ -443,34 +442,34 @@
 	*/
 
 	fp = engine_init_registers;
-	fp = (*fp)();
-	fp = entry_point;
+	fp = (Func *) (*fp)();
+	fp = (Func *) entry_point;
 
 #if !defined(MR_DEBUG_GOTOS)
 if (!tracedebug) {
 	for (;;)
 	{
-		fp = (*fp)();
-		fp = (*fp)();
-		fp = (*fp)();
-		fp = (*fp)();
-		fp = (*fp)();
-		fp = (*fp)();
-		fp = (*fp)();
-		fp = (*fp)();
+		fp = (Func *) (*fp)();
+		fp = (Func *) (*fp)();
+		fp = (Func *) (*fp)();
+		fp = (Func *) (*fp)();
+		fp = (Func *) (*fp)();
+		fp = (Func *) (*fp)();
+		fp = (Func *) (*fp)();
+		fp = (Func *) (*fp)();
 	}
 } else
 #endif
 	for (;;)
 	{
-		prev_fps[prev_fp_index] = (FuncPtr) fp;
+		prev_fps[prev_fp_index] = (Code *) fp;
 
 		if (++prev_fp_index >= NUM_PREV_FPS)
 			prev_fp_index = 0;
 
 		debuggoto(fp);
 		debugsreg();
-		fp = (*fp)();
+		fp = (Func *) (*fp)();
 	}
 } /* end call_engine_inner() */
 #endif /* not USE_GCC_NONLOCAL_GOTOS */
@@ -494,11 +493,11 @@
 Define_extern_entry(do_last_succeed);
 Define_extern_entry(do_not_reached);
 
-MR_MAKE_STACK_LAYOUT_ENTRY(do_redo);
-MR_MAKE_STACK_LAYOUT_ENTRY(do_fail);
-MR_MAKE_STACK_LAYOUT_ENTRY(do_succeed);
-MR_MAKE_STACK_LAYOUT_ENTRY(do_last_succeed);
-MR_MAKE_STACK_LAYOUT_ENTRY(do_not_reached);
+MR_MAKE_STACK_LAYOUT_ENTRY(do_redo)
+MR_MAKE_STACK_LAYOUT_ENTRY(do_fail)
+MR_MAKE_STACK_LAYOUT_ENTRY(do_succeed)
+MR_MAKE_STACK_LAYOUT_ENTRY(do_last_succeed)
+MR_MAKE_STACK_LAYOUT_ENTRY(do_not_reached)
 
 BEGIN_MODULE(special_labels_module)
 	init_entry(do_redo);
Index: runtime/mercury_goto.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_goto.h,v
retrieving revision 1.12
diff -u -r1.12 mercury_goto.h
--- mercury_goto.h	1998/07/03 05:51:20	1.12
+++ mercury_goto.h	1998/07/13 17:20:08
@@ -573,40 +573,40 @@
   #define BEGIN_CODE			return 0;
   #define END_MODULE			}
 
-  #define Declare_entry(label)		extern void *label(void)
-  #define Declare_static(label)		static void *label(void)
-  #define Define_extern_entry(label)	void *label(void)
-  #define Define_entry(label)	\
-		GOTO(label);	\
-	}			\
+  #define Declare_entry(label)		extern Code *label(void)
+  #define Declare_static(label)		static Code *label(void)
+  #define Define_extern_entry(label)	Code *label(void)
+  #define Define_entry(label)		\
+		GOTO_LABEL(label);	\
+	}				\
 	Code* label(void) {
-  #define Define_static(label)	\
-		GOTO(label);	\
-	}			\
+  #define Define_static(label)		\
+		GOTO_LABEL(label);	\
+	}				\
 	static Code* label(void) {
   #define init_entry(label)	make_entry(stringify(label), label, label)
   #define init_entry_sl(label)	make_entry_sl(stringify(label), label, label)
 
   #define Declare_local(label)	static Code *label(void)
-  #define Define_local(label)	\
-		GOTO(label);	\
-	}			\
+  #define Define_local(label)		\
+		GOTO_LABEL(label);	\
+	}				\
 	static Code* label(void) {
   #define init_local(label)	make_local(stringify(label), label, label)
   #define init_local_sl(label)	make_local_sl(stringify(label), label, label)
 
   #define Declare_label(label)	static Code *label(void)
-  #define Define_label(label)	\
-		GOTO(label);	\
-	}			\
+  #define Define_label(label)		\
+		GOTO_LABEL(label);	\
+	}				\
 	static Code* label(void) {
   #define init_label(label)	make_label(stringify(label), label, label)
   #define init_label_sl(label)	make_label_sl(stringify(label), label, label)
 
-  #define ENTRY(label) 		(label)
-  #define STATIC(label) 	(label)
-  #define LOCAL(label)		(label)
-  #define LABEL(label)		(label)
+  #define ENTRY(label) 		((Code *) (label))
+  #define STATIC(label) 	((Code *) (label))
+  #define LOCAL(label)		((Code *) (label))
+  #define LABEL(label)		((Code *) (label))
   /*
   ** The call to debuggoto() is in the driver function in mercury_engine.c,
   ** which is why the following definitions have no debuggoto().
Index: runtime/mercury_heap.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_heap.h,v
retrieving revision 1.5
diff -u -r1.5 mercury_heap.h
--- mercury_heap.h	1998/06/09 02:08:00	1.5
+++ mercury_heap.h	1998/07/13 18:56:58
@@ -76,11 +76,17 @@
   #define mark_hp(dest)		((void)0)
   #define restore_hp(src)	((void)0)
 
-			/* we use `hp' as a convenient temporary here */
-  #define hp_alloc(count) \
-		(incr_hp(MR_hp, (count)), MR_hp += (count), (void)0)
-  #define hp_alloc_atomic(count) \
-		(incr_hp_atomic(MR_hp, (count)), MR_hp += (count), (void)0)
+			/* we use `MR_hp' as a convenient temporary here */
+  #define hp_alloc(count) (						\
+		incr_hp(LVALUE_CAST(Word, MR_hp), (count)),		\
+		MR_hp += (count),					\
+		(void)0							\
+	)
+  #define hp_alloc_atomic(count)					\
+		incr_hp_atomic(LVALUE_CAST(Word, MR_hp), (count)), 	\
+		MR_hp += (count),					\
+		(void)0							\
+	)
 
 #else /* not CONSERVATIVE_GC */
 
@@ -98,29 +104,29 @@
   #define mark_hp(dest)		((dest) = (Word) MR_hp)
 
   /*
-  ** When restoring hp, we must make sure that we don't truncate the heap
+  ** When restoring MR_hp, we must make sure that we don't truncate the heap
   ** further than it is safe to. We can only truncate it as far as
   ** min_heap_reclamation_point. See the comments in mercury_context.h next to
   ** the set_min_heap_reclamation_point() macro.
   */
   #define	restore_hp(src)	(					\
-  			LVALUE_CAST(Word,MR_hp) = (src),		\
+  			LVALUE_CAST(Word, MR_hp) = (src),		\
   			(void)0						\
   		)
 
   /*
   #define	restore_hp(src)	(					\
-  			LVALUE_CAST(Word,MR_hp) =			\
+  			LVALUE_CAST(Word, MR_hp) =			\
   			  ( (Word) MR_min_hp_rec < (src) ?		\
   			  (src) : (Word) MR_min_hp_rec ),		\
   			(void)0						\
   		)
   */
   
-  #define hp_alloc(count)  incr_hp(hp,count)
-  #define hp_alloc_atomic(count) incr_hp_atomic(count)
+  #define hp_alloc(count)  	 incr_hp(LVALUE_CAST(Word, MR_hp), count)
+  #define hp_alloc_atomic(count) incr_hp_atomic(LVALUE_CAST(Word, MR_hp), count)
   
-  #endif /* not CONSERVATIVE_GC */
+#endif /* not CONSERVATIVE_GC */
   
 #ifdef	PROFILE_MEMORY
   #define tag_incr_hp_msg(dest, tag, count, proclabel, type)		\
Index: runtime/mercury_ho_call.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_ho_call.c,v
retrieving revision 1.9
diff -u -r1.9 mercury_ho_call.c
--- mercury_ho_call.c	1998/07/03 05:51:22	1.9
+++ mercury_ho_call.c	1998/07/13 16:54:33
@@ -67,22 +67,22 @@
 Define_extern_entry(mercury__compare_3_3);
 Declare_label(mercury__compare_3_0_i1);
 
-MR_MAKE_STACK_LAYOUT_ENTRY(do_call_det_closure);
-MR_MAKE_STACK_LAYOUT_ENTRY(do_call_semidet_closure);
-MR_MAKE_STACK_LAYOUT_ENTRY(do_call_nondet_closure);
-
-MR_MAKE_STACK_LAYOUT_ENTRY(do_call_det_class_method);
-MR_MAKE_STACK_LAYOUT_ENTRY(do_call_semidet_class_method);
-MR_MAKE_STACK_LAYOUT_ENTRY(do_call_nondet_class_method);
-
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__unify_2_0);
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__index_2_0);
-MR_MAKE_STACK_LAYOUT_INTERNAL(mercury__index_2_0, 1);
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__compare_3_0);
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__compare_3_1);
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__compare_3_2);
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__compare_3_3);
-MR_MAKE_STACK_LAYOUT_INTERNAL(mercury__compare_3_0, 1);
+MR_MAKE_STACK_LAYOUT_ENTRY(do_call_det_closure)
+MR_MAKE_STACK_LAYOUT_ENTRY(do_call_semidet_closure)
+MR_MAKE_STACK_LAYOUT_ENTRY(do_call_nondet_closure)
+
+MR_MAKE_STACK_LAYOUT_ENTRY(do_call_det_class_method)
+MR_MAKE_STACK_LAYOUT_ENTRY(do_call_semidet_class_method)
+MR_MAKE_STACK_LAYOUT_ENTRY(do_call_nondet_class_method)
+
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__unify_2_0)
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__index_2_0)
+MR_MAKE_STACK_LAYOUT_INTERNAL(mercury__index_2_0, 1)
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__compare_3_0)
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__compare_3_1)
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__compare_3_2)
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__compare_3_3)
+MR_MAKE_STACK_LAYOUT_INTERNAL(mercury__compare_3_0, 1)
 
 
 BEGIN_MODULE(call_module)
@@ -461,7 +461,7 @@
 	int	type_arity;
 
 	type_arity = pop();
-	MR_succip = pop();
+	MR_succip = (Code *) pop();
 	save_registers();
 	r3 = virtual_reg(type_arity + 2);
 	proceed();
@@ -570,7 +570,7 @@
 	int	type_arity;
 
 	type_arity = pop();
-	MR_succip = pop();
+	MR_succip = (Code *) pop();
 	save_registers();
 	r2 = virtual_reg(type_arity + 1);
 	proceed();
Index: runtime/mercury_memory_handlers.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_memory_handlers.c,v
retrieving revision 1.3
diff -u -r1.3 mercury_memory_handlers.c
--- mercury_memory_handlers.c	1998/05/14 06:35:08	1.3
+++ mercury_memory_handlers.c	1998/07/13 18:07:03
@@ -244,9 +244,9 @@
 void
 setup_signals(void)
 {
-	MR_setup_signal(SIGBUS, bus_handler, TRUE,
+	MR_setup_signal(SIGBUS, (Code *) bus_handler, TRUE,
 		"Mercury runtime: cannot set SIGBUS handler");
-	MR_setup_signal(SIGSEGV, segv_handler, TRUE,
+	MR_setup_signal(SIGSEGV, (Code *) segv_handler, TRUE,
 		"Mercury runtime: cannot set SIGSEGV handler");
 }
 
Index: runtime/mercury_table_builtins.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_table_builtins.c,v
retrieving revision 1.1
diff -u -r1.1 mercury_table_builtins.c
--- mercury_table_builtins.c	1998/07/07 19:57:38	1.1
+++ mercury_table_builtins.c	1998/07/13 18:16:00
@@ -66,9 +66,9 @@
 	}
 
 	if (i < NUM_OF_PRIMES) {
-		return (primes[i]);
+		return primes[i];
 	} else { 
-		return (2 * old_size - 1);
+		return 2 * old_size - 1;
 	}
 }
 
@@ -278,7 +278,7 @@
 		*t = table;
 	}
 
-	hash = hash_string(key);
+	hash = hash_string((Word) key);
 	bucket = hash % SIZE(table);
 
 	p = BUCKET(table, bucket);
@@ -314,7 +314,8 @@
 		for (i = 0; i < old_size; i++) {
 			q = BUCKET(table, i);
 			if (q) {
-				re_hash(new_table, hash_string(q->key), q); 
+				re_hash(new_table, 
+					hash_string((Word) q->key), q); 
 			}
 		}
 		
Index: runtime/mercury_tabling.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_tabling.h,v
retrieving revision 1.3
diff -u -r1.3 mercury_tabling.h
--- mercury_tabling.h	1998/07/07 19:57:43	1.3
+++ mercury_tabling.h	1998/07/13 19:08:43
@@ -84,23 +84,25 @@
 
 #ifdef CONSERVATIVE_GC
 
-  #define table_allocate(Size)						\
-	GC_malloc(Size);
+  #define table_allocate(size)						\
+	GC_malloc(size)
 
-  #define table_reallocate(Pointer, Size)				\
-	GC_realloc(Pointer, Size);
+  #define table_reallocate(pointer, size)				\
+	GC_realloc(pointer, size)
 
-  #define table_free(Pointer)						\
-	GC_free(Pointer);
+  #define table_free(pointer)						\
+	GC_free(pointer)
 
   #define MR_table_list_cons(h, t) list_cons((h),(t))
 
 #else /* not CONSERVATIVE_GC */
 
   #define table_allocate(Size)						\
-	(fatal_error("Sorry, not implemented: tabling in non-GC grades"), NULL)
+	(fatal_error("Sorry, not implemented: tabling in non-GC grades"), \
+	(void *) NULL)
   #define table_reallocate(Pointer, Size)				\
-	(fatal_error("Sorry, not implemented: tabling in non-GC grades"), NULL)
+	(fatal_error("Sorry, not implemented: tabling in non-GC grades"), \
+	(void *) NULL)
   #define table_free(Pointer)						\
 	fatal_error("Sorry, not implemented: tabling in non-GC grades")
 
@@ -111,24 +113,31 @@
 #endif /* CONSERVATIVE_GC */
 
 #define table_copy_mem(Dest, Source, Size)				\
-	memcpy(Dest, Source, Size);
+	memcpy(Dest, Source, Size)
 
 #ifdef MR_TABLE_DEBUG
 
 #include <stdio.h>
-#include <varargs.h>
+#include <stdarg.h>
+
+/* XXX should move this to mercury_tabling.c */
 
-static void table_printf(const char *format, ...)
+static void
+table_printf(const char *format, ...)
 {
 	va_list list;
 	
 	va_start(list);
 	vprintf(format, list);
+	va_end(list);
 }
 
 #else /* not MR_TABLE_DEBUG */
 
-static void table_printf(const char *format, ...)
+/* XXX should move this to mercury_tabling.c */
+
+static void
+table_printf(const char *format, ...)
 {
 }
 
Index: runtime/mercury_trace_external.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_trace_external.c,v
retrieving revision 1.2
diff -u -r1.2 mercury_trace_external.c
--- mercury_trace_external.c	1998/05/26 16:33:03	1.2
+++ mercury_trace_external.c	1998/07/13 19:12:02
@@ -79,9 +79,9 @@
 socket(unix, stream, Sock),
 bind(sock, Name, Socket_file),
 if (do_it_manually) {
-	printf("user: you must do
-			setenv MERCURY_INET_DEBUGGER_SOCKET Name
-		and then run the program");
+	printf( "user: you must do\n"
+	        "	setenv MERCURY_INET_DEBUGGER_SOCKET Name\n"
+		"and then run the program\n");
 	... just wait for the user do it ...
 } else {
 	fork()
Index: runtime/mercury_type_info.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_type_info.c,v
retrieving revision 1.8
diff -u -r1.8 mercury_type_info.c
--- mercury_type_info.c	1998/06/15 07:00:18	1.8
+++ mercury_type_info.c	1998/07/13 16:55:59
@@ -115,10 +115,10 @@
 Define_extern_entry(mercury__builtin_compare_pred_3_0);
 Declare_label(mercury__builtin_compare_pred_3_0_i4);
 
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__builtin_unify_pred_2_0);
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__builtin_index_pred_2_0);
-MR_MAKE_STACK_LAYOUT_ENTRY(mercury__builtin_compare_pred_3_0);
-MR_MAKE_STACK_LAYOUT_INTERNAL(mercury__builtin_compare_pred_3_0, 4);
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__builtin_unify_pred_2_0)
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__builtin_index_pred_2_0)
+MR_MAKE_STACK_LAYOUT_ENTRY(mercury__builtin_compare_pred_3_0)
+MR_MAKE_STACK_LAYOUT_INTERNAL(mercury__builtin_compare_pred_3_0, 4)
 
 BEGIN_MODULE(mercury__builtin_unify_pred_module)
 	init_entry(mercury__builtin_unify_pred_2_0);
Index: runtime/mercury_types.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_types.h,v
retrieving revision 1.11
diff -u -r1.11 mercury_types.h
--- mercury_types.h	1998/05/16 07:28:35	1.11
+++ mercury_types.h	1998/07/13 17:53:12
@@ -16,15 +16,20 @@
 #include <stdio.h>	/* for `FILE' */
 
 /* 
-** Note that we require sizeof(Word) == sizeof(Integer) == sizeof(Code*)
-** this is assured by the autoconfiguration script
+** Note that we require sizeof(Word) == sizeof(Integer) == sizeof(Code*);
+** this is ensured by the autoconfiguration script.
 */
 
 typedef	unsigned WORD_TYPE	Word;
 typedef WORD_TYPE		Integer;
 typedef unsigned WORD_TYPE	Unsigned;
 typedef WORD_TYPE		Bool;
-typedef void			Code;	/* code addresses are `void *' */
+
+/*
+** `Code *' is used as a generic pointer-to-label type that can point
+** to any label defined using the Define_* macros in mercury_goto.h.
+*/
+typedef void			Code;
 
 /*
 ** Float64 is required for the bytecode.
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.16
diff -u -r1.16 mercury_wrapper.c
--- mercury_wrapper.c	1998/07/07 08:04:15	1.16
+++ mercury_wrapper.c	1998/07/13 16:56:08
@@ -839,10 +839,10 @@
 Declare_label(global_fail);
 Declare_label(all_done);
 
-MR_MAKE_STACK_LAYOUT_ENTRY(do_interpreter);
-MR_MAKE_STACK_LAYOUT_INTERNAL_WITH_ENTRY(global_success, do_interpreter);
-MR_MAKE_STACK_LAYOUT_INTERNAL_WITH_ENTRY(global_fail, do_interpreter);
-MR_MAKE_STACK_LAYOUT_INTERNAL_WITH_ENTRY(all_done, do_interpreter);
+MR_MAKE_STACK_LAYOUT_ENTRY(do_interpreter)
+MR_MAKE_STACK_LAYOUT_INTERNAL_WITH_ENTRY(global_success, do_interpreter)
+MR_MAKE_STACK_LAYOUT_INTERNAL_WITH_ENTRY(global_fail, do_interpreter)
+MR_MAKE_STACK_LAYOUT_INTERNAL_WITH_ENTRY(all_done, do_interpreter)
 
 BEGIN_MODULE(interpreter_module)
 	init_entry(do_interpreter);

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.



More information about the developers mailing list