rev 353 - in trunk: include/prothon modules/Re src

SVN User <[email protected]>
Newsgroups gmane.comp.lang.prothon.cvs
Message-ID <[email protected]>
Author: mark
Date: 2004-04-14 15:10:53 -0400 (Wed, 14 Apr 2004)
New Revision: 353

Modified:
   trunk/include/prothon/prothon.h
   trunk/include/prothon/prothon_dll.h
   trunk/modules/Re/Re.c
   trunk/src/builtins-list.c
   trunk/src/builtins-tuple.c
   trunk/src/interp.c
   trunk/src/object.c
   trunk/src/prlist.h
   trunk/src/symbol.c
   trunk/src/sys.c
Log:
added list.sort!()

Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/include/prothon/prothon.h	2004-04-14 19:10:53 UTC (rev 353)
@@ -109,12 +109,12 @@
 #define MAX_INT_VAL		0x7fffffffffffffffLL
 #endif
 
-#ifndef min
+#undef min
 # define min(a,b) (((a)<(b)) ? (a) : (b))
-#endif /* min */
-#ifndef max
+#undef max
 # define max(a,b) (((a)<(b)) ? (b) : (a))
-#endif /* max */
+#undef exch
+#define exch(a,b) (tmp=a, a=b, b=tmp)
 
 // neg key value means entry is deleted
 #define ENTRY_DELETED	-1
@@ -565,7 +565,7 @@
 obj_p new_list_obj(isp ist, size_t initial_size);
 
 // CLONE_LIST_OBJ: Create a new list object that's a shallow copy of another
-obj_p clone_list_obj(isp ist, obj_p list_obj);
+obj_p copy_list_obj(isp ist, obj_p list_obj);
 
 // LIST_APPEND: Append object item to existing list object
 obj_p list_append(isp ist, obj_p list, obj_p item);
@@ -731,7 +731,7 @@
 
 //************************* Prothon C FUNCTION ********************************
 // This is the type of C function that the dll author must provide to implement
-// a Prothon function in C.  A pointer to this type is passed to new_func_obj.
+// a Prothon function in C.  A pointer to this type is passed to new_C_func_obj.
 // FUNCTION CALLING:
 // Interp is a pointer to the interpreter state (see above).
 // Self is the object that the function was called on.  lbl_parm_arr is an array
@@ -740,7 +740,7 @@
 // (symbol object).  The second object (and every odd numbered object) is the passed 
 // value object that corresponds to that label.  Note that a param value in the
 // param array might actually be a list or dictionary of many parameters if the 
-// *list or **dictionary type formal parameters were used in new_func_obj.
+// *list or **dictionary type formal parameters were used in new_C_func_obj.
 // In this case the symbol object ptr for the label will be PARAM_STAR or PARAM_STAR_STAR.
 // Dyn-locals (dynamic locals) are the locals of the calling function.   This allows
 // you to access vars in the same manner that the @ operator does in Prothon.
@@ -761,7 +761,7 @@
 // example:  in "def func(x, y="3", *z)", the label_def_list would be:
 //    list6(ist,NULL, sym(ist, "x"), NULL, sym(ist, "y"), new_string_obj(ist, "3"), PARAM_STAR, sym(ist, "z"));
 // If the formal param list is empty, you can put NULL instead of the list.
-obj_p new_func_obj(isp ist, pr_func* func_ptr, obj_p label_def_list);
+obj_p new_C_func_obj(isp ist, pr_func* func_ptr, obj_p label_def_list);
 
 // FPARMn: Convenience macros for formal params in function definitions
 #define FPARM1(lab1, val1)										\
@@ -802,9 +802,8 @@
 // An object if always returned, at least OBJ(NONE) if nothing else.  This object will 
 // usually have the del_locked bit set so call del_unlock(obj) after you are done with
 // the object (see OBJECT LOCKING section below).
-// If you want to call a function object directly without looking it up, and without
-// having a self object (an unbound function call), then pass the function object in the
-// self parameter and leave func_sym NULL.
+// To call a function without looking it up or having a self object (an unbound function 
+// call), just pass the function object in the func_sym parameter and leave self NULL.
 // NULL may be passed for lbl_val_arr and/or dyn_locals if those features aren't needed.
 // Example: "sum=x+y"  =>  sum = call_func(ist, x, sym(ist, "__add__"), 2, y_arr, NULL);
 //         where y_arr =>  obj_p y_arr[2] = {NULL, y};

Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/include/prothon/prothon_dll.h	2004-04-14 19:10:53 UTC (rev 353)
@@ -90,9 +90,10 @@
 	obj_p		(*new_string_n_obj)(isp ist, char* string, size_t n);
 	obj_p		(*new_tuple_obj)(isp ist, int fixed_size);
 	obj_p		(*new_list_obj)(isp ist, size_t initial_size);
-	obj_p		(*clone_list_obj)(isp ist, obj_p list_obj);
-	obj_p		(*new_func_obj)(isp ist, pr_func* func_ptr, obj_p form_lbl_val_list);
-	obj_p		(*call_func)(isp ist, obj_p self, obj_p func_sym, int parm_cnt, obj_p* lbl_val_arr, obj_p dyn_locals);
+	obj_p		(*copy_list_obj)(isp ist, obj_p list_obj);
+	obj_p		(*new_C_func_obj)(isp ist, pr_func* func_ptr, obj_p form_lbl_val_list);
+	obj_p		(*call_func)( isp ist, obj_p self, obj_p func_sym, 
+		                      int parm_cnt, obj_p* lbl_val_arr, obj_p dyn_locals );
 	obj_p		(*call_func1_f)(isp ist, obj_p self, obj_p sym, obj_p parm);
 	obj_p   	(*sym)(isp ist, char* symbol);
 	void		(*raise_exception)(isp ist, obj_p proto_obj, const char *format, ...)
@@ -145,7 +146,7 @@
 		       obj_p* parms, obj_p dlocals);				\
 static void slf##func##init(void) {							\
         set_attr(ist, slf##_OBJ, sym(ist, #func),			\
-		 new_func_obj(ist, slf##func, fparam_list));		\
+		 new_C_func_obj(ist, slf##func, fparam_list));		\
 }															\
 static obj_p slf##func(isp ist, obj_p self, int pcnt,		\
 		       obj_p* parms, obj_p dlocals)
@@ -204,7 +205,7 @@
 #define list_len			(*services->list_len)
 #define list_clear			(*services->list_clear)
 #define new_hash_obj		(*services->new_hash_obj)
-#define new_func_obj		(*services->new_func_obj)
+#define new_C_func_obj		(*services->new_C_func_obj)
 #define call_func			(*services->call_func)
 #define call_func1_f		(*services->call_func1_f)
 #define new_int_obj			(*services->new_int_obj)
@@ -213,7 +214,7 @@
 #define new_string_n_obj	(*services->new_string_n_obj)
 #define new_tuple_obj		(*services->new_tuple_obj)
 #define new_list_obj		(*services->new_list_obj)
-#define clone_list_obj		(*services->clone_list_obj)
+#define copy_list_obj		(*services->copy_list_obj)
 #define sym					(*services->sym)
 #define list1				(*services->list1)
 #define list2				(*services->list2)

Modified: trunk/modules/Re/Re.c
===================================================================
--- trunk/modules/Re/Re.c	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/modules/Re/Re.c	2004-04-14 19:10:53 UTC (rev 353)
@@ -465,7 +465,7 @@
 		lastindex_obj->data.i64 = last_index;
 		if (repl_is_func) {
 			read_unlock(ist, parms[1]);
-			repl_obj = call_func(ist, parms[1], NULL, 2, arr, NULL); 
+			repl_obj = call_func(ist, NULL, parms[1], 2, arr, NULL); 
 			read_lock(ist, parms[1]);
 			if_exc_return NULL;
 			if (repl_obj == OBJ(NONE)) repl = "";

Modified: trunk/src/builtins-list.c
===================================================================
--- trunk/src/builtins-list.c	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/src/builtins-list.c	2004-04-14 19:10:53 UTC (rev 353)
@@ -93,8 +93,8 @@
 	return list_obj;
 }
 
-//********************************* clone_list_obj ****************************
-obj_p clone_list_obj(isp ist, obj_p list_obj) {
+//********************************* copy_list_obj ****************************
+obj_p copy_list_obj(isp ist, obj_p list_obj) {
 	obj_p res;
 	size_t llen, size;
 	list_p list_ptr;
@@ -215,6 +215,66 @@
 	return list_obj;
 }
 
+//********************************* quicksort *********************************
+int obj_lt(obj_p a, obj_p b, isp ist, obj_p cmp_func) {
+	obj_p res, arr[4];
+	if (cmp_func != OBJ(NONE)) {
+		arr[0] = NULL;
+		arr[1] = a;
+		arr[2] = NULL;
+		arr[3] = b;
+		res = call_func(ist, NULL, cmp_func, 4, arr, NULL);
+		if_exc_return 0;
+		return (res->data.i64 < 0);
+	}
+	arr[0] = NULL;
+	arr[1] = b;
+	res = call_func(ist, a, SYM(CMP), 2, arr, NULL);
+	if_exc_return 0;
+	return (res->data.i64 < 0);
+}
+
+int obj_eq(obj_p a, obj_p b, isp ist, obj_p cmp_func) {
+	obj_p res, arr[4];
+	if (cmp_func != OBJ(NONE)) {
+		arr[0] = NULL;
+		arr[1] = a;
+		arr[2] = NULL;
+		arr[3] = b;
+		res = call_func(ist, NULL, cmp_func, 4, arr, NULL);
+		if_exc_return 0;
+		return (res->data.i64 == 0);
+	}
+	arr[0] = NULL;
+	arr[1] = b;
+	res = call_func(ist, a, SYM(__EQ__QUES), 2, arr, NULL);
+	if_exc_return 0;
+	return (res == OBJ(PR_TRUE));
+}
+
+void quicksort(obj_p a[], int l, int r, isp ist, obj_p cmp_func) {
+	int i=l-1, j=r, k, p=l-1, q=r;
+	obj_p tmp, v=a[r];
+
+	if (r <= l) return;
+	while (TRUE) {
+		while (obj_lt(a[++i], v, ist, cmp_func)) if_exc_return;
+		while (obj_lt(v, a[--j], ist, cmp_func)) if (j==l) break;
+		if_exc_return;
+		if (i >= j) break;
+		exch(a[i], a[j]);
+		if (obj_eq(a[i], v, ist, cmp_func)) { if_exc_return; p++; exch(a[p], a[i]); }
+		if (obj_eq(v, a[j], ist, cmp_func)) { if_exc_return; q--; exch(a[j], a[q]); }
+	}
+	exch(a[i], a[r]);
+	j = i-1;
+	i = i+1;
+	for (k=l;   k < p; k++, j--) exch(a[k], a[j]);
+	for (k=r-1; k > q; k--, i++) exch(a[i], a[k]);
+	quicksort(a, l, j, ist, cmp_func); if_exc_return;
+	quicksort(a, i, r, ist, cmp_func);
+}
+
 // ***************************** LIST ******************************************
 
 MODULE_START(List)
@@ -355,7 +415,7 @@
 		if (exp_len != val_len && index2 != self_len)
 			memmove( &(((list_p)self->data.ptr)->item[index1+val_len]),
 					 &(((list_p)self->data.ptr)->item[index2]),
-					 (self_len - (size_t) index2) * sizeof(list_item_t) );
+					 (self_len - (size_t) index2) * sizeof(obj_p) );
 		for(i = index1, j=0; j < (int) val_len; i++, j++)
 			listitem(self, i) = seq_item(ist, value, j);
 	}
@@ -392,7 +452,7 @@
 			if (index1 != self_len-1)
 				memmove( &(((list_p)self->data.ptr)->item[index1]),
 					     &(((list_p)self->data.ptr)->item[index1+1]),
-						 (self_len-1 - (size_t)index1) * sizeof(list_item_t) );
+						 (self_len-1 - (size_t)index1) * sizeof(obj_p) );
 			listlen(self)--;
 			def_write_unlock(self);
 			return NULL;
@@ -448,13 +508,13 @@
 				if (i != self_len-1)
 					memmove( &(((list_p)self->data.ptr)->item[i-j]),
 							 &(((list_p)self->data.ptr)->item[i-j+1]),
-								(self_len - 1 - (size_t)i) * sizeof(list_item_t) );
+								(self_len - 1 - (size_t)i) * sizeof(obj_p) );
 		} else {
 			for(i = index1, j=0; i > index2; i += index3, j++)
 				if (i != self_len-1)
 					memmove( &(((list_p)self->data.ptr)->item[i]),
 							 &(((list_p)self->data.ptr)->item[i+1]),
-								(self_len - 1 - (size_t)i) * sizeof(list_item_t) );
+								(self_len - 1 - (size_t)i) * sizeof(obj_p) );
 		}
 	} else {
 		new_len = index1 + ((i64_t)self_len - index2);
@@ -462,7 +522,7 @@
 		if (exp_len != 0 && index2 != self_len)
 			memmove( &(((list_p)self->data.ptr)->item[index1]),
 					 &(((list_p)self->data.ptr)->item[index2]),
-					 (self_len - (size_t)index2) * sizeof(list_item_t) );
+					 (self_len - (size_t)index2) * sizeof(obj_p) );
 		def_write_unlock(self);
 		return NULL;
 	}
@@ -473,7 +533,7 @@
 
 DEF(List, __add__, FORM_RPARAM) { 
 	int i;
-	obj_p res = clone_list_obj(ist, self);
+	obj_p res = copy_list_obj(ist, self);
 	if (has_proto_QUES(ist, parms[1], OBJ(SEQ_PROTO)) && !has_proto_QUES(ist, parms[1], OBJ(STRING_PROTO)))
 		for(i=0; i < (int) list_len(ist, parms[1]); i++) 
 			list_append(ist, res, list_item(ist, parms[1], i));
@@ -504,7 +564,7 @@
 	lstpsize(lstp) = size;
 	lstplen(lstp)  = size;
 	for(i=0; i < times; i++)
-		memcpy(&(lstp->item[i*len]), selfp->item, len*sizeof(list_item_t));
+		memcpy(&(lstp->item[i*len]), selfp->item, len*sizeof(obj_p));
 	return res;
 }
 
@@ -539,7 +599,7 @@
 		selfp = pr_realloc(selfp, list_sizeof(lstpsize(selfp)));
 		self->data.ptr = selfp;
 	}
-	memcpy( selfp->item+self_len, otherp->item, other_len*sizeof(list_item_t));
+	memcpy( selfp->item+self_len, otherp->item, other_len*sizeof(obj_p));
 	lstplen(selfp) = self_len+other_len;
 	def_write_unlock(self);
 	return self;
@@ -569,7 +629,7 @@
 	}
 	if (index < self_len)
 		memmove( selfp->item+index+1, selfp->item+index, 
-				  (self_len - (size_t)index) * sizeof(list_item_t) ); 
+				  (self_len - (size_t)index) * sizeof(obj_p) ); 
 	listitem(self, index) = parms[3];
 	lstplen(selfp)++;
 	def_write_unlock(self);
@@ -594,7 +654,7 @@
 	}
 	if (i < self_len-1)
 		memmove( selfp->item+i, selfp->item+i+1, 
-		        (self_len - 1 - (size_t)i) * sizeof(list_item_t) ); 
+		        (self_len - 1 - (size_t)i) * sizeof(obj_p) ); 
 	lstplen(selfp)--;
 	def_write_unlock(self);
 	return self;
@@ -624,7 +684,7 @@
 	res = listitem(self, index);
 	if (index < self_len-1)
 		memmove( selfp->item+index, selfp->item+index+1, 
-				 (self_len - 1 - (size_t)index) * sizeof(list_item_t) ); 
+				 (self_len - 1 - (size_t)index) * sizeof(obj_p) ); 
 	lstplen(selfp)--;
 	def_write_unlock(self);
 	return res;
@@ -633,14 +693,14 @@
 DEF(List, reverse_BANG, NULL) {
 	size_t self_len;
 	list_p selfp;
-	list_item_t *p1, *p2;
+	obj_p *p1, *p2;
 	def_write_lock(self);
 	selfp    = self->data.ptr;
 	self_len = lstplen(selfp);
 	p1 = selfp->item;
 	p2 = selfp->item+self_len-1;
 	while(p1<p2) {
-		list_item_t tmp = *p2;
+		obj_p tmp = *p2;
 		*p2 = *p1;
 		*p1 = tmp;
 		p1++; p2--;
@@ -649,7 +709,20 @@
 	return self;
 }
 
+DEF(List, sort_BANG, FPARM1(f, OBJ(NONE))) {
+	int	self_len;
+	list_p	selfp;
+	obj_p*	a;
 
+	if (parms[1] != OBJ(NONE))
+		CHECK_TYPE_EXC(self, OBJ(FUNC_PROTO), "function");
+	selfp = self->data.ptr;
+	self_len = (int) lstplen(selfp);
+	a = selfp->item;
+	quicksort(a, 0, self_len-1, ist, parms[1]);
+	return self;
+}
+
 MAIN_MODULE_INIT(List)
 {
 	MODULE_SUB_INIT(List);
@@ -666,4 +739,5 @@
 	MODULE_ADD_SYM(List, remove_BANG);
 	MODULE_ADD_SYM(List, pop_BANG);
 	MODULE_ADD_SYM(List, reverse_BANG);
+	MODULE_ADD_SYM(List, sort_BANG);
 }

Modified: trunk/src/builtins-tuple.c
===================================================================
--- trunk/src/builtins-tuple.c	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/src/builtins-tuple.c	2004-04-14 19:10:53 UTC (rev 353)
@@ -192,7 +192,7 @@
 
 DEF(Tuple, __add__, FORM_RPARAM) { 
 	int i;
-	obj_p res = clone_list_obj(ist, self);
+	obj_p res = copy_list_obj(ist, self);
 	if (has_proto_QUES(ist, parms[1], OBJ(SEQ_PROTO)) && !has_proto_QUES(ist, parms[1], OBJ(STRING_PROTO)))
 		for(i=0; i < (int) list_len(ist, parms[1]); i++) 
 			list_append(ist, res, list_item(ist, parms[1], i));
@@ -228,7 +228,7 @@
 	lstpsize(lstp) = size;
 	lstplen(lstp)  = size;
 	for(i=0; i < times; i++)
-		memcpy(lstp->item+(i*len), selfp->item, len*sizeof(list_item_t));
+		memcpy(lstp->item+(i*len), selfp->item, len*sizeof(obj_p));
 	return res;
 }
 
@@ -294,7 +294,7 @@
 DEF(Tuple, __gen__, NULL) {
 	obj_p list_obj, gen_obj = new_object(ist, Tgen_OBJ);
 	gen_obj->data_type = DATA_TYPE_DATAPTR;
-	gen_obj->data.ptr = list_obj = clone_list_obj(ist, self);
+	gen_obj->data.ptr = list_obj = copy_list_obj(ist, self);
 	listlen(list_obj) = 0;
 	return gen_obj;
 }

Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/src/interp.c	2004-04-14 19:10:53 UTC (rev 353)
@@ -746,9 +746,8 @@
 					fr_push(OBJ(PR_FALSE));
 				break;
 			case OP_SWAP: { 
-				obj_p tos = fr_tos;
-				fr_tos = fr_stack[fr_sp-2];
-				fr_stack[fr_sp-2] = tos;
+				obj_p tmp;
+				exch(fr_stack[fr_sp-1], fr_stack[fr_sp-2]);
 			}	break;
 			case OP_POP: 
 				for(i=0; i < param; i++) 
@@ -858,9 +857,9 @@
 				obj_p func = call_func0(ist, fr_data(2), SYM(COPY));
 				obj_p fparams_obj = new_list_obj(ist, fparams_len);
 				fr_sp -= fparams_len+2;
-				assert(sizeof(list_item_t) == sizeof(obj_p));
+				assert(sizeof(obj_p) == sizeof(obj_p));
 				memcpy( ((list_p)(obj_data_p(fparams_obj)))->item, 
-						fr_stack+fr_sp+2, fparams_len*sizeof(list_item_t) );
+						fr_stack+fr_sp+2, fparams_len*sizeof(obj_p) );
 				listlen(fparams_obj) = fparams_len;
 				set_attr(ist, func,       SYM(__SELF__),    frame->self);
 				set_attr(ist, func,    SYM(__FPARAMS__),    fparams_obj);
@@ -1303,8 +1302,11 @@
 //******************************** call_func **********************************
 obj_p call_func( isp ist, obj_p self, obj_p func_sym, 
 				 int parm_cnt, obj_p* lbl_val_arr, obj_p dyn_locals ) {
-    obj_p func_obj;
-	if (func_sym) {
+	obj_p func_obj;
+	if (!self) {
+		func_obj = func_sym; 
+		self = new_object(ist, NULL);
+	} else {
 		func_obj = get_proto_attr(ist, self, func_sym, NULL, NULL); if_exc_return NULL;
 		if (!func_obj) {
 			if (!ist) {
@@ -1315,9 +1317,6 @@
 					as_str(ist, func_sym));
 			return NULL;
 		}
-	} else {
-		func_obj = self;
-		self = new_object(ist, NULL);
 	}
 	if (func_obj->data_type == DATA_TYPE_FUNCPTR) {
 		obj_p res;

Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/src/object.c	2004-04-14 19:10:53 UTC (rev 353)
@@ -142,8 +142,8 @@
 	dll_services.new_string_n_obj = new_string_n_obj;	
 	dll_services.new_tuple_obj	  = new_tuple_obj;	
 	dll_services.new_list_obj	  = new_list_obj;
-	dll_services.clone_list_obj	  = clone_list_obj;
-	dll_services.new_func_obj	  = new_func_obj;	
+	dll_services.copy_list_obj	  = copy_list_obj;
+	dll_services.new_C_func_obj	  = new_C_func_obj;	
 	dll_services.call_func		  = call_func;
 	dll_services.call_func1_f	  = call_func1_f;
 	dll_services.sym			  = sym;			
@@ -848,13 +848,13 @@
 		set_attr(ist, obj, SYM(__DOC__), new_string_obj(ist, str));
 }
 
-//********************************* new_func_obj ******************************
-obj_p new_func_obj(isp ist, pr_func* func_ptr, obj_p label_values_list) {
+//********************************* new_C_func_obj ******************************
+obj_p new_C_func_obj(isp ist, pr_func* func_ptr, obj_p label_values_list) {
 	obj_p func_obj = new_object(ist, OBJ(FUNC_PROTO));
 	func_obj->data_type = DATA_TYPE_FUNCPTR;
 	func_obj->data.ptr = func_ptr;
 	if (label_values_list)
-		set_attr(ist,  func_obj, SYM(__FPARAMS__), clone_list_obj(ist, label_values_list) );
+		set_attr(ist,  func_obj, SYM(__FPARAMS__), copy_list_obj(ist, label_values_list) );
 	return func_obj;
 }
 

Modified: trunk/src/prlist.h
===================================================================
--- trunk/src/prlist.h	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/src/prlist.h	2004-04-14 19:10:53 UTC (rev 353)
@@ -56,28 +56,23 @@
 #define DEFAULT_INITIAL_LIST_SIZE	8
 #define LIST_GROWTH_FACTOR			2
 
-#define list_sizeof(n)	(sizeof(list_hdr_t)+((n)*sizeof(list_item_t)))
+#define list_sizeof(n)	(sizeof(list_hdr_t)+((n)*sizeof(obj_p)))
 
 typedef struct {
 	size_t	size;
 	size_t	len;
 } list_hdr_t;
 
-typedef union {
-	int     num;
-	obj_p	item;
-} list_item_t;
-
 typedef struct {
 	list_hdr_t  hdr;
-	list_item_t	item[];
+	obj_p		item[];
 } list_t;
 
 typedef list_t* list_p;
 
 #define lstpsize(list_ptr)		(((list_p)(list_ptr))->hdr.size)
 #define lstplen(list_ptr)		(((list_p)(list_ptr))->hdr.len)
-#define lstpitem(list_ptr,i)	(((list_p)(list_ptr))->item[i].item)
+#define lstpitem(list_ptr,i)	(((list_p)(list_ptr))->item[i])
 
 #define listsize(list_obj)		lstpsize((list_obj)->data.ptr)
 #define listlen(list_obj)		 lstplen((list_obj)->data.ptr)

Modified: trunk/src/symbol.c
===================================================================
--- trunk/src/symbol.c	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/src/symbol.c	2004-04-14 19:10:53 UTC (rev 353)
@@ -273,5 +273,5 @@
 	int i;
 	for(i = 0; i < SYM_ENUM_COUNT; i++)
 		sym_id_table[i].id = sym(ist, sym_id_table[i].str);
-	set_attr(ist, OBJ(SYMBOL_PROTO), SYM(__STR__), new_func_obj(ist, str_sym, NULL));
+	set_attr(ist, OBJ(SYMBOL_PROTO), SYM(__STR__), new_C_func_obj(ist, str_sym, NULL));
 }

Modified: trunk/src/sys.c
===================================================================
--- trunk/src/sys.c	2004-04-14 19:06:04 UTC (rev 352)
+++ trunk/src/sys.c	2004-04-14 19:10:53 UTC (rev 353)
@@ -195,7 +195,7 @@
 	set_attr(ist, sys_module, sym(ist, "maxint"),  new_int_obj(ist, MAX_INT_VAL));
 	set_attr(ist, sys_module, sym(ist, "modules"), OBJ(MODULES));
 	set_attr( ist, sys_module, sym(ist, "exit"),
-		      new_func_obj(ist, sys_exit, list2(ist, sym(ist,"num"),new_int_obj(ist, 1))) );
+		      new_C_func_obj(ist, sys_exit, list2(ist, sym(ist,"num"),new_int_obj(ist, 1))) );
 
 #if defined(WIN32)
 	set_attr(ist, sys_module, sym(ist, "platform"), new_string_obj(ist, "win32"));
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.