rev 464 - in trunk: include/prothon pr src

SVN User <[email protected]> Mon, 10 May 2004 03:14:53 -0400
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-05-10 03:14:50 -0400 (Mon, 10 May 2004)
New Revision: 464

Modified:
   trunk/include/prothon/prothon.h
   trunk/pr/bin.pr
   trunk/pr/bind.pr
   trunk/pr/closure.pr
   trunk/pr/defs.pr
   trunk/pr/test.pr
   trunk/src/builtins-tuple.c
   trunk/src/interp.c
   trunk/src/lock.c
   trunk/src/memory_mgr.c
   trunk/src/object.c
   trunk/src/object.h
   trunk/src/parser_routines.c
   trunk/src/src.vcproj
Log:
added homemade assert to solve visual studio problem

Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/include/prothon/prothon.h	2004-05-10 07:14:50 UTC (rev 464)
@@ -72,6 +72,7 @@
 #include <apr_pools.h>
 #include <apr_thread_proc.h>
 #include <apr_portable.h>
+#include <apr_strings.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -106,8 +107,21 @@
 typedef apr_uint64_t		u64_t;
 
 #ifdef WIN32
+// temporary kludge until Visual Studio problem resolved
+#define pr_assert(expr)									\
+do {char buf[80];										\
+	if (!(expr)) {										\
+		apr_snprintf(buf, sizeof(buf),					\
+			"Assertion failed at file %s, line %d\n",	\
+								__FILE__, __LINE__);	\
+		printf(buf);									\
+		pr_exit(1);										\
+	}													\
+} while (0)
+
 #define MAX_INT_VAL		0x7fffffffffffffff
 #else
+#define pr_assert(expr)	assert(expr)
 #define MAX_INT_VAL		0x7fffffffffffffffLL
 #endif
 
@@ -509,7 +523,7 @@
 // prototype chain.
 // The ist param may return an exception object if proto pointers are missing 
 // or have a circular reference.  See section "INTERPRETER STATE".
-obj_p get_proto_attr(isp ist, obj_p object, obj_p key, obj_p *proto_pp, obj_p super_obj);
+obj_p get_attr_in_chain(isp ist, obj_p object, obj_p key, obj_p *proto_pp, obj_p super_obj);
 
 // DEL_ATTR: Find attr in object that matches a key and delete it.
 // Much like get-attr, except that when an attr is found it is deleted.
@@ -792,14 +806,14 @@
 //****************** HIGHER LEVEL OBJECT ACCESS ROUTINES ************************
 
 // xxx_ITEM: These are higher-level access routines for attributes and data
-// If you pass a symbol for the ref_key value then you can get, set, or delete
+// If you pass a symbol for the key value then you can get, set, or delete
 // object attributes.  If you pass a slice object, then you can operate on any 
 // mutable sequence object such as a list or dictionary.  If you pass a super 
 // object as a key then you can access attributes of proto objects.  These are the
 // routines called by the Prothon interpreter for general access.
 obj_p get_item(isp ist, obj_p obj, obj_p key);
-void set_item(isp ist, obj_p value, obj_p obj, obj_p key);
-void del_item(isp ist, obj_p obj, obj_p key);
+void  set_item(isp ist, obj_p obj, obj_p key, obj_p value);
+void  del_item(isp ist, obj_p obj, obj_p key);
 
 // NEW_SLICE_OBJ: This is the object that represents a slice of a sequence.
 // A slice is one, two, or three objects such as the two ints in x[5:9].  A slice 
@@ -827,9 +841,10 @@
 // NEW_SUPER_OBJ: This represents the reference of a proto of an object
 // This is much like a slice in that it indicates how data is to be referenced
 // in an object.  In this case the data is an attribute of a proto.
-// Example: If you are in the function of an object self, and you refer to :x, 
+// Example: If you are in the function of an object self, and you refer to ^x, 
 // then you are referring to the attribute x in a proto of self. Then
-// to access :x in the proto of self -> get_item(ist, self, new_super_obj(ist, sym(ist, "x")));
+// to access ^x in the proto of self do:
+//        get_item(ist, self, new_super_obj(ist, sym(ist, "x")));
 obj_p new_super_obj(isp ist, obj_p symbol);
 
 //************************* Prothon C FUNCTION ********************************

Modified: trunk/pr/bin.pr
===================================================================
--- trunk/pr/bin.pr	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/pr/bin.pr	2004-05-10 07:14:50 UTC (rev 464)
@@ -5,11 +5,11 @@
 x = Exception
 
 object obj(String, Int):
-        Int$__init__(99)      # inits using second proto
-        print Int$__str__()   # prints 99
+        Int.__init__{local.obj}(99)      # inits using second proto
+        print Int.__str__{local.obj}()   # prints 99
         
 try:
-    with obj: Int$__init__(99)   # init Int a second time
+    with obj: Int.__init__{local.obj}(99)   # init Int a second time
 except x,e: print e    # throws "object has binary data, expected none"
 
 try:
Modified: trunk/pr/bind.pr
===================================================================
--- trunk/pr/bind.pr	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/pr/bind.pr	2004-05-10 07:14:50 UTC (rev 464)
@@ -1,31 +1,19 @@
 #!/usr/bin/env prothon
 
 def func():
-	print $
+	print self
 	
-bf33 = func.bind(33)
-bf66 = func.bind(66)
+bf33 = func{33}
+bf66 = func{66}
 print bf33				#   <func:93b7c0:bound:33> 
 print bf66				#	<func:93b7e0:bound:66>
 
 bf33()					# 33
 bf66()					# 66
-with 99: bf33()			# 33
-with 99: bf66()			# 66
+bf33{77}()				# 77
+bf66{88}()				# 88
 
 print bf33				#   <func:93b7c0:bound:33>
 print bf33.__bindObj__	#	33
 del bf33.__bindObj__
 print bf33				#  <func:93b7c0>
-
-print bf66				#  <func:93b7e0:bound:66> 
-
-bf66 = bf66.bind(11)	#  <func:93b7e0:bound:66> 
-print bf66				#  <func:93bbc0:bound:11>
-bf66 = bf66.bind()
-print bf66				#  <func:93bc80>
-
-
-
-
-
Modified: trunk/pr/closure.pr
===================================================================
--- trunk/pr/closure.pr	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/pr/closure.pr	2004-05-10 07:14:50 UTC (rev 464)
@@ -18,13 +18,13 @@
 			def f4():
 				g=7
 				def count():
-					print &a,&b,&c,&d,&e,&f,&g,&h,
-					&c = &a+&b
-					&e = &c+&d
-					&g = &e+&f
-					&h = &c+&e+&g
-					&counter += 100
-					print &counter
+					print outer.a,outer.b,outer.c,outer.d,outer.e,outer.f,outer.g,outer.h,
+					outer.c = outer.a+outer.b
+					outer.e = outer.c+outer.d
+					outer.g = outer.e+outer.f
+					outer.h = outer.c+outer.e+outer.g
+					outer.counter += 100
+					print outer.counter
 				h=8
 				return count
 			f=6

Modified: trunk/pr/defs.pr
===================================================================
--- trunk/pr/defs.pr	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/pr/defs.pr	2004-05-10 07:14:50 UTC (rev 464)
@@ -1,15 +1,18 @@
 #!/usr/bin/env prothon
 
-print "\nThis should print 1 2 3 1 2 3\n"
+print """
+This should print 
+1 2 3 1 2 3
+"""
 
-def outer():
+def outer_func():
 	c = 0
 	def f():
-		&c += 1
-		return &c
+		outer.c += 1
+		return outer.c
 	return f
 
-c1 = outer()
-c2 = outer()
+c1 = outer_func()
+c2 = outer_func()
 print c1(),c1(),c1(),c2(),c2(),c2()
 

Modified: trunk/pr/test.pr
===================================================================
--- trunk/pr/test.pr	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/pr/test.pr	2004-05-10 07:14:50 UTC (rev 464)
@@ -1,36 +1,42 @@
 #!/usr/bin/env prothon
 
-object Fixed(Int):
-    dp = 2 
-    divisor = 100
-    
-    def __call__(n=0, decimalplaces=2):
-        obj = Proto(self)
-        obj.dp = decimalplaces
-        obj.divisor = 10
-        obj.__init__(n)   # binary data init here 
-        return obj
+if not e.hasKey?(1) or e.hasKey?(2): print 'error4'
+/*
 
-object PrettyPrintFixed(Fixed): 
+d = {1:2}
+if d.keys()   != [1]  : print 'error in keys'
+if d.values() != [2]  : print 'error in values'
+if d.get(1)   !=  2   : print 'error1 in get'
+if d.get(2)   != None : print 'error2 in get'
+if d.get(3,4) !=  4   : print 'error3 in get'
+if d.get(3,5) !=  5   : print 'error4 in get'
+if d.setDefault!(3,4) !=  4   : print 'error5 in setdefault'
+if d.get(3,5) !=  4   : print 'error6 in get'
+if 3 not in d: print 'error 7 in notin'
 
-    def __init__(n):
-        Int.__init__{self}(n)
-        # Set default print format width.
-        self.setPrintWidth(self.dp+5)
-        
-    def setPrintWidth(wid):
-        # Create string comprehension "%W.Pf"
-        # where W is wid and P  is selfdp
-        self.pattern =  "%%%i.%if" % (wid, self.dp) 
-        print self.pattern
-        
-    def __str__(): 
-        return  self.pattern % (self / self.divisor)
-        
-print """
-This should print
+d = {1:2, 3:4}
+e = d.copy()
+   
+if d.items() != e.items():
+	print 'error1'
+	
+if Len(e.items()) != 2:
+    print 'error2'
 
-%6.1f 
-123456.7 
-"""
-print PrettyPrintFixed(1234567, 1)
+d.clear!()
+
+d = {1:2}
+d.update!({3:4})
+if d.items() != e.items():
+	print d.items(), e.items(), 'error3'
+
+if not e.hasKey?(1) or e.hasKey?(2): print 'error4'
+
+print 'all tests passed'
+
+print '\nfollowing should be:  1 (1, 2) 3 (3, 4)\n'
+
+for i in e: print i, d.popItem!(),
+
+print '\n'
+*/
\ No newline at end of file

Modified: trunk/src/builtins-tuple.c
===================================================================
--- trunk/src/builtins-tuple.c	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/src/builtins-tuple.c	2004-05-10 07:14:50 UTC (rev 464)
@@ -67,7 +67,7 @@
 //********************************* new_tuple_obj *****************************
 obj_p new_tuple_obj(isp ist, int fixed_size) {
 	obj_p tuple_obj = NEW_LIST(fixed_size);
-	assert(!(tuple_obj->has_attrs));
+	pr_assert(!(tuple_obj->has_attrs));
 	tuple_obj->attr_proto.proto = OBJ(TUPLE_PROTO);
 	return tuple_obj;
 }

Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/src/interp.c	2004-05-10 07:14:50 UTC (rev 464)
@@ -114,15 +114,15 @@
 	frame->syn_locals		= (func_obj ? get_attr(ist, func_obj, SYM(__SYN_LOCALS__)) : syn_locals);
 	frame->dyn_locals		= dyn_locals;
 	frame->locals			= locals;
-	frame->def_locals		= locals;
-	frame->def_globals		= frame->globals;
 	frame->code				= code;
-	if(!frame->globals)       frame->globals = globals;
+	if(!frame->globals)    frame->globals    = globals;
 	if(!frame->syn_locals) frame->syn_locals = syn_locals;
 	if(!frame->syn_locals) frame->syn_locals = locals;
 	if(!frame->dyn_locals) frame->dyn_locals = locals;
-	assert(frame->globals && frame->syn_locals && frame->dyn_locals && frame->locals);
-	return frame;
+	pr_assert(frame->globals && frame->syn_locals && frame->dyn_locals && frame->locals);
+	frame->def_locals  = frame->locals;
+	frame->def_globals = frame->globals;
+	return frame;																				  
 }
 
 #define ERR 1
@@ -140,7 +140,7 @@
 //********************************* new_slice_obj *****************************
 obj_p new_slice_obj(isp ist, obj_p ind1, obj_p ind2, obj_p ind3) {
 	obj_p slice_obj = NEW_LIST(3);
-	assert(!(slice_obj->has_attrs));
+	pr_assert(!(slice_obj->has_attrs));
 	slice_obj->attr_proto.proto = OBJ(SLICE_PROTO);
 	if (ind1 == SLICEPARAM_EMPTY)
 		list_append_no_lock(slice_obj, OBJ(NONE));
@@ -167,7 +167,7 @@
 	if (has_proto_QUES(ist, ref_key, OBJ(SYMBOL_PROTO))) {
 		obj_p res;
 		if_exc_return NULL;
-		res = get_proto_attr(ist, ref_self, ref_key, NULL, NULL);
+		res = get_attr_in_chain(ist, ref_self, ref_key, NULL, NULL);
 		if (!res) {
 			raise_exception(ist, OBJ(NAME_EXC), "Attribute %s not found",
 					symch(ist, ref_key));
@@ -180,7 +180,7 @@
         return call_func(ist, ref_self, SYM(__GETITEM__), 2, param, 0);
 	} else if (has_proto_QUES(ist, ref_key, OBJ(SUPER_PROTO))) {
 		if_exc_return NULL;
-        return get_proto_attr(ist, ref_self, ref_key->data.ptr, NULL, ref_self);
+        return get_attr_in_chain(ist, ref_self, ref_key->data.ptr, NULL, ref_self);
 	} else {
 		raise_exception(ist, OBJ(INTERNAL_EXC), "Invalid reference type");
 		return NULL;
@@ -188,7 +188,7 @@
 }
 
 //********************************* set_item ******************************
-void set_item(isp ist, obj_p value, obj_p ref_self, obj_p ref_key){
+void set_item(isp ist, obj_p ref_self, obj_p ref_key, obj_p value){
 	if (has_proto_QUES(ist, ref_key, OBJ(SYMBOL_PROTO))) {
 		if_exc_return;
 		set_attr(ist, ref_self, ref_key, value);
@@ -199,7 +199,7 @@
         call_func(ist, ref_self, SYM(__SETITEM__), 4, param, 0);
 	} else if (has_proto_QUES(ist, ref_key, OBJ(SUPER_PROTO))) {
 		obj_p proto_obj;
-        get_proto_attr(ist, ref_self, ref_key->data.ptr, &proto_obj, ref_self);
+        get_attr_in_chain(ist, ref_self, ref_key->data.ptr, &proto_obj, ref_self);
 		if_exc_return;
 		if (!proto_obj) {
 			obj_p proto_list_obj = proto_list(ist, ref_self); if_exc_return;
@@ -223,7 +223,7 @@
         call_func(ist, ref_self, SYM(__DELITEM__), 2, param, 0);
 	} else if (has_proto_QUES(ist, ref_key, OBJ(SUPER_PROTO))) {
 		obj_p proto_obj;
-        get_proto_attr(ist, ref_self, ref_key->data.ptr, &proto_obj, ref_self);
+        get_attr_in_chain(ist, ref_self, ref_key->data.ptr, &proto_obj, ref_self);
 		if_exc_return;
 		if (proto_obj) del_attr(ist, proto_obj, ref_key->data.ptr);
 	} else {
@@ -844,7 +844,7 @@
 				sp1 = sp2 - param;
 				fr_sp = sp2;
 				for(i=0; i < param; i++, sp1++, sp2+=2)
-					set_item(ist, fr_stack[sp1], fr_stack[sp2], fr_stack[sp2+1]);
+					set_item(ist, fr_stack[sp2], fr_stack[sp2+1], fr_stack[sp1]);
 			}	break;
 			case OP_SEQ_ASSIGN: {
 				obj_p list;
@@ -906,7 +906,7 @@
 				fr_sp -= fparams_len+2;
 				if (fparams_len) {
 					obj_p fparams_obj = NEW_LIST(fparams_len);
-					assert(sizeof(obj_p) == sizeof(obj_p));
+					pr_assert(sizeof(obj_p) == sizeof(obj_p));
 					memcpy( ((list_p)(obj_data_p(fparams_obj)))->item, 
 							fr_stack+fr_sp+2, fparams_len*sizeof(obj_p) );
 					listlen(fparams_obj) = fparams_len;
@@ -934,7 +934,7 @@
 					func->data.ptr = new_frame;
 					switch_proto(ist, func, OBJ(GEN_PROTO));
 				}
-				set_item(ist, func, fr_stack[fr_sp], fr_stack[fr_sp+1]);
+				set_item(ist, fr_stack[fr_sp], fr_stack[fr_sp+1], func);
 			}	break;
 			case OP_DEL:
 				fr_sp -= 2;
@@ -1100,7 +1100,7 @@
 				if (num_protos == 0) new_obj = new_object(ist, NULL);
 				else {
 					obj_p psym = fr_stack[fr_sp+3];
-					obj_p proto = get_proto_attr(ist, fr_stack[fr_sp+2], psym, NULL, NULL); IF_EXC_BREAK;
+					obj_p proto = get_attr_in_chain(ist, fr_stack[fr_sp+2], psym, NULL, NULL); IF_EXC_BREAK;
 					if (!proto) {
 						raise_exception(ist, OBJ(NAME_EXC), "prototype %s not found", symch(ist, psym));
 						goto end_op_obj;
@@ -1109,7 +1109,7 @@
 				}
 				for (i=1; i < num_protos; i++) {
 					obj_p psym = fr_stack[fr_sp+(i+1)*2+1];
-					obj_p proto = get_proto_attr(ist, fr_stack[fr_sp+(i+1)*2], psym, NULL, NULL);
+					obj_p proto = get_attr_in_chain(ist, fr_stack[fr_sp+(i+1)*2], psym, NULL, NULL);
 					if (ist->exception_obj) goto end_op_obj;
 					if (!proto) {
 						raise_exception(ist, OBJ(NAME_EXC), "prototype %s not found", symch(ist, psym));
@@ -1133,7 +1133,7 @@
 			case OP_CALL: {
 				fr_sp -= 3+(2*param);
 				if (has_proto_QUES(ist, fr_stack[fr_sp+1], OBJ(SUPER_PROTO))) {
-					func_obj = get_proto_attr(ist, fr_stack[fr_sp], fr_stack[fr_sp+1]->data.ptr, NULL, frame->syn_self);
+					func_obj = get_attr_in_chain(ist, fr_stack[fr_sp], fr_stack[fr_sp+1]->data.ptr, NULL, frame->syn_self);
 					goto got_func;
 				}
 				if (!has_proto_QUES(ist, fr_stack[fr_sp+1], OBJ(SYMBOL_PROTO))) {
@@ -1157,7 +1157,7 @@
 					raise_exception(ist, OBJ(INTERPRETER_EXC), "reference to non-existant self object");
 					break;
 				}
-				func_obj = get_proto_attr(ist, fr_stack[fr_sp], fr_stack[fr_sp+1], NULL, NULL);
+				func_obj = get_attr_in_chain(ist, fr_stack[fr_sp], fr_stack[fr_sp+1], NULL, NULL);
 got_func:
 				IF_EXC_BREAK;
 				if (!func_obj) {
@@ -1177,7 +1177,7 @@
 						self = fr_stack[fr_sp]; 
 					IF_EXC_BREAK;
 					pre_call_lock(ist, self, plist);  IF_EXC_BREAK;
-					assert(sizeof(obj_p) == sizeof(clist_item_t));
+					pr_assert(sizeof(obj_p) == sizeof(clist_item_t));
 					res = ((pr_func*)(func_obj->data.ptr))
 								(ist, self, 
 								(plist ? clist_len(plist) : 0), 
@@ -1216,7 +1216,7 @@
 				} else {
 					obj_p value;
 					if (fr_stack[fr_sp+1] != SYM(__CALL__)) {
-						value = get_proto_attr(ist, fr_stack[fr_sp],
+						value = get_attr_in_chain(ist, fr_stack[fr_sp],
 								fr_stack[fr_sp+1], NULL, NULL);
 						IF_EXC_BREAK;
 						if (value) {
@@ -1412,7 +1412,7 @@
 		func_obj = func_sym; 
 		self = NEW_OBJ(NULL);
 	} else {
-		func_obj = get_proto_attr(ist, self, func_sym, NULL, super_obj); if_exc_return NULL;
+		func_obj = get_attr_in_chain(ist, self, func_sym, NULL, super_obj); if_exc_return NULL;
 		if (!func_obj) {
 			if (!ist) {
 				printf("Internal error with exceptions disabled: Function not found: \"%s\"", as_str(ist, func_sym));

Modified: trunk/src/lock.c
===================================================================
--- trunk/src/lock.c	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/src/lock.c	2004-05-10 07:14:50 UTC (rev 464)
@@ -214,7 +214,7 @@
 void write_unlock(isp ist, obj_p obj) {
 	int write_ready_flag;
 	if (obj->immutable) return;
-	assert(obj->wrlock);
+	pr_assert(obj->wrlock);
 	obj->archived = FALSE;
 	obj->state = OBJ_STATE_NEW_OR_MARKED;
 	if (mem_mgr_phase == MM_PHASE_MARKING && obj->scanned) {

Modified: trunk/src/memory_mgr.c
===================================================================
--- trunk/src/memory_mgr.c	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/src/memory_mgr.c	2004-05-10 07:14:50 UTC (rev 464)
@@ -99,7 +99,7 @@
 //********************************* mm_write_unlock ***************************
 void mm_write_unlock(obj_p obj) {
 	int write_ready_flag;
-	assert(obj->wrlock);
+	pr_assert(obj->wrlock);
 	write_ready_flag = obj->wrlock_req_cnt;	
 	free_wrlock(obj);
 	if (write_ready_flag)  apr_thread_cond_broadcast(write_cond);

Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/src/object.c	2004-05-10 07:14:50 UTC (rev 464)
@@ -598,7 +598,7 @@
 	attr_key_t i, akey, tgt = key->data.key;
 	if (tgt%3 != 0)
 		ptr = NULL;
-	assert((tgt%3)==0);
+	pr_assert((tgt%3)==0);
 	wrlock_rtrn(obj);
 	if (obj->has_attrs) attrs = obj->attr_proto.attrs;
 	else				attrs = add_attrs(obj);
@@ -860,11 +860,11 @@
 	return TRUE;
 }
 
-//********************************* get_proto_attr *****************************
+//********************************* get_attr_in_chain *****************************
 // same as get_attr but will look in all protos for key as well
 // if proto_pp not null, then will return proto obj that attr was found in
 // if super_obj specified, then only objects after super_obj searched
-obj_p get_proto_attr(isp ist, obj_p objid, obj_p key, obj_p *proto_pp, obj_p super_obj) {
+obj_p get_attr_in_chain(isp ist, obj_p objid, obj_p key, obj_p *proto_pp, obj_p super_obj) {
 	obj_p  obj=objid, proto, res = NULL;
 	int i, j, len;
 	clist_t *pao_list;

Modified: trunk/src/object.h
===================================================================
--- trunk/src/object.h	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/src/object.h	2004-05-10 07:14:50 UTC (rev 464)
@@ -131,7 +131,7 @@
 obj_p copy_object(isp ist, obj_p obj);
 void free_object(obj_p obj);
 
-void set_item(isp ist, obj_p value, obj_p ref_self, obj_p ref_key);
+void set_item(isp ist, obj_p ref_self, obj_p ref_key, obj_p value);
 void del_item(isp ist, obj_p ref_self, obj_p ref_key);
 
 obj_p new_float_obj(isp ist, double num);

Modified: trunk/src/parser_routines.c
===================================================================
--- trunk/src/parser_routines.c	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/src/parser_routines.c	2004-05-10 07:14:50 UTC (rev 464)
@@ -465,7 +465,7 @@
 	res->code_data[k].bytecode.opcode  = OP_OBJCALL;
 	res->code_data[k++].bytecode.param = clist_len(parms);
 	res->stack_depth -= 2*llen;
-	assert(k==res->len);
+	pr_assert(k==res->len);
 	return debug_retrn(__LINE__, res);
 }
 code_p bound_bind_params(void* param, code_p attr_ref, code_p obj){
@@ -478,21 +478,21 @@
 	add_code(obj, res, &k);
 	res->code_data[k++].bytecode.opcode  = OP_BIND;
 	res->stack_depth -= 2;
-	assert(k == res->len);
+	pr_assert(k == res->len);
 	return debug_retrn(__LINE__, res);
 }
 code_p unbound_bind_params(void* param, code_p attr_ref, code_p obj){
 	code_p res;
-	int k=0, len = 0, stack_depth = 0, max_stack_depth = 0;
+	int k=0, len = 2, stack_depth = 0, max_stack_depth = 0;
 	calc_code(attr_ref, &len, &stack_depth, &max_stack_depth);
 	calc_code(obj, &len, &stack_depth, &max_stack_depth);
-	res = new_code(param, len+1, stack_depth, max_stack_depth, 0);
+	res = new_code(param, len, stack_depth, max_stack_depth, 0);
 	add_code(attr_ref, res, &k);
 	res->code_data[k++].bytecode.opcode = OP_DEREF;
 	add_code(obj, res, &k);
 	res->code_data[k++].bytecode.opcode  = OP_OBJBIND;
 	res->stack_depth -= 2;
-	assert(k == res->len);
+	pr_assert(k == res->len);
 	return debug_retrn(__LINE__, res);
 }
 code_p bound_func_params(void* param, code_p attr_ref, clist_p parms) {
@@ -511,7 +511,7 @@
 	res->code_data[k].bytecode.opcode  = OP_CALL;
 	res->code_data[k++].bytecode.param = clist_len(parms);
 	res->stack_depth -= 2+(2*llen);
-	assert(k==res->len);
+	pr_assert(k==res->len);
 	return debug_retrn(__LINE__, res);
 }
 code_p unbound_func_params(void* param, code_p attr_ref, clist_p parms) {
@@ -531,7 +531,7 @@
 	res->code_data[k  ].bytecode.opcode = OP_OBJCALL;
 	res->code_data[k++].bytecode.param  = clist_len(parms);
 	res->stack_depth -= 2+(2*llen);
-	assert(k==res->len);
+	pr_assert(k==res->len);
 	return debug_retrn(__LINE__, res);
 }
 code_p bound_bind_func_params(void* param, code_p attr_ref, code_p obj, clist_p parms) {
@@ -551,7 +551,7 @@
 	res->code_data[k  ].bytecode.opcode = OP_OBJCALL;
 	res->code_data[k++].bytecode.param  = clist_len(parms);
 	res->stack_depth -= 2+(2*llen);
-	assert(k==res->len);
+	pr_assert(k==res->len);
 	return debug_retrn(__LINE__, res);
 }
 code_p unbound_bind_func_params(void* param, code_p attr_ref, code_p obj, clist_p parms){
@@ -571,7 +571,7 @@
 	res->code_data[k  ].bytecode.opcode = OP_OBJCALL;
 	res->code_data[k++].bytecode.param  = clist_len(parms);
 	res->stack_depth -= 2+(2*llen);
-	assert(k==res->len);
+	pr_assert(k==res->len);
 	return debug_retrn(__LINE__, res);
 }
 /*
@@ -594,7 +594,7 @@
 	res->code_data[k  ].bytecode.opcode = OP_SUPERCALL;
 	res->code_data[k++].bytecode.param  = clist_len(parms);
 	res->stack_depth -= 1+(2*llen);
-	assert(k==res->len);
+	pr_assert(k==res->len);
 	return debug_retrn(__LINE__, res);
 }
 */
@@ -638,7 +638,7 @@
 	memmove(obj_malloc(IST, OBJ(FUNC_PROTO), func, code_len), body, code_len);
 	res->code_data[k++].data = func;
 	res->code_data[k++].num  = llen;
-	assert(k = len);
+	pr_assert(k = len);
 	res->stack_depth -= (llen+1)*2-1;
 	return res;
 }
@@ -778,7 +778,7 @@
 		if (have_cmp_op)
 			res->code_data[k++].bytecode.opcode = OP_CHAIN_CMP;
 		res->stack_depth = 1;
-		assert(k==res->len);
+		pr_assert(k==res->len);
 	}
 	return debug_retrn(__LINE__, res);
 }
@@ -866,7 +866,7 @@
 	}
 	if (els->len)
 		add_code(els, res, &k);
-	assert(k == res->len);
+	pr_assert(k == res->len);
 	return debug_retrn(__LINE__, res);
 }
 
@@ -944,7 +944,7 @@
 	int len_lcc	= clist_len(lcc);
 	int end_loc;
 
-	assert(clist_len(loc_list) >= 1);
+	pr_assert(clist_len(loc_list) >= 1);
 	end_loc  = clist_pop_num(loc_list);
 
 	add_code(ifexpr, res, k);
@@ -969,10 +969,10 @@
 		add_code(itemexpr, res, k);
 		res->code_data[*k    ].bytecode.opcode = OP_APPEND;
 		res->code_data[(*k)++].bytecode.param  = stk_ofs-2;
-		assert(clist_len(loc_list) == 0);
+		pr_assert(clist_len(loc_list) == 0);
 		free_clist(loc_list);
 	}
-	assert(end_loc == *k);
+	pr_assert(end_loc == *k);
 	res->code_data[*k    ].bytecode.opcode = OP_POP;
 	res->code_data[(*k)++].bytecode.param  = 1;
 	res->stack_depth -=3;
@@ -1018,7 +1018,7 @@
 	code_p expr		= clist_item(forlst, llen);
 	int loop_loc, exc_loc, end_loc;
 
-	assert(clist_len(loc_list) >= 3);
+	pr_assert(clist_len(loc_list) >= 3);
 	loop_loc = clist_pop_num(loc_list);
 	exc_loc	 = clist_pop_num(loc_list);
 	end_loc  = clist_pop_num(loc_list);
@@ -1041,7 +1041,7 @@
 	res->code_data[*k    ].bytecode.opcode = OP_TRYEXCEPT;
 	res->code_data[*k    ].bytecode.param  = exc_loc - *k;
 	(*k)++;
-	assert(loop_loc == *k);
+	pr_assert(loop_loc == *k);
 	res->code_data[*k    ].bytecode.opcode = OP_DUPLICATE;
 	res->code_data[(*k)++].bytecode.param  = -1;
 	res->code_data[*k    ].bytecode.opcode = OP_PUSH;
@@ -1067,13 +1067,13 @@
 		add_code(itemexpr, res, k);
 		res->code_data[*k    ].bytecode.opcode = OP_APPEND;
 		res->code_data[(*k)++].bytecode.param  = stk_ofs-2;
-		assert(clist_len(loc_list) == 0);
+		pr_assert(clist_len(loc_list) == 0);
 		free_clist(loc_list);
 	}
 	res->code_data[*k    ].bytecode.opcode = OP_BR;
 	res->code_data[*k    ].bytecode.param  = loop_loc - *k;
 	(*k)++;
-	assert(exc_loc == *k);
+	pr_assert(exc_loc == *k);
 	res->code_data[*k    ].bytecode.opcode = OP_PUSH;
 	res->code_data[(*k)++].bytecode.param  = 3;
 	res->code_data[(*k)++].data = OBJ(STOP_ITERATION_EXC);
@@ -1084,7 +1084,7 @@
 	res->code_data[*k    ].bytecode.opcode = OP_POP;
 	res->code_data[(*k)++].bytecode.param  = 1;
 	res->stack_depth -=4;
-	assert(end_loc == *k);
+	pr_assert(end_loc == *k);
 }
 
 // lcc is list of lists
@@ -1146,7 +1146,7 @@
 	res->code_data[k  ].bytecode.opcode = OP_TRYEXCEPT;
 	res->code_data[k ].bytecode.param  = els_loc - k;
 	k++;
-	assert(loop_loc == k);
+	pr_assert(loop_loc == k);
 	res->code_data[k  ].bytecode.opcode = OP_DUPLICATE;
 	res->code_data[k++].bytecode.param  = -1;
 	res->code_data[k  ].bytecode.opcode = OP_PUSH;
@@ -1161,7 +1161,7 @@
 		res->code_data[k++].data = clist_item(targets,i);
 	res->code_data[k  ].bytecode.opcode = OP_SEQ_ASSIGN;
 	res->code_data[k++].bytecode.param  = llen-1;
-	assert(body_loc == k);
+	pr_assert(body_loc == k);
 	add_code(body, res, &k);
 	res->code_data[k  ].bytecode.opcode = OP_BR;
 	res->code_data[k  ].bytecode.param  = loop_loc - k;
@@ -1171,7 +1171,7 @@
 	res->code_data[k  ].bytecode.opcode = OP_BR;
 	res->code_data[k  ].bytecode.param  = end_loc - k;
 	k++;
-	assert(els_loc == k);
+	pr_assert(els_loc == k);
 	res->code_data[k  ].bytecode.opcode = OP_PUSH;
 	res->code_data[k++].bytecode.param  = 3;
 	res->code_data[k++].data = OBJ(STOP_ITERATION_EXC);
@@ -1181,11 +1181,11 @@
 	k++;
 	if (els->len)
 		add_code(els, res, &k);
-	assert(end_els_loc == k);
+	pr_assert(end_els_loc == k);
 	res->code_data[k  ].bytecode.opcode = OP_POP;
 	res->code_data[k++].bytecode.param  = 1;
 	res->code_data[k++].bytecode.opcode = OP_RERAISE;
-	assert(end_loc == k);
+	pr_assert(end_loc == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p ref_expr_to_ass_op(void* param, code_p ref, code_p rparm, int iop, int op){
@@ -1226,7 +1226,7 @@
 	res->code_data[k  ].bytecode.opcode = OP_BR;
 	res->code_data[k  ].bytecode.param  = end_loc - k;
 	k++;
-	assert(end_icall_loc = k);
+	pr_assert(end_icall_loc = k);
 	res->code_data[k  ].bytecode.opcode = OP_PUSH;
 	res->code_data[k++].bytecode.param  = 3;
 	res->code_data[k++].data = OBJ(FUNCNOTFOUND_EXC);
@@ -1249,9 +1249,9 @@
 	res->code_data[k++].bytecode.param  = 1;
 	res->code_data[k  ].bytecode.opcode = OP_POP;
 	res->code_data[k++].bytecode.param  = 1;
-	assert(end_exc_loc = k);
+	pr_assert(end_exc_loc = k);
 	res->code_data[k++].bytecode.opcode = OP_RERAISE;
-	assert(end_loc = k);
+	pr_assert(end_loc = k);
 	res->stack_depth -= 7;
 	return debug_retrn(__LINE__, res);
 }
@@ -1272,7 +1272,7 @@
 		calc_code(els, &len, &stack_depth, &max_stack_depth);
 	end_loc  = len;
 	res = new_code(param, len, stack_depth, max_stack_depth, 0);
-	assert(loop_loc == k);
+	pr_assert(loop_loc == k);
 	add_code(expr, res, &k);
 	res->code_data[k  ].bytecode.opcode = OP_PUSH;
 	res->code_data[k++].bytecode.param  = 3;
@@ -1286,7 +1286,7 @@
 	res->code_data[k++].data = OBJ(PR_FALSE);
 	res->code_data[k  ].bytecode.opcode = OP_POP;
 	res->code_data[k++].bytecode.param  = 1;
-	assert(body_loc == k);
+	pr_assert(body_loc == k);
 	add_code(body, res, &k);
 	res->code_data[k  ].bytecode.opcode = OP_BR;
 	res->code_data[k  ].bytecode.param  = loop_loc - k;
@@ -1294,12 +1294,12 @@
 	res->code_data[k  ].bytecode.opcode = OP_BR;
 	res->code_data[k  ].bytecode.param  = end_loc - k;
 	k++;
-	assert(els_loc == k);
+	pr_assert(els_loc == k);
 	res->code_data[k  ].bytecode.opcode = OP_POP;
 	res->code_data[k++].bytecode.param  = 1;
 	if (els->len)
 		add_code(els, res, &k);
-	assert(end_loc == k);
+	pr_assert(end_loc == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p cond_exc_to_assert(void* param, code_p cond, code_p exc){
@@ -1328,11 +1328,11 @@
 	res->code_data[k++].bytecode.param  = 1;
 	add_code(exc, res, &k);
 	res->code_data[k++].bytecode.opcode = OP_RAISE;
-	assert(pop_loc == k);
+	pr_assert(pop_loc == k);
 	res->code_data[k  ].bytecode.opcode = OP_POP;
 	res->code_data[k++].bytecode.param  = 1;
 	res->stack_depth -= 1;
-	assert(res->len == k);
+	pr_assert(res->len == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p ref_parm_body_to_def(void* param, code_p name, clist_p params, code_p self, code_p body, int flg) { 
@@ -1392,7 +1392,7 @@
 		res->code_data[k  ].bytecode.opcode = OP_POP;
 		res->code_data[k++].bytecode.param  = 1;
 	}
-	assert(res->len == k);
+	pr_assert(res->len == k);
 	if (body->doc_flg)
 		set_attr(IST, func, SYM(__DOC__), (obj_p)(body->code_data[1].data));
 	return debug_retrn(__LINE__, res);
@@ -1424,7 +1424,7 @@
 	res->code_data[k  ].bytecode.opcode = OP_PRINT;
 	res->code_data[k++].bytecode.param  = clist_len(list);
 	res->stack_depth -= clist_len(list);
-	assert(res->len == k);
+	pr_assert(res->len == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p new_tuple_list(void* param, clist_p lst, int tuple_flag){
@@ -1440,7 +1440,7 @@
 	res->code_data[k++].bytecode.param  = clist_len(lst);
 	pr_free(lst);
 	res->stack_depth -= clist_len(lst);
-	assert(res->len == k);
+	pr_assert(res->len == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p new_dict(void* param, clist_p lst){
@@ -1464,7 +1464,7 @@
 	res->code_data[k++].bytecode.param  = clist_len(lst)*2;
 	pr_free(lst);
 	res->stack_depth -= clist_len(lst)*2;
-	assert(res->len == k);
+	pr_assert(res->len == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p word_expr_to_param(void* param, obj_p word, code_p expr){
@@ -1475,7 +1475,7 @@
 	res->code_data[k++].bytecode.param = 2;
 	res->code_data[k++].data = word;
 	add_code(expr, res, &k);
-	assert(res->len == k);
+	pr_assert(res->len == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p expr_to_param(void* param, code_p expr){
@@ -1570,7 +1570,7 @@
 	res->assign_parm_cnt = rlen;
 	for(i=0; i < rlen; i++)
 		add_code(clist_item(right,i), res, &k);
-	assert(k==res->len);
+	pr_assert(k==res->len);
 	return debug_retrn(__LINE__, res);
 }
 code_p tgt_eq_stmt_to_stmt(void* param, clist_p left, code_p right){
@@ -1593,7 +1593,7 @@
 	res->code_data[k  ].bytecode.opcode = (seq_expand ? OP_SEQ_ASSIGN : OP_ASSIGN);
 	res->code_data[k++].bytecode.param  = llen;
 	res->stack_depth -= llen*2;
-	assert(k==res->len);
+	pr_assert(k==res->len);
 	return debug_retrn(__LINE__, append_code(param, right, res, 0));
 }
 code_p tgt_eq_expr_to_stmt(void* param, clist_p left, clist_p right){
@@ -1624,7 +1624,7 @@
 		res->code_data[k++].data = OBJ(NONE);
 	res->code_data[k  ].bytecode.opcode = OP_EXCEPT;
 	res->code_data[k++].bytecode.param  = body->len+1;
-	assert(res->len == k);
+	pr_assert(res->len == k);
 	return debug_retrn(__LINE__, append_code(param, res, body, 0));
 }
 code_p body_except_else_to_tryexcept(void* param, code_p body, clist_p except_list, code_p els){
@@ -1650,17 +1650,17 @@
 	res->code_data[k  ].bytecode.opcode = OP_BR;
 	res->code_data[k  ].bytecode.param  = els_loc - k;
 	k++;
-	assert(except_loc == k);
+	pr_assert(except_loc == k);
 	for (i = 0; i < llen; i++, k++) {
 		add_code(clist_item(except_list,i), res, &k);
 		res->code_data[k  ].bytecode.opcode = OP_BR;
 		res->code_data[k  ].bytecode.param  = end_loc - k;
 	}
 	res->code_data[k++].bytecode.opcode = OP_RERAISE;
-	assert(els_loc == k);
+	pr_assert(els_loc == k);
 	if (els)
 		add_code(els, res, &k);
-	assert(end_loc == k);
+	pr_assert(end_loc == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p tryfinally_body(void* param, code_p body, code_p final){
@@ -1673,7 +1673,7 @@
 	add_code(body, res, &k);
 	add_code(final, res, &k);
 	res->code_data[k++].bytecode.opcode = OP_RERAISE;
-	assert(res->len == k);
+	pr_assert(res->len == k);
 	return debug_retrn(__LINE__, res);
 }
 code_p op_expr(int op, code_p expr, int size){

Modified: trunk/src/src.vcproj
===================================================================
--- trunk/src/src.vcproj	2004-05-09 05:29:09 UTC (rev 463)
+++ trunk/src/src.vcproj	2004-05-10 07:14:50 UTC (rev 464)
@@ -26,7 +26,7 @@
 				RuntimeLibrary="1"
 				UsePrecompiledHeader="0"
 				WarningLevel="3"
-				WarnAsError="TRUE"
+				WarnAsError="FALSE"
 				Detect64BitPortabilityProblems="TRUE"
 				DebugInformationFormat="4"/>
 			<Tool