[m-rev.] diff: fix tests/hard_coded/typeclasses tests for il backend

Peter Ross pro at missioncriticalit.com
Fri Nov 29 00:14:22 AEDT 2002


Hi,

These were also tested in the asm_fast.gc and hlc.gc grades.

===================================================================


Estimated hours taken: 2
Branches: main

Fix compile errors in the test cases, so that they compile on the il
backend.

tests/hard_coded/typeclasses/existential_type_classes.m:
	Replace some C code with the equivalent mercury code.

tests/hard_coded/typeclasses/impure_methods.m:
	Add an equivalent C# implementation of some C code.

tests/hard_coded/typeclasses/superclass_bug.m:
	Add a default mercury implementation of some C code.

Index: tests/hard_coded/typeclasses/existential_type_classes.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/typeclasses/existential_type_classes.m,v
retrieving revision 1.7
diff -u -r1.7 existential_type_classes.m
--- tests/hard_coded/typeclasses/existential_type_classes.m	31 Jan 2001 18:28:49 -0000	1.7
+++ tests/hard_coded/typeclasses/existential_type_classes.m	28 Nov 2002 13:09:49 -0000
@@ -28,7 +28,8 @@
 	% my_univ_value(Univ):
 	%	returns the value of the object stored in Univ.
 
-:- type my_univ == c_pointer.
+:- type my_univ
+	--->	some [T] f(T) => fooable(T).
 
 :- func my_univ(T) = my_univ <= fooable(T).
 
@@ -63,19 +64,5 @@
 
 my_exist_t = 43.
 
-:- pragma c_header_code("
-	#include ""mercury_heap.h""	/* for MR_incr_hp() */
-	#include ""mercury_tags.h""	/* for MR_field() */
-").
-:- pragma c_code(my_univ_value(Univ::in) = (Value::out), will_not_call_mercury, "
-	TypeClassInfo_for_existential_type_classes__fooable_T =
-		MR_field(MR_mktag(0), Univ, 0);
-	Value = MR_field(MR_mktag(0), Univ, 1);
-").
-:- pragma c_code(my_univ(Value::in) = (Univ::out), will_not_call_mercury, "
-	MR_incr_hp(Univ, 2);
-	MR_field(MR_mktag(0), Univ, 0) = (MR_Word)
-		TypeClassInfo_for_existential_type_classes__fooable_T;
-	MR_field(MR_mktag(0), Univ, 1) = (MR_Word) Value;
-
-").
+my_univ(T) = 'new f'(T).
+my_univ_value(f(T)) = T.
Index: tests/hard_coded/typeclasses/impure_methods.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/typeclasses/impure_methods.m,v
retrieving revision 1.1
diff -u -r1.1 impure_methods.m
--- tests/hard_coded/typeclasses/impure_methods.m	27 Mar 2000 05:08:07 -0000	1.1
+++ tests/hard_coded/typeclasses/impure_methods.m	28 Nov 2002 13:09:49 -0000
@@ -58,6 +58,13 @@
 :- pragma c_code(foo_m1(_F::in), "foo_counter++;").
 :- pragma c_code(foo_m2(_F::in, Val::out), "Val = foo_counter;").
 
+:- pragma foreign_code("C#", "static int foo_counter = 0;").
+
+:- pragma foreign_proc("C#", foo_m1(_F::in),
+		[], "foo_counter++;").
+:- pragma foreign_proc("C#", foo_m2(_F::in, Val::out),
+		[promise_semipure], "Val = foo_counter;").
+
 goo_m1(_).
 goo_m2(_, 42).
 
Index: tests/hard_coded/typeclasses/superclass_bug.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/typeclasses/superclass_bug.m,v
retrieving revision 1.2
diff -u -r1.2 superclass_bug.m
--- tests/hard_coded/typeclasses/superclass_bug.m	5 Dec 2000 02:11:18 -0000	1.2
+++ tests/hard_coded/typeclasses/superclass_bug.m	28 Nov 2002 13:09:49 -0000
@@ -104,6 +104,7 @@
       IntroducedIdlBug_2OutPtr = IntroducedIdlBug_2InPtr;
       OutTypeVarPtr = InTypeVarPtr;
 ").
+ixmldomnode_replacechild_c_code(A, A, B, B, A, C, C) = hresult(5).
 
 %------------------------------------------------------------------------------%
 

--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list