rev 658 - in trunk: include/prothon pr/test src
SVN User <[email protected]> Thu, 24 Jun 2004 00:18:53 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-06-24 00:18:50 -0400 (Thu, 24 Jun 2004)
New Revision: 658
Modified:
trunk/include/prothon/prothon.h
trunk/pr/test/test.pr
trunk/src/builtins-attrdict.c
trunk/src/builtins-core.c
trunk/src/builtins-dict.c
trunk/src/builtins-list.c
trunk/src/builtins-protolist.c
trunk/src/interp.c
Log:
Added Slice methods str_ and init_, getItem_, setItem_, and del_item_ methods now allow single objects instead of Slice(obj)
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-06-23 18:33:42 UTC (rev 657)
+++ trunk/include/prothon/prothon.h 2004-06-24 04:18:50 UTC (rev 658)
@@ -317,10 +317,10 @@
TUPLE_PROTO, // 16 Tuple
LIST_PROTO, // 17 List
DICT_PROTO, // 18 Dict
- FUNC_PROTO, // Func
- METHOD_PROTO, // Method
- HASH_PROTO, // Hash
- SLICE_PROTO, // Slice
+ FUNC_PROTO, // 19 Func
+ METHOD_PROTO, // 20 Method
+ HASH_PROTO, // 21 Hash
+ SLICE_PROTO, // 22 Slice
LOCAL_PROTO, //
OUTER_PROTO, //
SUPER_PROTO, //
Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr 2004-06-23 18:33:42 UTC (rev 657)
+++ trunk/pr/test/test.pr 2004-06-24 04:18:50 UTC (rev 658)
@@ -1,13 +1,7 @@
#!/usr/bin/env prothon
-try:
- x = 1//0
-except e = (DivideByZero, Exception):
- if e.str_() != 'Divide by zero Error':
- print 'error!'
- sys.exit(1)
-
-print """
-test passed
-"""
+print Slice(99)
+print Slice(99,1)
+print Slice(99,1,2)
+print Object.attrs_.getItem_($cmp)
Modified: trunk/src/builtins-attrdict.c
===================================================================
--- trunk/src/builtins-attrdict.c 2004-06-23 18:33:42 UTC (rev 657)
+++ trunk/src/builtins-attrdict.c 2004-06-24 04:18:50 UTC (rev 658)
@@ -201,12 +201,14 @@
DEF(AttrDict, getItem_, FORM_RPARAM) {
obj_p res = NULL, index;
BIN_CONTENT_CHK(AttrDict);
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
- if (list_len(ist, parms[1]) > 1) {
- raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
- return NULL;
- }
- index = list_item(ist, parms[1], 0);
+ if (has_proto(ist, parms[1], OBJ(SLICE_PROTO))) {
+ if (list_len(ist, parms[1]) > 1) {
+ raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
+ return NULL;
+ }
+ index = list_item(ist, parms[1], 0);
+ } else
+ index = parms[1];
if (has_proto(ist, index, OBJ(SYMBOL_PROTO)))
res = get_attr(ist, self->data.ptr, index);
else if (has_proto(ist, index, OBJ(STRING_PROTO))) {
@@ -219,12 +221,14 @@
DEF(AttrDict, setItem_, FORM_PARAM2) {
obj_p index;
BIN_CONTENT_CHK(AttrDict);
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
- if (list_len(ist, parms[1]) > 1) {
- raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
- return NULL;
- }
- index = list_item(ist, parms[1], 0);
+ if (has_proto(ist, parms[1], OBJ(SLICE_PROTO))) {
+ if (list_len(ist, parms[1]) > 1) {
+ raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
+ return NULL;
+ }
+ index = list_item(ist, parms[1], 0);
+ } else
+ index = parms[1];
if (has_proto(ist, index, OBJ(SYMBOL_PROTO)))
set_attr(ist, self->data.ptr, index, parms[3]);
else if (has_proto(ist, index, OBJ(STRING_PROTO))) {
@@ -237,12 +241,14 @@
DEF(AttrDict, delItem_, FORM_RPARAM) {
obj_p index;
BIN_CONTENT_CHK(AttrDict);
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
- if (list_len(ist, parms[1]) > 1) {
- raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
- return NULL;
- }
- index = list_item(ist, parms[1], 0);
+ if (has_proto(ist, parms[1], OBJ(SLICE_PROTO))) {
+ if (list_len(ist, parms[1]) > 1) {
+ raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
+ return NULL;
+ }
+ index = list_item(ist, parms[1], 0);
+ } else
+ index = parms[1];
if (has_proto(ist, index, OBJ(SYMBOL_PROTO)))
del_attr(ist, self->data.ptr, index);
else if (has_proto(ist, index, OBJ(STRING_PROTO))) {
Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c 2004-06-23 18:33:42 UTC (rev 657)
+++ trunk/src/builtins-core.c 2004-06-24 04:18:50 UTC (rev 658)
@@ -77,6 +77,7 @@
MODULE_DECLARE(Func);
MODULE_DECLARE(Method);
MODULE_DECLARE(RangeGen);
+MODULE_DECLARE(Slice);
MODULE_DECLARE(UniqueObjects);
MODULE_DECLARE(NoKey);
MODULE_DECLARE(NoDef);
@@ -93,7 +94,6 @@
set_obj_doc(OBJ(SYMBOL_PROTO), "Symbol object prototype");
set_obj_doc(OBJ(HASH_PROTO), "Hash object prototype");
- set_obj_doc(OBJ(SLICE_PROTO), "Slice object prototype");
set_obj_doc(OBJ(LOCAL_PROTO), "Local object prototype");
set_obj_doc(OBJ(OUTER_PROTO), "Outer object prototype");
set_obj_doc(OBJ(SUPER_PROTO), "Super object prototype");
@@ -633,12 +633,11 @@
obj_p get_sequence_item(isp ist, obj_p self, obj_p slice, int seq_type) {
obj_p res = NULL, slice_item1, slice_item2, slice_item3;
int i, index1 = 0, index2 = 0, index3 = 0, slice1_empty=FALSE, slice2_empty=FALSE;
- int exp_len, self_len, slice_len = (int) list_len(ist, slice);
+ int exp_len, self_len, slice_len;
ch3_p self_str = NULL;
u8_t* self_bytes = NULL;
CHECK_TYPE_EXC(self, OBJ(SEQ_PROTO), sequence);
- CHECK_TYPE_EXC(slice, OBJ(SLICE_PROTO), slice);
if (seq_type == SEQ_TYPE_BYTES) {
self_bytes = bytes_ptr(self);
@@ -648,12 +647,22 @@
self_len = (int) pr_strlen(self);
} else
self_len = (int) list_len(ist, self);
- slice_item1 = list_item(ist, slice,0);
- if (slice_item1 == SLICEPARAM_EMPTY || slice_item1 == OBJ(NONE))
+ if (has_proto(ist, slice, OBJ(SLICE_PROTO))) {
+ slice_item1 = list_item(ist, slice, 0);
+ slice_len = (int) list_len(ist, slice);
+ } else {
+ slice_len = 1;
+ slice_item1 = slice;
+ }
+ if (slice_item1 == SLICEPARAM_EMPTY || slice_item1 == OBJ(NONE)) {
slice1_empty=TRUE;
- else {
+ if (slice_len == 1) {
+ raise_exception(ist, OBJ(INDEX_EXC), "Indexes missing");
+ return NULL;
+ }
+ } else {
CHECK_TYPE_EXC(slice_item1, OBJ(INT_PROTO), "integer");
-
+
index1 = int2i32t(ist, slice_item1);
if (index1 < 0) index1 += self_len;
if (index1 < 0 || index1 >= self_len) {
@@ -895,6 +904,66 @@
return self;
}
+// ***************************** Slice *********************************
+
+obj_p new_slice_obj(isp ist, obj_p ind1, obj_p ind2, obj_p ind3) {
+ obj_p slice_obj = NEW_LIST(3);
+ 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));
+ else
+ list_append_no_lock(slice_obj, ind1);
+ if (ind2 != SLICEPARAM_MISSING) {
+ if (ind2 == SLICEPARAM_EMPTY)
+ list_append_no_lock(slice_obj, OBJ(NONE));
+ else
+ list_append_no_lock(slice_obj, ind2);
+ if (ind3 != SLICEPARAM_MISSING) {
+ if (ind3 == SLICEPARAM_EMPTY)
+ list_append_no_lock(slice_obj, OBJ(NONE));
+ else
+ list_append_no_lock(slice_obj,ind3);
+ }
+ }
+ slice_obj->immutable = TRUE;
+ return slice_obj;
+}
+
+MODULE_START(Slice)
+{
+ Slice_OBJ = OBJ(SLICE_PROTO);
+ MODULE_SET_DOC(Slice, "Slice prototype object");
+ MODULE_ADD_TO_OBJ(Slice, OBJ(OBJECT), "Slice");
+ set_obj_id(Slice_OBJ, *, Object);
+ set_obj_doc(Slice_OBJ, "Slice object prototype");
+}
+
+DEF(Slice, init_, FPARM3(idx1, NEW_INT(0), idx2, SLICEPARAM_MISSING, idx3, SLICEPARAM_MISSING)) {
+ BIN_EMPTY_CHK();
+ return new_slice_obj(ist, parms[1], parms[3], parms[5]);
+}
+
+DEF(Slice, str_, NULL) {
+ char buf[300];
+ int llen;
+
+ BIN_STR_CHK(Slice);
+ llen = (int) list_len(ist, self);
+ if (llen == 1)
+ apr_snprintf(buf, sizeof(buf), "<Slice:%s>", as_str(ist, list_item(ist, self, 0)));
+ else if (llen == 2)
+ apr_snprintf(buf, sizeof(buf), "<Slice:%s:%s>", as_str(ist, list_item(ist, self, 0)),
+ as_str(ist, list_item(ist, self, 1)));
+ else if (llen == 3)
+ apr_snprintf(buf, sizeof(buf), "<Slice:%s:%s:%s>", as_str(ist, list_item(ist, self, 0)),
+ as_str(ist, list_item(ist, self, 1)),
+ as_str(ist, list_item(ist, self, 2)));
+ else
+ strcpy(buf, "<Slice:invalid>");
+ return NEW_STRING(buf);
+}
+
// ***************************** UNIQUEOBJECTS ********************************
MODULE_START(UniqueObjects)
{
@@ -1016,6 +1085,10 @@
MODULE_ADD_SYM(RangeGen, iter_);
MODULE_ADD_SYM(RangeGen, next);
+ MODULE_SUB_INIT(Slice);
+ MODULE_ADD_SYM(Slice, init_);
+ MODULE_ADD_SYM(Slice, str_);
+
MODULE_SUB_INIT(UniqueObjects);
MODULE_ADD_SYM(NoKey, str_);
MODULE_ADD_SYM(NoDef, str_);
Modified: trunk/src/builtins-dict.c
===================================================================
--- trunk/src/builtins-dict.c 2004-06-23 18:33:42 UTC (rev 657)
+++ trunk/src/builtins-dict.c 2004-06-24 04:18:50 UTC (rev 658)
@@ -131,7 +131,7 @@
i32_t i, hash, hash_in, match=FALSE;
obj_p key, rp[2];
dict_p dict, dp, hole=NULL;
- rp[0]=0; rp[1]=key_in;
+ rp[0]=OBJ(NOKEY); rp[1]=key_in;
hash_in = hash_value(ist, key_in);
hash_in = hash_in & HASH_MASK;
@@ -413,45 +413,57 @@
}
DEF(Dict, getItem_, FORM_RPARAM) {
- obj_p res;
+ obj_p res, index;
BIN_CONTENT_CHK(Dict);
CHECK_TYPE_EXC(self, OBJ(DICT_PROTO), "dict");
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
- if (list_len(ist, parms[1]) > 1) {
- raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in dictionary indexing");
+ if (has_proto(ist, parms[1], OBJ(SLICE_PROTO))) {
+ if (list_len(ist, parms[1]) > 1) {
+ raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
+ return NULL;
+ }
+ index = list_item(ist, parms[1], 0);
+ } else
+ index = parms[1];
+ if (!(res = dict_item(ist, self, index))) {
+ raise_exception( ist, OBJ(INDEX_EXC), "no entry found with key: %s",
+ as_str(ist, index) );
return NULL;
}
- if (!(res = dict_item(ist, self, list_item(ist, parms[1], 0)))) {
- raise_exception(ist, OBJ(INDEX_EXC), "no entry found with key: %s",
- as_str(ist, list_item(ist, parms[1], 0)));
- return NULL;
- }
return res;
}
DEF(Dict, setItem_, FORM_PARAM2) {
+ obj_p index;
BIN_CONTENT_CHK(Dict);
- if (list_len(ist, parms[1]) > 1) {
- raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in dictionary indexing");
- return NULL;
- }
+ if (has_proto(ist, parms[1], OBJ(SLICE_PROTO))) {
+ if (list_len(ist, parms[1]) > 1) {
+ raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
+ return NULL;
+ }
+ index = list_item(ist, parms[1], 0);
+ } else
+ index = parms[1];
def_write_lock(self);
- dict_add(ist, self, list_item(ist, parms[1], 0), parms[3]);
+ dict_add(ist, self, index, parms[3]);
def_write_unlock(self);
return NULL;
}
DEF(Dict, delItem_, FORM_RPARAM) {
i32_t i, hash_in;
- obj_p key, key_in, rp[2];
+ obj_p key, key_in, rp[2], index;
dict_p dict, dp;
BIN_CONTENT_CHK(Dict);
- rp[0]=0; rp[1] = key_in = list_item(ist, parms[1], 0);
- if (list_len(ist, parms[1]) > 1) {
- raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in dictionary indexing");
- return NULL;
- }
+ if (has_proto(ist, parms[1], OBJ(SLICE_PROTO))) {
+ if (list_len(ist, parms[1]) > 1) {
+ raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in attr dictionary indexing");
+ return NULL;
+ }
+ index = list_item(ist, parms[1], 0);
+ } else
+ index = parms[1];
+ rp[0]=OBJ(NOKEY); rp[1] = key_in = index;
def_write_lock(self);
hash_in = hash_value(ist, key_in);
if (ist->exception_obj) {
Modified: trunk/src/builtins-list.c
===================================================================
--- trunk/src/builtins-list.c 2004-06-23 18:33:42 UTC (rev 657)
+++ trunk/src/builtins-list.c 2004-06-24 04:18:50 UTC (rev 658)
@@ -380,15 +380,25 @@
obj_p slice_item1, slice_item2, slice_item3;
obj_p slice = parms[1], value = parms[3];
i64_t i, new_len, exp_len, index1 = 0, index2 = 0, index3 = 0, slice1_empty=FALSE, slice2_empty=FALSE;
- size_t val_len, self_len, slice_len = list_len(ist, slice);
+ size_t val_len, self_len, slice_len;
BIN_CONTENT_CHK(List);
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
+ if (has_proto(ist, slice, OBJ(SLICE_PROTO))) {
+ slice_item1 = list_item(ist, slice, 0);
+ slice_len = (int) list_len(ist, slice);
+ } else {
+ slice_len = 1;
+ slice_item1 = slice;
+ }
def_write_lock(self);
self_len = listlen(self);
slice_item1 = list_item(ist, slice,0);
- if (slice_item1 == SLICEPARAM_EMPTY || slice_item1 == OBJ(NONE))
+ if (slice_item1 == SLICEPARAM_EMPTY || slice_item1 == OBJ(NONE)) {
slice1_empty=TRUE;
- else {
+ if (slice_len == 1) {
+ raise_exception(ist, OBJ(INDEX_EXC), "Indexes missing");
+ return NULL;
+ }
+ } else {
if (!has_proto(ist, slice_item1, OBJ(INT_PROTO))) {
raise_exception(ist, OBJ(TYPE_EXC), "List slice index must be an integer");
def_write_unlock(self);
@@ -405,7 +415,7 @@
if (slice_len == 1) {
listitem(self, index1) = value;
def_write_unlock(self);
- return NULL;
+ return value;
}
}
if ( !has_proto(ist, value, List_OBJ) &&
@@ -498,13 +508,22 @@
i64_t i, new_len, index1 = 0, index2 = 0, index3 = 0, slice1_empty=FALSE, slice2_empty=FALSE;
size_t exp_len, self_len, slice_len = list_len(ist, slice);
BIN_CONTENT_CHK(List);
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
def_write_lock(self);
self_len = listlen(self);
- slice_item1 = list_item(ist, slice,0);
- if (slice_item1 == SLICEPARAM_EMPTY || slice_item1 == OBJ(NONE))
+ if (has_proto(ist, slice, OBJ(SLICE_PROTO))) {
+ slice_item1 = list_item(ist, slice, 0);
+ slice_len = (int) list_len(ist, slice);
+ } else {
+ slice_len = 1;
+ slice_item1 = slice;
+ }
+ if (slice_item1 == SLICEPARAM_EMPTY || slice_item1 == OBJ(NONE)) {
slice1_empty=TRUE;
- else {
+ if (slice_len == 1) {
+ raise_exception(ist, OBJ(INDEX_EXC), "Indexes missing");
+ return NULL;
+ }
+ } else {
if (!has_proto(ist, slice_item1, OBJ(INT_PROTO))) {
raise_exception(ist, OBJ(TYPE_EXC), "List slice index must be an integer");
def_write_unlock(self);
Modified: trunk/src/builtins-protolist.c
===================================================================
--- trunk/src/builtins-protolist.c 2004-06-23 18:33:42 UTC (rev 657)
+++ trunk/src/builtins-protolist.c 2004-06-24 04:18:50 UTC (rev 658)
@@ -141,7 +141,6 @@
DEF(ProtoList, getItem_, FORM_RPARAM) {
obj_p res, list;
BIN_CONTENT_CHK(ProtoList);
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
res = call_func1(ist, list = protos2list(ist, self->data.ptr),
sym(ist, "getItem_"), parms[1]);
del_unlock(list);
@@ -151,7 +150,6 @@
DEF(ProtoList, setItem_, FORM_PARAM2) {
obj_p list;
BIN_CONTENT_CHK(ProtoList);
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
call_func2(ist, list = protos2list(ist, self->data.ptr),
sym(ist, "setItem_"), parms[1], parms[3]);
list2protos(ist, list, self->data.ptr);
@@ -162,7 +160,6 @@
DEF(ProtoList, delItem_, FORM_RPARAM) {
obj_p list;
BIN_CONTENT_CHK(ProtoList);
- CHECK_TYPE_EXC(parms[1], OBJ(SLICE_PROTO), Slice);
call_func1(ist, list = protos2list(ist, self->data.ptr),
sym(ist, "delItem_"), parms[1]);
list2protos(ist, list, self->data.ptr);
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-06-23 18:33:42 UTC (rev 657)
+++ trunk/src/interp.c 2004-06-24 04:18:50 UTC (rev 658)
@@ -182,31 +182,6 @@
return outer_obj;
}
-//********************************* 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);
- 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));
- else
- list_append_no_lock(slice_obj, ind1);
- if (ind2 != SLICEPARAM_MISSING) {
- if (ind2 == SLICEPARAM_EMPTY)
- list_append_no_lock(slice_obj, OBJ(NONE));
- else
- list_append_no_lock(slice_obj, ind2);
- if (ind3 != SLICEPARAM_MISSING) {
- if (ind3 == SLICEPARAM_EMPTY)
- list_append_no_lock(slice_obj, OBJ(NONE));
- else
- list_append_no_lock(slice_obj,ind3);
- }
- }
- slice_obj->immutable = TRUE;
- return slice_obj;
-}
-
//********************************* get_item ******************************
obj_p get_item(isp ist, obj_p ref_self, obj_p ref_key){
if (has_proto(ist, ref_key, OBJ(SYMBOL_PROTO))) {
@@ -224,7 +199,7 @@
} else if (has_proto(ist, ref_key, OBJ(SLICE_PROTO))) {
obj_p param[2];
if_exc_return NULL;
- param[0]=0; param[1]=ref_key;
+ param[0]=OBJ(NOKEY); param[1]=ref_key;
return call_func(ist, ref_self, SYM(GETITEM_), 2, param, 0);
} else if (has_proto(ist, ref_key, OBJ(OUTER_PROTO))) {
obj_p res;
@@ -237,7 +212,7 @@
return res;
} else if (has_proto(ist, ref_key, OBJ(INT_PROTO))) {
obj_p param[2];
- param[0]=0; param[1]=slice1(ref_key);
+ param[0]=OBJ(NOKEY); param[1]=slice1(ref_key);
return call_func(ist, ref_self, SYM(GETITEM_), 2, param, 0);
} else if (has_proto(ist, ref_key, OBJ(SUPER_PROTO))) {
obj_p res, cont = get_attr(ist, ref_key, SYM(CONT_));
@@ -280,8 +255,8 @@
set_attr(ist, ref_self, ref_key->data.ptr, value);
} else if (has_proto(ist, ref_key, OBJ(SLICE_PROTO))) {
obj_p param[4];
- param[0]=0; param[1]=ref_key;
- param[2]=0; param[3]=value;
+ param[0]=OBJ(NOKEY); param[1]=ref_key;
+ param[2]=OBJ(NOKEY); param[3]=value;
call_func(ist, ref_self, SYM(SETITEM_), 4, param, 0);
} else if (has_proto(ist, ref_key, OBJ(OUTER_PROTO))) {
obj_p scope_obj;
@@ -295,8 +270,8 @@
set_attr(ist, scope_obj, ref_key->data.ptr, value);
} else if (has_proto(ist, ref_key, OBJ(INT_PROTO))) {
obj_p param[4];
- param[0]=0; param[1]=slice1(ref_key);
- param[2]=0; param[3]=value;
+ param[0]=OBJ(NOKEY); param[1]=slice1(ref_key);
+ param[2]=OBJ(NOKEY); param[3]=value;
call_func(ist, ref_self, SYM(SETITEM_), 4, param, 0);
} else if (has_proto(ist, ref_key, OBJ(SUPER_PROTO))) {
obj_p res, proto, cont = get_attr(ist, ref_key, SYM(CONT_));
@@ -332,7 +307,7 @@
del_attr(ist, ref_self, ref_key->data.ptr);
} else if (has_proto(ist, ref_key, OBJ(SLICE_PROTO))) {
obj_p param[2];
- param[0]=0; param[1]=ref_key;
+ param[0]=OBJ(NOKEY); param[1]=ref_key;
call_func(ist, ref_self, SYM(DELITEM_), 2, param, 0);
} else if (has_proto(ist, ref_key, OBJ(OUTER_PROTO))) {
obj_p scope_obj;
@@ -346,7 +321,7 @@
del_attr(ist, scope_obj, ref_key->data.ptr);
} else if (has_proto(ist, ref_key, OBJ(INT_PROTO))) {
obj_p param[2];
- param[0]=0; param[1]=slice1(ref_key);
+ param[0]=OBJ(NOKEY); param[1]=slice1(ref_key);
call_func(ist, ref_self, SYM(DELITEM_), 2, param, 0);
} else if (has_proto(ist, ref_key, OBJ(SUPER_PROTO))) {
obj_p res, proto, cont = get_attr(ist, ref_key, SYM(CONT_));
@@ -998,7 +973,7 @@
att = get_item(ist, obj, key); IF_EXC_BREAK;
if (!att) {
raise_exception( ist, OBJ(INTERPRETER_EXC), "attribute %s not found",
- as_str(ist, key) );
+ as_str(ist, key) );
break;
}
fr_push(att);