rev 476 - in trunk: include/prothon pr src

SVN User <[email protected]> Wed, 12 May 2004 20:58:49 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-05-12 20:58:47 -0400 (Wed, 12 May 2004)
New Revision: 476

Removed:
   trunk/pr/super.pr
Modified:
   trunk/include/prothon/prothon.h
   trunk/pr/new.pr
   trunk/pr/object.pr
   trunk/pr/oops.pr
   trunk/pr/re.pr
   trunk/pr/test.pr
   trunk/pr/threads.pr
   trunk/src/interp.c
Log:
fixed thread bug where self was missing, cleaned up test files, this may be interim release

Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/include/prothon/prothon.h	2004-05-13 00:58:47 UTC (rev 476)
@@ -78,7 +78,7 @@
 extern "C" {
 #endif
 
-#define PROTHON_VERSION_NUMBER	"0.0"
+#define PROTHON_VERSION_NUMBER	"0.1"
 #define PROTHON_VERSION_BUILD   "$Rev$"  
 #define PROTHON_VERSION_DATE	__DATE__
 

Modified: trunk/pr/new.pr
===================================================================
--- trunk/pr/new.pr	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/pr/new.pr	2004-05-13 00:58:47 UTC (rev 476)
@@ -7,11 +7,11 @@
 
 p = Object()
 with p:
-    $x = None
-    def $init_(x):
-        $x = x
-    def $str_():
-        return '*'+$x+'*'
+    x = None
+    def init_(x):
+        self.x = x
+    def str_():
+        return '*'+self.x+'*'
 
 print
 print 'Should print ...'

Modified: trunk/pr/object.pr
===================================================================
--- trunk/pr/object.pr	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/pr/object.pr	2004-05-13 00:58:47 UTC (rev 476)
@@ -3,13 +3,13 @@
 # object.pr
 
 object Point(Object):
-	self.x = 0; self.y = 0
-	def self.init_(x, y):
+	x = 0; y = 0
+	def init_(x, y):
 		self.x=x; self.y=y
-	def self.move(xofs, yofs):
+	def move(xofs, yofs):
 		self.x += xofs; self.y += yofs
-		print self.
-	def self.str_():
+		print self
+	def str_():
 		return '<'+self.x+':'+self.y+'>'
 		
 print

Modified: trunk/pr/oops.pr
===================================================================
--- trunk/pr/oops.pr	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/pr/oops.pr	2004-05-13 00:58:47 UTC (rev 476)
@@ -4,15 +4,14 @@
 
 with Emp_proto:
 
-	$name = "<proto name>"
+	name = "<proto name>"
 	
-	def $init_(name):
-		$name = name
-		$hello()
-		return $
+	def init_(name):
+		self.name = name
+		hello()
 
-	def $hello():
-		print "My name is:", $name	
+	def hello():
+		print "My name is:", self.name	
 			
 
 Emp_proto.hello()

Modified: trunk/pr/re.pr
===================================================================
--- trunk/pr/re.pr	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/pr/re.pr	2004-05-13 00:58:47 UTC (rev 476)
@@ -5,7 +5,7 @@
 def findAll(r,s):
 	result=[]
 	def foundOne(mo): 
-		&result.append!(mo.group())
+		outer.result.append!(mo.group())
 		return ''
 	r.sub(foundOne, s)
 	return result

Deleted: trunk/pr/super.pr
===================================================================
--- trunk/pr/super.pr	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/pr/super.pr	2004-05-13 00:58:47 UTC (rev 476)
@@ -1,15 +0,0 @@
-#!/usr/bin/env prothon
-
-proto = Object()
-obj = proto()
-proto.x = 2
-obj.x   = 1
-with obj:
-	print $x   # prints 1
-	print ^x   # prints 2
-
-print '\nabove should say...'
-print 1
-print 2
-print
-

Modified: trunk/pr/test.pr
===================================================================
--- trunk/pr/test.pr	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/pr/test.pr	2004-05-13 00:58:47 UTC (rev 476)
@@ -1,40 +1,4 @@
 #!/usr/bin/env prothon
 
-object ModInt(Int): 
-    modulo = 10
-    def init_(i=0): 
-        Int.init_{self}(i % self.modulo)
-    def add_(other):
-        if self.modulo != other.modulo: 
-            raise TypeError 
-        return (self.protoList()[1])(Int.add_{self}(other) % self.modulo) 
-
-object Mod16Int(ModInt):
-    modulo = 16
-
-object Mod16IntC(Mod16Int):     
-    cache = {}                 
-    def init_(i):            
-        i = i % self.modulo         
-        if i in cache:       
-            print  cache[i] , 'from cache' 
-            return cache[i]    
-        obj = Mod16Int(i)       
-        cache[i] = obj   
-        print obj, 'new'      
-        return obj              
-
-print """
-
-Should print
-
-11 new 
-8 new 
-8 from cache 
-11 + 8 + 8 = 11 
-"""
-
-i = Mod16IntC(27)
-j = Mod16IntC(8)    
-k = Mod16IntC(8)    
-print "%i + %i + %i = %02i" % (i, j, k, (i + j + k))
+for i in 10:
+	print i

Modified: trunk/pr/threads.pr
===================================================================
--- trunk/pr/threads.pr	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/pr/threads.pr	2004-05-13 00:58:47 UTC (rev 476)
@@ -10,7 +10,7 @@
 	for i in n:
 		Sleep(d)
 		print my_thread, "has been running",(i+1)*d,'seconds'
-	Finished_thread_count += 1
+	outer.Finished_thread_count += 1
 
 a = Thread(func, [10, 1.0000], "A")
 b = Thread(func, [ 5, 2.0000], "B")

Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-05-12 22:40:25 UTC (rev 475)
+++ trunk/src/interp.c	2004-05-13 00:58:47 UTC (rev 476)
@@ -1763,7 +1763,7 @@
 void* user_thread(apr_thread_t *handle, void *argv) {
 	user_thread_p uthread = (user_thread_p) argv;
 	isp ist = get_ist(uthread->access);
-	obj_p func_obj = uthread->func;
+	obj_p thread_module, func_obj = uthread->func;
 	frame_p new_frame;
 	obj_p new_locals, lbl_val_arr[MAX_NUM_PARAMS]; 
 	int i, parm_cnt = (int) list_len(ist, uthread->params) * 2;
@@ -1780,7 +1780,8 @@
 		lbl_val_arr[i+1] = list_item(ist, uthread->params, i/2);
 	}
 	new_locals = NEW_OBJ(NULL);
-	new_frame = create_frame( ist, NULL, NULL, NULL, new_locals, func_obj, NULL );
+	thread_module = NEW_OBJ(NULL);
+	new_frame = create_frame( ist, thread_module, thread_module, NULL, new_locals, func_obj, NULL );
 	new_frame->called_from_c = TRUE;
 	new_frame->prev_frame = NULL;
 	load_frame_params( ist, new_locals, func_obj, parm_cnt, lbl_val_arr);
@@ -1792,6 +1793,7 @@
 	}
 	ist->frame = new_frame;
 	exec_loop(ist);
+	check_exceptions(ist);
 	thread_p->running = FALSE;
 	return NULL;
 }