[m-rev.] for review: rewrite mercury_mcpp.cpp in C#
Peter Ross
pro at missioncriticalit.com
Sun Oct 26 00:39:09 AEST 2003
Some more stuff that got lost accidently.
I think I did something strange with a backgrounded vim session.
===================================================================
Estimated hours taken: 0.5
Branches: main
runtime/mercury_mcpp.cs:
Add this missing LowLevelData class, that I accidently
deleted.
Index: runtime/mercury_mcpp.cs
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_mcpp.cs,v
retrieving revision 1.2
diff -u -r1.2 mercury_mcpp.cs
--- runtime/mercury_mcpp.cs 25 Oct 2003 14:24:53 -0000 1.2
+++ runtime/mercury_mcpp.cs 25 Oct 2003 14:35:46 -0000
@@ -104,5 +104,53 @@
public static int MR_SECTAG_REMOTE = 2;
}
+public class LowLevelData
+{
+ // Make a Mercury enumeration with the given integer value.
+ public static object[] make_enum(int enum_value)
+ {
+ object[] e;
+ e = make_MR_Word(enum_value, 0);
+ return e;
+ }
+
+ // Make a MR_Word with the given tag and arity.
+ public static object[] make_MR_Word(int tag, int arity)
+ {
+ object[] o = new object[arity + 1];
+ o[0] = tag;
+ return o;
+ }
+
+ // Set a field of an MR_Word with a given value.
+ // The first field is at index 1.
+ public static void set_MR_Word_field(object[] w, int index, object value)
+ {
+ w[index] = value;
+ }
+
+ // Get the value from an MR_Word.
+ // The first field is at index 1.
+ public static object get_MR_Word_field(object[] w, int index)
+ {
+ return w[index];
+ }
+
+ public static bool list_is_cons(object[] w)
+ {
+ return (System.Convert.ToInt32(w[0]) != 0);
+ }
+
+ public static object list_get_head(object[] w)
+ {
+ return w[1];
+ }
+
+ public static object[] list_get_tail(object[] w)
+ {
+ return ((object[]) w[2]);
+ }
+}
+
}
}
--------------------------------------------------------------------------
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