rev 666 - in trunk: . src

SVN User <[email protected]> Sun, 27 Jun 2004 02:59:49 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-06-27 02:59:47 -0400 (Sun, 27 Jun 2004)
New Revision: 666

Modified:
   trunk/STATUS.txt
   trunk/src/builtins-dict.c
   trunk/src/interp.c
Log:
added immutable check to dict keys

Modified: trunk/STATUS.txt
===================================================================
--- trunk/STATUS.txt	2004-06-27 05:08:19 UTC (rev 665)
+++ trunk/STATUS.txt	2004-06-27 06:59:47 UTC (rev 666)
@@ -1,27 +1,25 @@
 
 ----------------------- TO-DO (highest priority first) ------------------------
 
---- command error -> returning the object instead of throwing an exception 
+--- OSThread, Thread, and Gate
+		http://www.prothon.org/pipermail/prothon-user/2004-June/002124.html
+--- lock keyword?
+--- thread keyword for param improvement?
 
+--- checking method? return values ???
+
 --- metaclasses not supported
 		http://www.prothon.org/pipermail/prothon-user/2004-June/002409.html
+		http://www.prothon.org/pipermail/prothon-user/2004-June/002480.html
 		
 --- factory keyword, attrProxy_ object
 		http://www.prothon.org/pipermail/prothon-user/2004-June/002442.html
 		http://www.prothon.org/pipermail/prothon-user/2004-June/002444.html
 --- class keyword
 		http://www.prothon.org/pipermail/prothon-user/2004-June/002445.html
-
---- OSThread, Thread, and Gate
-		http://www.prothon.org/pipermail/prothon-user/2004-June/002124.html
---- lock keyword?
---- thread keyword for param improvement?
-
---- checking method? return values ???
-
 --- type keyword?
 		http://www.prothon.org/pipermail/prothon-user/2004-June/002508.html
-		
+	
 --- assignment as expression ???
 		http://www.prothon.org/pipermail/prothon-user/2004-June/002160.html
 		
@@ -46,10 +44,10 @@
 
 --- weak references
 
+--- raise exception_object, doc_object
 --- allow tracebacks in the constructors to exception objects or raise command
 --- Traceback objects (stack trace of an exception), exceptions should show function names
 --- Fix error reporting mess, hide fake file names
---- raise exception_object, doc_object
 
 --- put in skeleton code for + _"abc"
 --- GNU message catalog _"abc" strings
@@ -73,7 +71,7 @@
 
 --- support long ints & Bytes in dbm & prosist
 
---- Swig and/or other (what GTK port used?) backend
+--- Swig, Boost, Pyrex and/or other (what GTK port used?) backend
 
 --- concatenate adjacent strings  "abc" "def" -> "abcdef"
 
@@ -89,8 +87,6 @@
 
 --- nesting  /* .. */ comments 
 
---- check dict keys for mutability bit
-
 --- -m -l cmd-line options missing
 --- memory bounds -> mem-mgr priorities
 

Modified: trunk/src/builtins-dict.c
===================================================================
--- trunk/src/builtins-dict.c	2004-06-27 05:08:19 UTC (rev 665)
+++ trunk/src/builtins-dict.c	2004-06-27 06:59:47 UTC (rev 666)
@@ -122,6 +122,10 @@
 	else {
 		obj_p hash_obj = call_func0(ist, key_in, SYM(HASH_));
 		if_exc_return 0;
+		if (!is_immutable(key_in)) {
+			raise_exception(ist, OBJ(TYPE_EXC), "dictionary keys must be immutable");
+			return 0;
+		}
 		return hash_obj->data.i32[0];
 	}
 }

Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-06-27 05:08:19 UTC (rev 665)
+++ trunk/src/interp.c	2004-06-27 06:59:47 UTC (rev 666)
@@ -1841,7 +1841,7 @@
 					apr_snprintf(buf2, sizeof(buf2), "%s, ", pr2c_strptr(ist, doc));
 					if (strlen(buf)+strlen(buf2) < sizeof(buf)) strcat(buf, buf2);
 				} else if (doc) {
-					apr_snprintf(buf2, sizeof(buf2), "%s.\n\n", pr2c_strptr(ist, doc));
+					apr_snprintf(buf2, sizeof(buf2), "%s.", pr2c_strptr(ist, doc));
 					if (strlen(buf)+strlen(buf2) < sizeof(buf)) strcat(buf, buf2);
 				} else if (i == 0) {
 					for (p=buf+strlen(buf)-1; p > buf && *p != ','; p--);
@@ -1849,9 +1849,8 @@
 				}
 			}
 		}
-		printf("%s\n",buf);
+		printf("%s\n\n",buf);
 	}
-
 	return orig_excobj;
 }