rev 612 - in trunk: modules/OS modules/Re modules/SQLite pr/test src
SVN User <[email protected]> Sat, 12 Jun 2004 17:39:03 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-06-12 17:39:00 -0400 (Sat, 12 Jun 2004)
New Revision: 612
Modified:
trunk/modules/OS/OS.c
trunk/modules/Re/Re.c
trunk/modules/SQLite/SQLite.c
trunk/pr/test/adict.pr
trunk/pr/test/dbm.pr
trunk/pr/test/dict.pr
trunk/pr/test/file.pr
trunk/pr/test/hex.pr
trunk/pr/test/imp.pr
trunk/pr/test/int.pr
trunk/pr/test/listcomp.pr
trunk/pr/test/mi2.pr
trunk/pr/test/plist.pr
trunk/pr/test/re.pr
trunk/pr/test/sqlite.pr
trunk/pr/test/string.pr
trunk/pr/test/strmod.pr
trunk/pr/test/supercall.pr
trunk/pr/test/system.pr
trunk/pr/test/test.pr
trunk/src/builtins-core.c
trunk/src/init.pth
trunk/src/interp.c
trunk/src/prothon.y
Log:
Changed SQLite to sqlite, OS to os, Re to re, `var to $var
Modified: trunk/modules/OS/OS.c
===================================================================
--- trunk/modules/OS/OS.c 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/modules/OS/OS.c 2004-06-12 21:39:00 UTC (rev 612)
@@ -50,24 +50,24 @@
* ====================================================================
*/
-// OS.c - OS routines
+// os.c - os routines
#include <stdlib.h>
#include <prothon/prothon_dll.h>
// note: to build this in windows, define NO_APR
-MODULE_DECLARE(OS);
+MODULE_DECLARE(os);
-MODULE_START(OS)
+MODULE_START(os)
{
- OS_OBJ = NEW_OBJ(NULL);
- MODULE_SET_DOC(OS, "Operating System specific routines");
- set_obj_id(OS_OBJ, *, OS);
- MODULE_ADD_TO_BASE(OS);
+ os_OBJ = NEW_OBJ(NULL);
+ MODULE_SET_DOC(os, "Operating System specific routines");
+ set_obj_id(os_OBJ, *, os);
+ MODULE_ADD_TO_BASE(os);
}
-DEF(OS, system, FPARM1(cmd, NULL)) {
+DEF(os, system, FPARM1(cmd, NULL)) {
if (!has_proto(ist, parms[1], OBJ(STRING_PROTO))) {
ist->exception_obj = NEW_OBJ(OBJ(TYPE_EXC));
ist->exception_obj->wr_access = ACC_GUEST;
@@ -77,10 +77,10 @@
return NEW_INT(system(pr2c_strptr(ist, parms[1])));
}
-MAIN_MODULE_INIT(OS)
+MAIN_MODULE_INIT(os)
{
- MODULE_SUB_INIT(OS);
- MODULE_ADD_SYM(OS, system);
+ MODULE_SUB_INIT(os);
+ MODULE_ADD_SYM(os, system);
check_exceptions(ist);
}
Modified: trunk/modules/Re/Re.c
===================================================================
--- trunk/modules/Re/Re.c 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/modules/Re/Re.c 2004-06-12 21:39:00 UTC (rev 612)
@@ -15,7 +15,7 @@
* derivative works, distribute, and otherwise use Prothon alone or in any
* derivative version, provided, however, that HCA's License Agreement and
* HCA's notice of copyright, i.e., "Copyright (c) 2004 Hahn Creative
- * Applications; All Rights Reserved" are retained in Prothon alone or
+ * Applications; All Rights reserved" are retained in Prothon alone or
* in any derivative version prepared by Licensee.
*
* 3. In the event Licensee prepares a derivative work that is based on or
@@ -51,7 +51,7 @@
*/
-// Re.c - regex using POSIX regex()
+// re.c - regex using POSIX regex()
#include <stdio.h>
#include <string.h>
@@ -63,34 +63,34 @@
#define numgrps(re_obj) (((regex_t*)((re_obj)->data.ptr))->re_nsub)
-static obj_p ReException_OBJ;
+static obj_p reException_OBJ;
static obj_p i_flg, s_flg;
-MODULE_DECLARE(Re);
-MODULE_DECLARE(ReCompiled);
-MODULE_DECLARE(ReMatch);
+MODULE_DECLARE(re);
+MODULE_DECLARE(reCompiled);
+MODULE_DECLARE(reMatch);
-MODULE_START(Re)
+MODULE_START(re)
{
- Re_OBJ = NEW_OBJ(NULL);
- MODULE_SET_DOC(Re, "module for regular expressions");
- set_obj_id(Re_OBJ, *, Re);
- MODULE_ADD_TO_BASE(Re);
+ re_OBJ = NEW_OBJ(NULL);
+ MODULE_SET_DOC(re, "module for regular expressions");
+ set_obj_id(re_OBJ, *, re);
+ MODULE_ADD_TO_BASE(re);
- ReException_OBJ = NEW_OBJ(OBJ(EXCEPTION));
- MODULE_SET_DOC(ReException, "Re module error");
- MODULE_ADD_TO_OBJ(ReException, Re_OBJ, "ReException");
+ reException_OBJ = NEW_OBJ(OBJ(EXCEPTION));
+ MODULE_SET_DOC(reException, "re module error");
+ MODULE_ADD_TO_OBJ(reException, re_OBJ, "reException");
i_flg = NEW_INT(REG_ICASE);
s_flg = NEW_INT(REG_NEWLINE); // reverse meaning
- set_attr(ist, Re_OBJ, sym(ist, "I"), i_flg);
- set_attr(ist, Re_OBJ, sym(ist, "IGNORECASE"), i_flg);
- set_attr(ist, Re_OBJ, sym(ist, "S"), s_flg);
- set_attr(ist, Re_OBJ, sym(ist, "DOTALL"), s_flg);
+ set_attr(ist, re_OBJ, sym(ist, "I"), i_flg);
+ set_attr(ist, re_OBJ, sym(ist, "IGNORECASE"), i_flg);
+ set_attr(ist, re_OBJ, sym(ist, "S"), s_flg);
+ set_attr(ist, re_OBJ, sym(ist, "DOTALL"), s_flg);
}
-DEF(Re, compile, FPARM2( pattern, NULL,
+DEF(re, compile, FPARM2( pattern, NULL,
flags, OBJ(ZERO_INT) ) ) {
obj_p re_obj;
regex_t* e = pr_malloc(sizeof(regex_t));
@@ -108,19 +108,19 @@
if ((buf_size = regerror(err, NULL, msg, 1024)) > 1024) {
char* msg2 = pr_malloc(buf_size+1);
regerror(err, NULL, msg2, buf_size);
- raise_exception(ist, ReException_OBJ, "%s", msg2);
+ raise_exception(ist, reException_OBJ, "%s", msg2);
pr_free(msg2);
} else
- raise_exception(ist, ReException_OBJ, "%s", msg);
+ raise_exception(ist, reException_OBJ, "%s", msg);
pr_free(e);
return NULL;
}
if (e->re_nsub > MAX_GROUPS) {
- raise_exception(ist, ReException_OBJ, "more than 99 groups in regular expression");
+ raise_exception(ist, reException_OBJ, "more than 99 groups in regular expression");
return NULL;
}
- re_obj = NEW_OBJ(ReCompiled_OBJ);
- SET_TYPE_IF_EXC(ReCompiled_OBJ, re_obj, DATA_TYPE_DATAPTR) return NULL;
+ re_obj = NEW_OBJ(reCompiled_OBJ);
+ SET_TYPE_IF_EXC(reCompiled_OBJ, re_obj, DATA_TYPE_DATAPTR) return NULL;
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]);
@@ -128,15 +128,15 @@
}
-MODULE_START(ReCompiled)
+MODULE_START(reCompiled)
{
- ReCompiled_OBJ = NEW_OBJ(NULL);
- MODULE_ADD_TO_OBJ(ReCompiled, Re_OBJ, "Re");
- set_obj_id(ReCompiled_OBJ, Re, Re);
- MODULE_SET_DOC(ReCompiled, "prototype for compiled regular expressions");
+ reCompiled_OBJ = NEW_OBJ(NULL);
+ MODULE_ADD_TO_OBJ(reCompiled, re_OBJ, "re");
+ set_obj_id(reCompiled_OBJ, re, re);
+ MODULE_SET_DOC(reCompiled, "prototype for compiled regular expressions");
}
-DEF(ReCompiled, findAll, FORM_RPARAM) {
+DEF(reCompiled, findAll, FORM_RPARAM) {
char* s;
regmatch_t* m;
obj_p res, tuple_obj;
@@ -144,7 +144,7 @@
int i, err, ngrps = numgrps(self);
regex_t* e = self->data.ptr;
- BIN_CONTENT_CHK(ReCompiled);
+ BIN_CONTENT_CHK(reCompiled);
STRING_PARAM(1, s);
res = NEW_LIST(10);
@@ -161,10 +161,10 @@
if ((buf_size = regerror(err, NULL, msg, 1024)) > 1024) {
char* msg2 = pr_malloc(buf_size+1);
regerror(err, NULL, msg2, buf_size);
- raise_exception(ist, ReException_OBJ, "%s", msg2);
+ raise_exception(ist, reException_OBJ, "%s", msg2);
pr_free(msg2);
} else
- raise_exception(ist, ReException_OBJ, "%s", msg);
+ raise_exception(ist, reException_OBJ, "%s", msg);
pr_free(m);
return NULL;
}
@@ -191,7 +191,7 @@
return res;
}
-DEF( ReCompiled, search, FPARM3( s, NULL,
+DEF( reCompiled, search, FPARM3( s, NULL,
start, OBJ(ZERO_INT),
end, NEW_INT(MAX_INT_VAL) ) ) {
obj_p match_obj, lastindex_obj;
@@ -202,7 +202,7 @@
regex_t* e = self->data.ptr;
i64_t start, end;
- BIN_CONTENT_CHK(ReCompiled);
+ BIN_CONTENT_CHK(reCompiled);
STRING_PARAM(1, s);
INT_64_PARAM(2, start);
INT_64_PARAM(3, end);
@@ -217,15 +217,15 @@
if ((buf_size = regerror(err, NULL, msg, 1024)) > 1024) {
char* msg2 = pr_malloc(buf_size+1);
regerror(err, NULL, msg2, buf_size);
- raise_exception(ist, ReException_OBJ, "%s", msg2);
+ raise_exception(ist, reException_OBJ, "%s", msg2);
pr_free(msg2);
} else
- raise_exception(ist, ReException_OBJ, "%s", msg);
+ raise_exception(ist, reException_OBJ, "%s", msg);
pr_free(m);
return NULL;
}
match_obj = NEW_LIST((ngrps+1)*2);
- switch_proto(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(m[i].rm_so));
@@ -242,7 +242,7 @@
return match_obj;
}
-DEF( ReCompiled, split, FPARM2( s, NULL,
+DEF( reCompiled, split, FPARM2( s, NULL,
maxsplit, OBJ(ZERO_INT) ) ) {
regmatch_t* m;
obj_p res;
@@ -251,7 +251,7 @@
int i, split_count=0, maxsplit, err, ngrps = numgrps(self);
char* s;
- BIN_CONTENT_CHK(ReCompiled);
+ BIN_CONTENT_CHK(reCompiled);
STRING_PARAM(1, s);
INT_32_PARAM(2, maxsplit);
@@ -270,10 +270,10 @@
if ((buf_size = regerror(err, NULL, msg, 1024)) > 1024) {
char* msg2 = pr_malloc(buf_size+1);
regerror(err, NULL, msg2, buf_size);
- raise_exception(ist, ReException_OBJ, "%s", msg2);
+ raise_exception(ist, reException_OBJ, "%s", msg2);
pr_free(msg2);
} else
- raise_exception(ist, ReException_OBJ, "%s", msg);
+ raise_exception(ist, reException_OBJ, "%s", msg);
pr_free(m);
return NULL;
}
@@ -374,11 +374,11 @@
*(*p2)=0;
return FALSE;
err:
- raise_exception(ist, ReException_OBJ, "invalid escape sequence");
+ raise_exception(ist, reException_OBJ, "invalid escape sequence");
return TRUE;
}
-DEF( ReCompiled, sub, FPARM3( repl, NULL,
+DEF( reCompiled, sub, FPARM3( repl, NULL,
s, NULL,
count, OBJ(ZERO_INT) ) ) {
@@ -390,7 +390,7 @@
char *repl = "", *orig_s, *p1, *p2, *s, *s_lim, *res;
int i, last_index=0, repl_is_func=FALSE, count, err, ngrps = numgrps(self);
- BIN_CONTENT_CHK(ReCompiled);
+ BIN_CONTENT_CHK(reCompiled);
if ( !has_proto(ist, parms[1], OBJ(STRING_PROTO)) &&
!(repl_is_func=has_proto(ist, parms[1], OBJ(FUNC_PROTO))) ) {
raise_exception(ist, OBJ(TYPE_EXC), "sub repl parameter must be a string or function");
@@ -401,7 +401,7 @@
INT_32_PARAM(3, count);
match_obj = NEW_LIST((ngrps+1)*2);
- switch_proto(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(last_index);
@@ -424,10 +424,10 @@
if ((buf_size = regerror(err, NULL, msg, 1024)) > 1024) {
char* msg2 = pr_malloc(buf_size+1);
regerror(err, NULL, msg2, buf_size);
- raise_exception(ist, ReException_OBJ, "%s", msg2);
+ raise_exception(ist, reException_OBJ, "%s", msg2);
pr_free(msg2);
} else
- raise_exception(ist, ReException_OBJ, "%s", msg);
+ raise_exception(ist, reException_OBJ, "%s", msg);
pr_free(m);
return NULL;
}
@@ -484,69 +484,69 @@
return res_obj;
}
-DEF(ReCompiled, objList_, FORM_RPARAM) {
- BIN_CONTENT_CHK(ReCompiled);
+DEF(reCompiled, objList_, FORM_RPARAM) {
+ BIN_CONTENT_CHK(reCompiled);
return parms[1];
}
-DEF(ReCompiled, del_, NULL) {
- BIN_CONTENT_CHK(ReCompiled);
+DEF(reCompiled, del_, NULL) {
+ BIN_CONTENT_CHK(reCompiled);
regfree((regex_t*)(self->data.ptr));
return OBJ(NONE);
}
-MODULE_START(ReMatch)
+MODULE_START(reMatch)
{
- ReMatch_OBJ = NEW_OBJ(OBJ(LIST_PROTO));
- MODULE_SET_DOC(ReMatch, "prototype for regular expression match objects");
- set_obj_id(ReMatch_OBJ, Re, Match);
- MODULE_ADD_TO_OBJ(ReMatch, Re_OBJ, "Match");
+ reMatch_OBJ = NEW_OBJ(OBJ(LIST_PROTO));
+ MODULE_SET_DOC(reMatch, "prototype for regular expression match objects");
+ set_obj_id(reMatch_OBJ, re, Match);
+ MODULE_ADD_TO_OBJ(reMatch, re_OBJ, "Match");
}
-DEF(ReMatch, objList_, FORM_RPARAM) {
- BIN_CONTENT_CHK(ReMatch);
+DEF(reMatch, objList_, FORM_RPARAM) {
+ BIN_CONTENT_CHK(reMatch);
return parms[1];
}
-DEF(ReMatch, start, FPARM1(groupid, OBJ(ZERO_INT))) {
+DEF(reMatch, start, FPARM1(groupid, OBJ(ZERO_INT))) {
u32_t grp;
i64_t groupid;
- BIN_CONTENT_CHK(ReMatch);
+ BIN_CONTENT_CHK(reMatch);
INT_64_PARAM(1, groupid);
grp = (u32_t) groupid;
if (grp < 0 || grp >= list_len(ist, self)/2) {
- raise_exception(ist, ReException_OBJ, "start function groupid parameter value invalid");
+ raise_exception(ist, reException_OBJ, "start function groupid parameter value invalid");
return NULL;
}
return list_item(ist, self, 2*grp);
}
-DEF(ReMatch, end, FPARM1(groupid, OBJ(ZERO_INT))) {
+DEF(reMatch, end, FPARM1(groupid, OBJ(ZERO_INT))) {
u32_t grp;
i64_t groupid;
- BIN_CONTENT_CHK(ReMatch);
+ BIN_CONTENT_CHK(reMatch);
INT_64_PARAM(1, groupid);
grp = (u32_t) groupid;
if (grp < 0 || grp >= list_len(ist, self)/2) {
- raise_exception(ist, ReException_OBJ, "end function groupid parameter value invalid");
+ raise_exception(ist, reException_OBJ, "end function groupid parameter value invalid");
return NULL;
}
return list_item(ist, self, 2*grp+1);
}
-DEF(ReMatch, span, FPARM1(groupid, OBJ(ZERO_INT))) {
+DEF(reMatch, span, FPARM1(groupid, OBJ(ZERO_INT))) {
u32_t grp;
obj_p res;
i64_t groupid;
- BIN_CONTENT_CHK(ReMatch);
+ BIN_CONTENT_CHK(reMatch);
INT_64_PARAM(1, groupid);
grp = (u32_t) groupid;
if (grp < 0 || grp >= list_len(ist, self)/2) {
- raise_exception(ist, ReException_OBJ, "span function groupid parameter value invalid");
+ raise_exception(ist, reException_OBJ, "span function groupid parameter value invalid");
return NULL;
}
res = NEW_TUPLE(2);
@@ -556,12 +556,12 @@
return res;
}
-DEF(ReMatch, expand, FORM_RPARAM) {
+DEF(reMatch, expand, FORM_RPARAM) {
size_t size;
char *p1, *p2, *s, *s_lim, *orig_s;
obj_p orig_s_obj, res;
- BIN_CONTENT_CHK(ReMatch);
+ BIN_CONTENT_CHK(reMatch);
STRING_PARAM(1, p1);
size = (strlen(p1) * 2 > 256 ? strlen(p1) * 2 : 256);
@@ -576,13 +576,13 @@
return res;
}
-DEF( ReMatch, group, list4(ist, sym(ist, "groupid"), OBJ(ZERO_INT),
+DEF( reMatch, group, list4(ist, sym(ist, "groupid"), OBJ(ZERO_INT),
PARAM_STAR, sym(ist, "groupids") ) ) {
int i, j, llen, ngrps = ((int)list_len(ist, self))/2, sp, ep;
char* orig_s;
obj_p orig_s_obj, res;
- BIN_CONTENT_CHK(ReMatch);
+ BIN_CONTENT_CHK(reMatch);
INT_32_PARAM(1, j);
if (j < 0 || j > ngrps) {
@@ -627,13 +627,13 @@
}
}
-DEF( ReMatch, groups, FPARM1(default, OBJ(NONE))) {
+DEF( reMatch, groups, FPARM1(default, OBJ(NONE))) {
int i, ngrps = (int)list_len(ist, self)/2, sp, ep;
char* orig_s;
obj_p orig_s_obj, res = NEW_TUPLE(ngrps);
orig_s_obj = get_attr(ist, self, sym(ist, "string")); if_exc_return NULL;
orig_s = pr2c_strptr(ist, orig_s_obj);
- BIN_CONTENT_CHK(ReMatch);
+ BIN_CONTENT_CHK(reMatch);
for (i=0; i < ngrps; i++) {
sp = (int)(list_item(ist, self, i*2 )->data.i64);
ep = (int)(list_item(ist, self, i*2+1)->data.i64);
@@ -645,27 +645,27 @@
}
-MAIN_MODULE_INIT(Re)
+MAIN_MODULE_INIT(re)
{
- MODULE_SUB_INIT(Re);
- MODULE_ADD_SYM(Re, compile);
+ MODULE_SUB_INIT(re);
+ MODULE_ADD_SYM(re, compile);
- MODULE_SUB_INIT(ReCompiled);
- MODULE_ADD_SYM(ReCompiled, findAll);
- 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_SUB_INIT(reCompiled);
+ MODULE_ADD_SYM(reCompiled, findAll);
+ 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_SUB_INIT(ReMatch);
- MODULE_ADD_SYM(ReMatch, start);
- MODULE_ADD_SYM(ReMatch, end);
- MODULE_ADD_SYM(ReMatch, span);
- MODULE_ADD_SYM(ReMatch, expand);
- MODULE_ADD_SYM(ReMatch, group);
- MODULE_ADD_SYM(ReMatch, groups);
- MODULE_ADD_SYM(ReMatch, objList_);
+ MODULE_SUB_INIT(reMatch);
+ MODULE_ADD_SYM(reMatch, start);
+ MODULE_ADD_SYM(reMatch, end);
+ MODULE_ADD_SYM(reMatch, span);
+ MODULE_ADD_SYM(reMatch, expand);
+ MODULE_ADD_SYM(reMatch, group);
+ MODULE_ADD_SYM(reMatch, groups);
+ MODULE_ADD_SYM(reMatch, objList_);
check_exceptions(ist);
}
Modified: trunk/modules/SQLite/SQLite.c
===================================================================
--- trunk/modules/SQLite/SQLite.c 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/modules/SQLite/SQLite.c 2004-06-12 21:39:00 UTC (rev 612)
@@ -50,7 +50,7 @@
* ====================================================================
*/
-// SQLite.c Prothon wrapper module for SQLite DB
+// sqlite.c Prothon wrapper module for sqlite DB
//
// Conforms to subset of Python DBAPI 2.0
@@ -72,28 +72,28 @@
typedef cursor_t* cursor_p;
-MODULE_DECLARE(SQLite);
+MODULE_DECLARE(sqlite);
MODULE_DECLARE(Connection);
MODULE_DECLARE(Cursor);
MODULE_DECLARE(Error);
-MODULE_START(SQLite)
+MODULE_START(sqlite)
{
- SQLite_OBJ = NEW_OBJ(NULL);
- MODULE_SET_DOC(SQLite, "SQLite database wrapper module");
- MODULE_ADD_TO_BASE(SQLite);
+ sqlite_OBJ = NEW_OBJ(NULL);
+ MODULE_SET_DOC(sqlite, "sqlite database wrapper module");
+ MODULE_ADD_TO_BASE(sqlite);
Connection_OBJ = NEW_OBJ(NULL);
- MODULE_SET_DOC(Connection, "SQLite Connection prototype object");
- MODULE_ADD_TO_OBJ(Connection, SQLite_OBJ, "Connection");
+ MODULE_SET_DOC(Connection, "sqlite Connection prototype object");
+ MODULE_ADD_TO_OBJ(Connection, sqlite_OBJ, "Connection");
Cursor_OBJ = NEW_OBJ(NULL);
- MODULE_SET_DOC(Cursor, "SQLite Cursor prototype object");
- MODULE_ADD_TO_OBJ(Cursor, SQLite_OBJ, "Cursor");
+ MODULE_SET_DOC(Cursor, "sqlite Cursor prototype object");
+ MODULE_ADD_TO_OBJ(Cursor, sqlite_OBJ, "Cursor");
Error_OBJ = NEW_OBJ(OBJ(EXCEPTION));
- MODULE_SET_DOC(Error, "SQLite db error");
- MODULE_ADD_TO_OBJ(Error, SQLite_OBJ, "Error");
+ MODULE_SET_DOC(Error, "sqlite db error");
+ MODULE_ADD_TO_OBJ(Error, sqlite_OBJ, "Error");
Connection_OBJ->unclonable = TRUE;
set_obj_rdacc(Connection_OBJ, ACC_USER1);
@@ -101,13 +101,13 @@
set_obj_rdacc(Cursor_OBJ, ACC_USER1);
}
-DEF(SQLite, connect, list2(ist, sym(ist, "database"), NULL)) {
+DEF(sqlite, connect, list2(ist, sym(ist, "database"), NULL)) {
obj_p conn_obj;
char *filename, *errmsg=NULL;
CHECK_TYPE_EXC(parms[1], OBJ(STRING_PROTO), "string");
filename = pr2c_strptr(ist, parms[1]);
conn_obj = NEW_OBJ(Connection_OBJ);
- set_obj_doc(conn_obj, "SQLite connection");
+ set_obj_doc(conn_obj, "sqlite connection");
conn_obj->unclonable = TRUE;
set_obj_rdacc(conn_obj, ACC_USER1);
SET_TYPE_IF_EXC(Connection_OBJ, conn_obj, DATA_TYPE_DATAPTR) return NULL;
@@ -124,7 +124,7 @@
if (self->data.ptr) {
cursor_p cursorp;
obj_p curs_obj = NEW_OBJ(Cursor_OBJ);
- set_obj_doc(curs_obj, "SQLite cursor");
+ set_obj_doc(curs_obj, "sqlite cursor");
SET_TYPE_IF_EXC(Cursor_OBJ, curs_obj, DATA_TYPE_DATAPTR) return NULL;
cursorp = curs_obj->data.ptr = pr_malloc(sizeof(cursor_t));
cursorp->ist = ist;
@@ -285,10 +285,10 @@
return parms[1];
}
-MAIN_MODULE_INIT(SQLite)
+MAIN_MODULE_INIT(sqlite)
{
- MODULE_SUB_INIT(SQLite);
- MODULE_ADD_SYM(SQLite, connect);
+ MODULE_SUB_INIT(sqlite);
+ MODULE_ADD_SYM(sqlite, connect);
MODULE_ADD_SYM(Connection, cursor);
MODULE_ADD_SYM(Connection, rollBack);
Modified: trunk/pr/test/adict.pr
===================================================================
--- trunk/pr/test/adict.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/adict.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -2,21 +2,21 @@
def err(n):
print "failure number",n
- Sys.exit(1)
+ sys.exit(1)
x = [1]
-if Len(x.attrs_) != 0: err(0)
-x.attrs_ = {`a:1, `b:2}
+if len(x.attrs_) != 0: err(0)
+x.attrs_ = {$a:1, $b:2}
if x.a != 1 or x.b != 2: err(1)
x.c = 3
-if x.attrs_[`c] != 3: err(2)
+if x.attrs_[$c] != 3: err(2)
if x.attrs_['c'] != 3: err(3)
-if Len(x.attrs_) != 3: err(4)
+if len(x.attrs_) != 3: err(4)
del x.attrs_['c']
-del x.attrs_[`b]
-if Len(x.attrs_) != 1: err(5)
-if x.attrs_.str_() != "{`a:1}": err(6)
-x.attrs_[`b] = 22
+del x.attrs_[$b]
+if len(x.attrs_) != 1: err(5)
+if x.attrs_.str_() != "{$a:1}": err(6)
+x.attrs_[$b] = 22
if x.b != 22: err(7)
print """
Modified: trunk/pr/test/dbm.pr
===================================================================
--- trunk/pr/test/dbm.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/dbm.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -8,7 +8,7 @@
if db.exists?('a'):
print 'err1'
- Sys.exit(1)
+ sys.exit(1)
db.store('a', 'abcdef')
db.store('c', 'xyz')
@@ -16,19 +16,19 @@
if not db.exists?('a'):
print 'err2'
- Sys.exit(1)
+ sys.exit(1)
if db.fetch('a') != 'abcdef':
print 'err3'
- Sys.exit(1)
+ sys.exit(1)
if db.fetch('b') != '':
print 'err4'
- Sys.exit(1)
+ sys.exit(1)
if db.fetch('c') != 'xyz':
print 'err5'
- Sys.exit(1)
+ sys.exit(1)
list = []
k = db.firstKey()
@@ -40,7 +40,7 @@
if list != ['a','b','c']:
print 'err6'
- Sys.exit(1)
+ sys.exit(1)
print '\nall tests passed\n'
Modified: trunk/pr/test/dict.pr
===================================================================
--- trunk/pr/test/dict.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/dict.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -4,7 +4,7 @@
def err(str):
print str
- Sys.exit(1)
+ sys.exit(1)
d = {1:2}
if d.keys() != [1] : err( 'error in keys' )
@@ -23,7 +23,7 @@
if d.items() != e.items():
err( 'error1' )
-if Len(e.items()) != 2:
+if len(e.items()) != 2:
err( 'error2' )
d.clear!()
@@ -37,7 +37,7 @@
dd = Dict(a=1)
-if `a not in dd: err( 'error5' )
+if $a not in dd: err( 'error5' )
if "a" not in dd: err( 'error6' )
print 'all tests passed'
Modified: trunk/pr/test/file.pr
===================================================================
--- trunk/pr/test/file.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/file.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -14,27 +14,27 @@
print x
if (x != ''.join(ref)):
print "test failed: x != f"
- Sys.exit(1)
+ sys.exit(1)
f.seek(7)
x = f.read(7)
print x
if (x != 'line 1\n'):
print "test failed: x != 'line 1'"
- Sys.exit(1)
+ sys.exit(1)
f.seek(21)
x = f.read(14)
print x
if (x != 'line 3\nline 4\n'):
print "test failed: x != 'line 3line 4'"
- Sys.exit(1)
+ sys.exit(1)
x = f.readLines()
ref = ['line 5\n','line 6\n','line 7\n','line 8\n','line 9\n',]
print x
if (''.join(x) != ''.join(ref)):
print "test failed: x != 'line 5','line 6','line 7','line 8','line 9'"
- Sys.exit(1)
+ sys.exit(1)
print "\nall tests passed"
Modified: trunk/pr/test/hex.pr
===================================================================
--- trunk/pr/test/hex.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/hex.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -5,8 +5,8 @@
while n:
d = n & 0xf
n = n >> 4
- if d < 10: s = ('0'.ord()+d).chr() + s
- else: s = ('a'.ord()+d-10).chr() + s
+ if d < 10: s = ('0'.ord_()+d).chr_() + s
+ else: s = ('a'.ord_()+d-10).chr_() + s
return s
print hex(0x100)
Modified: trunk/pr/test/imp.pr
===================================================================
--- trunk/pr/test/imp.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/imp.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -2,9 +2,9 @@
# imp.pr
-Sys.path.append!('../../pr/test')
-Sys.path.append!('../pr/test')
-print Sys.path
+sys.path.append!('../../pr/test')
+sys.path.append!('../pr/test')
+print sys.path
import imp2
Modified: trunk/pr/test/int.pr
===================================================================
--- trunk/pr/test/int.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/int.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -2,7 +2,7 @@
def err(n):
print 'error', n
- Sys.exit(1)
+ sys.exit(1)
x = 1
if x != 1: err(0)
Modified: trunk/pr/test/listcomp.pr
===================================================================
--- trunk/pr/test/listcomp.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/listcomp.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -5,17 +5,17 @@
lst = [x for x in 4]
if lst != [0, 1, 2, 3]:
print "err1"
- Sys.exit(1)
+ sys.exit(1)
lst = [(x,y) for x in 2 for y in 2]
if lst != [(0, 0), (0, 1), (1, 0), (1, 1)]:
print "err2"
- Sys.exit(1)
+ sys.exit(1)
lst = [(x,y) for x in 4 if x%2==0 for y in 4 if y%2==1]
if lst != [(0, 1), (0, 3), (2, 1), (2, 3)]:
print "err3"
- Sys.exit(1)
+ sys.exit(1)
print
print "all tests passed"
Modified: trunk/pr/test/mi2.pr
===================================================================
--- trunk/pr/test/mi2.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/mi2.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -2,7 +2,7 @@
def refer(start, attrname):
mro = self.protoChain()
- n = mro.len()
+ n = mro.len_()
i = 0
while i < n:
if mro[i] is start:
@@ -45,7 +45,7 @@
for i in 100:
if m != i % 8:
print "test failed:",i
- Sys.exit(1)
+ sys.exit(1)
m = m + n
print """
Modified: trunk/pr/test/plist.pr
===================================================================
--- trunk/pr/test/plist.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/plist.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -2,7 +2,7 @@
def err(n):
print "failure number",n
- Sys.exit(1)
+ sys.exit(1)
x = Object()
x2 = x()
@@ -10,7 +10,7 @@
x4 = x3()
object x5(x4,x3,x2,x): pass
-if Len(x5.protos_) != 4: err(-1)
+if len(x5.protos_) != 4: err(-1)
if x5.protos_[0] is not x4: err(0)
if x5.protos_[1] is not x3: err(1)
if x5.protos_[2] is not x2: err(2)
@@ -21,7 +21,7 @@
b=2
c=3
y.protos_ = [a,b,c]
-if Len(y.protos_) != 3: err(4)
+if len(y.protos_) != 3: err(4)
if y.protos_[0] is not a: err(5)
if y.protos_[1] is not b: err(6)
if y.protos_[2] is not c: err(7)
Modified: trunk/pr/test/re.pr
===================================================================
--- trunk/pr/test/re.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/re.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -1,6 +1,6 @@
#!/usr/bin/env prothon
-import Re
+import re
def findAll(r,s):
result=[]
@@ -10,23 +10,23 @@
r.sub(foundOne, s)
return result
-re = Re.compile("m..k")
+r = re.compile("m..k")
s = 'this mark likes to muck around in minks'
-print findAll(re, s)
+print findAll(r, s)
-print re.findAll(s)
+print r.findAll(s)
-print re.split(s, 2)
+print r.split(s, 2)
-mo = re.search(s, 10)
+mo = r.search(s, 10)
print mo.group(), mo.groups()
-re = Re.compile(" (m..k) (l..e)")
+r = re.compile(" (m..k) (l..e)")
-mo = re.search(s, 2, 20)
+mo = r.search(s, 2, 20)
print mo.group(), mo.groups(), mo.expand(r'grp1:<\1> grp2:<\2>')
Modified: trunk/pr/test/sqlite.pr
===================================================================
--- trunk/pr/test/sqlite.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/sqlite.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -2,9 +2,9 @@
# sqlite.pr
-import SQLite
+import sqlite
-conn = SQLite.connect('test.db')
+conn = sqlite.connect('test.db')
curs = conn.cursor()
try: curs.execute!("drop table tbl1")
@@ -46,27 +46,27 @@
if curs1.rowCount() != 2:
print 'curs1.rowCount() error'
- Sys.exit(1)
+ sys.exit(1)
rows1 = curs1.fetchAll()
for row in rows1:
curs2.execute!('select * from tbl2 where a='+row[0])
if curs2.rowCount() != 9:
print 'curs2.rowCount() error, rows1:', rows1, 'rowCount:',curs2.rowCount()
- Sys.exit(1)
+ sys.exit(1)
for i in 4:
row2 = curs2.fetchOne()
if row2[2] != ''+(101+i) and row2[2] != ''+(201+i):
print 'row2[2] error'
- Sys.exit(1)
+ sys.exit(1)
rows2 = curs2.fetchMany(3)
- if Len(rows2) != 3:
- print 'Len(rows2) error1, rows2:', rows2
- Sys.exit(1)
+ if len(rows2) != 3:
+ print 'len(rows2) error1, rows2:', rows2
+ sys.exit(1)
rows2 = curs2.fetchMany(3)
- if Len(rows2) != 2:
- print 'Len(rows2) error2'
- Sys.exit(1)
+ if len(rows2) != 2:
+ print 'len(rows2) error2'
+ sys.exit(1)
conn.close()
print '\nall tests passed\n'
Modified: trunk/pr/test/string.pr
===================================================================
--- trunk/pr/test/string.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/string.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -2,7 +2,7 @@
def err(n):
print 'test',n,'failed'
- Sys.exit(1)
+ sys.exit(1)
x = "abcdefghijklm"
@@ -14,7 +14,7 @@
if "e:de:def:ab:fed:fedcba:abcdef" != x[-2]+':'+x[-3:-1]+':'+x[3:]+':'+x[:2]+':'+x[:2:-1]+':'+x[::-1]+':'+x[:]:
err(2)
-if 3 != Len("abc"): err(3)
+if 3 != len("abc"): err(3)
if "ABC" != "abc".upper(): err(4)
Modified: trunk/pr/test/strmod.pr
===================================================================
--- trunk/pr/test/strmod.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/strmod.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -106,4 +106,4 @@
print '\nall tests passed\n'
else:
print "%d failure(s) occurred!\n"%failures
- Sys.exit(1)
+ sys.exit(1)
Modified: trunk/pr/test/supercall.pr
===================================================================
--- trunk/pr/test/supercall.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/supercall.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -4,7 +4,7 @@
def call_():
if self.call_ is super.call_:
print "Error: self.call_ is super.call_"
- Sys.exit(1)
+ sys.exit(1)
return super.call_()
Y = X()
Modified: trunk/pr/test/system.pr
===================================================================
--- trunk/pr/test/system.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/system.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -1,6 +1,6 @@
#!/usr/bin/env prothon
-import OS
+import os
print
print 'The following lines should be:'
@@ -8,6 +8,6 @@
print '0'
print
-ret = OS.system("echo hello")
+ret = os.system("echo hello")
print ret
print
\ No newline at end of file
Modified: trunk/pr/test/test.pr
===================================================================
--- trunk/pr/test/test.pr 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/pr/test/test.pr 2004-06-12 21:39:00 UTC (rev 612)
@@ -1,13 +1,39 @@
#!/usr/bin/env prothon
-# -i -dpbc ..\pr\test\test.pr
+import re
-try:
- print 0x123.chr_()
-except Exception, e:
- print e
+def findAll(r,s):
+ result=[]
+ def foundOne(mo):
+ outer.result.append!(mo.group())
+ return ''
+ r.sub(foundOne, s)
+ return result
-try:
- 0x123456789.chr_()
-except Exception, e:
- print e
+re = re.compile("m..k")
+
+s = 'this mark likes to muck around in minks'
+
+print findAll(re, s)
+
+print re.findAll(s)
+
+print re.split(s, 2)
+
+mo = re.search(s, 10)
+
+print mo.group(), mo.groups()
+
+re = re.compile(" (m..k) (l..e)")
+
+mo = re.search(s, 2, 20)
+
+print mo.group(), mo.groups(), mo.expand(r'grp1:<\1> grp2:<\2>')
+
+print "\n-------- above should look like ... -------------\n"
+
+print "['mark', 'muck', 'mink']"
+print "['mark', 'muck', 'mink']"
+print "['this ', ' likes to ', ' around in minks']"
+print "mark ('mark')"
+print " mark like (' mark like', 'mark', 'like') grp1:<mark> grp2:<like>"
Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/src/builtins-core.c 2004-06-12 21:39:00 UTC (rev 612)
@@ -398,7 +398,7 @@
obj_p str_obj = get_attr(ist, self, SYM(STRING_));
char buf[512];
BIN_STR_CHK(Symbol);
- apr_snprintf(buf, sizeof(buf), "`%s", pr2c_strptr(ist, str_obj));
+ apr_snprintf(buf, sizeof(buf), "$%s", pr2c_strptr(ist, str_obj));
return NEW_STRING(buf);
}
Modified: trunk/src/init.pth
===================================================================
--- trunk/src/init.pth 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/src/init.pth 2004-06-12 21:39:00 UTC (rev 612)
@@ -7,11 +7,11 @@
c:\prothon\modules\re\debug
c:\prothon\modules\prosist\debug
-c:\prothon\modules\SQLite\debug
+c:\prothon\modules\sqlite\debug
c:\prothon\modules\OS\debug
c:\prothon\modules\DBM\debug
# this is executed before Main as module PthMod1
-#import Re
+#import re
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/src/interp.c 2004-06-12 21:39:00 UTC (rev 612)
@@ -879,7 +879,8 @@
printf("Internal fatal error: frame stack overflow\n");
pr_exit(1);
}
-
+ if (fr_pc == 133)
+ op = op;
switch (op) {
case OP_NOP:
break;
Modified: trunk/src/prothon.y
===================================================================
--- trunk/src/prothon.y 2004-06-12 20:45:02 UTC (rev 611)
+++ trunk/src/prothon.y 2004-06-12 21:39:00 UTC (rev 612)
@@ -183,7 +183,7 @@
%left UPL
%left UMI
%nonassoc '~'
-%nonassoc '`'
+%nonassoc '$'
%right EXP
%left '.'
%left ':'
@@ -552,7 +552,7 @@
| INT_IMAG { $$ = float_to_obj(yylex_param, 0.0, $1, NEW_IMAG); }
| FLOAT_IMAG { $$ = float_to_obj(yylex_param, $1, NULL, NEW_IMAG); }
| STRING { $$ = string_to_obj(yylex_param, $1); }
- | '`' LABEL %prec '`' { $$ = rquote_lbl_to_obj(yylex_param, $2); }
+ | '$' LABEL %prec '$' { $$ = rquote_lbl_to_obj(yylex_param, $2); }
| target_param { $$ = tgtparm_to_obj(yylex_param, $1); }
| '{' brace_params '}' { $$ = new_dict(yylex_param, $2); }
| '[' list_params ']' { $$ = new_tuple_list(yylex_param, $2, NEW_LIST_); }