rev 376 - in trunk: include/prothon modules/File modules/Re modules/SQLite modules/dbm src
SVN User <[email protected]> Sat, 17 Apr 2004 16:51:38 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-04-17 16:51:35 -0400 (Sat, 17 Apr 2004)
New Revision: 376
Modified:
trunk/include/prothon/prothon.h
trunk/include/prothon/prothon_dll.h
trunk/modules/File/File.c
trunk/modules/Re/Re.c
trunk/modules/SQLite/SQLite.c
trunk/modules/SQLite/SQLite.vcproj
trunk/modules/dbm/DBM.c
trunk/modules/dbm/dbm.vcproj
trunk/src/argproc.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.h
trunk/src/prothon.y
trunk/src/symbol.c
trunk/src/sys.c
Log:
OS module builds with APR on windows now, removed NO_APR
def from all code
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/include/prothon/prothon.h 2004-04-17 20:51:35 UTC (rev 376)
@@ -66,12 +66,10 @@
//*****************************************************************************
-#ifndef NO_APR
#include <apr.h>
#include <apr_pools.h>
#include <apr_thread_proc.h>
#include <apr_portable.h>
-#endif
#ifdef __cplusplus
extern "C" {
@@ -97,15 +95,6 @@
//************************* BASIC TYPE DEFINITIONS ********************************
typedef signed char i8_t;
-#ifdef NO_APR
-typedef short i16_t;
-typedef int i32_t;
-typedef __int64 i64_t;
-typedef unsigned char u8_t;
-typedef unsigned short u16_t;
-typedef unsigned int u32_t;
-typedef unsigned __int64 u64_t;
-#else
typedef apr_int16_t i16_t;
typedef apr_int32_t i32_t;
typedef apr_int64_t i64_t;
@@ -113,7 +102,6 @@
typedef apr_uint16_t u16_t;
typedef apr_uint32_t u32_t;
typedef apr_uint64_t u64_t;
-#endif
#ifdef WIN32
#define MAX_INT_VAL 0x7fffffffffffffff
@@ -221,7 +209,6 @@
typedef user_thread_t* user_thread_p;
-#ifndef NO_APR
typedef struct {
apr_os_thread_t apr_os_thread;
apr_thread_t* apr_thread;
@@ -234,7 +221,7 @@
} pr_thread_t;
typedef pr_thread_t* pr_thread_p;
-#endif
+
//************************* MALLOC FUNCTIONS **********************************
// These behave identical to the standard OS functions, but on segments smaller
// than 64 bytes are much faster than most OS implementations. See prmalloc.c.
@@ -538,7 +525,6 @@
} \
} while(0)
-#ifndef NO_APR
// IF_APR_ERR: Convenience macro for apr call error checking
#define IF_APR_ERR(msg) \
if (aprerr != APR_SUCCESS) { \
@@ -549,7 +535,6 @@
// SWITCH_PROTO_TO: Replace all old protos with a new single proto object
void switch_proto(isp ist, obj_p obj, obj_p new_proto);
-#endif
//***************** SPECIFIC OBJECT TYPE FUNCTIONS **************************
@@ -572,16 +557,20 @@
// NEW_FLOAT_OBJ: Create a new float object from a 64-bit C double.
obj_p new_float_obj(isp ist, double num);
+#define NEW_FLOAT(num) new_float_obj(ist, num)
// NEW_STRING_OBJ: Create a new string object from a C string.
obj_p new_string_obj(isp ist, char* string);
+#define NEW_STRING(string) new_string_obj(ist, string)
// NEW_STRING_OBJ_N: Create a new string object from a C string of N chars long.
// Same as new_string_obj but string length is set by n, not null char at end.
obj_p new_string_n_obj(isp ist, char* string, size_t n);
+#define NEW_STRINGN(string, n) new_string_n_obj(ist, string, n)
// NEW_LIST_OBJ: Create a new list object with a given initial size
obj_p new_list_obj(isp ist, size_t initial_size);
+#define NEW_LIST(size) new_list_obj(ist, size)
// CLONE_LIST_OBJ: Create a new list object that's a shallow copy of another
obj_p copy_list_obj(isp ist, obj_p list_obj);
@@ -616,7 +605,7 @@
// immutable. At the C level this means that you should not modify it
// once you have given it away to other code. It is implemented the same
// way as a list so all the list functions will work on a tuple.
-// This creation function actually calls new_list_obj(ist, ) and changes the
+// This creation function actually calls NEW_LIST() and changes the
// proto to TUPLE_PROTO. After calling this you should set all the data
// items with list_append() before releasing the object to other code.
obj_p new_tuple_obj(isp ist, int fixed_size);
@@ -697,8 +686,8 @@
// All Prototypes should be marked with this.
#define set_obj_id(obj, module, name) \
set_attr(ist, (obj), SYM(__ID__), \
- list2(ist, new_string_obj(ist, (#module)), \
- new_string_obj(ist, (#name)) ) )
+ list2(ist, NEW_STRING((#module)), \
+ NEW_STRING((#name)) ) )
// SET_OBJ_DOC: Add document string (__doc__) to object
// This can be used on any object. It is recommended that it be used
@@ -706,7 +695,6 @@
void set_obj_doc_f(isp ist, obj_p obj, char* str);
#define set_obj_doc(obj, str) set_obj_doc_f(ist, (obj), (str))
-#ifndef NO_APR
// NEW_THREAD_OBJ: Create a new thread object and start the thread
// thread_func is the C function to execute. thread_data points to
// arugments for the thread_func function.
@@ -724,7 +712,7 @@
// Example thread_func: void *main_thread(apr_thread_t *handle, void *argv);
// The handle parameter is used for this_thread: register_thread(handle);
obj_p register_thread(isp ist, apr_thread_t *this_thread);
-#endif
+
//****************** HIGHER LEVEL OBJECT ACCESS ROUTINES ************************
// xxx_ITEM: These are higher-level access routines for attributes and data
@@ -798,7 +786,7 @@
// **dictionary args which are supported by putting PARAM_STAR or PARAM_STAR_STAR in
// the label (even) position and the list or dict symbol in the default (odd) position.
// example: in "def func(x, y="3", *z)", the label_def_list would be:
-// list6(ist,NULL, sym(ist, "x"), NULL, sym(ist, "y"), new_string_obj(ist, "3"), PARAM_STAR, sym(ist, "z"));
+// list6(ist,NULL, sym(ist, "x"), NULL, sym(ist, "y"), NEW_STRING("3"), PARAM_STAR, sym(ist, "z"));
// If the formal param list is empty, you can put NULL instead of the list.
obj_p new_C_func_obj(isp ist, pr_func* func_ptr, obj_p label_def_list);
@@ -853,7 +841,7 @@
#define SEQ_OR_PARAM(index, var) \
if ( has_proto_QUES(ist, parms[((index)-1)*2+1], OBJ(STRING_PROTO)) || \
!has_proto_QUES(ist, parms[((index)-1)*2+1], OBJ(SEQ_PROTO))) { \
- list = new_list_obj(ist, 1); \
+ list = NEW_LIST(1); \
list_append(ist, list, parms[((index)-1)*2+1]); \
(var) = list; \
} else \
@@ -934,10 +922,10 @@
// both NULL, then it will catch all exception objects. When this function catches the
// exception and returns it, the exception object is no longer raised unless you call
// raise_exception again with that object.
-#ifndef NO_APR
+
void raise_exception(isp ist, obj_p proto_obj, const char *format, ...)
__attribute__((format(printf,3,4)));
-#endif
+
obj_p catch_exception(isp ist, obj_p proto, obj_p proto_list);
// EXCEPT: Convenience macro to catch all exceptions and return if exception caught
Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/include/prothon/prothon_dll.h 2004-04-17 20:51:35 UTC (rev 376)
@@ -63,6 +63,9 @@
#endif
typedef struct {
+ void (*raise_exception)(isp ist, obj_p proto_obj, const char *format, ...)
+ __attribute__((format(printf,3,4)));
+ apr_pool_t* (*get_pr_head_pool)(void);
isp (*get_ist)(access_t access);
obj_p (*get_attr)(isp ist, obj_p obj, obj_p key);
void (*set_attr)(isp ist, obj_p object, obj_p key, obj_p value);
@@ -127,11 +130,6 @@
obj_p* OBJ_;
sym_id_entry_t* sym_id_table;
-#ifndef NO_APR
- void (*raise_exception)(isp ist, obj_p proto_obj, const char *format, ...)
- __attribute__((format(printf,3,4)));
- apr_pool_t* (*get_pr_head_pool)(void);
-#endif
} pr_services_t;
Modified: trunk/modules/File/File.c
===================================================================
--- trunk/modules/File/File.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/modules/File/File.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -126,7 +126,7 @@
}
DEF(File, __init__, FPARM3( path, NULL,
- mode, new_string_obj(ist, "r"),
+ mode, NEW_STRING("r"),
bufsize, NEW_INT(-1) ) ) {
apr_file_t *f;
apr_status_t aprerr;
@@ -266,7 +266,7 @@
raise_exception(ist, OBJ(IOEXCEPTION), "read called on file opened without read perms");
return NULL;
}
- if (!size_in) return new_string_obj(ist, "");
+ if (!size_in) return NEW_STRING("");
if (size_in < 0) {
readall = TRUE;
size = BUFSIZE(self);
@@ -343,7 +343,7 @@
raise_exception(ist, OBJ(IOEXCEPTION), "readLine called on file opened without read perms");
return NULL;
}
- if (!size_in) return new_string_obj(ist, "");
+ if (!size_in) return NEW_STRING("");
if (size_in < 0) {
readall = TRUE;
size = BUFSIZE(self);
@@ -418,13 +418,13 @@
raise_exception(ist, OBJ(IOEXCEPTION), "readLines called on file opened without read perms");
return NULL;
}
- if (!size_in) return new_string_obj(ist, "");
+ if (!size_in) return NEW_STRING("");
if (size_in < 0) {
readall = TRUE;
size = BUFSIZE(self);
} else
size = (size_t) size_in;
- list_obj = new_list_obj(ist, 10);
+ list_obj = NEW_LIST(10);
aprerr = 0;
while (aprerr != APR_EOF && (readall || total_read < size)) {
str_obj = NEW_OBJ(OBJ(STRING_PROTO));
@@ -667,22 +667,22 @@
switch (type) {
case __STDIN:
aprerr = apr_file_open_stdin(&fp, subpool);
- mode = new_string_obj(ist, "r");
- file = new_string_obj(ist, "<stdin>");
+ mode = NEW_STRING("r");
+ file = NEW_STRING("<stdin>");
flags = APR_READ;
break;
case __STDOUT:
aprerr = apr_file_open_stdout(&fp, subpool);
- file = new_string_obj(ist, "<stdout>");
- mode = new_string_obj(ist, "w");
+ file = NEW_STRING("<stdout>");
+ mode = NEW_STRING("w");
flags = APR_WRITE;
break;
case __STDERR:
aprerr = apr_file_open_stderr(&fp, subpool);
- file = new_string_obj(ist, "<stderr>");
- mode = new_string_obj(ist, "w");
+ file = NEW_STRING("<stderr>");
+ mode = NEW_STRING("w");
flags = APR_WRITE;
break;
Modified: trunk/modules/Re/Re.c
===================================================================
--- trunk/modules/Re/Re.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/modules/Re/Re.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -146,7 +146,7 @@
STRING_PARAM(1, s);
- res = new_list_obj(ist, 10);
+ res = NEW_LIST(10);
m = pr_malloc((ngrps+1)*sizeof(regmatch_t));
m[0].rm_so = -1; m[0].rm_eo = 0;
while(TRUE) {
@@ -169,18 +169,18 @@
}
if (ngrps == 0) {
sp = m[0].rm_so;
- list_append(ist, res, new_string_n_obj(ist, s+sp, m[0].rm_eo-sp));
+ list_append(ist, res, NEW_STRINGN(s+sp, m[0].rm_eo-sp));
} else if (ngrps == 1) {
if ((sp = m[1].rm_so) == -1)
- list_append(ist, res, new_string_obj(ist, ""));
+ list_append(ist, res, NEW_STRING(""));
else
- list_append(ist, res, new_string_n_obj(ist, s+sp, m[1].rm_eo-sp));
+ list_append(ist, res, NEW_STRINGN(s+sp, m[1].rm_eo-sp));
} else {
tuple_obj = new_tuple_obj(ist, ngrps);
for (i=1; i <= ngrps; i++) {
sp = m[i].rm_so; ep = m[i].rm_eo;
- if (sp == -1) list_append(ist, tuple_obj, new_string_obj(ist, ""));
- else list_append(ist, tuple_obj, new_string_n_obj(ist, s+sp,ep-sp));
+ if (sp == -1) list_append(ist, tuple_obj, NEW_STRING(""));
+ else list_append(ist, tuple_obj, NEW_STRINGN(s+sp,ep-sp));
}
list_append(ist, res, tuple_obj);
tuple_obj->immutable = TRUE;
@@ -222,7 +222,7 @@
pr_free(m);
return NULL;
}
- match_obj = new_list_obj(ist, (ngrps+1)*2);
+ match_obj = NEW_LIST((ngrps+1)*2);
switch_proto(ist, match_obj, ReMatch_OBJ);
for(i=0; i <= numgrps(self); i++) {
if (m[i].rm_so > -1) last_index = i;
@@ -252,7 +252,7 @@
STRING_PARAM(1, s);
INT_32_PARAM(2, maxsplit);
- res = new_list_obj(ist, 10);
+ res = NEW_LIST(10);
m = pr_malloc((ngrps+1)*sizeof(regmatch_t));
m[0].rm_so = -1; m[0].rm_eo = 0;
last_split = 0;
@@ -275,18 +275,18 @@
return NULL;
}
if (m[0].rm_so == m[0].rm_eo) continue;
- list_append(ist, res, new_string_n_obj(ist, s+last_split, m[0].rm_so-last_split));
+ list_append(ist, res, NEW_STRINGN(s+last_split, m[0].rm_so-last_split));
for(i=1; i <= ngrps; i++) {
if ((sp = m[i].rm_so) == -1)
list_append(ist, res, OBJ(NONE));
else
- list_append(ist, res, new_string_n_obj(ist, s+sp, m[i].rm_eo-sp));
+ list_append(ist, res, NEW_STRINGN(s+sp, m[i].rm_eo-sp));
}
last_split = m[0].rm_eo;
if (maxsplit && ++split_count == maxsplit) break;
}
if ((sp=last_split) != (ep=strlen(s)))
- list_append(ist, res, new_string_n_obj(ist, s+sp, ep-sp));
+ list_append(ist, res, NEW_STRINGN(s+sp, ep-sp));
pr_free(m);
return res;
}
@@ -396,7 +396,7 @@
STRING_PARAM(2, orig_s);
INT_32_PARAM(3, count);
- match_obj = new_list_obj(ist, (ngrps+1)*2);
+ match_obj = NEW_LIST((ngrps+1)*2);
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]);
@@ -473,7 +473,7 @@
strncat(res, orig_s+last_split, strlen(orig_s)-last_split);
res[size] = 0;
}
- res_obj = new_string_obj(ist, res);
+ res_obj = NEW_STRING(res);
del_unlock(match_obj);
pr_free(res);
pr_free(m);
@@ -560,7 +560,7 @@
orig_s_obj = get_attr(ist, self, sym(ist, "string")); if_exc_return NULL;
orig_s = strch(orig_s_obj);
if (unescape(ist, self, orig_s, &p1, &p2, &s, &s_lim)) return NULL;
- res = new_string_obj(ist, s);
+ res = NEW_STRING(s);
pr_free(s);
return res;
}
@@ -599,7 +599,7 @@
sp = (int)(list_item(ist, self, j*2 )->data.i64);
ep = (int)(list_item(ist, self, j*2+1)->data.i64);
if (sp == -1) return OBJ(NONE);
- else return new_string_n_obj(ist, orig_s+sp, ep-sp);
+ else return NEW_STRINGN(orig_s+sp, ep-sp);
} else {
res = new_tuple_obj(ist, llen);
for (i=0; i < llen; i++) {
@@ -608,7 +608,7 @@
sp = (int)(list_item(ist, self, j*2 )->data.i64);
ep = (int)(list_item(ist, self, j*2+1)->data.i64);
if (sp == -1) list_append(ist, res, OBJ(NONE));
- else list_append(ist, res, new_string_n_obj(ist, orig_s+sp, ep-sp));
+ else list_append(ist, res, NEW_STRINGN(orig_s+sp, ep-sp));
}
res->immutable = TRUE;
return res;
@@ -625,7 +625,7 @@
sp = (int)(list_item(ist, self, i*2 )->data.i64);
ep = (int)(list_item(ist, self, i*2+1)->data.i64);
if (sp == -1) list_append(ist, res, parms[1]);
- else list_append(ist, res, new_string_n_obj(ist, orig_s+sp, ep-sp));
+ else list_append(ist, res, NEW_STRINGN(orig_s+sp, ep-sp));
}
res->immutable = TRUE;
return res;
Modified: trunk/modules/SQLite/SQLite.c
===================================================================
--- trunk/modules/SQLite/SQLite.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/modules/SQLite/SQLite.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -128,7 +128,7 @@
cursorp = curs_obj->data.ptr = pr_malloc(sizeof(cursor_t));
cursorp->ist = ist;
cursorp->conn_obj = self;
- cursorp->row_list = new_list_obj(ist, INITIAL_ROW_LIST_SIZE);
+ cursorp->row_list = NEW_LIST(INITIAL_ROW_LIST_SIZE);
del_unlock(cursorp->row_list);
return curs_obj;
} else {
@@ -173,9 +173,9 @@
int i;
cursor_p cursorp = (cursor_p) pArg;
isp ist = cursorp->ist;
- obj_p row = new_list_obj(ist, argc);
+ obj_p row = NEW_LIST(argc);
for(i=0; i < argc; i++)
- list_append(ist, row, new_string_obj(ist, argv[i]));
+ list_append(ist, row, NEW_STRING(argv[i]));
switch_proto(ist, row, OBJ(TUPLE_PROTO));
set_immutable(row);
list_append(ist, cursorp->row_list, row);
@@ -235,7 +235,7 @@
llen = (int) list_len(ist, cursorp->row_list);
e = p+n;
e = min(e, llen);
- res = new_list_obj(ist, e-p);
+ res = NEW_LIST(e-p);
for (i=p; i < e; i++)
list_append(ist, res, list_item(ist, cursorp->row_list, i));
switch_proto(ist, res, OBJ(TUPLE_PROTO));
@@ -251,7 +251,7 @@
p = cursorp->row_ptr;
llen = (int) list_len(ist, cursorp->row_list);
- res = new_list_obj(ist, llen-p);
+ res = NEW_LIST(llen-p);
for (i=p; i < llen; i++)
list_append(ist, res, list_item(ist, cursorp->row_list, i));
switch_proto(ist, res, OBJ(TUPLE_PROTO));
Modified: trunk/modules/SQLite/SQLite.vcproj
===================================================================
--- trunk/modules/SQLite/SQLite.vcproj 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/modules/SQLite/SQLite.vcproj 2004-04-17 20:51:35 UTC (rev 376)
@@ -20,7 +20,7 @@
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="c:\prothon\include;c:\prothon\apr\apr\include;c:\prothon\SQLiteC"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SQLITE_EXPORTS"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SQLITE_EXPORTS;APR_DECLARE_STATIC;APU_DECLARE_STATIC"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -33,10 +33,10 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="SQLiteC.lib"
+ AdditionalDependencies="SQLiteC.lib apr.lib wsock32.lib"
OutputFile="$(OutDir)/SQLite.dll"
LinkIncremental="2"
- AdditionalLibraryDirectories="C:\Prothon\SQLiteC\Debug"
+ AdditionalLibraryDirectories="C:\Prothon\SQLiteC\Debug;C:\prothon\apr\apr\LibR"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/SQLite.pdb"
SubSystem="2"
Modified: trunk/modules/dbm/DBM.c
===================================================================
--- trunk/modules/dbm/DBM.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/modules/dbm/DBM.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -53,34 +53,12 @@
// DBM.c
#include <prothon/prothon_dll.h>
-#include <stdio.h>
-#include <string.h>
-#include <apr_strings.h>
#include <apr_dbm.h>
MODULE_DECLARE(DBM);
MODULE_DECLARE(DB);
-
-/*
-DB if present *apr_status_t apr_dbm_open_ex (apr_dbm_t **dbm, const char *type, const char *name, apr_int32_t mode, apr_fileperms_t perm, apr_pool_t *cntxt)
-apr_status_t apr_dbm_open (apr_dbm_t **dbm, const char *name, apr_int32_t mode, apr_fileperms_t perm, apr_pool_t *cntxt)
-void apr_dbm_close (apr_dbm_t *dbm)
-apr_status_t apr_dbm_fetch (apr_dbm_t *dbm, apr_datum_t key, apr_datum_t *pvalue)
-apr_status_t apr_dbm_store (apr_dbm_t *dbm, apr_datum_t key, apr_datum_t value)
-apr_status_t apr_dbm_delete (apr_dbm_t *dbm, apr_datum_t key)
-int apr_dbm_exists (apr_dbm_t *dbm, apr_datum_t key)
-apr_status_t apr_dbm_firstkey (apr_dbm_t *dbm, apr_datum_t *pkey)
-apr_status_t apr_dbm_nextkey (apr_dbm_t *dbm, apr_datum_t *pkey)
-void apr_dbm_freedatum (apr_dbm_t *dbm, apr_datum_t data)
-char * apr_dbm_geterror (apr_dbm_t *dbm, int *errcode, char *errbuf, apr_size_t errbufsize)
-apr_status_t apr_dbm_get_usednames_ex (apr_pool_t *pool, const char *type, const char *pathname, const char **used1, const char **used2)
-void apr_dbm_get_usednames (apr_pool_t *pool, const char *pathname, const char **used1, const char **used2)
-
-*/
-
-
MODULE_CONSTANT_DECLARE(DBM, READONLY);
MODULE_START(DBM)
@@ -147,11 +125,30 @@
return self;
}
-MAIN_MODULE_INIT(File) {
+MAIN_MODULE_INIT(DBM) {
+ MODULE_SUB_INIT(DBM);
+
MODULE_ADD_SYM(DB, __init__);
}
+/*
+*apr_status_t apr_dbm_open_ex (apr_dbm_t **dbm, const char *type, const char *name, apr_int32_t mode, apr_fileperms_t perm, apr_pool_t *cntxt)
+apr_status_t apr_dbm_open (apr_dbm_t **dbm, const char *name, apr_int32_t mode, apr_fileperms_t perm, apr_pool_t *cntxt)
+void apr_dbm_close (apr_dbm_t *dbm)
+apr_status_t apr_dbm_fetch (apr_dbm_t *dbm, apr_datum_t key, apr_datum_t *pvalue)
+apr_status_t apr_dbm_store (apr_dbm_t *dbm, apr_datum_t key, apr_datum_t value)
+apr_status_t apr_dbm_delete (apr_dbm_t *dbm, apr_datum_t key)
+int apr_dbm_exists (apr_dbm_t *dbm, apr_datum_t key)
+apr_status_t apr_dbm_firstkey (apr_dbm_t *dbm, apr_datum_t *pkey)
+apr_status_t apr_dbm_nextkey (apr_dbm_t *dbm, apr_datum_t *pkey)
+void apr_dbm_freedatum (apr_dbm_t *dbm, apr_datum_t data)
+char * apr_dbm_geterror (apr_dbm_t *dbm, int *errcode, char *errbuf, apr_size_t errbufsize)
+apr_status_t apr_dbm_get_usednames_ex (apr_pool_t *pool, const char *type, const char *pathname, const char **used1, const char **used2)
+void apr_dbm_get_usednames (apr_pool_t *pool, const char *pathname, const char **used1, const char **used2)
+*/
+
+
Modified: trunk/modules/dbm/dbm.vcproj
===================================================================
--- trunk/modules/dbm/dbm.vcproj 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/modules/dbm/dbm.vcproj 2004-04-17 20:51:35 UTC (rev 376)
@@ -37,7 +37,7 @@
OutputFile="$(OutDir)/dbm.dll"
LinkIncremental="2"
AdditionalLibraryDirectories="C:\prothon\apr\apr\LibR"
- IgnoreDefaultLibraryNames="LIBCMTD.lib"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/dbm.pdb"
SubSystem="2"
Modified: trunk/src/argproc.c
===================================================================
--- trunk/src/argproc.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/argproc.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -73,7 +73,7 @@
}
obj_p parse_argv(isp ist, char* p) {
- obj_p argv = new_list_obj(ist, 4);
+ obj_p argv = NEW_LIST(4);
char* p1;
while(*p) {
if (*p == '\'') {
@@ -82,10 +82,10 @@
printf ("Unterminated quote in command-line parameter\n");
return NULL;
}
- list_append(ist, argv, new_string_n_obj(ist, p+1, p1-p-1));
+ list_append(ist, argv, NEW_STRINGN(p+1, p1-p-1));
} else {
for (p1=p; *p1 && *p1 != ' ' && *p1 != '\t'; p1++);
- list_append(ist, argv, new_string_n_obj(ist, p, p1-p));
+ list_append(ist, argv, NEW_STRINGN(p, p1-p));
}
for (p = p1; *p && (*p == ' ' || *p == '\t'); p++);
}
@@ -95,21 +95,21 @@
obj_p arginit(isp ist, int argc, char* argv[]) {
int i, past_c_args = FALSE;
obj_p thread_argv, argv_obj = NULL;
- obj_p thread_list = new_list_obj(ist, 4), res = NEW_OBJ(NULL);
+ obj_p thread_list = NEW_LIST(4), res = NEW_OBJ(NULL);
char *p, buf[10];
for (i=1; i < argc; i++) {
if (!past_c_args && argv[i][0] != '-') {
- argv_obj = new_list_obj(ist, argc - i);
+ argv_obj = NEW_LIST(argc - i);
set_attr(ist, res, sym(ist, "argv"), argv_obj);
past_c_args = TRUE;
}
if (past_c_args)
- list_append(ist, argv_obj, new_string_obj(ist, argv[i]));
+ list_append(ist, argv_obj, NEW_STRING(argv[i]));
else {
for (p=argv[i]; *p == '-'; p++);
switch (*p) {
case 'd':
- set_attr(ist, res, sym(ist, "debug"), new_string_obj(ist, argv[i]));
+ set_attr(ist, res, sym(ist, "debug"), NEW_STRING(argv[i]));
break;
case 'm':
if (++i == argc) goto err;
@@ -131,7 +131,7 @@
break;
case 'c':
if (++i == argc) goto err;
- set_attr(ist, res, sym(ist, "code"), new_string_obj(ist, argv[i]));
+ set_attr(ist, res, sym(ist, "code"), NEW_STRING(argv[i]));
break;
case 'v':
case 'V':
Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/builtins-core.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -175,11 +175,11 @@
DEF(Object, readAccessStr, NULL) {
switch (get_obj_rdacc(self)) {
- case 0: return new_string_obj(ist, "guest");
- case 1: return new_string_obj(ist, "user1");
- case 2: return new_string_obj(ist, "user2");
- case 3: return new_string_obj(ist, "system");
- default:return new_string_obj(ist, "<invalid access value>");
+ case 0: return NEW_STRING("guest");
+ case 1: return NEW_STRING("user1");
+ case 2: return NEW_STRING("user2");
+ case 3: return NEW_STRING("system");
+ default:return NEW_STRING("<invalid access value>");
}
}
@@ -199,11 +199,11 @@
DEF(Object, writeAccessStr, NULL) {
switch (get_obj_wracc(self)) {
- case 0: return new_string_obj(ist, "guest");
- case 1: return new_string_obj(ist, "user1");
- case 2: return new_string_obj(ist, "user2");
- case 3: return new_string_obj(ist, "system");
- default:return new_string_obj(ist, "<invalid access value>");
+ case 0: return NEW_STRING("guest");
+ case 1: return NEW_STRING("user1");
+ case 2: return NEW_STRING("user2");
+ case 3: return NEW_STRING("system");
+ default:return NEW_STRING("<invalid access value>");
}
}
@@ -251,7 +251,7 @@
apr_snprintf(str, sizeof(str), "<Object:%lx:%s>", (unsigned long)(uintptr_t)self, p);
else
apr_snprintf(str, sizeof(str), "<Object:%lx>", (unsigned long)(uintptr_t)self);
- return new_string_obj(ist, str);
+ return NEW_STRING(str);
}
DEF(Object, __hash__, NULL) {
@@ -319,7 +319,7 @@
for (i=0; i < (int) asize; i++) {
if (attr_ap(attrp,i)->attr.key > 0)
dict_add( ist, dict_obj,
- new_string_obj(ist, keych(ist, attr_ap(attrp,i)->attr.key)),
+ NEW_STRING(keych(ist, attr_ap(attrp,i)->attr.key)),
attr_ap(attrp,i)->attr.value );
}
return dict_obj;
@@ -333,7 +333,7 @@
obj_p thd;
CHECK_TYPE_EXC(parms[1], OBJ(FLOAT_PROTO), "float");
thd = os_thread_2_obj(apr_os_thread_current());
- call_func1(ist, thd, sym(ist, "sleep"), new_float_obj(ist, parms[1]->data.f64));
+ call_func1(ist, thd, sym(ist, "sleep"), NEW_FLOAT(parms[1]->data.f64));
return parms[1];
}
@@ -356,7 +356,7 @@
set_obj_id(False_OBJ, *, False);
}
-DEF(False, __str__, NULL) { return new_string_obj(ist, "False"); }
+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)
@@ -375,7 +375,7 @@
set_obj_id(True_OBJ, *, True);
}
-DEF(True, __str__, NULL) { return new_string_obj(ist, "True"); }
+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))
@@ -400,7 +400,7 @@
}
DEF(None, __str__, NULL) {
- return new_string_obj(ist, "None");
+ return NEW_STRING("None");
}
DEF(None, __bool__QUES, NULL) {
@@ -512,7 +512,7 @@
}
strcat(res, rdelim);
- ret_obj = new_string_obj(ist, res);
+ ret_obj = NEW_STRING(res);
pr_free(res);
return ret_obj;
@@ -545,7 +545,7 @@
}
if (slice_len == 1) {
if (seq_type == SEQ_TYPE_STRING) {
- return new_string_n_obj(ist, self_str+index1, 1);
+ return NEW_STRINGN(self_str+index1, 1);
} else
return list_item(ist, self, index1);
}
@@ -588,7 +588,7 @@
list_append(ist, res, list_item(ist, self, i));
break;
case SEQ_TYPE_LIST:
- res = new_list_obj(ist, exp_len);
+ res = NEW_LIST(exp_len);
for(i = index1; i < index2; i += index3)
list_append(ist, res, list_item(ist, self, i));
break;
@@ -597,7 +597,7 @@
char* s = pr_malloc(exp_len+2);
for(i = index1, j=0; i < index2; i += index3, j++)
s[j] = self_str[i];
- res = new_string_n_obj(ist, s, j);
+ res = NEW_STRINGN(s, j);
pr_free(s);
} break;
}
@@ -613,7 +613,7 @@
list_append(ist, res, list_item(ist, self, i));
break;
case SEQ_TYPE_LIST:
- res = new_list_obj(ist, exp_len);
+ res = NEW_LIST(exp_len);
for(i = index1; i > index2; i += index3)
list_append(ist, res, list_item(ist, self, i));
break;
@@ -622,7 +622,7 @@
char* s = pr_malloc(exp_len+2);
for(i = index1, j=0; i > index2; i += index3, j++)
s[j] = self_str[i];
- res = new_string_n_obj(ist, s, j);
+ res = NEW_STRINGN(s, j);
} break;
}
}
Modified: trunk/src/builtins-dict.c
===================================================================
--- trunk/src/builtins-dict.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/builtins-dict.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -165,12 +165,12 @@
case 4: llen = 2; break;
default: llen = len; break;
}
- list_obj = new_list_obj(ist, (int)llen);
+ list_obj = NEW_LIST((int)llen);
for(i=0; i < size; i++) {
if ((dp=dictptr(dict,i))->entry.hash > 0) {
assert (cnt++ < len);
if (key_flg == 3) {
- obj_p tuple = new_list_obj(ist, 2);
+ obj_p tuple = NEW_LIST(2);
list_append(ist, tuple, dp->entry.key);
list_append(ist, tuple, dp->entry.value);
switch_proto(ist, tuple, OBJ(TUPLE_PROTO));
@@ -273,7 +273,7 @@
}
strcat(res, "}");
- res_obj = new_string_obj(ist, res);
+ res_obj = NEW_STRING(res);
pr_free(res);
return res_obj;
Modified: trunk/src/builtins-float.c
===================================================================
--- trunk/src/builtins-float.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/builtins-float.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -133,11 +133,11 @@
DEF(Float, __abs__, NULL) {
double num = Float_value(self);
- return new_float_obj(ist, num < 0 ? -num : num);
+ return NEW_FLOAT(num < 0 ? -num : num);
}
DEF(Float, __neg__, NULL){
- return new_float_obj(ist, - Float_value(self) );
+ return NEW_FLOAT( - Float_value(self) );
}
DEF(Float, __pos__, NULL){
@@ -158,7 +158,7 @@
return OBJ(NONE);
}
}
- return new_float_obj(ist, Float_value(self) + float_other);
+ return NEW_FLOAT(Float_value(self) + float_other);
}
DEF(Float, __div__, FORM_RPARAM){
@@ -179,7 +179,7 @@
raise_exception(ist, OBJ(DIVIDEZERO_EXC), NULL);
return NULL;
}
- return new_float_obj(ist, Float_value(self) / float_other);
+ return NEW_FLOAT(Float_value(self) / float_other);
}
DEF(Float, __rDiv__, FORM_RPARAM){
@@ -198,7 +198,7 @@
raise_exception(ist, OBJ(DIVIDEZERO_EXC), NULL);
return NULL;
}
- return new_float_obj(ist, float_other / Float_value(self));
+ return NEW_FLOAT(float_other / Float_value(self));
}
DEF(Float, __mul__, FORM_RPARAM){
@@ -215,7 +215,7 @@
return NULL;
}
}
- return new_float_obj(ist, Float_value(self) * float_other);
+ return NEW_FLOAT(Float_value(self) * float_other);
}
DEF(Float, __sub__, FORM_RPARAM){
@@ -232,7 +232,7 @@
return NULL;
}
}
- return new_float_obj(ist, Float_value(self) - float_other);
+ return NEW_FLOAT(Float_value(self) - float_other);
}
DEF(Float, __rSub__, FORM_RPARAM){
@@ -247,7 +247,7 @@
return NULL;
}
}
- return new_float_obj(ist, float_other - Float_value(self));
+ return NEW_FLOAT(float_other - Float_value(self));
}
DEF(Float, __pow__, FORM_RPARAM){
@@ -264,7 +264,7 @@
return NULL;
}
}
- return new_float_obj(ist, pow(Float_value(self), float_other));
+ return NEW_FLOAT(pow(Float_value(self), float_other));
}
DEF(Float, __rPow__, FORM_RPARAM){
@@ -279,7 +279,7 @@
return NULL;
}
}
- return new_float_obj(ist, pow(float_other, Float_value(self)));
+ return NEW_FLOAT(pow(float_other, Float_value(self)));
}
@@ -298,7 +298,7 @@
}
}
if (Float_value(self) == float_other)
- return new_float_obj(ist, 0);
+ return NEW_FLOAT(0);
else if (Float_value(self) > float_other)
return NEW_INT(1);
else
@@ -318,7 +318,7 @@
}
}
if (Float_value(self) == float_other)
- return new_float_obj(ist, 0);
+ return NEW_FLOAT(0);
else if (Float_value(self) < float_other)
return NEW_INT(1);
else
@@ -345,7 +345,7 @@
DEF(Float, __str__, NULL){
char str[1024];
apr_snprintf(str, sizeof(str), "%g", Float_value(self));
- return new_string_obj(ist, str);
+ return NEW_STRING(str);
}
DEF(Float, __covers__QUES, FORM_RPARAM) {
@@ -355,9 +355,9 @@
DEF(Float, __coerce__, FORM_RPARAM) {
if (has_proto_QUES(ist, parms[1], OBJ(INT_PROTO)))
- return new_float_obj(ist, (double)(parms[1]->data.i64));
+ return NEW_FLOAT((double)(parms[1]->data.i64));
else if (has_proto_QUES(ist, parms[1], Float_OBJ))
- return new_float_obj(ist, parms[1]->data.f64);
+ return NEW_FLOAT(parms[1]->data.f64);
else
raise_exception(ist, OBJ(TYPE_EXC), "This object cannot be coerced to a Float");
return NULL;
Modified: trunk/src/builtins-int.c
===================================================================
--- trunk/src/builtins-int.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/builtins-int.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -97,7 +97,7 @@
/* Dependent objects */
OBJ(ZERO_INT) = NEW_INT(0);
OBJ(MAX_INT) = NEW_INT(MAX_INT_VAL);
- OBJ(LONG_PROTO) = new_string_obj(ist, "0");
+ OBJ(LONG_PROTO) = NEW_STRING("0");
clr_immutable(OBJ(LONG_PROTO));
set_obj_doc(OBJ(LONG_PROTO), "Long integer number object prototype");
set_immutable(OBJ(LONG_PROTO));
@@ -304,7 +304,7 @@
DEF(Int, __str__, NULL){
char str[24];
apr_snprintf(str, sizeof(str), "%"APR_INT64_T_FMT, (i64_t)Int_value(self));
- return new_string_obj(ist, str);
+ return NEW_STRING(str);
}
DEF(Int, __iter__, NULL) {
@@ -318,7 +318,7 @@
DEF(Int, chr, NULL) {
char s[1];
s[0] = (char) Int_value(self);
- return new_string_n_obj(ist, s, 1);
+ return NEW_STRINGN(s, 1);
}
Modified: trunk/src/builtins-list.c
===================================================================
--- trunk/src/builtins-list.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/builtins-list.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -77,7 +77,7 @@
if (has_proto_QUES(ist, seq, OBJ(STRING_PROTO))) {
s[0] = strch(seq)[i];
s[1] = 0;
- return new_string_obj(ist, s);
+ return NEW_STRING(s);
} else
return list_item(ist, seq, i);
}
@@ -166,21 +166,21 @@
//********************************* list1 *************************************
obj_p list1(isp ist, obj_p item1){
- obj_p list_obj = new_list_obj(ist, 1);
+ obj_p list_obj = NEW_LIST(1);
list_append_no_lock(list_obj, item1);
return list_obj;
}
//********************************* list2 *************************************
obj_p list2(isp ist, obj_p item1, obj_p item2){
- obj_p list_obj = new_list_obj(ist, 2);
+ obj_p list_obj = NEW_LIST(2);
list_append_no_lock(list_obj, item1); list_append_no_lock(list_obj, item2);
return list_obj;
}
//********************************* list3 *************************************
obj_p list3(isp ist, obj_p item1, obj_p item2, obj_p item3){
- obj_p list_obj = new_list_obj(ist, 3);
+ obj_p list_obj = NEW_LIST(3);
list_append_no_lock(list_obj, item1); list_append_no_lock(list_obj, item2);
list_append_no_lock(list_obj, item3);
return list_obj;
@@ -188,7 +188,7 @@
//********************************* list4 *************************************
obj_p list4(isp ist, obj_p item1, obj_p item2, obj_p item3, obj_p item4){
- obj_p list_obj = new_list_obj(ist, 4);
+ obj_p list_obj = NEW_LIST(4);
list_append_no_lock(list_obj, item1); list_append_no_lock(list_obj, item2);
list_append_no_lock(list_obj, item3); list_append_no_lock(list_obj, item4);
return list_obj;
@@ -197,7 +197,7 @@
//********************************* list6 *************************************
obj_p list6(isp ist, obj_p item1, obj_p item2, obj_p item3, obj_p item4,
obj_p item5, obj_p item6 ){
- obj_p list_obj = new_list_obj(ist, 6);
+ obj_p list_obj = NEW_LIST(6);
list_append_no_lock(list_obj, item1); list_append_no_lock(list_obj, item2);
list_append_no_lock(list_obj, item3); list_append_no_lock(list_obj, item4);
list_append_no_lock(list_obj, item5); list_append_no_lock(list_obj, item6);
@@ -207,7 +207,7 @@
//********************************* list8 *************************************
obj_p list8(isp ist, obj_p item1, obj_p item2, obj_p item3, obj_p item4,
obj_p item5, obj_p item6, obj_p item7, obj_p item8 ){
- obj_p list_obj = new_list_obj(ist, 8);
+ obj_p list_obj = NEW_LIST(8);
list_append_no_lock(list_obj, item1); list_append_no_lock(list_obj, item2);
list_append_no_lock(list_obj, item3); list_append_no_lock(list_obj, item4);
list_append_no_lock(list_obj, item5); list_append_no_lock(list_obj, item6);
@@ -553,7 +553,7 @@
}
times = (int)parms[1]->data.i64;
size = len*times;
- if(times == 0) return new_list_obj(ist, 0);
+ if(times == 0) return NEW_LIST(0);
if(times == 1) return self;
res = NEW_OBJ(List_OBJ);
lstp = res->data.ptr = pr_malloc(list_sizeof(size));
Modified: trunk/src/builtins-string.c
===================================================================
--- trunk/src/builtins-string.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/builtins-string.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -70,7 +70,7 @@
//********************************* new_string_obj ****************************
// this cannot be used with binary data, for C strings only
-// for binary data with embedded nulls use new_string_n_obj(ist, )
+// for binary data with embedded nulls use NEW_STRINGN()
obj_p new_string_obj(isp ist, char* str){
obj_p obj;
pr_str_p obj_str;
@@ -210,7 +210,7 @@
return NULL;
}
times = (size_t) parms[1]->data.i64;
- if(times == 0) return new_string_obj(ist, "");
+ if(times == 0) return NEW_STRING("");
if(times == 1) return self;
tlen = len*times+1;
obj = NEW_OBJ(String_OBJ);
@@ -245,7 +245,7 @@
if ( has_proto_QUES(ist, argv_obj, OBJ(STRING_PROTO)) ||
!has_proto_QUES(ist, argv_obj, OBJ(SEQ_PROTO)) ) {
- argv_obj = new_list_obj(ist, 1);
+ argv_obj = NEW_LIST(1);
list_append(ist, argv_obj, parms[1]);
}
argc = list_len(ist, argv_obj);
@@ -273,7 +273,7 @@
raise_exception(ist, OBJ(INTERPRETER_EXC), "invalid or wrong number of %% params");
return NULL;
}
- res = new_string_obj(ist, buf);
+ res = NEW_STRING(buf);
pr_free(buf);
return res;
}
@@ -302,8 +302,8 @@
}
list = parms[1];
llen = (int) list_len(ist, parms[1]);
- if (!llen) return new_string_obj(ist, "");
- str_list = new_list_obj(ist, llen);
+ if (!llen) return NEW_STRING("");
+ str_list = NEW_LIST(llen);
self_str = strch(self);
self_len = pr_strlen(self);
tlen = 0;
Modified: trunk/src/builtins-thread.c
===================================================================
--- trunk/src/builtins-thread.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/builtins-thread.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -80,7 +80,7 @@
thread_ptr->ist = ist;
thread_ptr->apr_os_thread = apr_os_thread_current();
thread_ptr->running = TRUE;
- set_attr(ist, thread_obj, sym(ist, "name"), new_string_obj(ist, "ConsoleThread"));
+ set_attr(ist, thread_obj, sym(ist, "name"), NEW_STRING("ConsoleThread"));
pr_lock(&thread_registry_lock);
thread_registry = new_clist(5);
@@ -231,7 +231,7 @@
}
if (parms[5] == OBJ(NONE)) {
apr_snprintf(buf, sizeof(buf), "uThread%lx", (unsigned long)(intptr_t) self);
- name_obj = new_string_obj(ist, buf);
+ name_obj = NEW_STRING(buf);
} else
name_obj = parms[5];
read_unlock(ist, self);
@@ -249,7 +249,7 @@
apr_snprintf(name, sizeof(name), "<Thread:%s>", strch(name_obj));
else
apr_snprintf(name, sizeof(name), "<Thread:%lx>", (unsigned long)(uintptr_t)self);
- return new_string_obj(ist, name);
+ return NEW_STRING(name);
}
DEF(Thread, access, NULL) {
@@ -271,11 +271,11 @@
DEF(Thread, accessStr, NULL) {
switch (ist->access) {
- case 0: return new_string_obj(ist, "guest");
- case 1: return new_string_obj(ist, "user1");
- case 2: return new_string_obj(ist, "user2");
- case 3: return new_string_obj(ist, "system");
- default:return new_string_obj(ist, "<invalid access value>");
+ case 0: return NEW_STRING("guest");
+ case 1: return NEW_STRING("user1");
+ case 2: return NEW_STRING("user2");
+ case 3: return NEW_STRING("system");
+ default:return NEW_STRING("<invalid access value>");
}
}
@@ -335,7 +335,7 @@
DEF(Mutex, __str__, NULL) {
char name[30];
apr_snprintf(name, sizeof(name), "<Mutex:%lx>", (unsigned long)(intptr_t)self);
- return new_string_obj(ist, name);
+ return NEW_STRING(name);
}
DEF(Mutex, lock, NULL) {
Modified: trunk/src/builtins-tuple.c
===================================================================
--- trunk/src/builtins-tuple.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/builtins-tuple.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -66,7 +66,7 @@
//********************************* new_tuple_obj *****************************
obj_p new_tuple_obj(isp ist, int fixed_size) {
- obj_p tuple_obj = new_list_obj(ist, fixed_size);
+ obj_p tuple_obj = NEW_LIST(fixed_size);
assert(!(tuple_obj->has_attrs));
tuple_obj->attr_proto.proto = OBJ(TUPLE_PROTO);
return tuple_obj;
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/interp.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -135,7 +135,7 @@
//********************************* new_slice_obj *****************************
obj_p new_slice_obj(isp ist, obj_p ind1, obj_p ind2, obj_p ind3) {
- obj_p slice_obj = new_list_obj(ist, 3);
+ obj_p slice_obj = NEW_LIST(3);
assert(!(slice_obj->has_attrs));
slice_obj->attr_proto.proto = OBJ(SLICE_PROTO);
if (ind1 == SLICEPARAM_EMPTY)
@@ -272,11 +272,11 @@
if (pstate == 2) goto fparmerr;
pstate = 2;
fparam_proc_state->free_pos_list_key = value;
- fparam_proc_state->free_pos_list_obj = new_list_obj(ist, 10);
+ fparam_proc_state->free_pos_list_obj = NEW_LIST(10);
} else if (label == PARAM_STAR_STAR) {
pstate = 3;
fparam_proc_state->free_label_list_key = value;
- fparam_proc_state->free_label_list_obj = new_list_obj(ist, 10);
+ fparam_proc_state->free_label_list_obj = NEW_LIST(10);
} else {
if (value) pstate = 1;
clist_append(fparam_proc_state->lbl_val_list, label);
@@ -393,7 +393,7 @@
ist->exception_obj = 0;
fstk_obj = get_attr(ist, orig_excobj, sym(ist, "frame_stack"));
if (!fstk_obj)
- set_attr(ist, orig_excobj, sym(ist, "frame_stack"), (fstk_obj = new_list_obj(ist, 10)));
+ set_attr(ist, orig_excobj, sym(ist, "frame_stack"), (fstk_obj = NEW_LIST(10)));
srcmap = frame->code->srcmap;
for (i = 0; i < clist_len(srcmap); i += 3) {
pc = clist_num(srcmap, i);
@@ -402,7 +402,7 @@
col = clist_num(srcmap, i+2);
}
if (frame->code->file_path)
- str_obj = new_string_obj(ist, frame->code->file_path);
+ str_obj = NEW_STRING(frame->code->file_path);
list_append(ist, fstk_obj, str_obj);
list_append(ist, fstk_obj, NEW_INT(line));
list_append(ist, fstk_obj, NEW_INT(col));
@@ -829,7 +829,7 @@
fr_push(tuple_obj);
} break;
case OP_NEWLIST: {
- obj_p list_obj = new_list_obj(ist, param);
+ obj_p list_obj = NEW_LIST(param);
fr_sp -= param;
for (i=0; i<param; i++)
list_append(ist, list_obj, fr_stack[fr_sp+i]);
@@ -859,7 +859,7 @@
case OP_DEF: {
int fparams_len = fr_data_int(1)*2;
obj_p func = call_func0(ist, fr_data(2), SYM(COPY));
- obj_p fparams_obj = new_list_obj(ist, fparams_len);
+ obj_p fparams_obj = NEW_LIST(fparams_len);
fr_sp -= fparams_len+2;
assert(sizeof(obj_p) == sizeof(obj_p));
memcpy( ((list_p)(obj_data_p(fparams_obj)))->item,
@@ -1556,7 +1556,7 @@
su(i);
set_attr(ist, OBJ(MODULES), main_sym, module);
set_attr(ist, OBJ(OBJECT), main_sym, module);
- set_attr(ist, thread_obj, sym(ist, "name"), new_string_obj(ist, name));
+ set_attr(ist, thread_obj, sym(ist, "name"), NEW_STRING(name));
set_attr(ist, module, sym(ist, "thread"), thread_obj);
un_su(i);
thread_p->main_id = main_index;
Modified: trunk/src/memory_mgr.c
===================================================================
--- trunk/src/memory_mgr.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/memory_mgr.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -108,7 +108,7 @@
//********************************* mem_mgr_thread ******************************
void *mem_mgr_thread(apr_thread_t *handle, void *dummy) {
isp ist = get_ist(ACC_SYSTEM);
- obj_p mm_obj_list = new_list_obj(ist, 100);
+ obj_p mm_obj_list = NEW_LIST(100);
obj_p mm_obj_act_param[2];
int last_obj_del_count = 0, last_obj_count = 0;
Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/object.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -205,7 +205,7 @@
OBJ(DICT_PROTO) = NEW_OBJ(NULL);
OBJ(FUNC_PROTO) = NEW_OBJ(NULL);
- OBJ(SYMBOLS) = new_list_obj(ist, SYM_ENUM_COUNT+100);
+ OBJ(SYMBOLS) = NEW_LIST(SYM_ENUM_COUNT+100);
init_symbol(ist);
@@ -610,7 +610,7 @@
clist_item(pao_list,i) = 0;
k++;
}
- list_obj = new_list_obj(ist, clist_len(pao_list)-k);
+ list_obj = NEW_LIST(clist_len(pao_list)-k);
for (i=0; i < clist_len(pao_list); i++)
if ((proto = clist_item(pao_list, i)))
list_append(ist, list_obj, proto);
@@ -842,10 +842,10 @@
char* ns = pr_malloc(strlen(str)+1);
strcpy(ns, str);
ns[strlen(str)-1] = 0;
- set_attr(ist, obj, SYM(__DOC__), new_string_obj(ist, ns));
+ set_attr(ist, obj, SYM(__DOC__), NEW_STRING(ns));
pr_free(ns);
} else
- set_attr(ist, obj, SYM(__DOC__), new_string_obj(ist, str));
+ set_attr(ist, obj, SYM(__DOC__), NEW_STRING(str));
}
//********************************* new_C_func_obj ******************************
Modified: trunk/src/parser.h
===================================================================
--- trunk/src/parser.h 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/parser.h 2004-04-17 20:51:35 UTC (rev 376)
@@ -116,7 +116,7 @@
#define OR_FLAG 0
#define AND_FLAG 1
-#define NEW_LIST 0
+#define NEW_LIST_ 0
#define NEW_TUPLE 1
#define NEW_REAL 0
#define NEW_IMAG 1
Modified: trunk/src/prothon.y
===================================================================
--- trunk/src/prothon.y 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/prothon.y 2004-04-17 20:51:35 UTC (rev 376)
@@ -530,7 +530,7 @@
| FLOAT_IMAG { $$ = float_to_obj(yylex_param, $1, NEW_IMAG); }
| STRING { $$ = string_to_obj(yylex_param, $1, NEW_STRN); }
| '{' brace_params '}' { $$ = new_dict(yylex_param, $2); }
- | '[' list_params ']' { $$ = new_tuple_list(yylex_param, $2, NEW_LIST); }
+ | '[' list_params ']' { $$ = new_tuple_list(yylex_param, $2, NEW_LIST_); }
| '(' expr ')' { $$ = $2; }
| '(' tuple_params ')' { $$ = new_tuple_list(yylex_param, $2, NEW_TUPLE); }
| obj '(' function_params ')' { $$ = obj_func_params(yylex_param, $1, $3); }
Modified: trunk/src/symbol.c
===================================================================
--- trunk/src/symbol.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/symbol.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -243,7 +243,7 @@
symbol_tree = ins_trie(symbol_tree, s, sym);
if (!STRING_SYM) STRING_SYM = sym;
pr_unlock(&symbol_tree_lock);
- set_attr(ist, sym, STRING_SYM, new_string_obj(ist, s));
+ set_attr(ist, sym, STRING_SYM, NEW_STRING(s));
sym->wr_access = ACC_SYSTEM;
su(i);
list_append(ist, OBJ(SYMBOLS), sym);
Modified: trunk/src/sys.c
===================================================================
--- trunk/src/sys.c 2004-04-17 20:31:48 UTC (rev 375)
+++ trunk/src/sys.c 2004-04-17 20:51:35 UTC (rev 376)
@@ -130,7 +130,7 @@
if (!strcmp(full_path, item))
return;
}
- list_append(ist, list, new_string_obj(ist, full_path));
+ list_append(ist, list, NEW_STRING(full_path));
}
obj_p load_sys_module(isp ist, char* prog_path, obj_p argv_obj) {
@@ -143,7 +143,7 @@
apr_file_t *file_pth;
apr_pool_t *mod_pool = NULL;
- sys_path = new_list_obj(ist, 10);
+ sys_path = NEW_LIST(10);
sys_module = NEW_OBJ(OBJ(OBJECT));
set_attr(ist, OBJ(MODULES),sym(ist, "Sys"), sys_module);
set_attr(ist, OBJ(OBJECT), sym(ist, "Sys"), sys_module);
@@ -173,7 +173,7 @@
path[len-1] = 0;
strcpy(home, path);
have_home = TRUE;
- set_attr(ist, sys_module, sym(ist, "prothonhome"), new_string_obj(ist, home));
+ set_attr(ist, sys_module, sym(ist, "prothonhome"), NEW_STRING(home));
}
}
if (!have_home) {
@@ -184,12 +184,12 @@
#endif
strcpy(home, path);
have_home = TRUE;
- set_attr(ist, sys_module, sym(ist, "prothonhome"), new_string_obj(ist, home));
+ set_attr(ist, sys_module, sym(ist, "prothonhome"), NEW_STRING(home));
}
vers_tuple = new_tuple_obj(ist, 3);
- list_append(ist, vers_tuple, new_string_obj(ist, PROTHON_VERSION_NUMBER));
- list_append(ist, vers_tuple, new_string_obj(ist, numonly(PROTHON_VERSION_BUILD, path)));
- list_append(ist, vers_tuple, new_string_obj(ist, PROTHON_VERSION_DATE));
+ list_append(ist, vers_tuple, NEW_STRING(PROTHON_VERSION_NUMBER));
+ list_append(ist, vers_tuple, NEW_STRING(numonly(PROTHON_VERSION_BUILD, path)));
+ list_append(ist, vers_tuple, NEW_STRING(PROTHON_VERSION_DATE));
vers_tuple->immutable = TRUE;
set_attr(ist, sys_module, sym(ist, "version"), vers_tuple);
set_attr(ist, sys_module, sym(ist, "maxint"), NEW_INT(MAX_INT_VAL));
@@ -198,26 +198,26 @@
new_C_func_obj(ist, sys_exit, list2(ist, sym(ist,"num"),NEW_INT(1))) );
#if defined(WIN32)
- set_attr(ist, sys_module, sym(ist, "platform"), new_string_obj(ist, "win32"));
+ set_attr(ist, sys_module, sym(ist, "platform"), NEW_STRING("win32"));
#elif defined(HAVE_SYS_UTSNAME_H)
{
struct utsname uts;
if (uname(&uts)) {
- set_attr(ist, sys_module, sym(ist, "platform"), new_string_obj(ist, "unknown"));
+ set_attr(ist, sys_module, sym(ist, "platform"), NEW_STRING("unknown"));
} else {
char plt_buf[1024];
apr_snprintf(plt_buf, sizeof(plt_buf), "%s %s (%s)",
uts.sysname, uts.release, uts.machine);
- set_attr(ist, sys_module, sym(ist, "platform"), new_string_obj(ist, plt_buf));
+ set_attr(ist, sys_module, sym(ist, "platform"), NEW_STRING(plt_buf));
}
}
#else
- set_attr(ist, sys_module, sym(ist, "platform"), new_string_obj(ist, "unknown"));
+ set_attr(ist, sys_module, sym(ist, "platform"), NEW_STRING("unknown"));
#endif
- set_attr(ist, sys_module, sym(ist, "ps1"), new_string_obj(ist, ">>> "));
- set_attr(ist, sys_module, sym(ist, "ps2"), new_string_obj(ist, "... "));
- set_attr(ist, sys_module, sym(ist, "execpath"), new_string_obj(ist, prog_path));
+ set_attr(ist, sys_module, sym(ist, "ps1"), NEW_STRING(">>> "));
+ set_attr(ist, sys_module, sym(ist, "ps2"), NEW_STRING("... "));
+ set_attr(ist, sys_module, sym(ist, "execpath"), NEW_STRING(prog_path));
set_attr(ist, sys_module, sym(ist, "argv"), argv_obj);
if (!APR_STATUS_IS_SUCCESS(apr_pool_create(&mod_pool, NULL)))
@@ -257,7 +257,7 @@
for (e=p; *e > ' '; e++);
if (p == e) continue;
*e = 0;
- list_append(ist, sys_path, new_string_obj(ist, p));
+ list_append(ist, sys_path, NEW_STRING(p));
}
apr_file_close(file_pth);
}