rev 668 - in trunk: . include/prothon src
SVN User <[email protected]> Sun, 27 Jun 2004 04:48:38 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-06-27 04:48:35 -0400 (Sun, 27 Jun 2004)
New Revision: 668
Modified:
trunk/STATUS.txt
trunk/include/prothon/prothon_dll.h
trunk/src/builtins-core.c
trunk/src/interp.c
trunk/src/prothon.y
Log:
started WeakRef, fixed formal param matching bug
Modified: trunk/STATUS.txt
===================================================================
--- trunk/STATUS.txt 2004-06-27 07:50:38 UTC (rev 667)
+++ trunk/STATUS.txt 2004-06-27 08:48:35 UTC (rev 668)
@@ -1,6 +1,12 @@
----------------------- TO-DO (highest priority first) ------------------------
+--- Add properties methods: prop keyword, get_, set_, delete_, wildcards
+
+--- change file.setStdout to property
+
+--- weak references, WeakRef.ref property is reference (stored in data), init_(obj)
+
--- OSThread, Thread, and Gate
http://www.prothon.org/pipermail/prothon-user/2004-June/002124.html
--- lock keyword?
@@ -42,8 +48,6 @@
--- add Object.data_ (builtins-databytes.c)
--- Bytes methods? copy struct module?
---- weak references
-
--- raise exception_object, doc_object
--- allow tracebacks in the constructors to exception objects or raise command
--- Traceback objects (stack trace of an exception), exceptions should show function names
@@ -53,8 +57,6 @@
--- GNU message catalog _"abc" strings
--- change all strings to resource file
---- Add properties methods: prop keyword, get_, set_, delete_, wildcards
-
--- getAttr(name), setAttr(name, value), delAttr(name)
--- add conditional expression "if C then x else y"
Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h 2004-06-27 07:50:38 UTC (rev 667)
+++ trunk/include/prothon/prothon_dll.h 2004-06-27 08:48:35 UTC (rev 668)
@@ -190,7 +190,7 @@
#define BIN_EMPTY_CHK() \
if (self->data_type != DATA_TYPE_NONE) { \
raise_exception(ist, OBJ(INTERNAL_EXC), \
- "object has binary data, expected none"); \
+ "object has data, expected none"); \
return NULL; }
//if (self == slf##_OBJ)
Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c 2004-06-27 07:50:38 UTC (rev 667)
+++ trunk/src/builtins-core.c 2004-06-27 08:48:35 UTC (rev 668)
@@ -78,6 +78,7 @@
MODULE_DECLARE(Method);
MODULE_DECLARE(RangeGen);
MODULE_DECLARE(Slice);
+MODULE_DECLARE(WeakRef);
MODULE_DECLARE(UniqueObjects);
MODULE_DECLARE(NoKey);
MODULE_DECLARE(NoDef);
@@ -1010,6 +1011,30 @@
return NEW_STRING(buf);
}
+// ***************************** WeakRef **************************************
+MODULE_START(WeakRef)
+{
+ WeakRef_OBJ = NEW_OBJ(NULL);
+ MODULE_ADD_TO_OBJ(WeakRef, OBJ(OBJECT), "WeakRef");
+}
+
+DEF(WeakRef, str_, NULL) {
+ char *str_obj, buf[256];
+ if (self == WeakRef_OBJ) return NEW_STRING("<Proto:WeakRef>");
+ BIN_STR_CHK(WeakRef);
+ str_obj = as_str(ist, (obj_p)(self->data.ptr));
+ apr_snprintf(buf, sizeof(buf), "<WeakRef:%s>", str_obj);
+ set_unclonable(self);
+ return NEW_STRING(buf);
+}
+DEF(WeakRef, init_, FORM_RPARAM) {
+ BIN_EMPTY_CHK();
+ SET_TYPE_IF_EXC(WeakRef_OBJ, self, DATA_TYPE_EXTPTR) return NULL;
+ self->data.ptr = parms[1];
+ set_unclonable(self);
+ return self;
+}
+
// ***************************** UNIQUEOBJECTS ********************************
MODULE_START(UniqueObjects)
{
@@ -1137,6 +1162,10 @@
MODULE_ADD_SYM(Slice, init_);
MODULE_ADD_SYM(Slice, str_);
+ MODULE_SUB_INIT(WeakRef);
+ MODULE_ADD_SYM(WeakRef, init_);
+ MODULE_ADD_SYM(WeakRef, str_);
+
MODULE_SUB_INIT(UniqueObjects);
MODULE_ADD_SYM(NoKey, str_);
MODULE_ADD_SYM(NoDef, str_);
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-06-27 07:50:38 UTC (rev 667)
+++ trunk/src/interp.c 2004-06-27 08:48:35 UTC (rev 668)
@@ -447,7 +447,7 @@
llen = fparam_proc_state.lbl_val_list ?
clist_len(fparam_proc_state.lbl_val_list)/2 : 0;
for (i=0; i < llen; i++)
- if (!clist_item(fparam_proc_state.lbl_val_list, 2*i+1))
+ if (clist_item(fparam_proc_state.lbl_val_list, 2*i+1) == OBJ(NODEF))
goto paramerr;
if (fparam_proc_state.free_pos_list_key){
clist_append(fparam_proc_state.lbl_val_list, fparam_proc_state.free_pos_list_key);
Modified: trunk/src/prothon.y
===================================================================
--- trunk/src/prothon.y 2004-06-27 07:50:38 UTC (rev 667)
+++ trunk/src/prothon.y 2004-06-27 08:48:35 UTC (rev 668)
@@ -280,7 +280,7 @@
ass_shr_statement | ass_shl_statement | ass_exp_statement |
break_statement | continue_statement| del_statement |
exec_statement | raise_statement | return_statement |
- yield_statement | command_statement | expr
+ yield_statement | command_statement | expr |
PASS { $$ = none(yylex_param); }
;
if_statement: