rev 697 - in trunk: . bin include/prothon modules/Prosist src
SVN User <[email protected]> Sat, 03 Jul 2004 17:55:18 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-07-03 17:55:15 -0400 (Sat, 03 Jul 2004)
New Revision: 697
Added:
trunk/bin/debug-rel.bat
Modified:
trunk/CHANGES.txt
trunk/bin/mark-rel-chklst.txt
trunk/bin/rel.bat
trunk/include/prothon/prothon.h
trunk/include/prothon/prothon_dll.h
trunk/modules/Prosist/Prosist.c
trunk/src/builtins-tuple.c
trunk/src/interp.c
trunk/src/lock.c
trunk/src/lock.h
trunk/src/main.c
trunk/src/memory_mgr.c
trunk/src/memory_mgr.h
trunk/src/object.c
trunk/src/object.h
Log:
*** Releae Build ***
Modified: trunk/CHANGES.txt
===================================================================
--- trunk/CHANGES.txt 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/CHANGES.txt 2004-07-03 21:55:15 UTC (rev 697)
@@ -1,6 +1,49 @@
----- Prothon Release History ----
+Version 0.1.2 - Build 697 - 7/03/04
+ - print is now a function, not a keyword
+ - function-as-command feature allows print to be used without parens
+ - Added prop keyword and properties feature with wildcards
+ - Changed del_ to final_ so properties could use get_, set_, & del_
+ - a += b type assignments now always do a = a + b
+ - New in-place modify operators a +! b, a -! b, a *! b, etc.
+ - Formal parameter default values now evaluated at call time
+ - String now stored with native 24-bit ordinal values
+ - Split String type into seperate String and Bytes (binary) types
+ - Split File into File and TextFile
+ - Replaced String % operator with String.fmt()
+ - Added object-oriented Directory object and methods
+ - Added TempDir and TempFile (deleted at shutdown)
+ - Added basic DateTime object
+ - Added WeakRef object with callback feature on obj modification
+ - Added Slice object
+ - getItem_, setItem_, and delItem_ now allow any object indexing
+ - Finalization now called on shutdown
+ - Added built-in range() generator (not list function)
+ - Added List(iter_) constructor
+ - Octal constant format changed from 0377 to 0o377
+ - except keyword no longer allowed alone, must use "except Exception"
+ - except syntax changed from "except exc, var" to "except exc as var"
+ - Function formal params now introspectable via simple attribute
+ - *args param local variable in func is now a tuple, not a list
+ - Fixed raise keyword so second arg is doc_ attribute of first
+ - Added immutable check to dictionary function key parameter
+ - Moved File from extension module to built-in
+ - Changed File.stdxxx to sys.stdIn, sys.stdOut, and sys.stdErr
+ - changed Len, Cmp, len, cmp, chr, ord to
+ len, cmp, len_, cmp_, chr_, ord_
+ - changed Sys to sys, changed sys.ps1, sys.ps2 to sys.cons.ps1,
+ sys.cons.ps2
+ - Changed SQLite to sqlite, OS to os, Re to re
+ - Change symbol prefix from backtick (`var) to dollar-sign ($var)
+ - Changed console prompt from >>> to O>>
+ - Fixed crash on printing recursive containers, now prints ...
+ - Fixed assignment from sequences to arg lists and for statements
+ - Fixed import in console
+ - Fixed bug in Func constructor
+ - Fixed bug in string.rstrip, string.strip, and string.find
+
Version 0.1.1 - Build 585 - 6/07/04
- Added super keyword
- Integers now have unlimited precision
Added: trunk/bin/debug-rel.bat
===================================================================
--- trunk/bin/debug-rel.bat 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/bin/debug-rel.bat 2004-07-03 21:55:15 UTC (rev 697)
@@ -0,0 +1,34 @@
+cd \prothon
+
+del /F /S /Q win32\Prothon\pr\test\*.*
+rmdir win32\Prothon\pr\test
+del /F /S /Q win32\Prothon\pr\tutorial\*.*
+rmdir win32\Prothon\pr\tutorial
+del /F /S /Q win32\Prothon\pr\*.*
+rmdir win32\Prothon\pr
+del /F /S /Q win32\Prothon\*.*
+rmdir win32\Prothon
+del /F /S /Q win32\*.*
+rmdir win32
+mkdir win32\Prothon\pr\test
+mkdir win32\Prothon\pr\tutorial
+
+copy src\debug\prothon.exe win32\Prothon
+
+copy modules\DBM\debug\DBM.dll win32\Prothon
+copy modules\File\debug\File.dll win32\Prothon
+copy modules\OS\debug\OS.dll win32\Prothon
+copy modules\Prosist\debug\Prosist.dll win32\Prothon
+copy modules\Re\debug\Re.dll win32\Prothon
+copy modules\SQLite\debug\SQLite.dll win32\Prothon
+
+copy bin\rel.pth win32\Prothon
+copy bin\msvcr71.dll win32\Prothon
+
+copy readme.txt win32\Prothon
+copy changes.txt win32\Prothon
+copy LICENSE win32\Prothon\LICENSE.txt
+
+copy pr\test\*.pr win32\Prothon\pr\test
+copy pr\tutorial\*.pr win32\Prothon\pr\tutorial
+
Modified: trunk/bin/mark-rel-chklst.txt
===================================================================
--- trunk/bin/mark-rel-chklst.txt 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/bin/mark-rel-chklst.txt 2004-07-03 21:55:15 UTC (rev 697)
@@ -1,15 +1,13 @@
Mark's Release checklist
-0) Check that Debug flags are off
-1) Do win32 build with VC set to release
-2) Test all pr files
-3) prepare changes.txt with NEXT build number
-4) touch prothon.h
-5) release with *** release build *** comment
-6) Do "release" build again with final build number
-7) build zip file and upload
-8) notify ben that release is ready for him
-9) wait for ben's ack that linux test's work and that
+1) Test all pr files
+2) Check prothon.h for debug flags and NEXT build number
+3) Do win32 build with VC set to release
+4) prepare changes.txt with NEXT build number
+5) Commit with *** release build *** comment
+6) build zip file and upload
+7) notify ben that release is ready for him
+8) wait for ben's ack that linux test's work and that
he has updated dowload section of website
-a) update news, docs, www.zip, and announcements
+9) update news, docs, www.zip, and announcements
Modified: trunk/bin/rel.bat
===================================================================
--- trunk/bin/rel.bat 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/bin/rel.bat 2004-07-03 21:55:15 UTC (rev 697)
@@ -13,14 +13,14 @@
mkdir win32\Prothon\pr\test
mkdir win32\Prothon\pr\tutorial
-copy src\debug\prothon.exe win32\Prothon
+copy src\release\prothon.exe win32\Prothon
-copy modules\DBM\debug\DBM.dll win32\Prothon
-copy modules\File\debug\File.dll win32\Prothon
-copy modules\OS\debug\OS.dll win32\Prothon
-copy modules\Prosist\debug\Prosist.dll win32\Prothon
-copy modules\Re\debug\Re.dll win32\Prothon
-copy modules\SQLite\debug\SQLite.dll win32\Prothon
+copy modules\DBM\release\DBM.dll win32\Prothon
+copy modules\File\release\File.dll win32\Prothon
+copy modules\OS\release\OS.dll win32\Prothon
+copy modules\Prosist\release\Prosist.dll win32\Prothon
+copy modules\Re\release\Re.dll win32\Prothon
+copy modules\SQLite\release\SQLite.dll win32\Prothon
copy bin\rel.pth win32\Prothon
copy bin\msvcr71.dll win32\Prothon
Modified: trunk/include/prothon/prothon.h
===================================================================
--- trunk/include/prothon/prothon.h 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/include/prothon/prothon.h 2004-07-03 21:55:15 UTC (rev 697)
@@ -786,9 +786,15 @@
// LIST_ITEM_SET: Set object i in list
void list_item_set(isp ist, obj_p list, int i, obj_p new_item);
+// TUPLEn: Convenience tuple create functions
+// tuple1, tuple2 are convenience functions that allow you to create
+// new tuple objects that contain 1 or 2 item objects.
+obj_p tuple1(isp ist, obj_p p1);
+obj_p tuple2(isp ist, obj_p p1, obj_p p2);
+
// LISTn: Convenience list create functions
// list1, list2, ... are convenience functions that allow you to create
-// new list objects that contain 1 to 8 item objects.
+// new list objects that contain 1 or more item objects.
obj_p list1(isp ist, obj_p p1);
obj_p list2(isp ist, obj_p p1, obj_p p2);
obj_p list3(isp ist, obj_p p1, obj_p p2, obj_p p3);
@@ -866,10 +872,10 @@
// module and container equal to * means Object.name.
// no quotes are needed, ex: set_obj_id(Match_OBJ, Re_OBJ, Match);
// All Prototypes should be marked with this.
-#define set_obj_id(obj, module, name) \
- set_attr(ist, (obj), SYM(ID_), \
- list2(ist, NEW_STRING((#module)), \
- NEW_STRING((#name)) ) )
+#define set_obj_id(obj, module, name) \
+ set_attr(ist, (obj), SYM(ID_), \
+ tuple2(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
Modified: trunk/include/prothon/prothon_dll.h
===================================================================
--- trunk/include/prothon/prothon_dll.h 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/include/prothon/prothon_dll.h 2004-07-03 21:55:15 UTC (rev 697)
@@ -79,6 +79,8 @@
void (*list_item_set)(isp ist, obj_p list_obj, int i, obj_p new_item);
size_t (*list_len)(isp ist, obj_p list);
void (*list_clear)(isp ist, obj_p list_obj);
+ obj_p (*tuple1)(isp ist, obj_p p1);
+ obj_p (*tuple2)(isp ist, obj_p p1, obj_p p2);
obj_p (*list1)(isp ist, obj_p p1);
obj_p (*list2)(isp ist, obj_p p1, obj_p p2);
obj_p (*list3)(isp ist, obj_p p1, obj_p p2, obj_p p3);
@@ -312,6 +314,8 @@
#define init_list_data (*services->init_list_data)
#define copy_list_obj (*services->copy_list_obj)
#define sym (*services->sym)
+#define tuple1 (*services->tuple1)
+#define tuple2 (*services->tuple2)
#define list1 (*services->list1)
#define list2 (*services->list2)
#define list3 (*services->list3)
Modified: trunk/modules/Prosist/Prosist.c
===================================================================
--- trunk/modules/Prosist/Prosist.c 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/modules/Prosist/Prosist.c 2004-07-03 21:55:15 UTC (rev 697)
@@ -357,8 +357,11 @@
//******************************** unlock_objects *****************************
void unlock_objects(isp ist, psrec_p psrecp) {
- obj_p olst = dict_keys_values(ist, psrecp->obj_to_proxy, 1 /*keys*/);
- int i, llen = (int) list_len(ist, olst);
+ obj_p olst;
+ int i, llen;
+ olst = dict_keys_values(ist, psrecp->obj_to_proxy, 1 /*keys*/);
+ if_exc_return;
+ llen = (int) list_len(ist, olst);
for(i=0; i < llen; i++) {
obj_p item = list_item(ist, olst, i);
if (item != PSNONE) {
@@ -422,13 +425,17 @@
if (append_all & obj_known)
goto endidobj;
dict_add(ist, psrecp->obj_to_id, mw_obj, id_obj);
- if (ist->exception_obj) { del_unlock(mw_obj); return; }
+ if (ist->exception_obj)
+ { del_unlock(mw_obj); return; }
dict_add(ist, psrecp->id_to_obj, id_obj, obj);
- if (ist->exception_obj) { del_unlock(mw_obj); return; }
+ if (ist->exception_obj)
+ { del_unlock(mw_obj); return; }
dict_add(ist, psrecp->id_to_idobj, id_tuple, obj);
- if (ist->exception_obj) { del_unlock(mw_obj); return; }
+ if (ist->exception_obj)
+ { del_unlock(mw_obj); return; }
dict_add(ist, psrecp->idobj_to_id, mw_obj, id_tuple);
- if (ist->exception_obj) { del_unlock(mw_obj); return; }
+ if (ist->exception_obj)
+ { del_unlock(mw_obj); return; }
ADD_BUF_START();
ADD_NUM(id);
ADD_BUF_TO_DATUM(key);
@@ -517,11 +524,14 @@
}
}
dict_add(ist, psrecp->obj_to_proxy, mw_obj, proxy_obj);
- if (ist->exception_obj) { del_unlock(mw_obj); return; }
+ if (ist->exception_obj)
+ { del_unlock(mw_obj); return; }
dict_add(ist, psrecp->obj_to_id, mw_obj, id_obj);
- if (ist->exception_obj) { del_unlock(mw_obj); return; }
+ if (ist->exception_obj)
+ { del_unlock(mw_obj); return; }
dict_add(ist, psrecp->id_to_obj, id_obj, obj);
- if (ist->exception_obj) { del_unlock(mw_obj); return; }
+ if (ist->exception_obj)
+ { del_unlock(mw_obj); return; }
}
del_unlock(mw_obj);
@@ -621,6 +631,8 @@
list_append(ist, obj, item);
del_unlock(ref_id_obj);
}
+ if (has_proto(ist, obj, OBJ(TUPLE_PROTO)))
+ set_immutable(obj);
goto done;
}
case 'i':
@@ -629,9 +641,11 @@
n = n*10 + *p - '0';
obj->imm_data_len = n;
memcpy(&(obj->data), p+1, sizeof(obj->data));
+ set_immutable(obj);
goto done;
case 's':
c2pr_strcpy(ist, obj, p+1, end-(p+1));
+ set_immutable(obj);
goto done;
case '`':
del_unlock(obj);
@@ -644,11 +658,13 @@
done:
res = call_func0(ist, obj, SYM(FROMSTORPROXY_));
if (obj != res) {
- obj_p mw_res = NEW_MW(res);
+ obj_p mw_res = NEW_MW(res); if_exc_return NULL;
dict_add(ist, psrecp->obj_to_id, mw_res, id_obj);
- if (ist->exception_obj) { del_unlock(mw_res); return NULL; }
+ if (ist->exception_obj)
+ { del_unlock(mw_res); return NULL; }
dict_add(ist, psrecp->id_to_obj, id_obj, res);
- if (ist->exception_obj) { del_unlock(mw_res); return NULL; }
+ if (ist->exception_obj)
+ { del_unlock(mw_res); return NULL; }
del_unlock(mw_res);
del_unlock(obj);
}
Modified: trunk/src/builtins-tuple.c
===================================================================
--- trunk/src/builtins-tuple.c 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/builtins-tuple.c 2004-07-03 21:55:15 UTC (rev 697)
@@ -72,7 +72,23 @@
return tuple_obj;
}
+//********************************* tuple1 *************************************
+obj_p tuple1(isp ist, obj_p item1){
+ obj_p tuple_obj = new_tuple_obj(ist, 1);
+ list_append_no_lock(tuple_obj, item1);
+ set_immutable(tuple_obj);
+ return tuple_obj;
+}
+//********************************* tuple2 *************************************
+obj_p tuple2(isp ist, obj_p item1, obj_p item2){
+ obj_p tuple_obj = new_tuple_obj(ist, 2);
+ list_append_no_lock(tuple_obj, item1); list_append_no_lock(tuple_obj, item2);
+ set_immutable(tuple_obj);
+ return tuple_obj;
+}
+
+
MODULE_DECLARE(Tuple);
MODULE_DECLARE(Tgen);
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/interp.c 2004-07-03 21:55:15 UTC (rev 697)
@@ -112,7 +112,8 @@
//******************************** str_chk_clr ********************************
void str_chk_clr(isp ist, frame_p frame) {
- clist_pop_to(astrstack, frame);
+ if (frame)
+ clist_pop_to(astrstack, frame);
}
//******************************** new_parmptr_obj ****************************
Modified: trunk/src/lock.c
===================================================================
--- trunk/src/lock.c 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/lock.c 2004-07-03 21:55:15 UTC (rev 697)
@@ -341,6 +341,25 @@
if (write_notify_flag) notify(ist, obj, WRITE_NOTIFY);
}
+//********************************* unlock_all_objs ***************************
+void unlock_all_objs() {
+ obj_p obj;
+ pr_lock(&object_list_lock);
+ obj = obj_list_root;
+ while(obj) {
+ if (obj->state == -1) {
+ obj->next_obj = NULL;
+ break;
+ }
+ obj->state = -1;
+ obj->rdlock_cnt = 0;
+ obj->wrlock_req_cnt = 0;
+ obj->wrlock = 0;
+ obj = obj->next_obj;
+ }
+ pr_unlock(&object_list_lock);
+}
+
//********************************* pr_lock ********************************
void pr_lock(pr_lock_t* lockp) {
if (lock(lockp->lock))
Modified: trunk/src/lock.h
===================================================================
--- trunk/src/lock.h 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/lock.h 2004-07-03 21:55:15 UTC (rev 697)
@@ -106,6 +106,8 @@
void get_wrlock(obj_p obj, int force_wait);
+void unlock_all_objs();
+
#endif // #ifndef LOCK_H
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/main.c 2004-07-03 21:55:15 UTC (rev 697)
@@ -70,8 +70,6 @@
#include <apr_thread_proc.h>
#include <apr_portable.h>
-#define MEMMGR_TIMEOUT (200/PAUSE_MS) /* 200 ms */
-
#ifdef TRACE_PARSER
extern int yydebug;
#endif
@@ -94,21 +92,6 @@
}
}
-//********************************* finalize_all ******************************
-void finalize_all(void) {
- isp ist = new_ist(ACC_SYSTEM);
- obj_p obj;
- pr_lock(&object_list_lock);
- obj = obj_list_root;
- pr_unlock(&object_list_lock);
- while(obj) {
- call_func(ist, obj, SYM(FINAL_), NULL, 0, NULL, NULL);
- check_exceptions(ist);
- pr_lock(&object_list_lock);
- obj = obj->next_obj;
- pr_unlock(&object_list_lock);
- }
-}
//********************************* main **************************************
int main(int argc, char *argv[]) {
obj_p sys_argv_obj, main_argv_obj, threads, code_str_obj, main1_thread_obj;
@@ -116,7 +99,7 @@
isp ist;
apr_status_t aprerr;
char buf[1024];
- int cmd_line_option_i_flg, mem_mgr_count;
+ int cmd_line_option_i_flg;
if ((aprerr = apr_app_initialize(&argc, (char const * const **)&argv, NULL))) {
char buf[1024];
@@ -227,11 +210,7 @@
printf("All main threads have terminated, now stopping memory manager ...\n");
#endif
- if (!disable_mem_mgr) {
- mem_mgr_req_termination = TRUE;
- mem_mgr_count = 0;
- while(!mem_mgr_terminated && ++mem_mgr_count < MEMMGR_TIMEOUT) apr_sleep(PAUSE_MS*1000);
- }
+ stop_mem_mgr();
#ifdef DEBUG_THREADS
if (debug_threads && !disable_mem_mgr)
Modified: trunk/src/memory_mgr.c
===================================================================
--- trunk/src/memory_mgr.c 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/memory_mgr.c 2004-07-03 21:55:15 UTC (rev 697)
@@ -166,7 +166,8 @@
pr_lock(&object_list_lock);
obj=obj_list_root;
pr_unlock(&object_list_lock);
- while(obj) {
+ while(obj && !mem_mgr_req_termination) {
+ pr_assert(obj != obj->next_obj);
mm_write_lock(ist, obj);
obj->state = OBJ_STATE_UNMARKED;
obj->scanned = FALSE;
@@ -192,14 +193,11 @@
markscan:
if (ist->exception_obj)
i=0;
- while(TRUE) {
+ while(TRUE && !mem_mgr_req_termination) {
obj_p val;
obj_count++;
- if (ist->exception_obj)
- i=0;
+ pr_assert(obj != obj->next_obj);
mm_read_lock(ist, obj);
- if (ist->exception_obj)
- i=0;
if (obj->has_attrs) {
int i;
attr_p attrs = obj->attr_proto.attrs;
@@ -305,7 +303,8 @@
obj=obj_list_root;
pr_unlock(&object_list_lock);
last_obj = NULL;
- while(obj) {
+ while(obj && !mem_mgr_req_termination) {
+ pr_assert(obj != obj->next_obj);
obj_count++;
if (obj->state != OBJ_STATE_NEW_OR_MARKED && !obj->del_locked) {
delete_notify(ist, obj);
@@ -346,3 +345,14 @@
}
return NULL;
}
+
+//********************************* stop_mem_mgr ******************************
+void stop_mem_mgr() {
+ int mem_mgr_count = 0;
+ if (!disable_mem_mgr) {
+ mem_mgr_req_termination = TRUE;
+ while(!mem_mgr_terminated && ++mem_mgr_count < MEMMGR_TIMEOUT)
+ apr_sleep(PAUSE_MS*1000);
+ }
+}
+
Modified: trunk/src/memory_mgr.h
===================================================================
--- trunk/src/memory_mgr.h 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/memory_mgr.h 2004-07-03 21:55:15 UTC (rev 697)
@@ -62,6 +62,8 @@
#include <apr_thread_proc.h>
+#define MEMMGR_TIMEOUT (200/PAUSE_MS) /* 200 ms */
+
#define FATAL_TIMEOUT_SECS 5
#define TIMEOUTS_PER_SEC 10
#define FATAL_TRIES FATAL_TIMEOUT_SECS*TIMEOUTS_PER_SEC
@@ -87,5 +89,6 @@
extern i64_t hi_mem_boundary;
extern i64_t lo_mem_boundary;
+void stop_mem_mgr();
#endif // #define MEMORY_MGR_H
Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/object.c 2004-07-03 21:55:15 UTC (rev 697)
@@ -152,6 +152,8 @@
dll_services.call_func1_f = call_func1_f;
dll_services.call_func2_f = call_func2_f;
dll_services.sym = sym;
+ dll_services.tuple1 = tuple1;
+ dll_services.tuple2 = tuple2;
dll_services.list1 = list1;
dll_services.list2 = list2;
dll_services.list3 = list3;
@@ -1121,6 +1123,24 @@
return func_obj;
}
+//********************************* finalize_all ******************************
+void finalize_all(void) {
+ isp ist = new_ist(ACC_SYSTEM);
+ obj_p obj;
+ stop_mem_mgr();
+ unlock_all_objs();
+ pr_lock(&object_list_lock);
+ obj = obj_list_root;
+ pr_unlock(&object_list_lock);
+ while(obj) {
+ call_func(ist, obj, SYM(FINAL_), NULL, 0, NULL, NULL);
+ check_exceptions(ist);
+ pr_lock(&object_list_lock);
+ obj = obj->next_obj;
+ pr_unlock(&object_list_lock);
+ }
+}
+
//********************************* dump **************************************
clist_p object_list;
int first_symbol, prt_flg=0;
Modified: trunk/src/object.h
===================================================================
--- trunk/src/object.h 2004-07-03 06:29:07 UTC (rev 696)
+++ trunk/src/object.h 2004-07-03 21:55:15 UTC (rev 697)
@@ -194,6 +194,8 @@
void delete_notify(isp ist, obj_p obj);
+void finalize_all(void);
+
extern pr_lock_t del_notify_lock_var;
#define del_notify_lock() pr_lock(&del_notify_lock_var)
#define del_notify_unlock() pr_unlock(&del_notify_lock_var)