rev 465 - in trunk: include/prothon modules/DBM modules/File modules/Prosist modules/Re modules/SQLite src
SVN User <[email protected]> Tue, 11 May 2004 15:19:24 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-05-11 15:19:20 -0400 (Tue, 11 May 2004)
New Revision: 465
Modified:
trunk/include/prothon/prothon.h
trunk/include/prothon/prothon_dll.h
trunk/modules/DBM/DBM.c
trunk/modules/File/File.c
trunk/modules/Prosist/Prosist.c
trunk/modules/Re/Re.c
trunk/modules/SQLite/SQLite.c
trunk/src/builtins-core.c
trunk/src/builtins-dict.c
trunk/src/builtins-float.c
trunk/src/builtins-int.c
trunk/src/builtins-list.c
trunk/src/builtins-string.c
trunk/src/builtins-thread.c
trunk/src/builtins-tuple.c
trunk/src/bytecodes.h
trunk/src/getline.c
trunk/src/interp.c
trunk/src/memory_mgr.c
trunk/src/object.c
trunk/src/object.h
trunk/src/parser_routines.c
trunk/src/prmalloc.c
trunk/src/prothon.y
trunk/src/symbol.c
Log:
changed special __var__ form to var_ form
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/include/prothon/prothon.h 2004-05-11 19:19:20 UTC (rev 465)
@@ -325,104 +325,104 @@
//************************* WELL-KNOWN-SYMBOLS ********************************
// actual symbols are lower-case versions of these constants
typedef enum {
- __STRING__,
- __NOT__QUES,
- __POS__,
- __NEG__,
- __INV__,
+ STRING_,
+ NOT_QUES_,
+ POS_,
+ NEG_,
+ INV_,
- __IN__QUES,
- __NOTIN__QUES,
- __IS__QUES,
- __ISNOT__QUES,
+ IN_QUES_,
+ NOTIN_QUES_,
+ IS_QUES_,
+ ISNOT_QUES_,
- __LT__QUES, // __LT__QUES thru __EQ__QUES
- __LE__QUES, // must stay in this sequence
- __GT__QUES, // see binary() in parser_routines.c
- __GE__QUES,
- __NE__QUES,
- __EQ__QUES,
+ LT_QUES_, // LT_QUES_ thru EQ_QUES_
+ LE_QUES_, // must stay in this sequence
+ GT_QUES_, // see binary() in parser_routines.c
+ GE_QUES_,
+ NE_QUES_,
+ EQ_QUES_,
CMP,
- __OR__,
- __XOR__,
- __AND__,
- __RSHIFT__,
- __LSHIFT__,
- __ADD__,
- __SUB__,
- __MUL__,
- __DIV__,
- __FLOORDIV__,
- __MOD__,
- __POW__,
+ OR_,
+ XOR_,
+ AND_,
+ RSHIFT_,
+ LSHIFT_,
+ ADD_,
+ SUB_,
+ MUL_,
+ DIV_,
+ FLOORDIV_,
+ MOD_,
+ POW_,
- __IOR__,
- __IXOR__,
- __IAND__,
- __IRSHIFT__,
- __ILSHIFT__,
- __IADD__,
- __ISUB__,
- __IMUL__,
- __IDIV__,
- __IFLOORDIV__,
- __IMOD__,
- __IPOW__,
+ IOR_,
+ IXOR_,
+ IAND_,
+ IRSHIFT_,
+ ILSHIFT_,
+ IADD_,
+ ISUB_,
+ IMUL_,
+ IDIV_,
+ IFLOORDIV_,
+ IMOD_,
+ IPOW_,
- __RIN__QUES,
- __RNOTIN__QUES,
- __RLT__QUES,
- __RLE__QUES,
- __RGT__QUES,
- __RGE__QUES,
- __RRSHIFT__,
- __RLSHIFT__,
- __RSUB__,
- __RDIV__,
- __RFLOORDIV__,
- __RMOD__,
- __RPOW__,
- __RCMP__,
+ RIN_QUES_,
+ RNOTIN_QUES_,
+ RLT_QUES_,
+ RLE_QUES_,
+ RGT_QUES_,
+ RGE_QUES_,
+ RRSHIFT_,
+ RLSHIFT_,
+ RSUB_,
+ RDIV_,
+ RFLOORDIV_,
+ RMOD_,
+ RPOW_,
+ RCMP_,
- __INIT__,
- __BOOL__QUES,
- __GETCMP__,
- __CMPVALOBJ__,
- __ITER__,
- __ID__,
- __DOC__,
- __HASH__,
- __FPARAMS__,
- __GLOBALS__,
- __SYN_FUNC__,
- __SYN_LOCALS__,
- __LOCALS__,
- __SYN_SELF__,
+ INIT_,
+ BOOL_QUES_,
+ GETCMP_,
+ CMPVALOBJ_,
+ ITER_,
+ ID_,
+ DOC_,
+ HASH_,
+ FPARAMS_,
+ GLOBALS_,
+ SYN_FUNC_,
+ SYN_LOCALS_,
+ LOCALS_,
+ SYN_SELF_,
RPARAM,
PARAM1,
PARAM2,
ARGS,
KWARGS,
- __COPY__,
- __COVERS__,
- __COERCE__,
- __STR__,
+ COPY_,
+ COVERS_,
+ COERCE_,
+ STR_,
NEXT,
- __GETITEM__,
- __SETITEM__,
- __DELITEM__,
- __OBJLIST__,
- __CDATALEN__,
- __DEL__,
+ GETITEM_,
+ SETITEM_,
+ DELITEM_,
+ OBJLIST_,
+ CDATALEN_,
+ DEL_,
LEN,
MAX,
MIN,
COPY,
- __TOSTORPROXY__,
- __FROMSTORPROXY__,
- __CALL__,
- __BINDOBJ__,
+ TOSTORPROXY_,
+ FROMSTORPROXY_,
+ CALL_,
+ BINDOBJ_,
SYM_ENUM_COUNT
} sym_enum_t;
@@ -435,8 +435,8 @@
sym_id_entry_t sym_id_table[SYM_ENUM_COUNT];
// You may get any symbol-obj from a string using sym(ist, "xxx").
-// Use SYM(__XXX__) instead of sym(ist, "__xxx__") when using a well-known
-// symbol for speed, although using sym(ist, "__xxx__") with a well-known would
+// Use SYM(XXX_) instead of sym(ist, "xxx_") when using a well-known
+// symbol for speed, although using sym(ist, "xxx_") with a well-known would
// get you the exact same object. Use symch(symbol_obj) for the reverse operation.
@@ -670,7 +670,7 @@
// NEW_DICT_OBJ: Create a new dictionary object
// A dictionary stores objects much like the attributes are stored except that
// any immutable object can be the key, not just a symbol. Lookups are more
-// expensive since hashes are used and an __eq__QUES call must be made during the
+// expensive since hashes are used and an eq_QUES_ call must be made during the
// lookup unlike attributes that just use the key identity for comparisom.
// Make sure the initial size is at least twice as large as the intended number
// of objects you will be adding initially. Expanding a dictionary is an expensive
@@ -713,7 +713,7 @@
obj_p item5, obj_p item6, obj_p item7, obj_p item8 );
// DICT_ADD: Add a key/value pair to the dictionary. Replace old one if key exists.
-// Key equality is determined by the __eq__QUES function on the key objects. The __eq__QUES
+// Key equality is determined by the eq_QUES_ function on the key objects. The eq_QUES_
// function is called on the existing key in the dict with the passed key as the parameter.
// If the keys match, then the value in the dictionary is replaced and the existing key
// is left in place. If there is no match the ky and value are added.
@@ -725,7 +725,7 @@
size_t dict_len(isp ist, obj_p dict);
// DICT_ITEM: Look up a value in the dictionary for the given key.
-// Find a key using the same __eq__QUES match criteria given for
+// Find a key using the same eq_QUES_ match criteria given for
// dict_add and return the corresponding value object. If no key
// matches then return null.
obj_p dict_item(isp ist, obj_p dict, obj_p key);
@@ -775,11 +775,11 @@
// no quotes are needed, ex: set_obj_id(Match_OBJ, Re_OBJ, Match);
// All Prototypes should be marked with this.
#define set_obj_id(obj, module, name) \
- set_attr(ist, (obj), SYM(__ID__), \
+ set_attr(ist, (obj), SYM(ID_), \
list2(ist, NEW_STRING((#module)), \
NEW_STRING((#name)) ) )
-// SET_OBJ_DOC: Add document string (__doc__) to object
+// SET_OBJ_DOC: Add document string (doc_) to object
// This can be used on any object. It is recommended that it be used
// liberally to make browsing objects easier and to make dumps readable.
void set_obj_doc_f(isp ist, obj_p obj, char* str);
@@ -1002,7 +1002,7 @@
// 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);
+// 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};
obj_p call_func( isp ist, obj_p self, obj_p func_sym,
int parm_cnt, obj_p* lbl_val_arr, obj_p super_obj );
@@ -1015,23 +1015,23 @@
#define call_func0(ist, self, sym) call_func((ist), (self), (sym), 0, NULL, NULL)
#define call_func1(ist, self, sym, parm) call_func1_f((ist), (self), (sym), (parm))
-// AS_STR: Call __str__ function on any object
-// Get C string representation of any object by calling __str__ function on it.
-#define as_str(ist, obj) pr_strptr(call_func0((ist), (obj), SYM(__STR__)))
+// AS_STR: Call str_ function on any object
+// Get C string representation of any object by calling str_ function on it.
+#define as_str(ist, obj) pr_strptr(call_func0((ist), (obj), SYM(STR_)))
// COVERS: Macro to determine if a type can be coerced to another type
// Returns true if data type of o1 can represent all data that type of o2 can
// represent. For example, float type "covers" int type and long type "covers"
// int type. Covering a value does not mean that some precision will not be lost.
// This test determines when coercion is allowed. It is up to the prototype
-// objects to decide which objects they cover by offering the __covers__QUES function.
-#define covers(o1, o2) (call_func1((ist), (o1), SYM(__COVERS__), (o2)) == OBJ(PR_TRUE))
+// objects to decide which objects they cover by offering the covers_QUES_ function.
+#define covers(o1, o2) (call_func1((ist), (o1), SYM(COVERS_), (o2)) == OBJ(PR_TRUE))
//********************************* EXCEPTIONS ******************************************
// Exceptions are raised by calling raise_exception(ist, proto, doc). Proto is a proto
// exception proto object (or NULL to default to OBJ(EXCEPTION)). Doc is an
-// optional string to document the exception cause (stored as __doc__). The exception is
+// optional string to document the exception cause (stored as doc_). The exception is
// created and stored in the ist structure only. It is the programmers job to then
// return from the function cleanly. You may call raise_exception more than once, but all calls
// other than the last will have no effect.
Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/include/prothon/prothon_dll.h 2004-05-11 19:19:20 UTC (rev 465)
@@ -183,7 +183,7 @@
#define BIN_STR_CHK(slf) \
if (self == slf##_OBJ) \
- return call_func(ist, self, SYM(__STR__), 0, NULL, slf##_OBJ); \
+ return call_func(ist, self, SYM(STR_), 0, NULL, slf##_OBJ); \
if (self->data_type == DATA_TYPE_NONE) { \
char msg[80]; \
apr_snprintf(msg, sizeof(msg), "<%s:Uninitialized>", #slf); \
Modified: trunk/modules/DBM/DBM.c
===================================================================
--- trunk/modules/DBM/DBM.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/modules/DBM/DBM.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -142,7 +142,7 @@
return res;
}
-DEF( DB, __init__, FPARM4( name, NULL,
+DEF( DB, init_, FPARM4( name, NULL,
mode, DBM_RWCREATE,
type, NEW_STRING("SDBM"),
uperm, NEW_INT(APR_UREAD|APR_UWRITE) ) ) {
@@ -300,7 +300,7 @@
else return OBJ(PR_TRUE);
}
-DEF(DB, __objList__, FORM_RPARAM) {
+DEF(DB, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(DB);
return parms[1];
}
@@ -309,7 +309,7 @@
MODULE_SUB_INIT(DBM);
MODULE_ADD_SYM(DB, getNames);
MODULE_ADD_SYM(DB, fetch);
- MODULE_ADD_SYM(DB, __init__);
+ MODULE_ADD_SYM(DB, init_);
MODULE_ADD_SYM(DB, store);
MODULE_ADD_SYM(DB, delete);
MODULE_ADD_SYM(DB, exists_QUES);
@@ -318,7 +318,7 @@
MODULE_ADD_SYM(DB, freeDatum);
MODULE_ADD_SYM(DB, close);
MODULE_ADD_SYM(DB, closed_QUES);
- MODULE_ADD_SYM(DB, __objList__);
+ MODULE_ADD_SYM(DB, objList_);
check_exceptions(ist);
}
Modified: trunk/modules/File/File.c
===================================================================
--- trunk/modules/File/File.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/modules/File/File.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -125,7 +125,7 @@
File_OBJ->unclonable = TRUE;
}
-DEF(File, __init__, FPARM3( path, NULL,
+DEF(File, init_, FPARM3( path, NULL,
mode, NEW_STRING("r"),
bufsize, NEW_INT(-1) ) ) {
apr_file_t *f;
@@ -184,7 +184,7 @@
return OBJ(NONE);
}
-DEF(File, __objList__, FORM_RPARAM) {
+DEF(File, objList_, FORM_RPARAM) {
return parms[1];
}
@@ -715,7 +715,7 @@
obj_p file_obj;
MODULE_SUB_INIT(File);
- MODULE_ADD_SYM(File, __init__);
+ MODULE_ADD_SYM(File, init_);
MODULE_ADD_SYM(File, read);
MODULE_ADD_SYM(File, readLine);
MODULE_ADD_SYM(File, readLines);
@@ -730,7 +730,7 @@
//MODULE_ADD_SYM(File, fileNo);
//MODULE_ADD_SYM(File, isATty_QUES);
//MODULE_ADD_SYM(File, tell);
- MODULE_ADD_SYM(File, __objList__);
+ MODULE_ADD_SYM(File, objList_);
/* Create base file objects for std{in,out,err} */
aprerr = apr_pool_create(&std_pool, get_pr_head_pool());
Modified: trunk/modules/Prosist/Prosist.c
===================================================================
--- trunk/modules/Prosist/Prosist.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/modules/Prosist/Prosist.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -413,7 +413,7 @@
id_obj = NEW_INT(id);
}
- if ((id_tuple = get_attr(ist, obj, SYM(__ID__)))) {
+ if ((id_tuple = get_attr(ist, obj, SYM(ID_)))) {
apr_status_t aprerr;
size_t slen;
char *s1, *s2;
@@ -474,9 +474,9 @@
}
}
if (repair_obj) {
- obj_p res = call_func0(ist, proxy_obj, SYM(__FROMSTORPROXY__));
+ obj_p res = call_func0(ist, proxy_obj, SYM(FROMSTORPROXY_));
if (!res) {
- raise_exception(ist, ProsistExc_OBJ, "__fromStorProxy__ not found on proxy obj");
+ raise_exception(ist, ProsistExc_OBJ, "fromStorProxy_ not found on proxy obj");
del_unlock(mw_obj);
del_unlock(id_obj);
return;
@@ -492,7 +492,7 @@
}
}
if (!proxy_obj) {
- proxy_obj = call_func0(ist, obj, SYM(__TOSTORPROXY__));
+ proxy_obj = call_func0(ist, obj, SYM(TOSTORPROXY_));
if (ist->exception_obj) {
del_unlock(mw_obj);
del_unlock(id_obj);
@@ -642,7 +642,7 @@
}
}
done:
- res = call_func0(ist, obj, SYM(__FROMSTORPROXY__));
+ res = call_func0(ist, obj, SYM(FROMSTORPROXY_));
if (obj != res) {
obj_p mw_res = NEW_MW(res);
dict_add(ist, psrecp->obj_to_id, mw_res, id_obj);
@@ -699,7 +699,7 @@
raise_exception(ist, ProsistExc_OBJ, "identity object %s not found in module %s", name, module);
return;
}
- id_tuple = get_attr(ist, obj, SYM(__ID__)); if_exc_return;
+ id_tuple = get_attr(ist, obj, SYM(ID_)); if_exc_return;
if (!id_tuple) {
raise_exception(ist, ProsistExc_OBJ, "identity object is missing id tuple");
return;
@@ -919,7 +919,7 @@
MODULE_CONSTANT_INT(Prosist, RWTRUNCATE, APR_DBM_RWTRUNC ); // r/w, truncate if already there
}
-DEF( Prosist, __init__, FPARM4( name, NULL,
+DEF( Prosist, init_, FPARM4( name, NULL,
root, OBJ(NONE),
mode, Prosist_RWCREATE,
uperm, NEW_INT(APR_UREAD|APR_UWRITE) ) ) {
@@ -1023,24 +1023,24 @@
else return OBJ(PR_TRUE);
}
-DEF(Prosist, __objList__, FORM_RPARAM) {
+DEF(Prosist, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(Prosist);
return parms[1];
}
-DEF(MutWrap, __hash__, NULL) {
+DEF(MutWrap, hash_, NULL) {
BIN_CONTENT_CHK(MutWrap);
return new_hash_obj(ist, (i32_t)(intptr_t) self->data.ptr);
}
-DEF(MutWrap, __eq__QUES, FORM_RPARAM) {
+DEF(MutWrap, eq_QUES_, FORM_RPARAM) {
BIN_CONTENT_CHK(MutWrap);
CHECK_TYPE_EXC(parms[1], MutWrap_OBJ, "immutable object wrapper");
if (self->data.ptr == parms[1]->data.ptr) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(MutWrap, __objList__, FORM_RPARAM) {
+DEF(MutWrap, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(MutWrap);
return parms[1];
}
@@ -1048,16 +1048,16 @@
MAIN_MODULE_INIT(Prosist)
{
MODULE_SUB_INIT(Prosist);
- MODULE_ADD_SYM(Prosist, __init__);
+ MODULE_ADD_SYM(Prosist, init_);
MODULE_ADD_SYM(Prosist, rollBack);
MODULE_ADD_SYM(Prosist, commit);
MODULE_ADD_SYM(Prosist, close);
MODULE_ADD_SYM(Prosist, closed_QUES);
- MODULE_ADD_SYM(Prosist, __objList__);
+ MODULE_ADD_SYM(Prosist, objList_);
- MODULE_ADD_SYM(MutWrap, __hash__);
- MODULE_ADD_SYM(MutWrap, __eq__QUES);
- MODULE_ADD_SYM(MutWrap, __objList__);
+ MODULE_ADD_SYM(MutWrap, hash_);
+ MODULE_ADD_SYM(MutWrap, eq_QUES_);
+ MODULE_ADD_SYM(MutWrap, objList_);
check_exceptions(ist);
}
Modified: trunk/modules/Re/Re.c
===================================================================
--- trunk/modules/Re/Re.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/modules/Re/Re.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -484,12 +484,12 @@
return res_obj;
}
-DEF(ReCompiled, __objList__, FORM_RPARAM) {
+DEF(ReCompiled, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(ReCompiled);
return parms[1];
}
-DEF(ReCompiled, __del__, NULL) {
+DEF(ReCompiled, del_, NULL) {
BIN_CONTENT_CHK(ReCompiled);
regfree((regex_t*)(self->data.ptr));
return OBJ(NONE);
@@ -504,7 +504,7 @@
MODULE_ADD_TO_OBJ(ReMatch, Re_OBJ, "Match");
}
-DEF(ReMatch, __objList__, FORM_RPARAM) {
+DEF(ReMatch, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(ReMatch);
return parms[1];
}
@@ -655,8 +655,8 @@
MODULE_ADD_SYM(ReCompiled, search);
MODULE_ADD_SYM(ReCompiled, split);
MODULE_ADD_SYM(ReCompiled, sub);
- MODULE_ADD_SYM(ReCompiled, __del__);
- MODULE_ADD_SYM(ReCompiled, __objList__);
+ MODULE_ADD_SYM(ReCompiled, del_);
+ MODULE_ADD_SYM(ReCompiled, objList_);
MODULE_SUB_INIT(ReMatch);
MODULE_ADD_SYM(ReMatch, start);
@@ -665,7 +665,7 @@
MODULE_ADD_SYM(ReMatch, expand);
MODULE_ADD_SYM(ReMatch, group);
MODULE_ADD_SYM(ReMatch, groups);
- MODULE_ADD_SYM(ReMatch, __objList__);
+ MODULE_ADD_SYM(ReMatch, objList_);
check_exceptions(ist);
}
Modified: trunk/modules/SQLite/SQLite.c
===================================================================
--- trunk/modules/SQLite/SQLite.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/modules/SQLite/SQLite.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -169,7 +169,7 @@
return OBJ(NONE);
}
-DEF(Connection, __objList__, FORM_RPARAM) {
+DEF(Connection, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(Connection);
return parms[1];
}
@@ -277,7 +277,7 @@
return NEW_INT(-1);
}
-DEF(Cursor, __objList__, FORM_RPARAM) {
+DEF(Cursor, objList_, FORM_RPARAM) {
cursor_p cursorp = (cursor_p)(self->data.ptr);
BIN_CONTENT_CHK(Cursor);
if (cursorp->row_list)
@@ -294,14 +294,14 @@
MODULE_ADD_SYM(Connection, rollBack);
MODULE_ADD_SYM(Connection, commit);
MODULE_ADD_SYM(Connection, close);
- MODULE_ADD_SYM(Connection, __objList__);
+ MODULE_ADD_SYM(Connection, objList_);
MODULE_ADD_SYM(Cursor, execute_BANG);
MODULE_ADD_SYM(Cursor, fetchOne);
MODULE_ADD_SYM(Cursor, fetchMany);
MODULE_ADD_SYM(Cursor, fetchAll);
MODULE_ADD_SYM(Cursor, rowCount);
- MODULE_ADD_SYM(Cursor, __objList__);
+ MODULE_ADD_SYM(Cursor, objList_);
check_exceptions(ist);
}
Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/builtins-core.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -95,16 +95,16 @@
set_attr(ist, OBJ(OBJECT), sym(ist, "Object"), OBJ(OBJECT));
}
-DEF(Object, __call__, FORM_STAR3_PARAM) {
+DEF(Object, call_, FORM_STAR3_PARAM) {
obj_p new_obj, init_obj;
parms[0] = PARAM_STAR; parms[2] = PARAM_STAR_STAR;
new_obj = new_object(ist, self);
- init_obj = call_func(ist, new_obj, SYM(__INIT__), 4, parms, NULL); if_exc_return NULL;
+ init_obj = call_func(ist, new_obj, SYM(INIT_), 4, parms, NULL); if_exc_return NULL;
if (init_obj == OBJ(NONE)) return new_obj;
return init_obj;
}
-DEF(Object, __init__, FORM_STAR3_PARAM) {
+DEF(Object, init_, FORM_STAR3_PARAM) {
return OBJ(NONE);
}
@@ -129,9 +129,9 @@
return NULL;
}
if (self->data_type == DATA_TYPE_DATAPTR) {
- obj_p cdata_len = call_func0(ist, self, SYM(__CDATALEN__));
+ obj_p cdata_len = call_func0(ist, self, SYM(CDATALEN_));
if (!cdata_len) {
- raise_exception(ist, OBJ(INTERNAL_EXC), "fatal error: __cDataLen__() call failed");
+ raise_exception(ist, OBJ(INTERNAL_EXC), "fatal error: cDataLen_() call failed");
return NULL;
}
cdata_size = (size_t) cdata_len->data.i64;
@@ -238,15 +238,15 @@
}
}
-DEF(Object, __getItem__, FORM_RPARAM) {
+DEF(Object, getItem_, FORM_RPARAM) {
raise_exception(ist, OBJ(TYPE_EXC), "indexing not supported on this object");
return NULL;
}
-DEF(Object, __setItem__, FORM_PARAM2) {
+DEF(Object, setItem_, FORM_PARAM2) {
raise_exception(ist, OBJ(TYPE_EXC), "indexing not supported on this object");
return NULL;
}
-DEF(Object, __delItem__, FORM_RPARAM) {
+DEF(Object, delItem_, FORM_RPARAM) {
raise_exception(ist, OBJ(TYPE_EXC), "indexing not supported on this object");
return NULL;
}
@@ -255,28 +255,28 @@
return proto_list(ist, self);
}
-DEF(Object, __bool__QUES, NULL) { return OBJ(PR_TRUE); }
-DEF(Object, __not__QUES, NULL)
+DEF(Object, bool_QUES_, NULL) { return OBJ(PR_TRUE); }
+DEF(Object, not_QUES_, NULL)
{
- if (call_func0(ist, self, SYM(__BOOL__QUES)) == OBJ(PR_TRUE))
+ if (call_func0(ist, self, SYM(BOOL_QUES_)) == OBJ(PR_TRUE))
return OBJ(PR_FALSE);
else
return OBJ(PR_TRUE);
}
-DEF(Object, __is__QUES, FORM_RPARAM) {
+DEF(Object, is_QUES_, FORM_RPARAM) {
if (self == parms[1]) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Object, __isNot__QUES, FORM_RPARAM) {
+DEF(Object, isNot_QUES_, FORM_RPARAM) {
if (self != parms[1]) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Object, __str__, NULL) {
+DEF(Object, str_, NULL) {
char str[1024];
- obj_p doc = get_attr(ist, self, SYM(__DOC__));
+ obj_p doc = get_attr(ist, self, SYM(DOC_));
char* p = pr_strptr(doc);
if (doc)
apr_snprintf(str, sizeof(str), "<Object:%lx:%s>", (unsigned long)(uintptr_t)self, p);
@@ -285,11 +285,11 @@
return NEW_STRING(str);
}
-DEF(Object, __hash__, NULL) {
+DEF(Object, hash_, NULL) {
return new_hash_obj(ist, (i32_t)(uintptr_t) self);
}
-DEF(Object, __eq__QUES, FORM_RPARAM) {
+DEF(Object, eq_QUES_, FORM_RPARAM) {
obj_p cmp_obj = call_func1(ist, self, SYM(CMP), parms[1]);
if(catch_exception(ist, OBJ(FUNCNOTFOUND_EXC), NULL))
return OBJ(PR_FALSE);
@@ -299,44 +299,44 @@
return OBJ(PR_FALSE);
}
-DEF(Object, __ne__QUES, FORM_RPARAM) {
- obj_p cmp_obj = call_func1(ist, self, SYM(__EQ__QUES), parms[1]); if_exc_return NULL;
+DEF(Object, ne_QUES_, FORM_RPARAM) {
+ obj_p cmp_obj = call_func1(ist, self, SYM(EQ_QUES_), parms[1]); if_exc_return NULL;
if (cmp_obj == OBJ(PR_TRUE))
return OBJ(PR_FALSE);
else
return OBJ(PR_TRUE);
}
-DEF(Object, __lt__QUES, FORM_RPARAM) {
+DEF(Object, lt_QUES_, FORM_RPARAM) {
obj_p cmp_obj = call_func1(ist, self, SYM(CMP), parms[1]); if_exc_return NULL;
if (cmp_obj && *((i64_t*)(obj_data_p(cmp_obj))) < 0) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Object, __le__QUES, FORM_RPARAM) {
+DEF(Object, le_QUES_, FORM_RPARAM) {
obj_p cmp_obj = call_func1(ist, self, SYM(CMP), parms[1]); if_exc_return NULL;
if (cmp_obj && *((i64_t*)(obj_data_p(cmp_obj))) <= 0) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Object, __gt__QUES, FORM_RPARAM) {
+DEF(Object, gt_QUES_, FORM_RPARAM) {
obj_p cmp_obj = call_func1(ist, self, SYM(CMP), parms[1]); if_exc_return NULL;
if (cmp_obj && *((i64_t*)(obj_data_p(cmp_obj))) > 0) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Object, __ge__QUES, FORM_RPARAM) {
+DEF(Object, ge_QUES_, FORM_RPARAM) {
obj_p cmp_obj = call_func1(ist, self, SYM(CMP), parms[1]); if_exc_return NULL;
if (cmp_obj && *((i64_t*)(obj_data_p(cmp_obj))) >= 0) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Object, __in__QUES, FORM_RPARAM) {
- return call_func1(ist, parms[1], SYM(__RIN__QUES), self);
+DEF(Object, in_QUES_, FORM_RPARAM) {
+ return call_func1(ist, parms[1], SYM(RIN_QUES_), self);
}
-DEF(Object, __notIn__QUES, FORM_RPARAM) {
- return call_func1(ist, parms[1], SYM(__RNOTIN__QUES), self);
+DEF(Object, notIn_QUES_, FORM_RPARAM) {
+ return call_func1(ist, parms[1], SYM(RNOTIN_QUES_), self);
}
DEF(Object, attrs, NULL) {
@@ -370,11 +370,11 @@
return parms[1];
}
-DEF(Object, __toStorProxy__, NULL) {
+DEF(Object, toStorProxy_, NULL) {
return copy_object(ist, self);
}
-DEF(Object, __fromStorProxy__, NULL) {
+DEF(Object, fromStorProxy_, NULL) {
return self;
}
@@ -389,8 +389,8 @@
set_obj_id(False_OBJ, *, False);
}
-DEF(False, __str__, NULL) { return NEW_STRING("False"); }
-DEF(False, __bool__QUES, NULL) { return False_OBJ; }
+DEF(False, str_, NULL) { return NEW_STRING("False"); }
+DEF(False, bool_QUES_, NULL) { return False_OBJ; }
DEF(False, cmp, FORM_RPARAM) {
if (parms[1] == False_OBJ)
return NEW_INT(0);
@@ -408,8 +408,8 @@
set_obj_id(True_OBJ, *, True);
}
-DEF(True, __str__, NULL) { return NEW_STRING("True"); }
-DEF(True, __bool__QUES, NULL) { return True_OBJ; }
+DEF(True, str_, NULL) { return NEW_STRING("True"); }
+DEF(True, bool_QUES_, NULL) { return True_OBJ; }
DEF(True, cmp, FORM_RPARAM) {
if (parms[1] == OBJ(PR_FALSE))
return NEW_INT(1);
@@ -418,8 +418,8 @@
else
return NEW_INT(-1);
}
-DEF(True, __getCmp__, NULL) {
- return get_attr(ist, self, SYM(__CMPVALOBJ__));
+DEF(True, getCmp_, NULL) {
+ return get_attr(ist, self, SYM(CMPVALOBJ_));
}
// ***************************** NONE *****************************************
@@ -432,15 +432,15 @@
set_obj_id(None_OBJ, *, None);
}
-DEF(None, __str__, NULL) {
+DEF(None, str_, NULL) {
return NEW_STRING("None");
}
-DEF(None, __bool__QUES, NULL) {
+DEF(None, bool_QUES_, NULL) {
return OBJ(PR_FALSE);
}
-DEF(None, __eq__QUES, FORM_RPARAM) {
+DEF(None, eq_QUES_, FORM_RPARAM) {
if (parms[1] == OBJ(NONE)) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
@@ -477,7 +477,7 @@
EXCEPTION_DECLARE(Exception_OBJ, PERMISSION_EXC, PermissionError, "Permission Error");
}
-DEF(Exception, __init__, FORM_STAR_PARAM) {
+DEF(Exception, init_, FORM_STAR_PARAM) {
char buf[512];
if (list_len(ist, parms[1]) > 0) {
apr_snprintf(buf, sizeof(buf), "%s", as_str(ist, list_item(ist, parms[1], 0)));
@@ -495,7 +495,7 @@
set_obj_id(Gen_OBJ, *, Generator);
}
-DEF(Gen, __iter__, NULL) {
+DEF(Gen, iter_, NULL) {
return self;
}
@@ -683,7 +683,7 @@
set_obj_id(Method_OBJ, *, Method);
}
-DEF(Func, __init__, FORM_RPARAM) {
+DEF(Func, init_, FORM_RPARAM) {
obj_p other, fparms, globals, syn_locals, obj;
code_p optr;
int size;
@@ -692,40 +692,40 @@
FUNC___PARAM(1, other);
optr = other->data.ptr;
if (!optr) {
- raise_exception(ist, OBJ(INTERNAL_EXC), "Func __init__ param not initialized");
+ raise_exception(ist, OBJ(INTERNAL_EXC), "Func init_ param not initialized");
return NULL;
}
self->data_type = other->data_type;
if (self->data_type == DATA_TYPE_DATAPTR) {
- if (!(globals = get_attr(ist, other, SYM(__GLOBALS__)))) {
- raise_exception(ist, OBJ(INTERNAL_EXC), "Func __init__ global specifier missing");
+ if (!(globals = get_attr(ist, other, SYM(GLOBALS_)))) {
+ raise_exception(ist, OBJ(INTERNAL_EXC), "Func init_ global specifier missing");
return NULL;
}
- if (!(syn_locals = get_attr(ist, other, SYM(__SYN_LOCALS__)))) {
- raise_exception(ist, OBJ(INTERNAL_EXC), "Func __init__ syn_locals specifier missing");
+ if (!(syn_locals = get_attr(ist, other, SYM(SYN_LOCALS_)))) {
+ raise_exception(ist, OBJ(INTERNAL_EXC), "Func init_ syn_locals specifier missing");
return NULL;
}
read_unlock(ist, self);
size = (int) (sizeof(code) + optr->len * sizeof(code_t));
self->data.ptr = pr_malloc(size);
memcpy(self->data.ptr, other->data.ptr, size);
- set_attr(ist, self, SYM(__GLOBALS__), globals);
- set_attr(ist, self, SYM(__SYN_LOCALS__), syn_locals);
- if (obj = get_attr(ist, other, SYM(__SYN_SELF__)))
- set_attr(ist, self, SYM(__SYN_SELF__), obj);
- if (obj = get_attr(ist, other, SYM(__SYN_FUNC__)))
- set_attr(ist, self, SYM(__SYN_FUNC__), obj);
+ set_attr(ist, self, SYM(GLOBALS_), globals);
+ set_attr(ist, self, SYM(SYN_LOCALS_), syn_locals);
+ if (obj = get_attr(ist, other, SYM(SYN_SELF_)))
+ set_attr(ist, self, SYM(SYN_SELF_), obj);
+ if (obj = get_attr(ist, other, SYM(SYN_FUNC_)))
+ set_attr(ist, self, SYM(SYN_FUNC_), obj);
read_lock(ist, self);
} else
self->data.ptr = other->data.ptr;
read_unlock(ist, self);
- if (fparms = get_attr(ist, other, SYM(__FPARAMS__)))
- set_attr(ist, self, SYM(__FPARAMS__), copy_list_obj(ist, fparms));
+ if (fparms = get_attr(ist, other, SYM(FPARAMS_)))
+ set_attr(ist, self, SYM(FPARAMS_), copy_list_obj(ist, fparms));
read_lock(ist, self);
return OBJ(NONE);
}
-DEF(Func, __str__, NULL) {
+DEF(Func, str_, NULL) {
obj_p bobj;
char str[128];
@@ -733,7 +733,7 @@
apr_snprintf(str, sizeof(str), "<func:%x", (unsigned long)(intptr_t) self);
if (self->data_type == DATA_TYPE_FUNCPTR)
strcat(str, ":c");
- if (bobj = get_attr(ist, self, SYM(__BINDOBJ__))) {
+ if (bobj = get_attr(ist, self, SYM(BINDOBJ_))) {
strcat(str, ":bound:");
strcat(str, as_str(ist, bobj));
}
@@ -744,17 +744,17 @@
DEF(Func, unbind, NULL) {
BIN_CONTENT_CHK(Func);
read_unlock(ist, self);
- del_attr(ist, self, SYM(__BINDOBJ__));
+ del_attr(ist, self, SYM(BINDOBJ_));
read_lock(ist, self);
return self;
}
-DEF(Func, __cDataLen__, NULL) {
+DEF(Func, cDataLen_, NULL) {
BIN_CONTENT_CHK(Func);
return NEW_INT(sizeof(code) + ((code_p)(self->data.ptr))->len * sizeof(code_t));
}
-DEF(Func, __objList__, FORM_RPARAM) {
+DEF(Func, objList_, FORM_RPARAM) {
return parms[1];
}
@@ -762,8 +762,8 @@
MAIN_MODULE_INIT(Core)
{
MODULE_SUB_INIT(Object);
- MODULE_ADD_SYM(Object, __call__);
- MODULE_ADD_SYM(Object, __init__);
+ MODULE_ADD_SYM(Object, call_);
+ MODULE_ADD_SYM(Object, init_);
MODULE_ADD_SYM(Object, Proto);
MODULE_ADD_SYM(Object, copy);
MODULE_ADD_SYM(Object, setReadAccess);
@@ -780,59 +780,59 @@
MODULE_ADD_SYM(Object, Len);
MODULE_ADD_SYM(Object, Max);
MODULE_ADD_SYM(Object, Min);
- MODULE_ADD_SYM(Object, __getItem__);
- MODULE_ADD_SYM(Object, __setItem__);
- MODULE_ADD_SYM(Object, __delItem__);
- MODULE_ADD_SYM(Object, __bool__QUES);
- MODULE_ADD_SYM(Object, __not__QUES);
- MODULE_ADD_SYM(Object, __is__QUES);
- MODULE_ADD_SYM(Object, __isNot__QUES);
- MODULE_ADD_SYM(Object, __str__);
- MODULE_ADD_SYM(Object, __hash__);
- MODULE_ADD_SYM(Object, __eq__QUES);
- MODULE_ADD_SYM(Object, __ne__QUES);
- MODULE_ADD_SYM(Object, __lt__QUES);
- MODULE_ADD_SYM(Object, __le__QUES);
- MODULE_ADD_SYM(Object, __gt__QUES);
- MODULE_ADD_SYM(Object, __ge__QUES);
- MODULE_ADD_SYM(Object, __in__QUES);
- MODULE_ADD_SYM(Object, __notIn__QUES);
+ MODULE_ADD_SYM(Object, getItem_);
+ MODULE_ADD_SYM(Object, setItem_);
+ MODULE_ADD_SYM(Object, delItem_);
+ MODULE_ADD_SYM(Object, bool_QUES_);
+ MODULE_ADD_SYM(Object, not_QUES_);
+ MODULE_ADD_SYM(Object, is_QUES_);
+ MODULE_ADD_SYM(Object, isNot_QUES_);
+ MODULE_ADD_SYM(Object, str_);
+ MODULE_ADD_SYM(Object, hash_);
+ MODULE_ADD_SYM(Object, eq_QUES_);
+ MODULE_ADD_SYM(Object, ne_QUES_);
+ MODULE_ADD_SYM(Object, lt_QUES_);
+ MODULE_ADD_SYM(Object, le_QUES_);
+ MODULE_ADD_SYM(Object, gt_QUES_);
+ MODULE_ADD_SYM(Object, ge_QUES_);
+ MODULE_ADD_SYM(Object, in_QUES_);
+ MODULE_ADD_SYM(Object, notIn_QUES_);
MODULE_ADD_SYM(Object, attrs);
MODULE_ADD_SYM(Object, CurrentThread);
MODULE_ADD_SYM(Object, Sleep);
- MODULE_ADD_SYM(Object, __toStorProxy__);
- MODULE_ADD_SYM(Object, __fromStorProxy__);
+ MODULE_ADD_SYM(Object, toStorProxy_);
+ MODULE_ADD_SYM(Object, fromStorProxy_);
MODULE_SUB_INIT(Seq);
MODULE_SUB_INIT(False);
- MODULE_ADD_SYM(False, __str__);
- MODULE_ADD_SYM(False, __bool__QUES);
+ MODULE_ADD_SYM(False, str_);
+ MODULE_ADD_SYM(False, bool_QUES_);
MODULE_ADD_SYM(False, cmp);
MODULE_SUB_INIT(True);
- MODULE_ADD_SYM(True, __str__);
- MODULE_ADD_SYM(True, __bool__QUES);
+ MODULE_ADD_SYM(True, str_);
+ MODULE_ADD_SYM(True, bool_QUES_);
MODULE_ADD_SYM(True, cmp);
- MODULE_ADD_SYM(True, __getCmp__);
+ MODULE_ADD_SYM(True, getCmp_);
MODULE_SUB_INIT(None);
- MODULE_ADD_SYM(None, __str__);
- MODULE_ADD_SYM(None, __bool__QUES);
- MODULE_ADD_SYM(None, __eq__QUES);
+ MODULE_ADD_SYM(None, str_);
+ MODULE_ADD_SYM(None, bool_QUES_);
+ MODULE_ADD_SYM(None, eq_QUES_);
MODULE_SUB_INIT(Exception);
- MODULE_ADD_SYM(Exception, __init__);
+ MODULE_ADD_SYM(Exception, init_);
MODULE_SUB_INIT(Gen);
- MODULE_ADD_SYM(Gen, __iter__);
+ MODULE_ADD_SYM(Gen, iter_);
MODULE_SUB_INIT(Func);
- MODULE_ADD_SYM(Func, __init__);
- MODULE_ADD_SYM(Func, __str__);
+ MODULE_ADD_SYM(Func, init_);
+ MODULE_ADD_SYM(Func, str_);
MODULE_ADD_SYM(Func, unbind);
- MODULE_ADD_SYM(Func, __cDataLen__);
- MODULE_ADD_SYM(Func, __objList__);
+ MODULE_ADD_SYM(Func, cDataLen_);
+ MODULE_ADD_SYM(Func, objList_);
check_exceptions(ist);
}
Modified: trunk/src/builtins-dict.c
===================================================================
--- trunk/src/builtins-dict.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/builtins-dict.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -116,7 +116,7 @@
if (has_proto_QUES(ist, key_in, OBJ(INT_PROTO)))
return ((i32_t) key_in->data.i64);
else {
- obj_p hash_obj = call_func0(ist, key_in, SYM(__HASH__));
+ obj_p hash_obj = call_func0(ist, key_in, SYM(HASH_));
if_exc_return 0;
return hash_obj->data.i32[0];
}
@@ -142,7 +142,7 @@
hash = dp->entry.hash;
if (hash < 0) { hole = dp; continue; }
if ( hash == hash_in && ( key == key_in ||
- call_func(ist, key, SYM(__EQ__QUES), 2, rp, NULL) == OBJ(PR_TRUE) ) ) {
+ call_func(ist, key, SYM(EQ_QUES_), 2, rp, NULL) == OBJ(PR_TRUE) ) ) {
match = PR_TRUE;
break;
}
@@ -191,7 +191,7 @@
dict = (dict_p) obj_data_p(dict_obj);
for (i=hash_in; (key=((dp=dictptr(dict,i))->entry.key)); i++){
if ( dp->entry.hash == hash_in && ( key == key_in ||
- call_func(ist, key, SYM(__EQ__QUES), 2, rp, NULL) == OBJ(PR_TRUE) ) ) {
+ call_func(ist, key, SYM(EQ_QUES_), 2, rp, NULL) == OBJ(PR_TRUE) ) ) {
dict_rd_chk();
res = dp->entry.value;
read_unlock(ist, dict_obj);
@@ -273,7 +273,7 @@
strcat(res, "'"); \
} while(0)
-DEF(Dict, __init__, FORM_STAR2_PARAM) {
+DEF(Dict, init_, FORM_STAR2_PARAM) {
dict_p dict;
obj_p list;
int i, llen, size = max(DEFAULT_INITIAL_DICT_SIZE, (int) dict_len(ist, parms[1])*3);
@@ -290,7 +290,7 @@
return OBJ(NONE);
}
-DEF(Dict, __str__, NULL) {
+DEF(Dict, str_, NULL) {
int i;
size_t len;
char* res;
@@ -357,7 +357,7 @@
return parms[3];
}
-DEF(Dict, __rIn__QUES, FORM_RPARAM) {
+DEF(Dict, rIn_QUES_, FORM_RPARAM) {
obj_p res;
BIN_CONTENT_CHK(Dict);
if ((res = dict_item(ist, self, parms[1]))) {
@@ -367,7 +367,7 @@
return OBJ(PR_FALSE);
}
-DEF(Dict, __rNotIn__QUES, FORM_RPARAM) {
+DEF(Dict, rNotIn_QUES_, FORM_RPARAM) {
obj_p res;
BIN_CONTENT_CHK(Dict);
if ((res = dict_item(ist, self, parms[1]))) {
@@ -377,18 +377,18 @@
return OBJ(PR_TRUE);
}
-DEF(Dict, __cDataLen__, NULL) {
+DEF(Dict, cDataLen_, NULL) {
BIN_CONTENT_CHK(Dict);
return NEW_INT(dict_size_bytes(self->data.ptr));
}
-DEF(Dict, __objList__, FORM_RPARAM) {
+DEF(Dict, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(Dict);
return parms[1];
}
-DEF(Dict, __getItem__, FORM_RPARAM) {
+DEF(Dict, getItem_, FORM_RPARAM) {
obj_p res;
BIN_CONTENT_CHK(Dict);
@@ -406,7 +406,7 @@
return res;
}
-DEF(Dict, __setItem__, FORM_PARAM2) {
+DEF(Dict, setItem_, FORM_PARAM2) {
BIN_CONTENT_CHK(Dict);
if (list_len(ist, parms[1]) > 1) {
raise_exception(ist, OBJ(INTERPRETER_EXC), "slice not allowed in dictionary indexing");
@@ -418,7 +418,7 @@
return NULL;
}
-DEF(Dict, __delItem__, FORM_RPARAM) {
+DEF(Dict, delItem_, FORM_RPARAM) {
i32_t i, hash_in;
obj_p key, key_in, rp[2];
dict_p dict, dp;
@@ -437,7 +437,7 @@
dict = (dict_p) self->data.ptr;
for(i=hash_in; (key=((dp=dictptr(dict,i))->entry.key)); i++){
if ( dp->entry.hash == hash_in && ( key == key_in ||
- call_func(ist, key, SYM(__EQ__QUES), 2, rp, NULL) == OBJ(PR_TRUE) ) ) {
+ call_func(ist, key, SYM(EQ_QUES_), 2, rp, NULL) == OBJ(PR_TRUE) ) ) {
dp->entry.hash = ENTRY_DELETED;
dictlen(dict)--;
def_write_unlock(self);
@@ -516,7 +516,7 @@
return dict_keys_values(ist, self, 4 /*tuple*/);
}
-DEF(Dict, __iter__, NULL) {
+DEF(Dict, iter_, NULL) {
obj_p list_obj, gen_obj = NEW_OBJ(DictGen_OBJ);
BIN_CONTENT_CHK(Dict);
@@ -527,7 +527,7 @@
return gen_obj;
}
-DEF(Dict, __toStorProxy__, NULL) {
+DEF(Dict, toStorProxy_, NULL) {
obj_p proxy_obj = dict_keys_values(ist, self, 2 /*list*/);
BIN_CONTENT_CHK(Dict);
switch_proto(ist, proxy_obj, DictRestore_OBJ);
@@ -540,7 +540,7 @@
set_obj_id(DictRestore_OBJ, *, DictRestore);
}
-DEF(DictRestore, __fromStorProxy__, NULL) {
+DEF(DictRestore, fromStorProxy_, NULL) {
int i, llen = (int)list_len(ist, self);
obj_p dict = NEW_DICT(2*llen);
BIN_CONTENT_CHK(DictRestore);
@@ -576,8 +576,8 @@
MAIN_MODULE_INIT(Dict)
{
MODULE_SUB_INIT(Dict);
- MODULE_ADD_SYM(Dict, __init__);
- MODULE_ADD_SYM(Dict, __str__);
+ MODULE_ADD_SYM(Dict, init_);
+ MODULE_ADD_SYM(Dict, str_);
MODULE_ADD_SYM(Dict, hasKey_QUES);
MODULE_ADD_SYM(Dict, items);
MODULE_ADD_SYM(Dict, len);
@@ -588,18 +588,18 @@
MODULE_ADD_SYM(Dict, update_BANG);
MODULE_ADD_SYM(Dict, setDefault_BANG);
MODULE_ADD_SYM(Dict, popItem_BANG);
- MODULE_ADD_SYM(Dict, __rIn__QUES);
- MODULE_ADD_SYM(Dict, __rNotIn__QUES);
- MODULE_ADD_SYM(Dict, __getItem__);
- MODULE_ADD_SYM(Dict, __setItem__);
- MODULE_ADD_SYM(Dict, __delItem__);
- MODULE_ADD_SYM(Dict, __iter__);
- MODULE_ADD_SYM(Dict, __toStorProxy__);
- MODULE_ADD_SYM(Dict, __objList__);
- MODULE_ADD_SYM(Dict, __cDataLen__);
+ MODULE_ADD_SYM(Dict, rIn_QUES_);
+ MODULE_ADD_SYM(Dict, rNotIn_QUES_);
+ MODULE_ADD_SYM(Dict, getItem_);
+ MODULE_ADD_SYM(Dict, setItem_);
+ MODULE_ADD_SYM(Dict, delItem_);
+ MODULE_ADD_SYM(Dict, iter_);
+ MODULE_ADD_SYM(Dict, toStorProxy_);
+ MODULE_ADD_SYM(Dict, objList_);
+ MODULE_ADD_SYM(Dict, cDataLen_);
MODULE_SUB_INIT(DictRestore);
- MODULE_ADD_SYM(DictRestore, __fromStorProxy__);
+ MODULE_ADD_SYM(DictRestore, fromStorProxy_);
MODULE_SUB_INIT(DictGen);
MODULE_ADD_SYM(DictGen, next);
Modified: trunk/src/builtins-float.c
===================================================================
--- trunk/src/builtins-float.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/builtins-float.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -108,7 +108,7 @@
//Imag_OBJ->data.f64 = 0.0;
}
-DEF(Float, __init__, FORM_STAR_PARAM) {
+DEF(Float, init_, FORM_STAR_PARAM) {
double f = 0.0;
BIN_EMPTY_CHK();
if (list_len(ist, parms[1]))
@@ -119,7 +119,7 @@
return OBJ(NONE);
}
-DEF(Float, __bool__QUES, NULL) {
+DEF(Float, bool_QUES_, NULL) {
BIN_CONTENT_CHK(Float);
if (Float_value(self) != 0.0 )
return OBJ(PR_TRUE);
@@ -127,7 +127,7 @@
return OBJ(PR_FALSE);
}
-DEF(Float, __hash__, NULL) {
+DEF(Float, hash_, NULL) {
double flt = (double) Float_value(self);
BIN_CONTENT_CHK(Float);
if (flt < 0) flt = -flt;
@@ -137,23 +137,23 @@
return new_hash_obj(ist, (i32_t)flt);
}
-DEF(Float, __abs__, NULL) {
+DEF(Float, abs_, NULL) {
double num = Float_value(self);
BIN_CONTENT_CHK(Float);
return NEW_FLOAT(num < 0 ? -num : num);
}
-DEF(Float, __neg__, NULL){
+DEF(Float, neg_, NULL){
BIN_CONTENT_CHK(Float);
return NEW_FLOAT( - Float_value(self) );
}
-DEF(Float, __pos__, NULL){
+DEF(Float, pos_, NULL){
BIN_CONTENT_CHK(Float);
return self;
}
-DEF(Float, __add__, FORM_RPARAM){
+DEF(Float, add_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -163,7 +163,7 @@
float_other = (double)other->data.i64;
else {
if (covers(other, self))
- return call_func1(ist, other, SYM(__ADD__), self);
+ return call_func1(ist, other, SYM(ADD_), self);
raise_exception(ist, OBJ(TYPE_EXC), "Float cannot be added to this object");
return OBJ(NONE);
}
@@ -171,7 +171,7 @@
return NEW_FLOAT(Float_value(self) + float_other);
}
-DEF(Float, __div__, FORM_RPARAM){
+DEF(Float, div_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -181,7 +181,7 @@
float_other = (double)other->data.i64;
else {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RDIV__), self);
+ return call_func1(ist, other, SYM(RDIV_), self);
raise_exception(ist, OBJ(TYPE_EXC), "Float cannot be divided by this object");
return NULL;
}
@@ -193,7 +193,7 @@
return NEW_FLOAT(Float_value(self) / float_other);
}
-DEF(Float, __rDiv__, FORM_RPARAM){
+DEF(Float, rDiv_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -213,7 +213,7 @@
return NEW_FLOAT(float_other / Float_value(self));
}
-DEF(Float, __mul__, FORM_RPARAM){
+DEF(Float, mul_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -223,7 +223,7 @@
float_other = (double)other->data.i64;
else {
if (covers(other, self))
- return call_func1(ist, other, SYM(__MUL__), self);
+ return call_func1(ist, other, SYM(MUL_), self);
raise_exception(ist, OBJ(TYPE_EXC), "float cannot be multiplied by this object");
return NULL;
}
@@ -231,7 +231,7 @@
return NEW_FLOAT(Float_value(self) * float_other);
}
-DEF(Float, __sub__, FORM_RPARAM){
+DEF(Float, sub_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -241,7 +241,7 @@
float_other = (double)other->data.i64;
else {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RSUB__), self);
+ return call_func1(ist, other, SYM(RSUB_), self);
raise_exception(ist, OBJ(TYPE_EXC), "this object cannot be subtracted from a float");
return NULL;
}
@@ -249,7 +249,7 @@
return NEW_FLOAT(Float_value(self) - float_other);
}
-DEF(Float, __rSub__, FORM_RPARAM){
+DEF(Float, rSub_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
if (is_Float(other)) float_other = Float_value(other);
@@ -264,7 +264,7 @@
return NEW_FLOAT(float_other - Float_value(self));
}
-DEF(Float, __pow__, FORM_RPARAM){
+DEF(Float, pow_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -274,7 +274,7 @@
float_other = (double)other->data.i64;
else {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RPOW__), self);
+ return call_func1(ist, other, SYM(RPOW_), self);
raise_exception(ist, OBJ(TYPE_EXC), "this object cannot be in a pow function with a float");
return NULL;
}
@@ -282,7 +282,7 @@
return NEW_FLOAT(pow(Float_value(self), float_other));
}
-DEF(Float, __rPow__, FORM_RPARAM){
+DEF(Float, rPow_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -309,7 +309,7 @@
float_other = (double)other->data.i64;
else {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RCMP__), self);
+ return call_func1(ist, other, SYM(RCMP_), self);
raise_exception(ist, OBJ(TYPE_EXC), "this object cannot compared to a float");
return NULL;
}
@@ -322,7 +322,7 @@
return NEW_INT(-1);
}
-DEF(Float, __rCmp__, FORM_RPARAM){
+DEF(Float, rCmp_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -343,7 +343,7 @@
return NEW_INT(-1);
}
-DEF(Float, __eq__QUES, FORM_RPARAM){
+DEF(Float, eq_QUES_, FORM_RPARAM){
double float_other;
obj_p other = parms[1];
BIN_CONTENT_CHK(Float);
@@ -353,7 +353,7 @@
float_other = (double)other->data.i64;
else {
if (covers(other, self))
- return call_func1(ist, other, SYM(__EQ__QUES), self);
+ return call_func1(ist, other, SYM(EQ_QUES_), self);
return OBJ(PR_FALSE);
}
}
@@ -361,20 +361,20 @@
else return OBJ(PR_FALSE);
}
-DEF(Float, __str__, NULL){
+DEF(Float, str_, NULL){
char str[1024];
BIN_STR_CHK(Float);
apr_snprintf(str, sizeof(str), "%g", Float_value(self));
return NEW_STRING(str);
}
-DEF(Float, __covers__QUES, FORM_RPARAM) {
+DEF(Float, covers_QUES_, FORM_RPARAM) {
BIN_CONTENT_CHK(Float);
if (has_proto_QUES(ist, parms[1], OBJ(INT_PROTO))) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Float, __coerce__, FORM_RPARAM) {
+DEF(Float, coerce_, FORM_RPARAM) {
BIN_CONTENT_CHK(Float);
if (has_proto_QUES(ist, parms[1], OBJ(INT_PROTO)))
return NEW_FLOAT((double)(parms[1]->data.i64));
@@ -390,26 +390,26 @@
MAIN_MODULE_INIT(Float)
{
MODULE_SUB_INIT(Float);
- MODULE_ADD_SYM(Float, __init__);
- MODULE_ADD_SYM(Float, __bool__QUES);
- MODULE_ADD_SYM(Float, __str__);
- MODULE_ADD_SYM(Float, __hash__);
- MODULE_ADD_SYM(Float, __eq__QUES);
+ MODULE_ADD_SYM(Float, init_);
+ MODULE_ADD_SYM(Float, bool_QUES_);
+ MODULE_ADD_SYM(Float, str_);
+ MODULE_ADD_SYM(Float, hash_);
+ MODULE_ADD_SYM(Float, eq_QUES_);
MODULE_ADD_SYM(Float, cmp);
- MODULE_ADD_SYM(Float, __rCmp__);
- MODULE_ADD_SYM(Float, __abs__);
- MODULE_ADD_SYM(Float, __neg__);
- MODULE_ADD_SYM(Float, __pos__);
- MODULE_ADD_SYM(Float, __add__);
- MODULE_ADD_SYM(Float, __sub__);
- MODULE_ADD_SYM(Float, __rSub__);
- MODULE_ADD_SYM(Float, __mul__);
- MODULE_ADD_SYM(Float, __div__);
- MODULE_ADD_SYM(Float, __rDiv__);
- MODULE_ADD_SYM(Float, __pow__);
- MODULE_ADD_SYM(Float, __rPow__);
- MODULE_ADD_SYM(Float, __covers__QUES);
- MODULE_ADD_SYM(Float, __coerce__);
+ MODULE_ADD_SYM(Float, rCmp_);
+ MODULE_ADD_SYM(Float, abs_);
+ MODULE_ADD_SYM(Float, neg_);
+ MODULE_ADD_SYM(Float, pos_);
+ MODULE_ADD_SYM(Float, add_);
+ MODULE_ADD_SYM(Float, sub_);
+ MODULE_ADD_SYM(Float, rSub_);
+ MODULE_ADD_SYM(Float, mul_);
+ MODULE_ADD_SYM(Float, div_);
+ MODULE_ADD_SYM(Float, rDiv_);
+ MODULE_ADD_SYM(Float, pow_);
+ MODULE_ADD_SYM(Float, rPow_);
+ MODULE_ADD_SYM(Float, covers_QUES_);
+ MODULE_ADD_SYM(Float, coerce_);
check_exceptions(ist);
}
Modified: trunk/src/builtins-int.c
===================================================================
--- trunk/src/builtins-int.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/builtins-int.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -108,7 +108,7 @@
set_immutable(OBJ(LONG_PROTO));
}
-DEF(Int, __init__, FORM_STAR_PARAM) { // 9bd8c0 9a4760 0 0 9bd820
+DEF(Int, init_, FORM_STAR_PARAM) { // 9bd8c0 9a4760 0 0 9bd820
i64_t i = 0;
BIN_EMPTY_CHK();
if (list_len(ist, parms[1]))
@@ -119,76 +119,76 @@
return OBJ(NONE);
}
-DEF(Int, __str__, NULL){
+DEF(Int, str_, NULL){
char str[24];
BIN_STR_CHK(Int);
apr_snprintf(str, sizeof(str), "%"APR_INT64_T_FMT, (i64_t)Int_value(self));
return NEW_STRING(str);
}
-DEF(Int, __bool__QUES, NULL) {
+DEF(Int, bool_QUES_, NULL) {
BIN_CONTENT_CHK(Int);
if (Int_value(self)) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Int, __hash__, NULL) {
+DEF(Int, hash_, NULL) {
i32_t i32 = (i32_t) Int_value(self);
BIN_CONTENT_CHK(Int);
return new_hash_obj(ist, i32);
}
-DEF(Int, __abs__, NULL){
+DEF(Int, abs_, NULL){
i64_t num = Int_value(self);
BIN_CONTENT_CHK(Int);
return NEW_INT(num < 0 ? -num : num);
}
-DEF(Int, __neg__, NULL){
+DEF(Int, neg_, NULL){
BIN_CONTENT_CHK(Int);
return NEW_INT( - Int_value(self) );
}
-DEF(Int, __pos__, NULL){
+DEF(Int, pos_, NULL){
BIN_CONTENT_CHK(Int);
return self;
}
-DEF(Int, __add__, FORM_RPARAM){
+DEF(Int, add_, FORM_RPARAM){
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
if (covers(other, self))
- return call_func1(ist, other, SYM(__ADD__), self);
+ return call_func1(ist, other, SYM(ADD_), self);
raise_exception(ist, OBJ(TYPE_EXC), "Integer cannot be added to this object");
return OBJ(NONE);
}
return NEW_INT(Int_value(self) + Int_value(other));
}
-DEF(Int, __div__, FORM_RPARAM){
+DEF(Int, div_, FORM_RPARAM){
obj_p res;
obj_p float_self, float_other, other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RDIV__), self);
+ return call_func1(ist, other, SYM(RDIV_), self);
raise_exception(ist, OBJ(TYPE_EXC), "Integer cannot be divided by this object");
return OBJ(NONE);
}
- float_self = call_func1(ist, OBJ(FLOAT_PROTO), SYM(__COERCE__), self); if_exc_return NULL;
- float_other = call_func1(ist, OBJ(FLOAT_PROTO), SYM(__COERCE__), other); if_exc_return NULL;
- res = call_func1(ist, float_self, SYM(__DIV__), float_other);
+ float_self = call_func1(ist, OBJ(FLOAT_PROTO), SYM(COERCE_), self); if_exc_return NULL;
+ float_other = call_func1(ist, OBJ(FLOAT_PROTO), SYM(COERCE_), other); if_exc_return NULL;
+ res = call_func1(ist, float_self, SYM(DIV_), float_other);
del_unlock(float_self); del_unlock(float_other);
return res;
}
-DEF(Int, __floorDiv__, FORM_RPARAM){
+DEF(Int, floorDiv_, FORM_RPARAM){
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RFLOORDIV__), self);
+ return call_func1(ist, other, SYM(RFLOORDIV_), self);
raise_exception(ist, OBJ(TYPE_EXC), "Integer cannot be floor divided by this object");
return OBJ(NONE);
}
@@ -199,12 +199,12 @@
return NEW_INT(Int_value(self) / Int_value(other));
}
-DEF(Int, __mod__, FORM_RPARAM) {
+DEF(Int, mod_, FORM_RPARAM) {
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RMOD__), self);
+ return call_func1(ist, other, SYM(RMOD_), self);
raise_exception(ist, OBJ(TYPE_EXC), "Integer cannot be modded by this object");
return OBJ(NONE);
}
@@ -215,37 +215,37 @@
return NEW_INT(Int_value(self) % Int_value(other));
}
-DEF(Int, __mul__, FORM_RPARAM) {
+DEF(Int, mul_, FORM_RPARAM) {
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
if (covers(other, self))
- return call_func1(ist, other, SYM(__MUL__), self);
+ return call_func1(ist, other, SYM(MUL_), self);
raise_exception(ist, OBJ(TYPE_EXC), "Integer cannot be multiplied by this object");
return OBJ(NONE);
}
return NEW_INT(Int_value(self) * Int_value(other));
}
-DEF(Int, __sub__, FORM_RPARAM) {
+DEF(Int, sub_, FORM_RPARAM) {
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RSUB__), self);
+ return call_func1(ist, other, SYM(RSUB_), self);
raise_exception(ist, OBJ(TYPE_EXC), "This object cannot be subtracted from an Integer");
return OBJ(NONE);
}
return NEW_INT(Int_value(self) - Int_value(other));
}
-DEF(Int, __pow__, FORM_RPARAM){
+DEF(Int, pow_, FORM_RPARAM){
obj_p res;
obj_p float_self, float_other, other = parms[1];
BIN_CONTENT_CHK(Int);
- float_self = call_func1(ist, OBJ(FLOAT_PROTO), SYM(__COERCE__), self); if_exc_return NULL;
- float_other = call_func1(ist, OBJ(FLOAT_PROTO), SYM(__COERCE__), other); if_exc_return NULL;
- res = call_func1(ist, float_self, SYM(__POW__), float_other);
+ float_self = call_func1(ist, OBJ(FLOAT_PROTO), SYM(COERCE_), self); if_exc_return NULL;
+ float_other = call_func1(ist, OBJ(FLOAT_PROTO), SYM(COERCE_), other); if_exc_return NULL;
+ res = call_func1(ist, float_self, SYM(POW_), float_other);
del_unlock(float_self); del_unlock(float_other);
return res;
}
@@ -255,7 +255,7 @@
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
if (covers(other, self))
- return call_func1(ist, other, SYM(__RCMP__), self);
+ return call_func1(ist, other, SYM(RCMP_), self);
raise_exception(ist, OBJ(TYPE_EXC), "This object cannot be compared to an Integer");
return OBJ(NONE);
}
@@ -267,25 +267,25 @@
return NEW_INT(-1);
}
-DEF(Int, __eq__QUES, FORM_RPARAM){
+DEF(Int, eq_QUES_, FORM_RPARAM){
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
int c = covers(other, self);
if (catch_exception(ist, OBJ(FUNCNOTFOUND_EXC), NULL))
return FALSE;
- if (c) return call_func1(ist, other, SYM(__EQ__QUES), self);
+ if (c) return call_func1(ist, other, SYM(EQ_QUES_), self);
return OBJ(PR_FALSE);
}
if (Int_value(self) == Int_value(other)) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(Int, __invert__, NULL){
+DEF(Int, invert_, NULL){
BIN_CONTENT_CHK(Int);
return NEW_INT( ~ Int_value(self) );
}
-DEF(Int, __xor__, FORM_RPARAM) {
+DEF(Int, xor_, FORM_RPARAM) {
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
@@ -295,7 +295,7 @@
return NEW_INT(Int_value(self) ^ Int_value(other));
}
-DEF(Int, __and__, FORM_RPARAM) {
+DEF(Int, and_, FORM_RPARAM) {
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
@@ -305,7 +305,7 @@
return NEW_INT(Int_value(self) & Int_value(other));
}
-DEF(Int, __or__, FORM_RPARAM) {
+DEF(Int, or_, FORM_RPARAM) {
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
@@ -315,7 +315,7 @@
return NEW_INT(Int_value(self) | Int_value(other));
}
-DEF(Int, __rShift__, FORM_RPARAM) {
+DEF(Int, rShift_, FORM_RPARAM) {
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
@@ -325,7 +325,7 @@
return NEW_INT(Int_value(self) >> Int_value(other));
}
-DEF(Int, __lShift__, FORM_RPARAM) {
+DEF(Int, lShift_, FORM_RPARAM) {
obj_p other = parms[1];
BIN_CONTENT_CHK(Int);
if (!is_Int(other)) {
@@ -335,7 +335,7 @@
return NEW_INT(Int_value(self) << Int_value(other));
}
-DEF(Int, __iter__, NULL) {
+DEF(Int, iter_, NULL) {
obj_p gen_obj = NEW_INT(0);
BIN_CONTENT_CHK(Int);
gen_obj->immutable = FALSE;
@@ -385,30 +385,30 @@
SYM_LIMIT = sym(ist, "limit");
MODULE_SUB_INIT(Int);
- MODULE_ADD_SYM(Int, __init__);
- MODULE_ADD_SYM(Int, __bool__QUES);
- MODULE_ADD_SYM(Int, __str__);
- MODULE_ADD_SYM(Int, __hash__);
- MODULE_ADD_SYM(Int, __eq__QUES);
+ MODULE_ADD_SYM(Int, init_);
+ MODULE_ADD_SYM(Int, bool_QUES_);
+ MODULE_ADD_SYM(Int, str_);
+ MODULE_ADD_SYM(Int, hash_);
+ MODULE_ADD_SYM(Int, eq_QUES_);
MODULE_ADD_SYM(Int, cmp);
MODULE_ADD_SYM(Int, chr);
- MODULE_ADD_SYM(Int, __abs__);
- MODULE_ADD_SYM(Int, __neg__);
- MODULE_ADD_SYM(Int, __pos__);
- MODULE_ADD_SYM(Int, __add__);
- MODULE_ADD_SYM(Int, __sub__);
- MODULE_ADD_SYM(Int, __mul__);
- MODULE_ADD_SYM(Int, __div__);
- MODULE_ADD_SYM(Int, __floorDiv__);
- MODULE_ADD_SYM(Int, __mod__);
- MODULE_ADD_SYM(Int, __pow__);
- MODULE_ADD_SYM(Int, __invert__);
- MODULE_ADD_SYM(Int, __xor__);
- MODULE_ADD_SYM(Int, __and__);
- MODULE_ADD_SYM(Int, __or__);
- MODULE_ADD_SYM(Int, __rShift__);
- MODULE_ADD_SYM(Int, __lShift__);
- MODULE_ADD_SYM(Int, __iter__);
+ MODULE_ADD_SYM(Int, abs_);
+ MODULE_ADD_SYM(Int, neg_);
+ MODULE_ADD_SYM(Int, pos_);
+ MODULE_ADD_SYM(Int, add_);
+ MODULE_ADD_SYM(Int, sub_);
+ MODULE_ADD_SYM(Int, mul_);
+ MODULE_ADD_SYM(Int, div_);
+ MODULE_ADD_SYM(Int, floorDiv_);
+ MODULE_ADD_SYM(Int, mod_);
+ MODULE_ADD_SYM(Int, pow_);
+ MODULE_ADD_SYM(Int, invert_);
+ MODULE_ADD_SYM(Int, xor_);
+ MODULE_ADD_SYM(Int, and_);
+ MODULE_ADD_SYM(Int, or_);
+ MODULE_ADD_SYM(Int, rShift_);
+ MODULE_ADD_SYM(Int, lShift_);
+ MODULE_ADD_SYM(Int, iter_);
MODULE_SUB_INIT(IntGen);
MODULE_ADD_SYM(IntGen, next);
Modified: trunk/src/builtins-list.c
===================================================================
--- trunk/src/builtins-list.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/builtins-list.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -267,7 +267,7 @@
}
arr[0] = NULL;
arr[1] = b;
- res = call_func(ist, a, SYM(__EQ__QUES), 2, arr, NULL);
+ res = call_func(ist, a, SYM(EQ_QUES_), 2, arr, NULL);
if_exc_return 0;
return (res == OBJ(PR_TRUE));
}
@@ -312,7 +312,7 @@
lstplen(lstp) = 0;
}
-DEF(List, __init__, FORM_STAR_PARAM) {
+DEF(List, init_, FORM_STAR_PARAM) {
BIN_EMPTY_OR_NOT_CHK(List);
read_unlock(ist, self);
read_unlock(ist, parms[1]);
@@ -322,17 +322,17 @@
return OBJ(NONE);
}
-DEF(List, __str__, NULL) {
+DEF(List, str_, NULL) {
BIN_STR_CHK(List);
return str_tuple_list(ist, self, "[", "]");
}
-DEF(List, __getItem__, FORM_RPARAM) {
+DEF(List, getItem_, FORM_RPARAM) {
BIN_CONTENT_CHK(List);
return get_sequence_item(ist, self, parms[1], SEQ_TYPE_LIST);
}
-DEF(List, __setItem__, FORM_PARAM2) {
+DEF(List, setItem_, FORM_PARAM2) {
int j;
obj_p slice_item1, slice_item2, slice_item3;
obj_p slice = parms[1], value = parms[3];
@@ -447,7 +447,7 @@
return NULL;
}
-DEF(List, __delItem__, FORM_RPARAM) {
+DEF(List, delItem_, FORM_RPARAM) {
int j;
obj_p slice_item1, slice_item2, slice_item3;
obj_p slice = parms[1];
@@ -556,7 +556,7 @@
return NULL;
}
-DEF(List, __add__, FORM_RPARAM) {
+DEF(List, add_, FORM_RPARAM) {
int i;
obj_p res = copy_list_obj(ist, self);
BIN_CONTENT_CHK(List);
@@ -568,7 +568,7 @@
return res;
}
-DEF(List, __mul__, FORM_RPARAM){
+DEF(List, mul_, FORM_RPARAM){
obj_p res;
list_p lstp, selfp = (list_p)(self->data.ptr);
int i, size, times, len = (int) list_len(ist, self);
@@ -675,7 +675,7 @@
selfp = self->data.ptr;
self_len = lstplen(selfp);
for (i=0; i < self_len; i++) {
- if (call_func1(ist, listitem(self, i), SYM(__EQ__QUES), parms[1]) == OBJ(PR_TRUE)) break;
+ if (call_func1(ist, listitem(self, i), SYM(EQ_QUES_), parms[1]) == OBJ(PR_TRUE)) break;
if_exc_return NULL;
}
if (i == self_len) {
@@ -760,13 +760,13 @@
MAIN_MODULE_INIT(List)
{
MODULE_SUB_INIT(List);
- MODULE_ADD_SYM(List, __init__);
- MODULE_ADD_SYM(List, __str__);
- MODULE_ADD_SYM(List, __getItem__);
- MODULE_ADD_SYM(List, __setItem__);
- MODULE_ADD_SYM(List, __delItem__);
- MODULE_ADD_SYM(List, __add__);
- MODULE_ADD_SYM(List, __mul__);
+ MODULE_ADD_SYM(List, init_);
+ MODULE_ADD_SYM(List, str_);
+ MODULE_ADD_SYM(List, getItem_);
+ MODULE_ADD_SYM(List, setItem_);
+ MODULE_ADD_SYM(List, delItem_);
+ MODULE_ADD_SYM(List, add_);
+ MODULE_ADD_SYM(List, mul_);
MODULE_ADD_SYM(List, append_BANG);
MODULE_ADD_SYM(List, extend_BANG);
MODULE_ADD_SYM(List, insert_BANG);
Modified: trunk/src/builtins-string.c
===================================================================
--- trunk/src/builtins-string.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/builtins-string.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -222,7 +222,7 @@
String_OBJ->data.str[0] = 0;
}
-DEF(String, __init__, FORM_STAR_PARAM) {
+DEF(String, init_, FORM_STAR_PARAM) {
char *s;
BIN_EMPTY_CHK();
if (!list_len(ist, parms[1]))
@@ -233,12 +233,12 @@
return OBJ(NONE);
}
-DEF(String, __str__, NULL) {
+DEF(String, str_, NULL) {
BIN_STR_CHK(String);
return self;
}
-DEF(String, __hash__, NULL) {
+DEF(String, hash_, NULL) {
i32_t res = 0x9a7c5e3;
char *p;
BIN_CONTENT_CHK(String);
@@ -246,17 +246,17 @@
return new_hash_obj(ist, res);
}
-DEF(String, __getItem__, FORM_RPARAM) {
+DEF(String, getItem_, FORM_RPARAM) {
BIN_CONTENT_CHK(String);
return get_sequence_item(ist, self, parms[1], SEQ_TYPE_STRING);
}
-DEF(String, __setItem__, FORM_RPARAM) {
+DEF(String, setItem_, FORM_RPARAM) {
raise_exception(ist, OBJ(MUTABLE_EXC), "strings may not be modifed");
return NULL;
}
-DEF(String, __delItem__, NULL) {
+DEF(String, delItem_, NULL) {
raise_exception(ist, OBJ(MUTABLE_EXC), "strings may not be modifed");
return NULL;
}
@@ -273,12 +273,12 @@
return NEW_INT(strcmp(pr_strptr(self), pr_strptr(other)));
}
-DEF(String, __add__, FORM_RPARAM){
+DEF(String, add_, FORM_RPARAM){
obj_p obj, other = parms[1];
pr_str_p obj_str;
size_t slen, olen, tlen;
BIN_CONTENT_CHK(String);
- if (!is_String(other)) other = call_func0(ist, other, SYM(__STR__));
+ if (!is_String(other)) other = call_func0(ist, other, SYM(STR_));
slen = pr_strlen(self); olen = pr_strlen(other);
tlen = slen + olen;
obj = NEW_OBJ(String_OBJ);
@@ -299,7 +299,7 @@
return obj;
}
-DEF(String, __mul__, FORM_RPARAM){
+DEF(String, mul_, FORM_RPARAM){
obj_p obj;
pr_str_p obj_str;
size_t i, times, tlen, len = pr_strlen(self);
@@ -335,7 +335,7 @@
}
-DEF(String, __mod__, FORM_RPARAM) {
+DEF(String, mod_, FORM_RPARAM) {
obj_p res, argv_obj = parms[1];
size_t i, argc;
pr_arg_p argv;
@@ -378,7 +378,7 @@
return res;
}
-DEF(String, __iter__, NULL) {
+DEF(String, iter_, NULL) {
obj_p gen_obj = NEW_OBJ(StringGen_OBJ);
BIN_CONTENT_CHK(String);
gen_obj->data_type = DATA_TYPE_DATAPTR;
@@ -411,7 +411,7 @@
self_len = pr_strlen(self);
tlen = 0;
for (i=0; i < llen; i++) {
- obj_p str_obj = call_func0(ist, list_item(ist, list, i), SYM(__STR__)); if_exc_return NULL;
+ obj_p str_obj = call_func0(ist, list_item(ist, list, i), SYM(STR_)); if_exc_return NULL;
list_append(ist, str_list, str_obj);
tlen += pr_strlen(str_obj);
if (i != llen-1) tlen += self_len;
@@ -446,18 +446,18 @@
return obj;
}
-DEF(String, __in__QUES, FORM_RPARAM) {
+DEF(String, in_QUES_, FORM_RPARAM) {
BIN_CONTENT_CHK(String);
if (!has_proto_QUES(ist, parms[1], String_OBJ))
- return call_func1(ist, parms[1], SYM(__RIN__QUES), self);
+ return call_func1(ist, parms[1], SYM(RIN_QUES_), self);
if (strstr(pr_strptr(parms[1]), pr_strptr(self))) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
}
-DEF(String, __notIn__QUES, FORM_RPARAM) {
+DEF(String, notIn_QUES_, FORM_RPARAM) {
BIN_CONTENT_CHK(String);
if (!has_proto_QUES(ist, parms[1], String_OBJ))
- return call_func1(ist, parms[1], SYM(__RNOTIN__QUES), self);
+ return call_func1(ist, parms[1], SYM(RNOTIN_QUES_), self);
if (strstr(pr_strptr(parms[1]), pr_strptr(self))) return OBJ(PR_FALSE);
else return OBJ(PR_TRUE);
}
@@ -467,7 +467,7 @@
return NEW_INT(pr_strlen(self));
}
-DEF(String, __bool__QUES, NULL) {
+DEF(String, bool_QUES_, NULL) {
BIN_CONTENT_CHK(String);
if (pr_strlen(self)) return OBJ(PR_TRUE);
else return OBJ(PR_FALSE);
@@ -633,7 +633,7 @@
obj_p tab = new_string_obj(ist,"\t");
obj_p tspace = new_string_obj(ist," ");
obj_p mul_args[]= {NULL, parms[1]};
- obj_p spcs = String__mul__(ist,tspace,2,mul_args,0);
+ obj_p spcs = Stringmul_(ist,tspace,2,mul_args,0);
obj_p repl_args[] = {NULL, tab, NULL, spcs};
result = Stringreplace(ist,self,4,repl_args,0);
del_unlock(tab);
@@ -743,12 +743,12 @@
return list_obj;
}
-DEF(String, __cDataLen__, NULL) {
+DEF(String, cDataLen_, NULL) {
BIN_CONTENT_CHK(String);
return NEW_INT(sizeof(pr_str_t) + pr_strlen(self) + 1);
}
-DEF(String, __objList__, FORM_RPARAM) {
+DEF(String, objList_, FORM_RPARAM) {
return parms[1];
}
@@ -784,23 +784,23 @@
MAIN_MODULE_INIT(String)
{
MODULE_SUB_INIT(String);
- MODULE_ADD_SYM(String, __init__);
- MODULE_ADD_SYM(String, __bool__QUES);
- MODULE_ADD_SYM(String, __str__);
- MODULE_ADD_SYM(String, __hash__);
+ MODULE_ADD_SYM(String, init_);
+ MODULE_ADD_SYM(String, bool_QUES_);
+ MODULE_ADD_SYM(String, str_);
+ MODULE_ADD_SYM(String, hash_);
MODULE_ADD_SYM(String, cmp);
MODULE_ADD_SYM(String, ord);
MODULE_ADD_SYM(String, len);
- MODULE_ADD_SYM(String, __getItem__);
- MODULE_ADD_SYM(String, __add__);
- MODULE_ADD_SYM(String, __mul__);
- MODULE_ADD_SYM(String, __mod__);
- MODULE_ADD_SYM(String, __iter__);
+ MODULE_ADD_SYM(String, getItem_);
+ MODULE_ADD_SYM(String, add_);
+ MODULE_ADD_SYM(String, mul_);
+ MODULE_ADD_SYM(String, mod_);
+ MODULE_ADD_SYM(String, iter_);
MODULE_ADD_SYM(String, join);
- MODULE_ADD_SYM(String, __in__QUES);
- MODULE_ADD_SYM(String, __notIn__QUES);
- MODULE_ADD_SYM(String, __setItem__);
- MODULE_ADD_SYM(String, __delItem__);
+ MODULE_ADD_SYM(String, in_QUES_);
+ MODULE_ADD_SYM(String, notIn_QUES_);
+ MODULE_ADD_SYM(String, setItem_);
+ MODULE_ADD_SYM(String, delItem_);
MODULE_ADD_SYM(String, lower);
MODULE_ADD_SYM(String, upper);
MODULE_ADD_SYM(String, replace);
@@ -812,8 +812,8 @@
MODULE_ADD_SYM(String, strip);
MODULE_ADD_SYM(String, split);
MODULE_ADD_SYM(String, find);
- MODULE_ADD_SYM(String, __objList__);
- MODULE_ADD_SYM(String, __cDataLen__);
+ MODULE_ADD_SYM(String, objList_);
+ MODULE_ADD_SYM(String, cDataLen_);
MODULE_SUB_INIT(StringGen);
MODULE_ADD_SYM(StringGen, next);
Modified: trunk/src/builtins-thread.c
===================================================================
--- trunk/src/builtins-thread.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/builtins-thread.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -202,7 +202,7 @@
}
-DEF(Thread, __init__, list8(ist, sym(ist, "func"), NULL,
+DEF(Thread, init_, list8(ist, sym(ist, "func"), NULL,
sym(ist, "params"), OBJ(NONE),
sym(ist, "name"), OBJ(NONE),
sym(ist, "access"), NEW_INT(-1) ) ) {
@@ -243,7 +243,7 @@
return OBJ(NONE);
}
-DEF(Thread, __str__, NULL) {
+DEF(Thread, str_, NULL) {
obj_p name_obj;
char name[80];
BIN_STR_CHK(Thread);
@@ -310,7 +310,7 @@
return NEW_INT(retval);
}
-DEF(Thread, __objList__, FORM_RPARAM) {
+DEF(Thread, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(Thread);
return parms[1];
}
@@ -328,7 +328,7 @@
}
-DEF(Mutex, __init__, NULL) {
+DEF(Mutex, init_, NULL) {
apr_status_t aprerr;
apr_pool_t *subpool;
@@ -341,7 +341,7 @@
return OBJ(NONE);
}
-DEF(Mutex, __str__, NULL) {
+DEF(Mutex, str_, NULL) {
char name[30];
BIN_CONTENT_CHK(Mutex);
apr_snprintf(name, sizeof(name), "<Mutex:%lx>", (unsigned long)(intptr_t)self);
@@ -374,13 +374,13 @@
return self;
}
-DEF(Mutex, __del__, NULL) {
+DEF(Mutex, del_, NULL) {
BIN_CONTENT_CHK(Mutex);
apr_thread_mutex_destroy((apr_thread_mutex_t*)(self->data.ptr));
return OBJ(NONE);
}
-DEF(Mutex, __objList__, FORM_RPARAM) {
+DEF(Mutex, objList_, FORM_RPARAM) {
BIN_CONTENT_CHK(Mutex);
return parms[1];
}
@@ -388,24 +388,24 @@
MAIN_MODULE_INIT(Thread) {
MODULE_SUB_INIT(Thread);
- MODULE_ADD_SYM(Thread, __init__);
- MODULE_ADD_SYM(Thread, __str__);
+ MODULE_ADD_SYM(Thread, init_);
+ MODULE_ADD_SYM(Thread, str_);
MODULE_ADD_SYM(Thread, access);
MODULE_ADD_SYM(Thread, accessStr);
MODULE_ADD_SYM(Thread, setAccess);
MODULE_ADD_SYM(Thread, running_QUES);
MODULE_ADD_SYM(Thread, sleep);
MODULE_ADD_SYM(Thread, join);
- MODULE_ADD_SYM(Thread, __objList__);
+ MODULE_ADD_SYM(Thread, objList_);
MODULE_SUB_INIT(Mutex);
- MODULE_ADD_SYM(Mutex, __init__);
- MODULE_ADD_SYM(Mutex, __str__);
+ MODULE_ADD_SYM(Mutex, init_);
+ MODULE_ADD_SYM(Mutex, str_);
MODULE_ADD_SYM(Mutex, lock);
MODULE_ADD_SYM(Mutex, tryLock);
MODULE_ADD_SYM(Mutex, unlock);
- MODULE_ADD_SYM(Mutex, __del__);
- MODULE_ADD_SYM(Mutex, __objList__);
+ MODULE_ADD_SYM(Mutex, del_);
+ MODULE_ADD_SYM(Mutex, objList_);
check_exceptions(ist);
}
Modified: trunk/src/builtins-tuple.c
===================================================================
--- trunk/src/builtins-tuple.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/builtins-tuple.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -93,7 +93,7 @@
lstplen(lstp) = 0;
}
-DEF(Tuple, __init__, FORM_STAR_PARAM) {
+DEF(Tuple, init_, FORM_STAR_PARAM) {
BIN_EMPTY_CHK();
read_unlock(ist, self);
read_unlock(ist, parms[1]);
@@ -105,27 +105,27 @@
return OBJ(NONE);
}
-DEF(Tuple, __str__, NULL) {
+DEF(Tuple, str_, NULL) {
BIN_STR_CHK(Tuple);
return str_tuple_list(ist, self, "(", ")");
}
-DEF(Tuple, __getItem__, FORM_RPARAM) {
+DEF(Tuple, getItem_, FORM_RPARAM) {
BIN_CONTENT_CHK(Tuple);
return get_sequence_item(ist, self, parms[1], SEQ_TYPE_TUPLE);
}
-DEF(Tuple, __setItem__, FORM_RPARAM) {
+DEF(Tuple, setItem_, FORM_RPARAM) {
raise_exception(ist, OBJ(MUTABLE_EXC), "tuples may not be modifed");
return NULL;
}
-DEF(Tuple, __delItem__, NULL) {
+DEF(Tuple, delItem_, NULL) {
raise_exception(ist, OBJ(MUTABLE_EXC), "tuples may not be modifed");
return NULL;
}
-DEF(Tuple, __objList__, FORM_RPARAM) {
+DEF(Tuple, objList_, FORM_RPARAM) {
return self;
}
@@ -154,7 +154,7 @@
return OBJ(ZERO_INT);
}
-DEF(Tuple, __eq__QUES, FORM_RPARAM) {
+DEF(Tuple, eq_QUES_, FORM_RPARAM) {
int i, llen, tlen;
obj_p self_item, tgt_item, tgt_list, false_obj = OBJ(PR_FALSE);
BIN_CONTENT_CHK(Tuple);
@@ -166,40 +166,40 @@
for(i=0; i < llen; i++) {
self_item = list_item(ist, self, i);
tgt_item = list_item(ist, tgt_list, i);
- if (call_func1(ist, self_item, SYM(__EQ__QUES), tgt_item) == false_obj)
+ if (call_func1(ist, self_item, SYM(EQ_QUES_), tgt_item) == false_obj)
return false_obj;
else if_exc_return NULL;
}
return OBJ(PR_TRUE);
}
-DEF(Tuple, __rIn__QUES, FORM_RPARAM) {
+DEF(Tuple, rIn_QUES_, FORM_RPARAM) {
int i, llen = (int) list_len(ist, self);
obj_p item, tgt = parms[1];
BIN_CONTENT_CHK(Tuple);
for(i=0; i < llen; i++) {
item = list_item(ist, self, i);
- if (call_func1(ist, item, SYM(__EQ__QUES), tgt) == OBJ(PR_TRUE))
+ if (call_func1(ist, item, SYM(EQ_QUES_), tgt) == OBJ(PR_TRUE))
return OBJ(PR_TRUE);
else if_exc_return NULL;
}
return OBJ(PR_FALSE);
}
-DEF(Tuple, __rNotIn__QUES, FORM_RPARAM) {
+DEF(Tuple, rNotIn_QUES_, FORM_RPARAM) {
int i, llen = (int) list_len(ist, self);
obj_p item, tgt = parms[1];
BIN_CONTENT_CHK(Tuple);
for(i=0; i < llen; i++) {
item = list_item(ist, self, i);
- if (call_func1(ist, item, SYM(__EQ__QUES), tgt) == OBJ(PR_TRUE))
+ if (call_func1(ist, item, SYM(EQ_QUES_), tgt) == OBJ(PR_TRUE))
return OBJ(PR_FALSE);
else if_exc_return NULL;
}
return OBJ(PR_TRUE);
}
-DEF(Tuple, __add__, FORM_RPARAM) {
+DEF(Tuple, add_, FORM_RPARAM) {
int i;
obj_p res = copy_list_obj(ist, self);
BIN_CONTENT_CHK(Tuple);
@@ -212,7 +212,7 @@
return res;
}
-DEF(Tuple, __mul__, FORM_RPARAM){
+DEF(Tuple, mul_, FORM_RPARAM){
obj_p res;
list_p lstp, selfp = (list_p)(self->data.ptr);
int i, size, times, len = (int) list_len(ist, self);
@@ -284,7 +284,7 @@
int i, cnt=0, llen = (int) list_len(ist, self);
BIN_CONTENT_CHK(Tuple);
for (i=0; i < llen; i++) {
- if (call_func1(ist, list_item(ist, self, i), SYM(__EQ__QUES), parms[1]) == OBJ(PR_TRUE))
+ if (call_func1(ist, list_item(ist, self, i), SYM(EQ_QUES_), parms[1]) == OBJ(PR_TRUE))
cnt++;
if_exc_return NULL;
}
@@ -295,7 +295,7 @@
int i, llen = (int) list_len(ist, self);
BIN_CONTENT_CHK(Tuple);
for (i=0; i < llen; i++) {
- if (call_func1(ist, list_item(ist, self, i), SYM(__EQ__QUES), parms[1]) == OBJ(PR_TRUE))
+ if (call_func1(ist, list_item(ist, self, i), SYM(EQ_QUES_), parms[1]) == OBJ(PR_TRUE))
return NEW_INT(i);
if_exc_return NULL;
}
@@ -303,11 +303,11 @@
return NULL;
}
-DEF(Tuple, __cDataLen__, NULL) {
+DEF(Tuple, cDataLen_, NULL) {
return NEW_INT(list_sizeof(listsize(self)));
}
-DEF(Tuple, __iter__, NULL) {
+DEF(Tuple, iter_, NULL) {
obj_p list_obj, gen_obj = NEW_OBJ(Tgen_OBJ);
BIN_CONTENT_CHK(Tuple);
gen_obj->data_type = DATA_TYPE_DATAPTR;
@@ -316,7 +316,7 @@
return gen_obj;
}
-DEF(Tuple, __hash__, NULL) {
+DEF(Tuple, hash_, NULL) {
obj_p hash_obj;
i32_t hash=0x937456;
int i, llen;
@@ -324,7 +324,7 @@
BIN_CONTENT_CHK(Tuple);
llen = (int) list_len(ist, self);
for (i=0; i < llen; i++) {
- hash_obj = call_func0(ist, list_item(ist, self, i), SYM(__HASH__));
+ hash_obj = call_func0(ist, list_item(ist, self, i), SYM(HASH_));
if_exc_return NULL;
hash += hash_obj->data.i32[0];
}
@@ -357,26 +357,26 @@
MAIN_MODULE_INIT(Tuple)
{
MODULE_SUB_INIT(Tuple);
- MODULE_ADD_SYM(Tuple, __init__);
- MODULE_ADD_SYM(Tuple, __str__);
+ MODULE_ADD_SYM(Tuple, init_);
+ MODULE_ADD_SYM(Tuple, str_);
MODULE_ADD_SYM(Tuple, len);
MODULE_ADD_SYM(Tuple, min);
MODULE_ADD_SYM(Tuple, max);
MODULE_ADD_SYM(Tuple, cmp);
- MODULE_ADD_SYM(Tuple, __eq__QUES);
+ MODULE_ADD_SYM(Tuple, eq_QUES_);
MODULE_ADD_SYM(Tuple, count);
MODULE_ADD_SYM(Tuple, index);
- MODULE_ADD_SYM(Tuple, __getItem__);
- MODULE_ADD_SYM(Tuple, __add__);
- MODULE_ADD_SYM(Tuple, __mul__);
- MODULE_ADD_SYM(Tuple, __rIn__QUES);
- MODULE_ADD_SYM(Tuple, __rNotIn__QUES);
- MODULE_ADD_SYM(Tuple, __iter__);
- MODULE_ADD_SYM(Tuple, __setItem__);
- MODULE_ADD_SYM(Tuple, __delItem__);
- MODULE_ADD_SYM(Tuple, __hash__);
- MODULE_ADD_SYM(Tuple, __objList__);
- MODULE_ADD_SYM(Tuple, __cDataLen__);
+ MODULE_ADD_SYM(Tuple, getItem_);
+ MODULE_ADD_SYM(Tuple, add_);
+ MODULE_ADD_SYM(Tuple, mul_);
+ MODULE_ADD_SYM(Tuple, rIn_QUES_);
+ MODULE_ADD_SYM(Tuple, rNotIn_QUES_);
+ MODULE_ADD_SYM(Tuple, iter_);
+ MODULE_ADD_SYM(Tuple, setItem_);
+ MODULE_ADD_SYM(Tuple, delItem_);
+ MODULE_ADD_SYM(Tuple, hash_);
+ MODULE_ADD_SYM(Tuple, objList_);
+ MODULE_ADD_SYM(Tuple, cDataLen_);
MODULE_SUB_INIT(Tgen);
MODULE_ADD_SYM(Tgen, next);
Modified: trunk/src/bytecodes.h
===================================================================
--- trunk/src/bytecodes.h 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/bytecodes.h 2004-05-11 19:19:20 UTC (rev 465)
@@ -317,7 +317,7 @@
// OP_CHAIN_CMP
// make chain compare object from items on stack
// stack: VALUE_OBJ, True/False -> cmp_object
-// if True: cmp_object = new_object with proto == True object, add __getCmp__(): return VALUE_OBJ
+// if True: cmp_object = new_object with proto == True object, add getCmp_(): return VALUE_OBJ
// else: cmp_object = False object
// param: <unused>
// |opcode|
Modified: trunk/src/getline.c
===================================================================
--- trunk/src/getline.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/getline.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -337,7 +337,7 @@
# include <windows.h>
#endif /* WIN32 */
-#ifdef __MWERKS__
+#ifdef MWERKS_
#define R__MWERKS
#endif
@@ -345,11 +345,11 @@
# include <unistd.h>
#endif
-#if defined(_AIX) || defined(__Lynx__) || defined(__APPLE__)
+#if defined(_AIX) || defined(Lynx_) || defined(APPLE_)
#define unix
#endif
-#if defined(__hpux) || defined(__osf__) /* [email protected] */
+#if defined(__hpux) || defined(osf_) /* [email protected] */
#ifndef unix
#define unix
#endif
@@ -357,14 +357,14 @@
#ifdef unix
#include <unistd.h>
-#if !defined(__osf__) && !defined(_AIX) /* [email protected] */
+#if !defined(osf_) && !defined(_AIX) /* [email protected] */
#include <sys/ioctl.h>
#endif
-#if defined(__linux__) && defined(__powerpc__)
+#if defined(linux_) && defined(powerpc_)
# define R__MKLINUX // = linux on PowerMac
#endif
-#if defined(__linux__) && defined(__alpha__)
+#if defined(linux_) && defined(alpha_)
# define R__ALPHALINUX // = linux on Alpha
#endif
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/interp.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -110,8 +110,8 @@
if (func_obj) frame->func = func_obj;
frame->syn_self = syn_self;
frame->self = self;
- frame->globals = (func_obj ? get_attr(ist, func_obj, SYM(__GLOBALS__)) : globals);
- frame->syn_locals = (func_obj ? get_attr(ist, func_obj, SYM(__SYN_LOCALS__)) : syn_locals);
+ frame->globals = (func_obj ? get_attr(ist, func_obj, SYM(GLOBALS_)) : globals);
+ frame->syn_locals = (func_obj ? get_attr(ist, func_obj, SYM(SYN_LOCALS_)) : syn_locals);
frame->dyn_locals = dyn_locals;
frame->locals = locals;
frame->code = code;
@@ -177,7 +177,7 @@
obj_p param[2];
if_exc_return NULL;
param[0]=0; param[1]=ref_key;
- return call_func(ist, ref_self, SYM(__GETITEM__), 2, param, 0);
+ 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_attr_in_chain(ist, ref_self, ref_key->data.ptr, NULL, ref_self);
@@ -196,7 +196,7 @@
obj_p param[4];
param[0]=0; param[1]=ref_key;
param[2]=0; param[3]=value;
- call_func(ist, ref_self, SYM(__SETITEM__), 4, param, 0);
+ 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_attr_in_chain(ist, ref_self, ref_key->data.ptr, &proto_obj, ref_self);
@@ -220,7 +220,7 @@
} else if (has_proto_QUES(ist, ref_key, OBJ(SLICE_PROTO))) {
obj_p param[2];
param[0]=0; param[1]=ref_key;
- call_func(ist, ref_self, SYM(__DELITEM__), 2, param, 0);
+ 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_attr_in_chain(ist, ref_self, ref_key->data.ptr, &proto_obj, ref_self);
@@ -263,7 +263,7 @@
obj_p func_obj, int parm_cnt, obj_p *act_params ){
obj_p form_params, label, value;
memset(fparam_proc_state, 0, sizeof(fparam_proc_state_t));
- if ((form_params = get_attr(ist, func_obj, SYM(__FPARAMS__)))) {
+ if ((form_params = get_attr(ist, func_obj, SYM(FPARAMS_)))) {
int i, j, pstate = 0, fcnt = (int) list_len(ist, form_params);
fparam_proc_state->lbl_val_list = new_clist(fcnt);
for (i=0, j=0; i < fcnt; i+=2) {
@@ -484,7 +484,7 @@
pkg_path[0] = 0;
for (i = 0; i < llen; i++) {
- apr_snprintf(full_path, sizeof(full_path), "%s/%s/__init__.pr",
+ apr_snprintf(full_path, sizeof(full_path), "%s/%s/init_.pr",
pr_strptr(list_item(ist, path_list, i)),
symch(ist, fr_data(pkg_depth)));
@@ -508,7 +508,7 @@
pkg_depth++;
while (pkg_depth < param) {
- apr_snprintf(full_path, sizeof(full_path), "%s/%s/__init__.pr",
+ apr_snprintf(full_path, sizeof(full_path), "%s/%s/init_.pr",
pkg_path, symch(ist, fr_data(pkg_depth)));
if (apr_stat(&finfo, full_path, APR_FINFO_TYPE,
@@ -747,7 +747,7 @@
fr_sp -= 2;
if (fr_stack[fr_sp+1] == OBJ(PR_TRUE)) {
obj_p cmp_obj = NEW_OBJ(OBJ(PR_TRUE));
- set_attr(ist, cmp_obj, SYM(__CMPVALOBJ__), fr_stack[fr_sp]);
+ set_attr(ist, cmp_obj, SYM(CMPVALOBJ_), fr_stack[fr_sp]);
fr_push(cmp_obj);
} else
fr_push(OBJ(PR_FALSE));
@@ -815,11 +815,11 @@
obj_p synloc = frame->syn_locals;
obj_p sym = fr_data(1);
while (!synloc || !get_attr(ist, synloc, sym)) {
- if (!func || !(synloc = get_attr(ist, func, SYM(__SYN_LOCALS__)))) {
+ if (!func || !(synloc = get_attr(ist, func, SYM(SYN_LOCALS_)))) {
raise_exception(ist, OBJ(INTERPRETER_EXC), "outer.%s not found", as_str(ist, sym));
goto outref_brk;
}
- func = get_attr(ist, func, SYM(__SYN_FUNC__));
+ func = get_attr(ist, func, SYM(SYN_FUNC_));
}
fr_push(synloc);
fr_push(sym);
@@ -910,13 +910,13 @@
memcpy( ((list_p)(obj_data_p(fparams_obj)))->item,
fr_stack+fr_sp+2, fparams_len*sizeof(obj_p) );
listlen(fparams_obj) = fparams_len;
- set_attr(ist, func, SYM(__FPARAMS__), fparams_obj);
+ set_attr(ist, func, SYM(FPARAMS_), fparams_obj);
}
- set_attr(ist, func, SYM(__SYN_SELF__), frame->self);
- set_attr(ist, func, SYM(__GLOBALS__), frame->globals);
- set_attr(ist, func, SYM(__SYN_LOCALS__), frame->locals);
+ set_attr(ist, func, SYM(SYN_SELF_), frame->self);
+ set_attr(ist, func, SYM(GLOBALS_), frame->globals);
+ set_attr(ist, func, SYM(SYN_LOCALS_), frame->locals);
if (frame->func)
- set_attr(ist, func, SYM(__SYN_FUNC__), frame->func);
+ set_attr(ist, func, SYM(SYN_FUNC_), frame->func);
#ifdef DUMP_MODULE_CODE
{
char dump_name[256];
@@ -1025,7 +1025,7 @@
fr_sp -= 2;
if (!(bindee = fr_stack[fr_sp+1])) bindee = frame->self;
bound_meth = copy_object(ist, fr_stack[fr_sp]);
- set_attr(ist, bound_meth, SYM(__BINDOBJ__), bindee); IF_EXC_BREAK;
+ set_attr(ist, bound_meth, SYM(BINDOBJ_), bindee); IF_EXC_BREAK;
fr_push(bound_meth);
} break;
case OP_BIND: {
@@ -1034,7 +1034,7 @@
if (!(bindee = fr_stack[fr_sp+2])) bindee = fr_stack[fr_sp];
obj = get_item(ist, fr_stack[fr_sp], fr_stack[fr_sp+1]); IF_EXC_BREAK;
bound_meth = copy_object(ist, obj);
- set_attr(ist, bound_meth, SYM(__BINDOBJ__), bindee); IF_EXC_BREAK;
+ set_attr(ist, bound_meth, SYM(BINDOBJ_), bindee); IF_EXC_BREAK;
fr_push(bound_meth);
} break;
case OP_OBJCALL: {
@@ -1046,7 +1046,7 @@
if (!func_obj->data.ptr) goto no_func_ptr;
plist = get_func_params(ist, func_obj, param*2, fr_stack+fr_sp+2);
if ( !(self = fr_stack[fr_sp+1]) &&
- !(self = get_attr(ist, func_obj, SYM(__BINDOBJ__))) )
+ !(self = get_attr(ist, func_obj, SYM(BINDOBJ_))) )
self = frame->self;
IF_EXC_BREAK;
pre_call_lock(ist, self, plist); IF_EXC_BREAK;
@@ -1065,9 +1065,9 @@
IF_EXC_BREAK;
if (!func_obj->data.ptr) goto no_func_ptr;
new_locals = NEW_OBJ(NULL);
- syn_self = get_attr(ist, func_obj, SYM(__SYN_SELF__)); IF_EXC_BREAK;
+ syn_self = get_attr(ist, func_obj, SYM(SYN_SELF_)); IF_EXC_BREAK;
if ( !(self = fr_stack[fr_sp+1]) &&
- !(self = get_attr(ist, func_obj, SYM(__BINDOBJ__))) )
+ !(self = get_attr(ist, func_obj, SYM(BINDOBJ_))) )
self = frame->self;
IF_EXC_BREAK;
new_frame = create_frame( ist, syn_self, self, NULL, NULL,
@@ -1087,7 +1087,7 @@
fr_push(func_obj);
} else {
memmove(fr_stack+fr_sp+2, fr_stack+fr_sp+1, (param*2+1) * sizeof(obj_p));
- fr_stack[fr_sp+1] = SYM(__CALL__);
+ fr_stack[fr_sp+1] = SYM(CALL_);
goto get_func;
}
} break;
@@ -1173,7 +1173,7 @@
plist = get_func_params(ist, func_obj, param*2, fr_stack+fr_sp+3);
IF_EXC_BREAK;
if ( !(self = fr_stack[fr_sp+2]) &&
- !(self = get_attr(ist, func_obj, SYM(__BINDOBJ__))) )
+ !(self = get_attr(ist, func_obj, SYM(BINDOBJ_))) )
self = fr_stack[fr_sp];
IF_EXC_BREAK;
pre_call_lock(ist, self, plist); IF_EXC_BREAK;
@@ -1193,9 +1193,9 @@
IF_EXC_BREAK;
if (!func_obj->data.ptr) goto no_func_ptr2;
new_locals = NEW_OBJ(NULL);
- syn_self = get_attr(ist, func_obj, SYM(__SYN_SELF__)); IF_EXC_BREAK;
+ syn_self = get_attr(ist, func_obj, SYM(SYN_SELF_)); IF_EXC_BREAK;
if ( !(self = fr_stack[fr_sp+2]) &&
- !(self = get_attr(ist, func_obj, SYM(__BINDOBJ__))) )
+ !(self = get_attr(ist, func_obj, SYM(BINDOBJ_))) )
self = fr_stack[fr_sp];
IF_EXC_BREAK;
new_frame = create_frame( ist, syn_self, self, NULL, NULL,
@@ -1215,13 +1215,13 @@
fr_push(func_obj);
} else {
obj_p value;
- if (fr_stack[fr_sp+1] != SYM(__CALL__)) {
+ if (fr_stack[fr_sp+1] != SYM(CALL_)) {
value = get_attr_in_chain(ist, fr_stack[fr_sp],
fr_stack[fr_sp+1], NULL, NULL);
IF_EXC_BREAK;
if (value) {
fr_stack[fr_sp] = value;
- fr_stack[fr_sp+1] = SYM(__CALL__);
+ fr_stack[fr_sp+1] = SYM(CALL_);
goto get_func;
}
}
@@ -1298,7 +1298,7 @@
fr_sp -= param;
for (i=0; i < param; i++)
if (fr_stack[fr_sp+i]) { // NOT STACKLESS XXX
- obj_p str_obj = call_func0(ist, fr_stack[fr_sp+i], SYM(__STR__));
+ obj_p str_obj = call_func0(ist, fr_stack[fr_sp+i], SYM(STR_));
IF_EXC_BREAK;
printf("%s ", pr_strptr(str_obj));
} else if (i == param-1) goto endcase;
@@ -1426,7 +1426,7 @@
if (func_obj->data_type == DATA_TYPE_FUNCPTR) {
obj_p res, aself;
clist_p plist = get_func_params( ist, func_obj, parm_cnt, lbl_val_arr);
- if (! (aself = get_attr(ist, func_obj, SYM(__BINDOBJ__))) )
+ if (! (aself = get_attr(ist, func_obj, SYM(BINDOBJ_))) )
aself = self; if_exc_return 0;
pre_call_lock(ist, aself, plist); if (intrp_exobj) return NULL;
res = ((pr_func*)(func_obj->data.ptr))
@@ -1451,12 +1451,12 @@
}
frame = ist->frame;
new_locals = NEW_OBJ(NULL);
- syn_self = get_attr(ist, func_obj, SYM(__SYN_SELF__));
+ syn_self = get_attr(ist, func_obj, SYM(SYN_SELF_));
if (intrp_exobj) {
if (!func_sym) del_unlock(self);
return 0;
}
- if (! (aself = get_attr(ist, func_obj, SYM(__BINDOBJ__))) )
+ if (! (aself = get_attr(ist, func_obj, SYM(BINDOBJ_))) )
aself = self; if_exc_return 0;
new_frame = create_frame( ist, syn_self, aself, NULL, NULL, NULL,
new_locals, func_obj, NULL );
@@ -1507,7 +1507,7 @@
obj_p exc = list_item(ist, bl, i);
if (exc && exc != OBJ(EXCEPTION) && has_proto_QUES(ist, exc, OBJ(EXCEPTION))) {
- obj_p doc = get_attr(ist, exc, SYM(__DOC__));
+ obj_p doc = get_attr(ist, exc, SYM(DOC_));
if (doc && exc != orig_excobj)
printf("%s, ", pr_strptr(doc));
@@ -1611,7 +1611,7 @@
set_obj_doc(module, full_doc);
frame = ist->frame;
new_locals = NEW_OBJ(NULL);
- set_attr(ist, module, SYM(__LOCALS__), new_locals);
+ set_attr(ist, module, SYM(LOCALS_), new_locals);
new_frame = create_frame( ist, NULL, module, module, dest_module, dyn_locals, new_locals, NULL, code );
new_frame->called_from_c = TRUE;
if (frame) ist->frame->next_frame = new_frame;
@@ -1721,8 +1721,8 @@
lbl_val_arr[i+1] = list_item(ist, uthread->params, i/2);
}
new_locals = NEW_OBJ(NULL);
- set_attr(ist, thread_obj, SYM(__LOCALS__), new_locals);
- syn_self = get_attr(ist, func_obj, SYM(__SYN_SELF__));
+ set_attr(ist, thread_obj, SYM(LOCALS_), new_locals);
+ syn_self = get_attr(ist, func_obj, SYM(SYN_SELF_));
new_frame = create_frame( ist, syn_self, NULL, thread_obj, NULL, NULL, new_locals, func_obj, NULL );
new_frame->called_from_c = TRUE;
new_frame->prev_frame = NULL;
@@ -1911,7 +1911,7 @@
fprintf(fout,"assign_parm_cnt: %4d\n", code->assign_parm_cnt);
if (code->file_path)
fprintf(fout,"file_path: %s\n\n", code->file_path);
- if (func && (lbl_value_list = get_attr(ist, func, SYM(__FPARAMS__)))) {
+ if (func && (lbl_value_list = get_attr(ist, func, SYM(FPARAMS_)))) {
int llen = (int) list_len(ist, lbl_value_list);
if (llen) fprintf(fout,"\nFormal Params:\n");
for (i=0; i < llen; i += 2) {
Modified: trunk/src/memory_mgr.c
===================================================================
--- trunk/src/memory_mgr.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/memory_mgr.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -198,7 +198,7 @@
mm_write_lock(ist, mm_obj_list);
listlen(mm_obj_list) = 0;
write_unlock(ist, mm_obj_list);
- obj_list = call_func(ist, obj, SYM(__OBJLIST__), 2, mm_obj_act_param, NULL);
+ obj_list = call_func(ist, obj, SYM(OBJLIST_), 2, mm_obj_act_param, NULL);
if (ist->exception_obj) {
printf("\nWarning: memory manager unable to scan object: %lx\n",
(unsigned long)(uintptr_t)obj);
@@ -208,7 +208,7 @@
dump(ist, "mm-ist-dump.txt", ist->exception_obj);
pr_exit(1);
printf(" exception: %s\n",
- pr_strptr(get_attr(ist, ist->exception_obj, SYM(__DOC__))));
+ pr_strptr(get_attr(ist, ist->exception_obj, SYM(DOC_))));
ist->exception_obj = 0;
} else if (obj_list) {
int i, llen = (int) list_len(ist, obj_list);
@@ -265,7 +265,7 @@
while(obj) {
obj_count++;
if (obj->state != OBJ_STATE_NEW_OR_MARKED && !obj->del_locked) {
- call_func(ist, obj, SYM(__DEL__), 0, NULL, NULL);
+ call_func(ist, obj, SYM(DEL_), 0, NULL, NULL);
ist->exception_obj = 0;
mm_write_lock(ist, obj);
obj->state = OBJ_STATE_DELETED;
Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/object.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -1045,10 +1045,10 @@
char* ns = pr_malloc(strlen(str)+1);
strcpy(ns, str);
ns[strlen(str)-1] = 0;
- set_attr(ist, obj, SYM(__DOC__), NEW_STRING(ns));
+ set_attr(ist, obj, SYM(DOC_), NEW_STRING(ns));
pr_free(ns);
} else
- set_attr(ist, obj, SYM(__DOC__), NEW_STRING(str));
+ set_attr(ist, obj, SYM(DOC_), NEW_STRING(str));
}
//********************************* new_C_func_obj ******************************
@@ -1057,7 +1057,7 @@
func_obj->data_type = DATA_TYPE_FUNCPTR;
func_obj->data.ptr = func_ptr;
if (label_values_list)
- set_attr(ist, func_obj, SYM(__FPARAMS__), copy_list_obj(ist, label_values_list) );
+ set_attr(ist, func_obj, SYM(FPARAMS_), copy_list_obj(ist, label_values_list) );
return func_obj;
}
@@ -1104,7 +1104,7 @@
void dump_obj(isp ist, obj_p obj, int dep){
int i;
obj_p doc;
- doc = get_attr(ist, obj, SYM(__DOC__));
+ doc = get_attr(ist, obj, SYM(DOC_));
if (doc) {fprintf(fout,"obj(%lx) doc: %s\n", (unsigned long)(uintptr_t)obj, pr_strptr(doc)); prt_flg = 1;}
else {fprintf(fout,"%s\n",as_str(ist, obj)); prt_flg = 1;}
for(i=0; i < clist_len(object_list); i++)
Modified: trunk/src/object.h
===================================================================
--- trunk/src/object.h 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/object.h 2004-05-11 19:19:20 UTC (rev 465)
@@ -92,7 +92,7 @@
// example: OBJ(OBJECT) or OBJ(PR_TRUE)
#define OBJ(x) OBJ[x]
-// Use SYM(__XXX__) instead of sym(ist, "__xxx__") for speed.
+// Use SYM(XXX_) instead of sym(ist, "xxx_") for speed.
#define SYM(symenum) (sym_id_table[symenum].id)
#define ATTRS_MAX_PERCENT_FULL 66
Modified: trunk/src/parser_routines.c
===================================================================
--- trunk/src/parser_routines.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/parser_routines.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -721,7 +721,7 @@
code_p res;
int have_lparm = FALSE;
int k=0, len=0, stack_depth=7, max_stack_depth = 7;
- int have_cmp_op = (op >= __LT__QUES && op <= __EQ__QUES);
+ int have_cmp_op = (op >= LT_QUES_ && op <= EQ_QUES_);
if (lparm->cmp_expr && have_cmp_op) {
lparm->cmp_expr = FALSE;
calc_code(lparm, &len, &stack_depth, &max_stack_depth);
@@ -737,7 +737,7 @@
res->code_data[k++].data = OBJ(PR_FALSE);
res->code_data[k ].bytecode.opcode = OP_PUSH;
res->code_data[k++].bytecode.param = 3;
- res->code_data[k++].data = SYM(__GETCMP__);
+ res->code_data[k++].data = SYM(GETCMP_);
res->code_data[k++].data = NULL;
res->code_data[k ].bytecode.opcode = OP_CALL;
res->code_data[k++].bytecode.param = 0;
@@ -792,7 +792,7 @@
res->code_data[k++].bytecode.param = -1;
res->code_data[k ].bytecode.opcode = OP_PUSH;
res->code_data[k++].bytecode.param = 3;
- res->code_data[k++].data = SYM(__BOOL__QUES);
+ res->code_data[k++].data = SYM(BOOL_QUES_);
res->code_data[k++].data = NULL;
res->code_data[k ].bytecode.opcode = OP_CALL;
res->code_data[k++].bytecode.param = 0;
@@ -813,7 +813,7 @@
void add_skip_code1(code_p body, code_p res, int* k){
res->code_data[(*k) ].bytecode.opcode = OP_PUSH;
res->code_data[(*k)++].bytecode.param = 3;
- res->code_data[(*k)++].data = SYM(__BOOL__QUES);
+ res->code_data[(*k)++].data = SYM(BOOL_QUES_);
res->code_data[(*k)++].data = NULL;
res->code_data[(*k) ].bytecode.opcode = OP_CALL;
res->code_data[(*k)++].bytecode.param = 0;
@@ -950,7 +950,7 @@
add_code(ifexpr, res, k);
res->code_data[(*k) ].bytecode.opcode = OP_PUSH;
res->code_data[(*k)++].bytecode.param = 3;
- res->code_data[(*k)++].data = SYM(__BOOL__QUES);
+ res->code_data[(*k)++].data = SYM(BOOL_QUES_);
res->code_data[(*k)++].data = NULL;
res->code_data[(*k) ].bytecode.opcode = OP_CALL;
res->code_data[(*k)++].bytecode.param = 0;
@@ -1034,7 +1034,7 @@
add_code(expr, res, k);
res->code_data[*k ].bytecode.opcode = OP_PUSH;
res->code_data[(*k)++].bytecode.param = 3;
- res->code_data[(*k)++].data = SYM(__ITER__);
+ res->code_data[(*k)++].data = SYM(ITER_);
res->code_data[(*k)++].data = NULL;
res->code_data[*k ].bytecode.opcode = OP_CALL;
res->code_data[(*k)++].bytecode.param = 0;
@@ -1139,7 +1139,7 @@
add_code(expr, res, &k);
res->code_data[k ].bytecode.opcode = OP_PUSH;
res->code_data[k++].bytecode.param = 3;
- res->code_data[k++].data = SYM(__ITER__);
+ res->code_data[k++].data = SYM(ITER_);
res->code_data[k++].data = NULL;
res->code_data[k ].bytecode.opcode = OP_CALL;
res->code_data[k++].bytecode.param = 0;
@@ -1276,7 +1276,7 @@
add_code(expr, res, &k);
res->code_data[k ].bytecode.opcode = OP_PUSH;
res->code_data[k++].bytecode.param = 3;
- res->code_data[k++].data = SYM(__BOOL__QUES);
+ res->code_data[k++].data = SYM(BOOL_QUES_);
res->code_data[k++].data = NULL;
res->code_data[k ].bytecode.opcode = OP_CALL;
res->code_data[k++].bytecode.param = 0;
@@ -1316,7 +1316,7 @@
add_code(cond, res, &k);
res->code_data[k ].bytecode.opcode = OP_PUSH;
res->code_data[k++].bytecode.param = 3;
- res->code_data[k++].data = SYM(__BOOL__QUES);
+ res->code_data[k++].data = SYM(BOOL_QUES_);
res->code_data[k++].data = NULL;
res->code_data[k ].bytecode.opcode = OP_CALL;
res->code_data[k++].bytecode.param = 0;
@@ -1394,7 +1394,7 @@
}
pr_assert(res->len == k);
if (body->doc_flg)
- set_attr(IST, func, SYM(__DOC__), (obj_p)(body->code_data[1].data));
+ set_attr(IST, func, SYM(DOC_), (obj_p)(body->code_data[1].data));
return debug_retrn(__LINE__, res);
}
code_p print_arglist(void* param, clist_p list){
Modified: trunk/src/prmalloc.c
===================================================================
--- trunk/src/prmalloc.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/prmalloc.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -48,7 +48,7 @@
*
* -- Don't use these functions in your code (to avoid mixing allocators) --
*
- * Redefine these __only__ if you are using a 3rd party general purpose
+ * Redefine these only_ if you are using a 3rd party general purpose
* allocator which exports functions with names _other_ than the standard
* malloc, calloc, realloc, free.
*/
Modified: trunk/src/prothon.y
===================================================================
--- trunk/src/prothon.y 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/prothon.y 2004-05-11 19:19:20 UTC (rev 465)
@@ -450,47 +450,47 @@
| ass_expr_list ',' expr { $$ = append_list(yylex_param, $1, $3); }
;
ass_add_statement:
- target_param ADD_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IADD__, __ADD__); }
+ target_param ADD_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IADD_, ADD_); }
;
ass_sub_statement:
- target_param SUB_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __ISUB__, __SUB__); }
+ target_param SUB_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, ISUB_, SUB_); }
;
ass_mul_statement:
- target_param MUL_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IMUL__, __MUL__); }
+ target_param MUL_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IMUL_, MUL_); }
;
ass_div_statement:
- target_param DIV_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IDIV__, __DIV__); }
+ target_param DIV_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IDIV_, DIV_); }
;
ass_tdv_statement:
- target_param TDV_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IFLOORDIV__, __FLOORDIV__); }
+ target_param TDV_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IFLOORDIV_, FLOORDIV_); }
;
ass_rem_statement:
- target_param REM_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IMOD__, __MOD__); }
+ target_param REM_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IMOD_, MOD_); }
;
ass_band_statement:
- target_param BAND_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IAND__, __AND__); }
+ target_param BAND_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IAND_, AND_); }
;
ass_bor_statement:
- target_param BOR_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IOR__, __OR__); }
+ target_param BOR_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IOR_, OR_); }
;
ass_bxor_statement:
- target_param BXOR_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IXOR__, __XOR__); }
+ target_param BXOR_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IXOR_, XOR_); }
;
ass_shr_statement:
- target_param RSH_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IRSHIFT__, __RSHIFT__); }
+ target_param RSH_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IRSHIFT_, RSHIFT_); }
;
ass_shl_statement:
- target_param LSH_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __ILSHIFT__, __LSHIFT__); }
+ target_param LSH_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, ILSHIFT_, LSHIFT_); }
;
ass_exp_statement:
- target_param EXP_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, __IPOW__, __POW__); }
+ target_param EXP_EQ expr { $$ = ref_expr_to_ass_op(yylex_param, $1, $3, IPOW_, POW_); }
;
print_statement:
PRINT arg_list { $$ = print_arglist(yylex_param, $2); }
;
is_not_check:
- /* empty string */ { $$ = (void *)(unsigned long)__IS__QUES; }
- | NOT { $$ = (void *)(unsigned long)__ISNOT__QUES; }
+ /* empty string */ { $$ = (void *)(unsigned long)IS_QUES_; }
+ | NOT { $$ = (void *)(unsigned long)ISNOT_QUES_; }
;
expr:
expr OR expr
@@ -500,56 +500,56 @@
{ $$ = expr_andor_expr(yylex_param, $1, $3, AND_FLAG); }
| expr IN_ expr
- { $$ = binary(yylex_param, $1, __IN__QUES, $3); }
+ { $$ = binary(yylex_param, $1, IN_QUES_, $3); }
| expr NOT IN_ expr %prec NOT_IN
- { $$ = binary(yylex_param, $1, __NOTIN__QUES, $4); }
+ { $$ = binary(yylex_param, $1, NOTIN_QUES_, $4); }
| expr IS is_not_check expr
{ $$ = binary(yylex_param, $1, (int)(intptr_t)$3, $4); }
| NOT expr
- { $$ = unary(yylex_param, __NOT__QUES, $2); }
+ { $$ = unary(yylex_param, NOT_QUES_, $2); }
| expr '<' expr %prec EQ
- { $$ = binary(yylex_param, $1, __LT__QUES, $3); }
+ { $$ = binary(yylex_param, $1, LT_QUES_, $3); }
| expr LE expr %prec EQ
- { $$ = binary(yylex_param, $1, __LE__QUES, $3); }
+ { $$ = binary(yylex_param, $1, LE_QUES_, $3); }
| expr '>' expr %prec EQ
- { $$ = binary(yylex_param, $1, __GT__QUES , $3); }
+ { $$ = binary(yylex_param, $1, GT_QUES_ , $3); }
| expr GE expr %prec EQ
- { $$ = binary(yylex_param, $1, __GE__QUES, $3); }
+ { $$ = binary(yylex_param, $1, GE_QUES_, $3); }
| expr NE expr %prec EQ
- { $$ = binary(yylex_param, $1, __NE__QUES, $3); }
+ { $$ = binary(yylex_param, $1, NE_QUES_, $3); }
| expr EQ expr %prec EQ
- { $$ = binary(yylex_param, $1, __EQ__QUES, $3); }
+ { $$ = binary(yylex_param, $1, EQ_QUES_, $3); }
| expr '|' expr
- { $$ = binary(yylex_param, $1, __OR__, $3); }
+ { $$ = binary(yylex_param, $1, OR_, $3); }
| expr '^' expr
- { $$ = binary(yylex_param, $1, __XOR__, $3); }
+ { $$ = binary(yylex_param, $1, XOR_, $3); }
| expr '&' expr
- { $$ = binary(yylex_param, $1, __AND__, $3); }
+ { $$ = binary(yylex_param, $1, AND_, $3); }
- | expr LSH expr { $$ = binary(yylex_param, $1, __LSHIFT__, $3); }
- | expr RSH expr { $$ = binary(yylex_param, $1, __RSHIFT__, $3); }
- | expr '+' expr { $$ = binary(yylex_param, $1, __ADD__, $3); }
- | expr '-' expr { $$ = binary(yylex_param, $1, __SUB__, $3); }
- | expr '*' expr { $$ = binary(yylex_param, $1, __MUL__, $3); }
- | expr '/' expr { $$ = binary(yylex_param, $1, __DIV__, $3); }
- | expr TDV expr { $$ = binary(yylex_param, $1, __FLOORDIV__, $3); }
- | expr '%' expr { $$ = binary(yylex_param, $1, __MOD__, $3); }
- | '+' expr %prec UPL { $$ = unary(yylex_param, __POS__, $2); }
- | '-' expr %prec UMI { $$ = unary(yylex_param, __NEG__, $2); }
- | '~' expr { $$ = unary(yylex_param, __INV__, $2); }
- | expr EXP expr { $$ = binary(yylex_param, $1, __POW__, $3); }
+ | expr LSH expr { $$ = binary(yylex_param, $1, LSHIFT_, $3); }
+ | expr RSH expr { $$ = binary(yylex_param, $1, RSHIFT_, $3); }
+ | expr '+' expr { $$ = binary(yylex_param, $1, ADD_, $3); }
+ | expr '-' expr { $$ = binary(yylex_param, $1, SUB_, $3); }
+ | expr '*' expr { $$ = binary(yylex_param, $1, MUL_, $3); }
+ | expr '/' expr { $$ = binary(yylex_param, $1, DIV_, $3); }
+ | expr TDV expr { $$ = binary(yylex_param, $1, FLOORDIV_, $3); }
+ | expr '%' expr { $$ = binary(yylex_param, $1, MOD_, $3); }
+ | '+' expr %prec UPL { $$ = unary(yylex_param, POS_, $2); }
+ | '-' expr %prec UMI { $$ = unary(yylex_param, NEG_, $2); }
+ | '~' expr { $$ = unary(yylex_param, INV_, $2); }
+ | expr EXP expr { $$ = binary(yylex_param, $1, POW_, $3); }
| list_comp
| obj
;
Modified: trunk/src/symbol.c
===================================================================
--- trunk/src/symbol.c 2004-05-10 07:14:50 UTC (rev 464)
+++ trunk/src/symbol.c 2004-05-11 19:19:20 UTC (rev 465)
@@ -61,98 +61,98 @@
// this must match exact order in enum sym_enum_t in bytecodes.h
sym_id_entry_t sym_id_table[SYM_ENUM_COUNT] = {
- { "__string__", 0 }, // __string__ must be first (==0)
- { "__not__QUES", 0 },
- { "__pos__", 0 },
- { "__neg__", 0 },
- { "__invert__", 0 },
- { "__in__QUES", 0 },
- { "__notIn__QUES", 0 },
- { "__is__QUES", 0 },
- { "__isNot__QUES", 0 },
- { "__lt__QUES", 0 },
- { "__le__QUES", 0 },
- { "__gt__QUES", 0 },
- { "__ge__QUES", 0 },
- { "__ne__QUES", 0 },
- { "__eq__QUES", 0 },
+ { "string_", 0 }, // string_ must be first (==0)
+ { "not_QUES_", 0 },
+ { "pos_", 0 },
+ { "neg_", 0 },
+ { "invert_", 0 },
+ { "in_QUES_", 0 },
+ { "notIn_QUES_", 0 },
+ { "is_QUES_", 0 },
+ { "isNot_QUES_", 0 },
+ { "lt_QUES_", 0 },
+ { "le_QUES_", 0 },
+ { "gt_QUES_", 0 },
+ { "ge_QUES_", 0 },
+ { "ne_QUES_", 0 },
+ { "eq_QUES_", 0 },
{ "cmp", 0 },
- { "__or__", 0 },
- { "__xor__", 0 },
- { "__and__", 0 },
- { "__rShift__", 0 },
- { "__lShift__", 0 },
- { "__add__", 0 },
- { "__sub__", 0 },
- { "__mul__", 0 },
- { "__div__", 0 },
- { "__floorDiv__", 0 },
- { "__mod__", 0 },
- { "__pow__", 0 },
- { "__ior__", 0 },
- { "__ixor__", 0 },
- { "__iand__", 0 },
- { "__irshift__", 0 },
- { "__ilshift__", 0 },
- { "__iadd__", 0 },
- { "__isub__", 0 },
- { "__imul__", 0 },
- { "__idiv__", 0 },
- { "__ifloordiv__", 0 },
- { "__imod__", 0 },
- { "__ipow__", 0 },
- { "__rIn__QUES", 0 },
- { "__rNotIn__QUES", 0 },
- { "__rlt__", 0 },
- { "__rle__", 0 },
- { "__rgt__", 0 },
- { "__rge__", 0 },
- { "__rrshift__", 0 },
- { "__rlshift__", 0 },
- { "__rSub__", 0 },
- { "__rDiv__", 0 },
- { "__rfloordiv__", 0 },
- { "__rmod__", 0 },
- { "__rPow__", 0 },
- { "__rCmp__", 0 },
- { "__init__", 0 },
- { "__bool__QUES", 0 },
- { "__getCmp__", 0 },
- { "__cmpvalobj__", 0 },
- { "__iter__", 0 },
- { "__id__", 0 },
- { "__doc__", 0 },
- { "__hash__", 0 },
- { "__fparams__", 0 },
- { "__globals__", 0 },
- { "__syn_func__", 0 },
- { "__syn_locals__", 0 },
- { "__locals__", 0 },
- { "__syn_self__", 0 },
+ { "or_", 0 },
+ { "xor_", 0 },
+ { "and_", 0 },
+ { "rShift_", 0 },
+ { "lShift_", 0 },
+ { "add_", 0 },
+ { "sub_", 0 },
+ { "mul_", 0 },
+ { "div_", 0 },
+ { "floorDiv_", 0 },
+ { "mod_", 0 },
+ { "pow_", 0 },
+ { "ior_", 0 },
+ { "ixor_", 0 },
+ { "iand_", 0 },
+ { "irshift_", 0 },
+ { "ilshift_", 0 },
+ { "iadd_", 0 },
+ { "isub_", 0 },
+ { "imul_", 0 },
+ { "idiv_", 0 },
+ { "ifloordiv_", 0 },
+ { "imod_", 0 },
+ { "ipow_", 0 },
+ { "rIn_QUES_", 0 },
+ { "rNotIn_QUES_", 0 },
+ { "rlt_", 0 },
+ { "rle_", 0 },
+ { "rgt_", 0 },
+ { "rge_", 0 },
+ { "rrshift_", 0 },
+ { "rlshift_", 0 },
+ { "rSub_", 0 },
+ { "rDiv_", 0 },
+ { "rfloordiv_", 0 },
+ { "rmod_", 0 },
+ { "rPow_", 0 },
+ { "rCmp_", 0 },
+ { "init_", 0 },
+ { "bool_QUES_", 0 },
+ { "getCmp_", 0 },
+ { "cmpvalobj_", 0 },
+ { "iter_", 0 },
+ { "id_", 0 },
+ { "doc_", 0 },
+ { "hash_", 0 },
+ { "fparams_", 0 },
+ { "globals_", 0 },
+ { "syn_func_", 0 },
+ { "syn_locals_", 0 },
+ { "locals_", 0 },
+ { "syn_self_", 0 },
{ "rparam", 0 },
{ "param1", 0 },
{ "param2", 0 },
{ "args", 0 },
{ "kwargs", 0 },
- { "__copy__", 0 },
- { "__covers__QUES", 0 },
- { "__coerce__", 0 },
- { "__str__", 0 },
+ { "copy_", 0 },
+ { "covers_QUES_", 0 },
+ { "coerce_", 0 },
+ { "str_", 0 },
{ "next", 0 },
- { "__getItem__", 0 },
- { "__setItem__", 0 },
- { "__delItem__", 0 },
- { "__objList__", 0 }, // f3
- { "__cDataLen__", 0 },
- { "__del__", 0 },
+ { "getItem_", 0 },
+ { "setItem_", 0 },
+ { "delItem_", 0 },
+ { "objList_", 0 }, // f3
+ { "cDataLen_", 0 },
+ { "del_", 0 },
{ "len", 0 },
{ "max", 0 },
{ "min", 0 },
{ "copy", 0 },
- { "__toStorProxy__", 0 },
- { "__fromStorProxy__", 0},
- { "__call__", 0},
- { "__bindObj__", 0},
+ { "toStorProxy_", 0 },
+ { "fromStorProxy_", 0},
+ { "call_", 0},
+ { "bindObj_", 0},
};
typedef struct trie_node_s* trie_p;
@@ -259,7 +259,7 @@
char* symch(isp ist, obj_p sym_obj){
obj_p s_obj;
if (sym_obj) {
- s_obj = get_attr(ist, sym_obj, SYM(__STRING__));
+ s_obj = get_attr(ist, sym_obj, SYM(STRING_));
if (s_obj) {
char* tmp = pr_strptr(s_obj);
return tmp;
@@ -271,7 +271,7 @@
//********************************* str_sym ***********************************
obj_p str_sym( isp ist, obj_p self,
int pcnt, obj_p* lbl_parm_arr, obj_p dyn_locals ){
- return get_attr(ist, self, SYM(__STRING__));
+ return get_attr(ist, self, SYM(STRING_));
}
//********************************* init_symbol *******************************
@@ -279,5 +279,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_C_func_obj(ist, str_sym, NULL));
+ set_attr(ist, OBJ(SYMBOL_PROTO), SYM(STR_), new_C_func_obj(ist, str_sym, NULL));
}