[m-rev.] diff: implement typeinfo_is_variable in C#

Peter Ross pro at missioncriticalit.com
Thu Nov 13 23:09:26 AEDT 2003


Hi,


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


Estimated hours taken: 1
Branches: main

library/rtti_implementation.m:
	Implement typeinfo_is_variable in C#.

Index: rtti_implementation.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/rtti_implementation.m,v
retrieving revision 1.46
diff -u -r1.46 rtti_implementation.m
--- rtti_implementation.m	13 Nov 2003 11:54:11 -0000	1.46
+++ rtti_implementation.m	13 Nov 2003 12:08:00 -0000
@@ -1549,11 +1549,14 @@
 typeinfo_is_variable(_::in, 42::out) :-
 	semidet_unimplemented("typeinfo_is_variable").
 
-:- pragma foreign_proc("MC++",
+:- pragma foreign_proc("C#",
 	typeinfo_is_variable(TypeInfo::in, VarNum::out), [promise_pure], "
-	SUCCESS_INDICATOR = (dynamic_cast<MR_Word>(TypeInfo) == NULL);
-	if (SUCCESS_INDICATOR) {
-		VarNum = System::Convert::ToInt32(TypeInfo);
+	try {
+		SUCCESS_INDICATOR = true;
+		VarNum = System.Convert.ToInt32(TypeInfo);
+	}
+	catch (System.Exception e) {
+		SUCCESS_INDICATOR = false;
 	}
 ").
 


-- 
Peter Ross		
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559
--------------------------------------------------------------------------
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