rev 653 - in trunk: . pr/test src

SVN User <[email protected]> Wed, 23 Jun 2004 01:57:39 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-06-23 01:57:36 -0400 (Wed, 23 Jun 2004)
New Revision: 653

Modified:
   trunk/STATUS.txt
   trunk/pr/test/bin.pr
   trunk/pr/test/fixed.pr
   trunk/pr/test/func.pr
   trunk/pr/test/new.pr
   trunk/pr/test/test.pr
   trunk/src/builtins-core.c
   trunk/src/interp.c
Log:
changed Proto to newObject, *args is now a tuple

Modified: trunk/STATUS.txt
===================================================================
--- trunk/STATUS.txt	2004-06-23 05:31:51 UTC (rev 652)
+++ trunk/STATUS.txt	2004-06-23 05:57:36 UTC (rev 653)
@@ -1,10 +1,6 @@
 
 ----------------------- TO-DO (highest priority first) ------------------------
 
---- fix raise command
---- change proto() to newObject() 
---- *args should be a tuple
-
 --- Python regrets from Paul and print proposal
 	http://www.prothon.org/pipermail/prothon-user/2004-June/001970.html
 	http://www.prothon.org/pipermail/prothon-user/2004-June/001991.html

Modified: trunk/pr/test/bin.pr
===================================================================
--- trunk/pr/test/bin.pr	2004-06-23 05:31:51 UTC (rev 652)
+++ trunk/pr/test/bin.pr	2004-06-23 05:57:36 UTC (rev 653)
@@ -16,7 +16,7 @@
     obj.init_('abc') # init as String
 except x,e: print e     # throws "object has binary data, expected none"
 
-L = Proto(List) # L is uninitialized list
+L = newObject(List) # L is uninitialized list
 
 L.init_(1,2,3)
 print L             # prints [1, 2, 3] 

Modified: trunk/pr/test/fixed.pr
===================================================================
--- trunk/pr/test/fixed.pr	2004-06-23 05:31:51 UTC (rev 652)
+++ trunk/pr/test/fixed.pr	2004-06-23 05:57:36 UTC (rev 653)
@@ -5,7 +5,7 @@
     divisor = 100
     
     def call_(n=0, decimalplaces=2):
-        obj = Proto(self)
+        obj = newObject(self)
         obj.dp = decimalplaces
         obj.divisor = 10
         obj.init_(n)   # binary data init here 

Modified: trunk/pr/test/func.pr
===================================================================
--- trunk/pr/test/func.pr	2004-06-23 05:31:51 UTC (rev 652)
+++ trunk/pr/test/func.pr	2004-06-23 05:57:36 UTC (rev 653)
@@ -16,7 +16,7 @@
 def f2(y=''):
 	print 'f2 '+y
 	
-f = Proto(f1)
+f = newObject(f1)
 f.init_(f2)
 
 f1('a')

Modified: trunk/pr/test/new.pr
===================================================================
--- trunk/pr/test/new.pr	2004-06-23 05:31:51 UTC (rev 652)
+++ trunk/pr/test/new.pr	2004-06-23 05:57:36 UTC (rev 653)
@@ -1,7 +1,7 @@
 #!/usr/bin/env prothon
 
 def New(proto, *args, **kwargs):
-    newObj = Proto(proto)
+    newObj = newObject(proto)
     newObj.init_(*args, **kwargs)
     return newObj
 

Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr	2004-06-23 05:31:51 UTC (rev 652)
+++ trunk/pr/test/test.pr	2004-06-23 05:57:36 UTC (rev 653)
@@ -1,5 +1,4 @@
 #!/usr/bin/env prothon
 
-object x:
-	pass
-x.attrs_.delItem_($eee)
+def func():
+	raise 'abc'

Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c	2004-06-23 05:31:51 UTC (rev 652)
+++ trunk/src/builtins-core.c	2004-06-23 05:57:36 UTC (rev 653)
@@ -139,7 +139,7 @@
 	return debug_object(self);
 }
 
-DEF(Object, Proto, FORM_STAR_PARAM) {
+DEF(Object, newObject, FORM_STAR_PARAM) {
 	int i, llen = (int) list_len(ist, parms[1]);
 	obj_p new_obj;
 	if (!llen) {
@@ -930,7 +930,7 @@
 	MODULE_ADD_SYM(Object, objId_);
 	MODULE_ADD_SYM(Object, isMain_QUES);
 	MODULE_ADD_SYM(Object, debug_);
-	MODULE_ADD_SYM(Object, Proto);
+	MODULE_ADD_SYM(Object, newObject);
 	MODULE_ADD_SYM(Object, copy);
 	MODULE_ADD_SYM(Object, setReadAccess);
 	MODULE_ADD_SYM(Object, readAccess);

Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-06-23 05:31:51 UTC (rev 652)
+++ trunk/src/interp.c	2004-06-23 05:57:36 UTC (rev 653)
@@ -523,9 +523,11 @@
 	for (i=0; i < llen; i++)
 		set_attr(ist, (*new_locals), clist_item((*fparam_proc_state).lbl_val_list, i*2), 
 						clist_item((*fparam_proc_state).lbl_val_list,(i*2)+1) );
-	if ((*fparam_proc_state).free_pos_list_key)
+	if ((*fparam_proc_state).free_pos_list_key) {
+		switch_proto(ist, (*fparam_proc_state).free_pos_list_obj, OBJ(TUPLE_PROTO));
 		set_attr(ist, (*new_locals), (*fparam_proc_state).free_pos_list_key, 
 						(*fparam_proc_state).free_pos_list_obj );
+	}
 	if ((*fparam_proc_state).free_label_list_key)
 		set_attr(ist, (*new_locals), (*fparam_proc_state).free_label_list_key, 
 						(*fparam_proc_state).free_label_list_obj );