rev 578 - in trunk: pr/test src

SVN User <[email protected]> Fri, 04 Jun 2004 18:39:55 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-06-04 18:39:52 -0400 (Fri, 04 Jun 2004)
New Revision: 578

Modified:
   trunk/pr/test/test.pr
   trunk/src/interp.c
Log:
fixed bug where all functions returned None

Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr	2004-06-04 22:11:08 UTC (rev 577)
+++ trunk/pr/test/test.pr	2004-06-04 22:39:52 UTC (rev 578)
@@ -1,31 +1,33 @@
 #!/usr/bin/env prothon
 
-# bin.pr
+print "these should all be true\n"
 
-x = Exception
+print 1 < 2 < 3 < 5 < 199
 
-object obj(String, Int):
-    Int.init_{obj}(99)      # inits using second proto
-    print Int.str_{obj}()   # prints 99
+print 10 < 20 <= 30 <= 30 >= 30 >= 20 > 10
 
-try:
-    with obj: Int.init_{obj}(99)   # init Int a second time
-except x,e: print e    # throws "object has binary data, expected none"
+print 1 < 2 > 1 < 2 > 1
 
-try:
-    obj.init_('abc')    # init as String
-except x,e: print e     # throws "object has binary data, expected none"
+print 1 >= 1 == 1 != 2 == 2 > 1 <= 1 <= 2
 
-L = Proto(List) # L is uninitialized list
+print "\n\nthese should all be false\n"
 
-L.init_(1,2,3)
-print L             # prints [1, 2, 3] 
+print 1 < 2 < 3 < 2 < 199
 
-L.init_(4,5,6)
-print L             # prints [4, 5, 6] 
+print 10 < 20 <= 30 <= 29 >= 30 >= 20 > 10
 
-d = {1:2, 'a':'b'}
-print d             # prints {1:2, 'a':'b'}
+print 1 < 2 > 2 < 2 > 1
 
-d.init_(c = 'd', f = 'g')
-print d             # prints {f:'g', c:'d'} 
\ No newline at end of file
+print 1 >= 1 == 2 != 2 == 2 > 1 <= 1 <= 2
+
+def f(i):
+	print i,
+	return i
+	
+print "\n\nThis should print 0 1 2\n"
+f(0) < f(1) < f(2)
+
+print "\n\nThis should print 0 1\n"
+f(0) > f(1) < f(2)
+
+print

Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-06-04 22:11:08 UTC (rev 577)
+++ trunk/src/interp.c	2004-06-04 22:39:52 UTC (rev 578)
@@ -752,7 +752,7 @@
 		if (fr_ccall) 
 			res = fr_tos;
 		else 
-			fr_prev->stack[fr_prev->stack_ptr] = fr_tos;
+			fr_prev->stack[fr_prev->stack_ptr-1] = fr_tos;
 		*switch_frame = fr_prev;
 		(*switch_frame)->next_frame = NULL;
 	} else