[Commit] nickle/builtin toplevel.c,1.17,1.18

Keith Packard commit at keithp.com
Mon Jul 21 16:22:13 PDT 2003


Committed by: keithp

Update of /local/src/CVS/nickle/builtin
In directory home.keithp.com:/tmp/cvs-serv7368/builtin

Modified Files:
	toplevel.c 
Log Message:
Add hashes, fix subscript type printing

Index: toplevel.c
===================================================================
RCS file: /local/src/CVS/nickle/builtin/toplevel.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- toplevel.c	30 Jun 2003 04:53:43 -0000	1.17
+++ toplevel.c	21 Jul 2003 22:22:11 -0000	1.18
@@ -24,6 +24,7 @@
     static const struct fbuiltin_0 funcs_0[] = {
         { do_getbyte, "getbyte", "i", "" },
         { do_time, "time", "i", "" },
+	{ do_hash_new, "hash_new", "p", "" },
         { 0 }
     };
 
@@ -71,6 +72,9 @@
         { do_xor, "xor", "i", "ii" },
 	{ do_setdims, "setdims", "v", "ApAi" },
 	{ do_setdim, "setdim", "v", "Api" },
+	{ do_hash_get, "hash_get", "p", "pp" },
+	{ do_hash_del, "hash_del", "v", "pp" },
+	{ do_hash_test, "hash_test", "b", "pp" },
         { 0 }
     };
 
@@ -79,6 +83,11 @@
         { 0 }
     };
 
+    static const struct fbuiltin_3 funcs_3[] = {
+	{ do_hash_set, "hash_set", "v", "ppp" },
+	{ 0 }
+    };
+
     static const struct fbuiltin_v funcs_v[] = {
         { do_imprecise, "imprecise", "R", "R.i" },
         { do_string_to_integer, "string_to_integer", "i", "s.i" },
@@ -88,6 +97,7 @@
     BuiltinFuncs0 (/*parent*/ 0, funcs_0);
     BuiltinFuncs1 (/*parent*/ 0, funcs_1);
     BuiltinFuncs2 (/*parent*/ 0, funcs_2);
+    BuiltinFuncs3 (/*parent*/ 0, funcs_3);
     BuiltinFuncs2J (/*parent*/ 0, funcs_2j);
     BuiltinFuncsV (/*parent*/ 0, funcs_v);
     EXIT ();
@@ -738,5 +748,33 @@
 Value
 do_hash (Value a)
 {
-    return ValueHash(a);
+    return ValueHash (a);
+}
+
+/* hash builtins (for testing) */
+Value	do_hash_new (void)
+{
+    return NewHash (False, typePoly, typePoly);
+}
+
+Value	do_hash_get (Value hv, Value key)
+{
+    return HashGet (hv, key);
+}
+
+Value	do_hash_del (Value hv, Value key)
+{
+    HashDelete (hv, key);
+    return Void;
+}
+
+Value	do_hash_test (Value hv, Value key)
+{
+    return HashTest (hv, key);
+}
+   
+Value	do_hash_set (Value hv, Value key, Value value)
+{
+    HashSet (hv, key, value);
+    return Void;
 }




More information about the Commit mailing list