rev 334 - in trunk: include/prothon modules/File modules/Prosist modules/Re src
SVN User <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-04-13 00:56:23 -0400 (Tue, 13 Apr 2004)
New Revision: 334
Modified:
trunk/include/prothon/prothon.h
trunk/include/prothon/prothon_dll.h
trunk/modules/File/File.c
trunk/modules/File/file.vcproj
trunk/modules/Prosist/Prosist.c
trunk/modules/Re/Re.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/interp.c
trunk/src/memory_mgr.c
trunk/src/object.c
trunk/src/parser_routines.c
trunk/src/symbol.c
Log:
added SQLite module (untested)
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/include/prothon/prothon.h 2004-04-13 04:56:23 UTC (rev 334)
@@ -141,11 +141,11 @@
} obj_state_t;
typedef enum {
- OBJ_TYPE_NONE = 0,
- OBJ_TYPE_IMMDATA,
- OBJ_TYPE_DATAPTR,
- OBJ_TYPE_FUNCPTR
-} obj_type_t;
+ DATA_TYPE_NONE = 0,
+ DATA_TYPE_IMMDATA,
+ DATA_TYPE_DATAPTR,
+ DATA_TYPE_FUNCPTR
+} data_type_t;
typedef union {
attr_p attrs;
@@ -173,7 +173,7 @@
typedef struct obj_s {
obj_state_t state :3; // 2 when not debugging
- obj_type_t data_type :3; // 2 when not debugging
+ data_type_t data_type :3; // 2 when not debugging
u8_t imm_data_len :4;
access_t rd_access :2;
access_t wr_access :2;
@@ -530,7 +530,7 @@
if (aprerr != APR_SUCCESS)
// SWITCH_PROTO_TO: Replace all old protos with a new single proto object
-void switch_proto_to(isp ist, obj_p obj, obj_p new_proto);
+void switch_proto(isp ist, obj_p obj, obj_p new_proto);
//***************** SPECIFIC OBJECT TYPE FUNCTIONS **************************
@@ -866,21 +866,21 @@
// OBJ_DATA_P: returns the C ptr to the data area for an object.
#define obj_data_p(obj) \
( !obj ? NULL : \
- ( (obj)->data_type == OBJ_TYPE_IMMDATA ? &((obj)->data) : \
- ( (obj)->data_type == OBJ_TYPE_DATAPTR ? (obj)->data.ptr : NULL ) ) )
+ ( (obj)->data_type == DATA_TYPE_IMMDATA ? &((obj)->data) : \
+ ( (obj)->data_type == DATA_TYPE_DATAPTR ? (obj)->data.ptr : NULL ) ) )
// STRCH: macro to retreive string object as a C string
// warning, string objects may contain null chars so C string result may be short
#define strch(str_obj) \
( !(str_obj) ? NULL : \
- (str_obj)->data_type == OBJ_TYPE_IMMDATA ? (str_obj)->data.str : \
- ((str_obj)->data_type == OBJ_TYPE_DATAPTR ? ((pr_str_p)((str_obj)->data.ptr))->str : NULL) )
+ (str_obj)->data_type == DATA_TYPE_IMMDATA ? (str_obj)->data.str : \
+ ((str_obj)->data_type == DATA_TYPE_DATAPTR ? ((pr_str_p)((str_obj)->data.ptr))->str : NULL) )
// pr_strlen: macro to retreive string length of a string object
// warning, string objects may contain null chars that this length ignores
#define pr_strlen(str_obj) \
- ( ((str_obj)->data_type == OBJ_TYPE_IMMDATA) ? (size_t)((str_obj)->imm_data_len) : \
- (((str_obj)->data_type == OBJ_TYPE_DATAPTR) ? ((pr_str_p)((str_obj)->data.ptr))->len : 0 ) )
+ ( ((str_obj)->data_type == DATA_TYPE_IMMDATA) ? (size_t)((str_obj)->imm_data_len) : \
+ (((str_obj)->data_type == DATA_TYPE_DATAPTR) ? ((pr_str_p)((str_obj)->data.ptr))->len : 0 ) )
//************************** OBJECT LOCKING ***********************************
@@ -929,7 +929,7 @@
#define wrlock_rtrn(obj) if (write_lock(ist, obj)) return
-//************************** UNMUTABLE BIT ***********************************
+//************************** IMMUTABLE BIT ***********************************
// Each object has a bit called immutable. This bit is effectively a write-protect
// bit for the object. When set the object cannot be modified. Any attempt
// to write_lock the object with immutable set will cause an exception. This bit
Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/include/prothon/prothon_dll.h 2004-04-13 04:56:23 UTC (rev 334)
@@ -70,7 +70,7 @@
int (*ins_proto)(isp ist, obj_p obj, obj_p proto, int pos);
int (*del_proto)(isp ist, obj_p obj, obj_p proto);
int (*has_proto_QUES)(isp ist, obj_p obj, obj_p obj_proto);
- void (*switch_proto_to)(isp ist, obj_p obj, obj_p new_proto);
+ void (*switch_proto)(isp ist, obj_p obj, obj_p new_proto);
obj_p (*list_append)(isp ist, obj_p list_obj, obj_p item);
obj_p (*list_item)(isp ist, obj_p list, int i);
size_t (*list_len)(isp ist, obj_p list);
@@ -198,7 +198,7 @@
#define ins_proto (*services->ins_proto)
#define del_proto (*services->del_proto)
#define has_proto_QUES (*services->has_proto_QUES)
-#define switch_proto_to (*services->switch_proto_to)
+#define switch_proto (*services->switch_proto)
#define list_append (*services->list_append)
#define list_item (*services->list_item)
#define list_len (*services->list_len)
Modified: trunk/modules/File/File.c
===================================================================
--- trunk/modules/File/File.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/modules/File/File.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -100,7 +100,7 @@
filep->stream = fp;
filep->pool = subpool;
filep->flags = flags;
- file_obj->data_type = OBJ_TYPE_DATAPTR;
+ file_obj->data_type = DATA_TYPE_DATAPTR;
file_obj->data.ptr = filep;
file_obj->rd_access = ACC_USER1;
file_obj->wr_access = ACC_USER1;
@@ -293,7 +293,7 @@
size = (size_t) size_in;
str_obj = new_object(ist, OBJ(STRING_PROTO));
if (size < IMMEDIATE_DATA_LEN) {
- str_obj->data_type = OBJ_TYPE_IMMDATA;
+ str_obj->data_type = DATA_TYPE_IMMDATA;
buf = str_obj->data.str;
} else {
obj_str = obj_malloc(str_obj, sizeof(pr_str_t)+size+1);
@@ -310,7 +310,7 @@
while(aprerr != APR_EOF && (readall || total_read < size)) {
size_t next_read = (readall ? size : size - total_read);
size_t new_len = total_read + next_read;
- if (str_obj->data_type == OBJ_TYPE_IMMDATA && new_len >= IMMEDIATE_DATA_LEN) {
+ if (str_obj->data_type == DATA_TYPE_IMMDATA && new_len >= IMMEDIATE_DATA_LEN) {
obj_str = obj_malloc(str_obj, sizeof(pr_str_t)+new_len+1);
buf = obj_str->str;
} else {
@@ -326,7 +326,7 @@
}
total_read += num_read;
}
- if (str_obj->data_type == OBJ_TYPE_IMMDATA)
+ if (str_obj->data_type == DATA_TYPE_IMMDATA)
str_obj->imm_data_len = (int) total_read;
else {
obj_str = obj_realloc(ist, str_obj, sizeof(pr_str_t)+total_read+1);
@@ -373,7 +373,7 @@
size = (size_t) size_in;
str_obj = new_object(ist, OBJ(STRING_PROTO));
if (size < IMMEDIATE_DATA_LEN) {
- str_obj->data_type = OBJ_TYPE_IMMDATA;
+ str_obj->data_type = DATA_TYPE_IMMDATA;
buf = str_obj->data.str;
} else {
obj_str = obj_malloc(str_obj, sizeof(pr_str_t)+size+1);
@@ -389,7 +389,7 @@
while (aprerr != APR_EOF && buf[total_read-1] != '\n' && (readall || total_read < size)) {
size_t next_read = (readall ? size : size - total_read);
size_t new_len = total_read + next_read;
- if (str_obj->data_type == OBJ_TYPE_IMMDATA && new_len >= IMMEDIATE_DATA_LEN) {
+ if (str_obj->data_type == DATA_TYPE_IMMDATA && new_len >= IMMEDIATE_DATA_LEN) {
obj_str = obj_malloc(str_obj, sizeof(pr_str_t)+new_len+1);
buf = obj_str->str;
} else {
@@ -404,7 +404,7 @@
}
total_read = strlen(buf);
}
- if (str_obj->data_type == OBJ_TYPE_IMMDATA)
+ if (str_obj->data_type == DATA_TYPE_IMMDATA)
str_obj->imm_data_len = (int) total_read;
else {
obj_str = obj_realloc(ist, str_obj, sizeof(pr_str_t)+total_read+1);
@@ -454,7 +454,7 @@
while (aprerr != APR_EOF && (readall || total_read < size)) {
str_obj = new_object(ist, OBJ(STRING_PROTO));
if (size < IMMEDIATE_DATA_LEN) {
- str_obj->data_type = OBJ_TYPE_IMMDATA;
+ str_obj->data_type = DATA_TYPE_IMMDATA;
buf = str_obj->data.str;
} else {
obj_str = obj_malloc(str_obj, sizeof(pr_str_t)+size+1);
@@ -472,7 +472,7 @@
(readall || total_read < size) ) {
size_t next_read = (readall ? size : size - total_read);
size_t new_len = num_read + next_read;
- if (str_obj->data_type == OBJ_TYPE_IMMDATA && new_len >= IMMEDIATE_DATA_LEN) {
+ if (str_obj->data_type == DATA_TYPE_IMMDATA && new_len >= IMMEDIATE_DATA_LEN) {
obj_str = obj_malloc(str_obj, sizeof(pr_str_t)+new_len+1);
buf = obj_str->str;
} else {
@@ -488,7 +488,7 @@
}
total_read += num_read = strlen(buf);
}
- if (str_obj->data_type == OBJ_TYPE_IMMDATA)
+ if (str_obj->data_type == DATA_TYPE_IMMDATA)
str_obj->imm_data_len = (int) num_read;
else {
obj_str = obj_realloc(ist, str_obj, sizeof(pr_str_t)+num_read+1);
@@ -692,7 +692,7 @@
DEF(Dir, __init__, list2(ist, sym(ist, "path"), NULL)) {
obj_p file_obj = new_string_obj(ist, strch(parms[1]));
- switch_proto_to(ist, file_obj, Dir_OBJ);
+ switch_proto(ist, file_obj, Dir_OBJ);
return file_obj;
}
Modified: trunk/modules/File/file.vcproj
===================================================================
--- trunk/modules/File/file.vcproj 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/modules/File/file.vcproj 2004-04-13 04:56:23 UTC (rev 334)
@@ -129,7 +129,7 @@
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm">
<File
- RelativePath="File.c">
+ RelativePath=".\File.c">
</File>
</Filter>
<Filter
Modified: trunk/modules/Prosist/Prosist.c
===================================================================
--- trunk/modules/Prosist/Prosist.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/modules/Prosist/Prosist.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -51,7 +51,7 @@
*/
-// Re.c - regex using POSIX regex()
+// Prosist.c - peristant Prothon db
#include <stdio.h>
#include <string.h>
@@ -140,7 +140,7 @@
root_obj = parms[3];
if (parms[5] == OBJ(PR_TRUE)) overwrite = TRUE;
- self->data_type = OBJ_TYPE_DATAPTR;
+ self->data_type = DATA_TYPE_DATAPTR;
dbdatap = self->data.ptr = pr_malloc(sizeof(dbdata_t));
//dbdatap->obj_map = new_dict_obj(ist, INITIAL_NUMBER_OF_OBJECTS);
Modified: trunk/modules/Re/Re.c
===================================================================
--- trunk/modules/Re/Re.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/modules/Re/Re.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -123,7 +123,7 @@
return NULL;
}
re_obj = new_object(ist, ReCompiled_OBJ);
- re_obj->data_type = OBJ_TYPE_DATAPTR;
+ re_obj->data_type = DATA_TYPE_DATAPTR;
re_obj->data.ptr = e;
set_attr(ist, re_obj, sym(ist, "pattern"), parms[1]);
set_attr(ist, re_obj, sym(ist, "flags"), parms[3]);
@@ -234,7 +234,7 @@
return NULL;
}
match_obj = new_list_obj(ist, (ngrps+1)*2);
- switch_proto_to(ist, match_obj, ReMatch_OBJ);
+ switch_proto(ist, match_obj, ReMatch_OBJ);
for(i=0; i <= numgrps(self); i++) {
if (m[i].rm_so > -1) last_index = i;
list_append(ist, match_obj, new_int_obj(ist, m[i].rm_so));
@@ -416,7 +416,7 @@
return NULL;
}
match_obj = new_list_obj(ist, (ngrps+1)*2);
- switch_proto_to(ist, match_obj, ReMatch_OBJ);
+ switch_proto(ist, match_obj, ReMatch_OBJ);
set_attr(ist, match_obj, sym(ist, "re"), self);
set_attr(ist, match_obj, sym(ist, "string"), parms[3]);
lastindex_obj = new_int_obj(ist, last_index);
Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/builtins-core.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -104,7 +104,7 @@
raise_exception(ist, OBJ(TYPE_EXC), "clone() not supported on this object");
return NULL;
}
- if (self->data_type == OBJ_TYPE_DATAPTR) {
+ if (self->data_type == DATA_TYPE_DATAPTR) {
size_t cdata_size;
obj_p cdata_len = call_func0(ist, self, SYM(__CDATALEN__));
if (!cdata_len) {
@@ -131,7 +131,7 @@
DEF(Object, set_proto, FORM_RPARAM) {
read_unlock(ist, self);
- switch_proto_to(ist, self, parms[1]);
+ switch_proto(ist, self, parms[1]);
read_lock(ist, self);
return NULL;
}
Modified: trunk/src/builtins-dict.c
===================================================================
--- trunk/src/builtins-dict.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/builtins-dict.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -77,7 +77,7 @@
MODULE_SET_DOC(Dict, "dictionary object prototype");
set_attr(ist, OBJ(OBJECT), sym(ist, "Dict"), Dict_OBJ);
- Dict_OBJ->data_type = OBJ_TYPE_DATAPTR;
+ Dict_OBJ->data_type = DATA_TYPE_DATAPTR;
dict = obj_malloc(Dict_OBJ, (DICT_OVERHEAD+DEFAULT_INITIAL_DICT_SIZE)*sizeof(dict_t));
memset(dict, 0, (DICT_OVERHEAD+DEFAULT_INITIAL_DICT_SIZE)*sizeof(dict_t));
dictsize(dict) = DEFAULT_INITIAL_DICT_SIZE;
@@ -92,7 +92,7 @@
DEF(Dict, __init__, NULL) {
dict_p dict;
- self->data_type = OBJ_TYPE_DATAPTR;
+ self->data_type = DATA_TYPE_DATAPTR;
dict = obj_malloc(self, (DICT_OVERHEAD+DEFAULT_INITIAL_DICT_SIZE)*sizeof(dict_t));
memset(dict, 0, (DICT_OVERHEAD+DEFAULT_INITIAL_DICT_SIZE)*sizeof(dict_t));
dictsize(dict) = DEFAULT_INITIAL_DICT_SIZE;
@@ -228,7 +228,7 @@
DEF(Dict, __gen__, NULL) {
obj_p list_obj, gen_obj = new_object(ist, DictGen_OBJ);
- gen_obj->data_type = OBJ_TYPE_DATAPTR;
+ gen_obj->data_type = DATA_TYPE_DATAPTR;
gen_obj->data.ptr = list_obj = dict_keys(ist, self);
listlen(list_obj) = 0;
Modified: trunk/src/builtins-float.c
===================================================================
--- trunk/src/builtins-float.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/builtins-float.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -86,17 +86,17 @@
set_attr(ist, OBJ(OBJECT), sym(ist, "Float"), OBJ(FLOAT_PROTO));
set_attr(ist, OBJ(OBJECT), sym(ist, "Imaginary"), OBJ(IMAG_PROTO));
- Float_OBJ->data_type = OBJ_TYPE_IMMDATA;
+ Float_OBJ->data_type = DATA_TYPE_IMMDATA;
Float_OBJ->imm_data_len = IMMEDIATE_DATA_LEN;
Float_OBJ->data.f64 = 0.0;
- //Imag_OBJ->data_type = OBJ_TYPE_IMMDATA;
+ //Imag_OBJ->data_type = DATA_TYPE_IMMDATA;
//Imag_OBJ->imm_data_len = IMMEDIATE_DATA_LEN;
//Imag_OBJ->data.f64 = 0.0;
}
DEF(Float, __init__, NULL) {
- self->data_type = OBJ_TYPE_IMMDATA;
+ self->data_type = DATA_TYPE_IMMDATA;
self->imm_data_len = IMMEDIATE_DATA_LEN;
self->data.f64 = 0.0;
return OBJ(NONE);
Modified: trunk/src/builtins-int.c
===================================================================
--- trunk/src/builtins-int.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/builtins-int.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -91,13 +91,13 @@
add_doc_to_obj(ist, OBJ(LONG_PROTO), "Long integer number object prototype");
set_immutable(OBJ(LONG_PROTO));
- Int_OBJ->data_type = OBJ_TYPE_IMMDATA;
+ Int_OBJ->data_type = DATA_TYPE_IMMDATA;
Int_OBJ->imm_data_len = IMMEDIATE_DATA_LEN;
Int_OBJ->data.i64 = 0;
}
DEF(Int, __init__, NULL) {
- self->data_type = OBJ_TYPE_IMMDATA;
+ self->data_type = DATA_TYPE_IMMDATA;
self->imm_data_len = IMMEDIATE_DATA_LEN;
self->data.i64 = 0;
return OBJ(NONE);
Modified: trunk/src/builtins-list.c
===================================================================
--- trunk/src/builtins-list.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/builtins-list.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -92,7 +92,7 @@
MODULE_SET_DOC(List, "object prototype");
set_attr(ist, OBJ(OBJECT), sym(ist, "List"), List_OBJ);
- List_OBJ->data_type = OBJ_TYPE_DATAPTR;
+ List_OBJ->data_type = DATA_TYPE_DATAPTR;
lstp = List_OBJ->data.ptr = pr_malloc(list_sizeof(2));
lstpsize(lstp) = 2;
lstplen(lstp) = 0;
@@ -101,7 +101,7 @@
DEF(List, __init__, NULL) {
list_p lstp;
- self->data_type = OBJ_TYPE_DATAPTR;
+ self->data_type = DATA_TYPE_DATAPTR;
lstp = self->data.ptr = pr_malloc(list_sizeof(2));
lstpsize(lstp) = 2;
lstplen(lstp) = 0;
@@ -367,7 +367,7 @@
raise_exception(ist, OBJ(OUTOFMEMORY_EXC), "memory allocation failed for list multiplication");
return NULL;
}
- res->data_type = OBJ_TYPE_DATAPTR;
+ res->data_type = DATA_TYPE_DATAPTR;
lstpsize(lstp) = size;
lstplen(lstp) = size;
for(i=0; i < times; i++)
Modified: trunk/src/builtins-string.c
===================================================================
--- trunk/src/builtins-string.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/builtins-string.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -76,13 +76,13 @@
String_OBJ = OBJ(STRING_PROTO);
MODULE_SET_DOC(String, "string object prototype");
set_attr(ist, OBJ(OBJECT), sym(ist, "String"), String_OBJ);
- String_OBJ->data_type = OBJ_TYPE_IMMDATA;
+ String_OBJ->data_type = DATA_TYPE_IMMDATA;
String_OBJ->imm_data_len = 0;
String_OBJ->data.str[0] = 0;
}
DEF(String, __init__, NULL) {
- self->data_type = OBJ_TYPE_IMMDATA;
+ self->data_type = DATA_TYPE_IMMDATA;
self->imm_data_len = 0;
self->data.str[0] = 0;
return OBJ(NONE);
@@ -141,7 +141,7 @@
tlen = slen + olen;
obj = new_object(ist, String_OBJ);
if (tlen < IMMEDIATE_DATA_LEN) {
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = (int) tlen;
memcpy(&(obj->data.str[0]), strch(self), slen);
memcpy(&(obj->data.str[slen]), strch(other), olen);
@@ -171,7 +171,7 @@
tlen = len*times+1;
obj = new_object(ist, String_OBJ);
if (tlen < IMMEDIATE_DATA_LEN) {
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = (int) tlen;
for(i=0; i < times; i++)
memcpy(obj->data.str+i*len, strch(self), len);
@@ -193,7 +193,7 @@
DEF(String, __gen__, NULL) {
obj_p gen_obj = new_object(ist, StringGen_OBJ);
- gen_obj->data_type = OBJ_TYPE_DATAPTR;
+ gen_obj->data_type = DATA_TYPE_DATAPTR;
gen_obj->data.ptr = strch(self);
set_attr(ist, gen_obj, sym(ist, "saved_string"), self);
return gen_obj;
@@ -228,7 +228,7 @@
}
obj = new_object(ist, String_OBJ);
if (tlen < IMMEDIATE_DATA_LEN) {
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = (int) tlen;
dest_ptr = obj->data.str;
} else {
Modified: trunk/src/builtins-thread.c
===================================================================
--- trunk/src/builtins-thread.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/builtins-thread.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -74,7 +74,7 @@
obj_p thread_obj;
pr_thread_p thread_ptr;
thread_obj = new_object(ist, OBJ(THREAD_PROTO));
- thread_obj->data_type = OBJ_TYPE_DATAPTR;
+ thread_obj->data_type = DATA_TYPE_DATAPTR;
thread_ptr = thread_obj->data.ptr = pr_malloc(sizeof(pr_thread_t));
memset(thread_obj->data.ptr, 0, sizeof(pr_thread_t));
thread_ptr->ist = ist;
@@ -132,7 +132,7 @@
if (!thread_obj) {
thread_obj = new_object(ist, OBJ(THREAD_PROTO));
- thread_obj->data_type = OBJ_TYPE_DATAPTR;
+ thread_obj->data_type = DATA_TYPE_DATAPTR;
thread_obj->data.ptr = pr_malloc(sizeof(pr_thread_t));
memset(thread_obj->data.ptr, 0, sizeof(pr_thread_t));
}
@@ -195,7 +195,7 @@
set_attr(ist, Thread_OBJ, sym(ist, "USER2"), new_int_obj(ist, ACC_USER2));
set_attr(ist, Thread_OBJ, sym(ist, "SYSTEM"), new_int_obj(ist, ACC_SYSTEM));
- Thread_OBJ->data_type = OBJ_TYPE_DATAPTR;
+ Thread_OBJ->data_type = DATA_TYPE_DATAPTR;
thread = obj_malloc(Thread_OBJ, sizeof(pr_thread_t));
memset(thread, 0, sizeof(pr_thread_t));
Thread_OBJ->unclonable = TRUE;
@@ -216,7 +216,7 @@
if (parms[5] != OBJ(NONE))
CHECK_TYPE_EXC(parms[5], OBJ(STRING_PROTO), "string");
CHECK_TYPE_EXC(parms[7], OBJ(INT_PROTO), "integer");
- self->data_type = OBJ_TYPE_DATAPTR;
+ self->data_type = DATA_TYPE_DATAPTR;
self->data.ptr = pr_malloc(sizeof(pr_thread_t));
memset(self->data.ptr, 0, sizeof(pr_thread_t));
uthread = &(((pr_thread_p)self->data.ptr)->user_thread_data);
@@ -314,7 +314,7 @@
MODULE_SET_DOC(Mutex, "mutex object prototype");
set_attr(ist, OBJ(OBJECT), sym(ist, "Mutex"), Mutex_OBJ);
- Mutex_OBJ->data_type = OBJ_TYPE_DATAPTR;
+ Mutex_OBJ->data_type = DATA_TYPE_DATAPTR;
Mutex_OBJ->unclonable = TRUE;
}
@@ -325,7 +325,7 @@
aprerr = apr_pool_create(&subpool, get_pr_head_pool());
IF_APR_ERR("out of memory creating mutex") return NULL;
- self->data_type = OBJ_TYPE_DATAPTR;
+ self->data_type = DATA_TYPE_DATAPTR;
aprerr = apr_thread_mutex_create((apr_thread_mutex_t**)(&self->data.ptr), APR_THREAD_MUTEX_UNNESTED, subpool);
IF_APR_ERR("error creating mutex in apr_thread_mutex_create") return NULL;
self->unclonable = TRUE;
Modified: trunk/src/builtins-tuple.c
===================================================================
--- trunk/src/builtins-tuple.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/builtins-tuple.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -77,7 +77,7 @@
MODULE_SET_DOC(Tuple, "object prototype");
set_attr(ist, OBJ(OBJECT), sym(ist, "Tuple"), Tuple_OBJ);
- Tuple_OBJ->data_type = OBJ_TYPE_DATAPTR;
+ Tuple_OBJ->data_type = DATA_TYPE_DATAPTR;
lstp = Tuple_OBJ->data.ptr = pr_malloc(list_sizeof(2));
lstpsize(lstp) = 2;
lstplen(lstp) = 0;
@@ -86,7 +86,7 @@
DEF(Tuple, __init__, NULL) {
list_p lstp;
- self->data_type = OBJ_TYPE_DATAPTR;
+ self->data_type = DATA_TYPE_DATAPTR;
lstp = self->data.ptr = pr_malloc(list_sizeof(2));
lstpsize(lstp) = 2;
lstplen(lstp) = 0;
@@ -189,7 +189,7 @@
list_append(ist, res, list_item(ist, parms[1], i));
else
list_append(ist, res, parms[1]);
- switch_proto_to(ist, res, Tuple_OBJ);
+ switch_proto(ist, res, Tuple_OBJ);
return res;
}
@@ -215,7 +215,7 @@
raise_exception(ist, OBJ(OUTOFMEMORY_EXC), "memory allocation failed for tuple multiplication");
return NULL;
}
- res->data_type = OBJ_TYPE_DATAPTR;
+ res->data_type = DATA_TYPE_DATAPTR;
lstpsize(lstp) = size;
lstplen(lstp) = size;
for(i=0; i < times; i++)
@@ -284,7 +284,7 @@
DEF(Tuple, __gen__, NULL) {
obj_p list_obj, gen_obj = new_object(ist, Tgen_OBJ);
- gen_obj->data_type = OBJ_TYPE_DATAPTR;
+ gen_obj->data_type = DATA_TYPE_DATAPTR;
gen_obj->data.ptr = list_obj = clone_list_obj(ist, self);
listlen(list_obj) = 0;
return gen_obj;
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/interp.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -783,7 +783,7 @@
frame->dyn_locals, frame->locals, func, NULL );
new_frame->gen_marker = TRUE;
func->data.ptr = new_frame;
- switch_proto_to(ist, func, OBJ(GEN_PROTO));
+ switch_proto(ist, func, OBJ(GEN_PROTO));
}
set_item(ist, func, fr_stack[fr_sp], fr_stack[fr_sp+1]);
} break;
@@ -873,7 +873,7 @@
} break;
case OP_OBJCALL: {
fr_sp -= 1+2*param;
- if ((func_obj = fr_stack[fr_sp])->data_type == OBJ_TYPE_FUNCPTR){
+ if ((func_obj = fr_stack[fr_sp])->data_type == DATA_TYPE_FUNCPTR){
obj_p res;
clist_p plist = get_func_params(ist, func_obj, param*2, fr_stack+fr_sp+1);
pre_call_lock(ist, frame->locals, plist); if (intrp_exobj) break;
@@ -966,7 +966,7 @@
as_str(ist, fr_stack[fr_sp+1]));
break;
}
- if (func_obj->data_type == OBJ_TYPE_FUNCPTR){
+ if (func_obj->data_type == DATA_TYPE_FUNCPTR){
obj_p res, slf = super_flag? frame->self : fr_stack[fr_sp];
clist_p plist = get_func_params(ist, func_obj, param*2, fr_stack+fr_sp+2);
if (intrp_exobj) break;
@@ -1223,7 +1223,7 @@
func_obj = self;
self = new_object(ist, NULL);
}
- if (func_obj->data_type == OBJ_TYPE_FUNCPTR) {
+ if (func_obj->data_type == DATA_TYPE_FUNCPTR) {
obj_p res;
clist_p plist = get_func_params( ist, func_obj, parm_cnt, lbl_val_arr);
pre_call_lock(ist, self, plist); if (intrp_exobj) return NULL;
Modified: trunk/src/memory_mgr.c
===================================================================
--- trunk/src/memory_mgr.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/memory_mgr.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -196,7 +196,7 @@
}
}
}
- if (obj->data_type == OBJ_TYPE_DATAPTR) {
+ if (obj->data_type == DATA_TYPE_DATAPTR) {
obj_p obj_list;
mm_write_lock(ist, mm_obj_list);
listlen(mm_obj_list) = 0;
Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/object.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -130,7 +130,7 @@
dll_services.ins_proto = ins_proto;
dll_services.del_proto = del_proto;
dll_services.has_proto_QUES = has_proto_QUES;
- dll_services.switch_proto_to = switch_proto_to;
+ dll_services.switch_proto = switch_proto;
dll_services.list_append = list_append;
dll_services.list_item = list_item;
dll_services.list_len = list_len;
@@ -271,7 +271,7 @@
void free_object(obj_p obj){
if (obj->has_attrs)
pr_free(obj->attr_proto.attrs);
- if (obj->data_type == OBJ_TYPE_DATAPTR)
+ if (obj->data_type == DATA_TYPE_DATAPTR)
pr_free(obj->data.ptr);
pr_free(obj);
}
@@ -471,8 +471,8 @@
write_unlock(ist, obj);
}
-//********************************* switch_proto_to ****************************
-void switch_proto_to(isp ist, obj_p obj, obj_p new_proto) {
+//********************************* switch_proto ****************************
+void switch_proto(isp ist, obj_p obj, obj_p new_proto) {
attr_p attrs;
wrlock_rtrn(obj);
if (!(obj->has_attrs)) {
@@ -769,11 +769,11 @@
//********************************* obj_alloc ***************************
void* obj_malloc(obj_p obj, size_t size) {
if (size <= sizeof(obj_data_t)){
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = (int) size;
return &obj->data;
} else {
- obj->data_type = OBJ_TYPE_DATAPTR;
+ obj->data_type = DATA_TYPE_DATAPTR;
obj->data.ptr = pr_malloc(size);
return obj->data.ptr;
}
@@ -782,10 +782,10 @@
//********************************* obj_realloc *******************************
void* obj_realloc(isp ist, obj_p obj, size_t size){
wrlock_rtrn(obj) NULL;
- if(obj->data_type == OBJ_TYPE_DATAPTR){
+ if(obj->data_type == DATA_TYPE_DATAPTR){
if(size <= sizeof(obj_data_t)){
char* ptr = obj->data.ptr;
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = (int) size;
memcpy(&obj->data, ptr, size);
pr_free(ptr);
@@ -797,7 +797,7 @@
else {
char* ptr = pr_malloc(size);
memcpy(ptr, &obj->data, obj->imm_data_len);
- obj->data_type = OBJ_TYPE_DATAPTR;
+ obj->data_type = DATA_TYPE_DATAPTR;
obj->data.ptr = ptr;
}
}
@@ -808,17 +808,17 @@
//********************************* obj_free **********************************
void obj_free(isp ist, obj_p obj) {
wrlock_rtrn(obj);
- if(obj->data_type == OBJ_TYPE_DATAPTR)
+ if(obj->data_type == DATA_TYPE_DATAPTR)
pr_free(obj->data.ptr);
obj->data.ptr = NULL;
- obj->data_type = OBJ_TYPE_NONE;
+ obj->data_type = DATA_TYPE_NONE;
write_unlock(ist, obj);
}
//********************************* new_int_obj *******************************
obj_p new_int_obj(isp ist, i64_t num){
obj_p obj = new_object(ist, OBJ(INT_PROTO));
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = 8;
obj->data.i64 = num;
obj->immutable = TRUE;
@@ -828,7 +828,7 @@
//********************************* new_float_obj *****************************
obj_p new_float_obj(isp ist, double num){
obj_p obj = new_object(ist, OBJ(FLOAT_PROTO));
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = 8;
obj->data.f64 = num;
obj->immutable = TRUE;
@@ -846,7 +846,7 @@
len = strlen(str);
obj = new_object(ist, OBJ(STRING_PROTO));
if (len < IMMEDIATE_DATA_LEN) {
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = (int) len;
strcpy(obj->data.str, str);
} else {
@@ -865,7 +865,7 @@
if(!str) return NULL;
obj = new_object(ist, OBJ(STRING_PROTO));
if (len < IMMEDIATE_DATA_LEN) {
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = (int) len;
memcpy(obj->data.str, str, len);
obj->data.str[len] = 0;
@@ -882,7 +882,7 @@
//********************************* new_hash_obj ******************************
obj_p new_hash_obj(isp ist, i32_t num) {
obj_p hash_obj = new_object(ist, OBJ(HASH_PROTO));
- hash_obj->data_type = OBJ_TYPE_IMMDATA;
+ hash_obj->data_type = DATA_TYPE_IMMDATA;
hash_obj->imm_data_len = 4;
hash_obj->data.i32[0] = num & HASH_MASK;
if (!(hash_obj->data.i32[0])) hash_obj->data.i32[0] = 1;
@@ -1004,7 +1004,7 @@
//********************************* new_super_obj *****************************
obj_p new_super_obj(isp ist, obj_p symbol){
obj_p super_obj = new_object(ist, OBJ(SUPER_PROTO));
- super_obj->data_type = OBJ_TYPE_DATAPTR;
+ super_obj->data_type = DATA_TYPE_DATAPTR;
super_obj->data.ptr = symbol;
super_obj->immutable = TRUE;
return super_obj;
@@ -1016,7 +1016,7 @@
obj_p list_obj = new_object(ist, OBJ(LIST_PROTO));
list_p lstp = list_obj->data.ptr =
pr_malloc(list_sizeof(max(initial_size,2)));
- list_obj->data_type = OBJ_TYPE_DATAPTR;
+ list_obj->data_type = DATA_TYPE_DATAPTR;
lstpsize(lstp) = max(initial_size,2);
lstplen(lstp) = 0;
return list_obj;
@@ -1269,7 +1269,7 @@
//********************************* new_func_obj ******************************
obj_p new_func_obj(isp ist, pr_func* func_ptr, obj_p label_values_list) {
obj_p func_obj = new_object(ist, OBJ(FUNC_PROTO));
- func_obj->data_type = OBJ_TYPE_FUNCPTR;
+ func_obj->data_type = DATA_TYPE_FUNCPTR;
func_obj->data.ptr = func_ptr;
if (label_values_list)
set_attr(ist, func_obj, SYM(__FPARAMS__), clone_list_obj(ist, label_values_list) );
@@ -1326,17 +1326,17 @@
( obj->state == OBJ_STATE_NEW_OR_MARKED ? "New/Marked" :
( obj->state == OBJ_STATE_UNMARKED ? "Unmarked" :
( obj->state == OBJ_STATE_DELETED ? "Deleted" : "*** ERROR ***" ))));
- if(obj->data_type != OBJ_TYPE_NONE){
+ if(obj->data_type != DATA_TYPE_NONE){
ind(dep+1); fprintf(fout,"Data %s",
- ( obj->data_type == OBJ_TYPE_IMMDATA ? "immediate: " :
- ( obj->data_type == OBJ_TYPE_DATAPTR ? "pointer: " :
+ ( obj->data_type == DATA_TYPE_IMMDATA ? "immediate: " :
+ ( obj->data_type == DATA_TYPE_DATAPTR ? "pointer: " :
"func ptr: " )));
}
- if(obj->data_type == OBJ_TYPE_IMMDATA){
+ if(obj->data_type == DATA_TYPE_IMMDATA){
fprintf(fout, "%08x %08x \"%s\"\n",
obj->data.i32[0], obj->data.i32[1],
obj->data.str );
- } else if(obj->data_type != OBJ_TYPE_NONE){
+ } else if(obj->data_type != DATA_TYPE_NONE){
fprintf(fout,"%08x\n", obj->data.i32[0]);
}
prt_flg = 1;
Modified: trunk/src/parser_routines.c
===================================================================
--- trunk/src/parser_routines.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/parser_routines.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -1154,7 +1154,7 @@
obj_p obj = new_object(INTRP,
(long_flag == NEW_LONG? OBJ(LONG_PROTO) : OBJ(STRING_PROTO)) );
if (len < IMMEDIATE_DATA_LEN) {
- obj->data_type = OBJ_TYPE_IMMDATA;
+ obj->data_type = DATA_TYPE_IMMDATA;
obj->imm_data_len = (int) len;
memcpy(obj->data.str, str, len);
obj->data.str[len] = 0;
Modified: trunk/src/symbol.c
===================================================================
--- trunk/src/symbol.c 2004-04-12 05:21:58 UTC (rev 333)
+++ trunk/src/symbol.c 2004-04-13 04:56:23 UTC (rev 334)
@@ -230,7 +230,7 @@
return sym;
}
sym = new_object(ist, OBJ(SYMBOL_PROTO));
- sym->data_type = OBJ_TYPE_IMMDATA;
+ sym->data_type = DATA_TYPE_IMMDATA;
sym->imm_data_len = 4;
if (!(next_key = (next_key+3) & 0x7fffffff)) {
printf("Out of unique symbol keys. Did we really use two billion?\n");