[Commit] nickle/builtin builtin.c,1.11,1.12 toplevel.c,1.18,1.19
    Keith Packard 
    commit at keithp.com
       
    Mon Jul 21 22:32:38 PDT 2003
    
        - Previous message: [Commit] nickle gram.y, 1.125, 1.126 hash.c, 1.1, 1.2 lex.l, 1.68,
	1.69 nickle.h, 1.106, 1.107 pretty.c, 1.63, 1.64 type.c, 1.56,
	1.57 value.h, 1.89, 1.90
- Next message: [Commit] grrobot/src grr_board_view.c, 1.11, 1.12 grr_board_view.h,
	1.8, 1.9 grr_icon.c, 1.2, 1.3 grr_icon.h, 1.2, 1.3 grrobot.c,
	1.14, 1.15
-  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
  
Committed by: keithp
Update of /local/src/CVS/nickle/builtin
In directory home.keithp.com:/tmp/cvs-serv9757/builtin
Modified Files:
	builtin.c toplevel.c 
Log Message:
Eliminate bogus function layer in Hash API.
Switch hash initializes from colon to double arrow (=>)
Fix hash printing to produce re-parsable output
Make HashHash compute reasonable hash values
Add hash_key builtin
Index: builtin.c
===================================================================
RCS file: /local/src/CVS/nickle/builtin/builtin.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- builtin.c	11 Jun 2003 05:01:55 -0000	1.11
+++ builtin.c	22 Jul 2003 04:32:36 -0000	1.12
@@ -118,7 +118,9 @@
     Type   *t;
     Bool    ref = False;
     Bool    array = False;
+    Bool    hash = False;
     Expr    *dims = 0;
+    Type    *k;
     
     ref = False;
     if (*format == '*')
@@ -136,6 +138,11 @@
 	    format++;
 	}
     }
+    if (*format == 'H')
+    {
+	hash = True;
+	format = BuiltinType (format + 1, &k);
+    }
     switch (*format++) {
     case 'p': t = typePoly; break;
     case 'n': t = typeGroup; break;
@@ -161,6 +168,8 @@
 	t = NewTypeRef (t, False);
     if (array)
 	t = NewTypeArray (t, dims);
+    if (hash)
+	t = NewTypeHash (t, k);
     *type = t;
     return format;
 }
Index: toplevel.c
===================================================================
RCS file: /local/src/CVS/nickle/builtin/toplevel.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- toplevel.c	21 Jul 2003 22:22:11 -0000	1.18
+++ toplevel.c	22 Jul 2003 04:32:36 -0000	1.19
@@ -24,7 +24,7 @@
     static const struct fbuiltin_0 funcs_0[] = {
         { do_getbyte, "getbyte", "i", "" },
         { do_time, "time", "i", "" },
-	{ do_hash_new, "hash_new", "p", "" },
+	{ do_hash_new, "hash_new", "Hpp", "" },
         { 0 }
     };
 
@@ -63,6 +63,7 @@
         { do_sleep, "sleep", "v", "i" },
         { do_string_to_real, "string_to_real", "R", "s" },
 	{ do_hash, "hash", "i", "p" },
+	{ do_hash_keys, "hash_keys", "Ap", "Hpp" },
         { 0 }
     };
 
@@ -72,9 +73,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" },
+	{ do_hash_get, "hash_get", "p", "Hppp" },
+	{ do_hash_del, "hash_del", "v", "Hppp" },
+	{ do_hash_test, "hash_test", "b", "Hppp" },
         { 0 }
     };
 
@@ -84,7 +85,7 @@
     };
 
     static const struct fbuiltin_3 funcs_3[] = {
-	{ do_hash_set, "hash_set", "v", "ppp" },
+	{ do_hash_set, "hash_set", "v", "Hpppp" },
 	{ 0 }
     };
 
@@ -773,6 +774,11 @@
     return HashTest (hv, key);
 }
    
+Value	do_hash_keys (Value hv)
+{
+    return HashKeys (hv);
+}
+
 Value	do_hash_set (Value hv, Value key, Value value)
 {
     HashSet (hv, key, value);
    
    
        
	- Previous message: [Commit] nickle gram.y, 1.125, 1.126 hash.c, 1.1, 1.2 lex.l, 1.68,
	1.69 nickle.h, 1.106, 1.107 pretty.c, 1.63, 1.64 type.c, 1.56,
	1.57 value.h, 1.89, 1.90
- Next message: [Commit] grrobot/src grr_board_view.c, 1.11, 1.12 grr_board_view.h,
	1.8, 1.9 grr_icon.c, 1.2, 1.3 grr_icon.h, 1.2, 1.3 grrobot.c,
	1.14, 1.15
-  Messages sorted by: 
              [ date ]
              [ thread ]
              [ subject ]
              [ author ]
         
More information about the Commit
mailing list