diff: typeclasses (round 2) [4/4]

David Glen JEFFERY dgj at cs.mu.oz.au
Thu Dec 18 19:03:07 AEDT 1997


Here's the changes to the runtime.

-----------------------------------------------------------------------------
diff -u -r runtime/mercury_ho_call.c /home/pgrad/dgj/mer/work/mercury/runtime/mercury_ho_call.c
--- runtime/mercury_ho_call.c	Thu Dec 18 14:56:15 1997
+++ /home/pgrad/dgj/mer/work/mercury/runtime/mercury_ho_call.c	Wed Dec 17 14:09:14 1997
@@ -116,8 +116,10 @@
 	call((Code *) field(0, closure, 1), LABEL(det_closure_return),
 		LABEL(do_call_det_closure));
 }
-	/* This is used as a return label both by do_call_det_closure and
-	* do_call_det_class_method */
+	/* 
+	** This is used as a return label both by do_call_det_closure and
+	** do_call_det_class_method 
+	*/
 Define_label(det_closure_return);
 {
 	int	i, num_in_args, num_out_args;
@@ -190,8 +192,10 @@
 	call((Code *) field(0, closure, 1), LABEL(semidet_closure_return),
 		LABEL(do_call_semidet_closure));
 }
-	/* This is used as a return label both by do_call_semidet_closure and
-	* do_call_semidet_class_method */
+	/* 
+	** This is used as a return label both by do_call_semidet_closure and
+	** do_call_semidet_class_method 
+	*/
 Define_label(semidet_closure_return);
 {
 	int	i, num_in_args, num_out_args;
@@ -249,8 +253,10 @@
 	call((Code *) field(0, closure, 1), LABEL(nondet_closure_return),
 		LABEL(do_call_nondet_closure));
 }
-	/* This is used as a return label both by do_call_nondet_closure and
-	* do_call_nondet_class_method */
+	/* 
+	** This is used as a return label both by do_call_nondet_closure and
+	** do_call_nondet_class_method 
+	*/
 Define_label(nondet_closure_return);
 {
 	int	i, num_in_args, num_out_args;
@@ -277,19 +283,19 @@
 
 
 	/*
-	 * r1: the typeclass_info
-	 * r2: index of class method
-	 * r3: number of immediate input arguments
-	 * r4: number of output arguments
-	 * r5+:input args
-	 */
+	** r1: the typeclass_info
+	** r2: index of class method
+	** r3: number of immediate input arguments
+	** r4: number of output arguments
+	** r5+:input args
+	*/
 Define_entry(do_call_det_class_method);
 {
 	Code 	*destination;
 	int	i, num_in_args, num_arg_typeclass_infos;
 
 	destination = MR_typeclass_info_class_method(r1, r2);
-	num_arg_typeclass_infos = (int)MR_typeclass_info_instance_arity(r1);
+	num_arg_typeclass_infos = (int) MR_typeclass_info_instance_arity(r1);
 
 	num_in_args = r3; /* number of input args */
 
@@ -330,7 +336,7 @@
 	int	i, num_in_args, num_arg_typeclass_infos;
 
 	destination = MR_typeclass_info_class_method(r1, r2);
-	num_arg_typeclass_infos = (int)MR_typeclass_info_instance_arity(r1);
+	num_arg_typeclass_infos = (int) MR_typeclass_info_instance_arity(r1);
 
 	num_in_args = r3; /* number of input args */
 
@@ -370,7 +376,7 @@
 	int	i, num_in_args, num_arg_typeclass_infos;
 
 	destination = MR_typeclass_info_class_method(r1, r2);
-	num_arg_typeclass_infos = (int)MR_typeclass_info_instance_arity(r1);
+	num_arg_typeclass_infos = (int) MR_typeclass_info_instance_arity(r1);
 
 	num_in_args = r3; /* number of input args */
 
diff -u -r runtime/mercury_type_info.h /home/pgrad/dgj/mer/work/mercury/runtime/mercury_type_info.h
--- runtime/mercury_type_info.h	Thu Dec 18 14:56:20 1997
+++ /home/pgrad/dgj/mer/work/mercury/runtime/mercury_type_info.h	Wed Dec 17 14:10:36 1997
@@ -778,11 +778,11 @@
 */
 
 #define	MR_typeclass_info_instance_arity(tci) \
-	(Integer)(*(Word **)(tci))[0]
+	((Integer)(*(Word **)(tci))[0])
 #define	MR_typeclass_info_class_method(tci, n) \
-	(Code *)(*(Word **)tci)[(n)]
+	((Code *)(*(Word **)tci)[(n)])
 #define	MR_typeclass_info_arg_typeclass_info(tci, n) \
-	((Word *)(tci))[(n)]
+	(((Word *)(tci))[(n)])
 
 	/*
 	** The following have the same definitions. This is because 
@@ -790,9 +790,9 @@
 	** number of superclass_infos for the class added to it
 	*/
 #define	MR_typeclass_info_superclass_info(tci, n) \
-	((Word *)(tci))[MR_typeclass_info_instance_arity(tci) + (n)]
+	(((Word *)(tci))[MR_typeclass_info_instance_arity(tci) + (n)])
 #define	MR_typeclass_info_type_info(tci, n) \
-	((Word *)(tci))[MR_typeclass_info_instance_arity(tci) + (n)]
+	(((Word *)(tci))[MR_typeclass_info_instance_arity(tci) + (n)])
 
 /*---------------------------------------------------------------------------*/
 


love and cuddles,
dgj
-- 
David Jeffery (dgj at cs.mu.oz.au) |  Marge: Did you just call everyone "chicken"?
MEngSc student,                 |  Homer: Noooo.  I swear on this Bible!
Department of Computer Science  |  Marge: That's not a Bible; that's a book of
University of Melbourne         |         carpet samples!
Australia                       |  Homer: Ooooh... Fuzzy.



More information about the developers mailing list