rev 303 - in trunk: . include/prothon pr src

SVN User <[email protected]>
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-04-08 18:18:02 -0400 (Thu, 08 Apr 2004)
New Revision: 303

Modified:
   trunk/STATUS.txt
   trunk/include/prothon/prothon.h
   trunk/pr/chained.pr
   trunk/src/parser_routines.c
Log:
more fixes in cmp chains a<b<c, stil broken

Modified: trunk/STATUS.txt
===================================================================
--- trunk/STATUS.txt	2004-04-08 13:04:12 UTC (rev 302)
+++ trunk/STATUS.txt	2004-04-08 22:18:02 UTC (rev 303)
@@ -2,7 +2,6 @@
 ----------------------- TO-DO (highest priority first) ------------------------
 
 --- add list comprehension
---- a < b < c
 
 --- add thread object so prothon code can create threads
 

Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h	2004-04-08 13:04:12 UTC (rev 302)
+++ trunk/include/prothon/prothon.h	2004-04-08 22:18:02 UTC (rev 303)
@@ -55,6 +55,17 @@
 #ifndef PROTHON_H
 #define PROTHON_H
 
+//**************************** DEBUG DEFINITIONS ******************************
+
+//#define DEBUG_THREADS
+//#define DEBUG_MEM_MGR
+//#define TRACE_PARSER
+#define DUMP_MODULE_CODE
+#define TRACE_INTERPRETER
+//#define DUMP_OBJECTS_AT_END
+
+//*****************************************************************************
+
 #include <apr.h>
 #include <apr_pools.h>
 #include <apr_thread_proc.h>
@@ -81,15 +92,6 @@
 #define PR_DECLARE_EXPORT
 #endif
 
-//**************************** DEBUG DEFINITIONS *********************************
-
-//#define DEBUG_THREADS
-//#define DEBUG_MEM_MGR
-//#define TRACE_PARSER
-//#define TRACE_INTERPRETER
-//#define DUMP_MODULE_CODE
-//#define DUMP_OBJECTS_AT_END
-
 //************************* BASIC TYPE DEFINITIONS ********************************
 
 typedef signed char		i8_t;

Modified: trunk/pr/chained.pr
===================================================================
--- trunk/pr/chained.pr	2004-04-08 13:04:12 UTC (rev 302)
+++ trunk/pr/chained.pr	2004-04-08 22:18:02 UTC (rev 303)
@@ -3,6 +3,7 @@
 
 print 30 <= 30 >= 30 >= 20
 
+/*
 print "these should all be true\n"
 
 print 1 < 2 < 3 < 5 < 199
@@ -33,3 +34,4 @@
 
 c(1,0) < c(2,1) < c(3,2)
 c(1,0) > c(2,1) < c(3,2)
+*/
\ No newline at end of file

Modified: trunk/src/parser_routines.c
===================================================================
--- trunk/src/parser_routines.c	2004-04-08 13:04:12 UTC (rev 302)
+++ trunk/src/parser_routines.c	2004-04-08 22:18:02 UTC (rev 303)
@@ -572,15 +572,29 @@
 	parm->code_data[parm->len-1].bytecode.param  = 0;
 	return debug_retrn(__LINE__, parm);
 }
+code_p bool_and_expr(void* param, code_p lbool, code_p rparm){
+	int k=0;
+	code_p res = new_code( param,  lbool->len + 3 + rparm->len, 1, 
+				          max( max( lbool->max_stack_depth, 
+				          lbool->stack_depth+1+rparm->max_stack_depth ), 3 ), 0 );
+	add_code_to(lbool, res, &k);
+	res->code_data[k  ].bytecode.opcode = OP_BEQ;
+	res->code_data[k++].bytecode.param  = rparm->len+3;
+	res->code_data[k++].data            = OBJ(PR_FALSE);
+	res->code_data[k  ].bytecode.opcode = OP_POP;
+	res->code_data[k++].bytecode.param  = 1;
+	add_code_to(rparm, res, &k);
+	return debug_retrn(__LINE__, res);
+}
 code_p binary(void* param, code_p lparm, int op, code_p rparm){
 	code_p res;
 	int k=0, have_cmp_op = (op >= __LT__QUES && op <= __EQ__QUES);
-
 	if (lparm->cmp_expr && have_cmp_op) {
 		code_p and_rparm, bin_lparm = lparm->cmp_expr;
 		lparm->cmp_expr = NULL;
 		and_rparm = binary(param, bin_lparm, op, rparm);
-		res = expr_andor_expr(param, lparm, and_rparm, AND_FLAG);
+		res = bool_and_expr(param, lparm, and_rparm);
+		res->cmp_expr = rparm;
 	} else {
 		res = new_code( param, lparm->len + 3 + rparm->len + 1, 
 						lparm->stack_depth, max( max( lparm->max_stack_depth,
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.