rev 150 - in trunk: . src
SVN User <[email protected]>
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-03-27 03:47:20 -0500 (Sat, 27 Mar 2004)
New Revision: 150
Modified:
trunk/src/console.c
trunk/src/interp.c
trunk/src/main.c
trunk/status.txt
Log:
added x'00' strings to documentation (forgot all about them)
Modified: trunk/src/console.c
===================================================================
--- trunk/src/console.c 2004-03-27 08:15:55 UTC (rev 149)
+++ trunk/src/console.c 2004-03-27 08:47:20 UTC (rev 150)
@@ -221,7 +221,7 @@
}
colon_flg = (strlen(line) >= 2 && src[strlen(line)-2] == ':');
}
- res = exec_string(ist, src, PR_TRUE, &frame);
+ res = exec_string(ist, src, TRUE, &frame);
if (check_exceptions(ist)) {
ist->frame = NULL;
} else {
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-03-27 08:15:55 UTC (rev 149)
+++ trunk/src/interp.c 2004-03-27 08:47:20 UTC (rev 150)
@@ -1279,14 +1279,16 @@
void *main_thread(apr_thread_t *handle, void *argv){
isp ist = get_ist();
int main_index=1;
- obj_p main_sym, module;
+ obj_p main_sym, module, thread_obj;
+ pr_thread_p thread_p;
char* filename = strch(list_item(ist, (obj_p)argv, 0));
#ifdef DEBUG_THREADS
printf("Starting a main thread\n");
#endif
- register_thread(handle);
+ thread_obj = register_thread(handle);
+ thread_p = thread_obj->data.ptr;
pr_lock(&start_main_lock);
@@ -1302,6 +1304,8 @@
if(!get_attr(ist, OBJ(MODULES), main_sym)) {
module = new_object(OBJ(ROOT_GLOBALS));
set_attr(ist, OBJ(MODULES), main_sym, module);
+ set_attr(ist, thread_obj, sym(ist, "name"), new_string_obj(name));
+ thread_p->main_id = main_index;
break;
}
main_index++;
@@ -1326,6 +1330,7 @@
check_exceptions(ist);
main_threads_running--;
+ thread_p->running = FALSE;
#ifdef DEBUG_THREADS
printf("%s:%d thread has terminated\n", symch(ist, main_sym), main_index);
Modified: trunk/src/main.c
===================================================================
--- trunk/src/main.c 2004-03-27 08:15:55 UTC (rev 149)
+++ trunk/src/main.c 2004-03-27 08:47:20 UTC (rev 150)
@@ -162,10 +162,12 @@
}
int main(int argc, char *argv[]) {
- obj_p sys_argv_obj, main_argv_obj, threads, code_str_obj;
+ obj_p sys_argv_obj, main_argv_obj, threads, code_str_obj, main1_thread_obj;
+ pr_thread_p main1_thread_ptr;
isp ist;
apr_status_t aprerr;
char buf[1024];
+ int cmd_line_option_i_flg;
#ifdef DEBUG_THREADS
int torture_scan_num_ptr[]={1,2,3,4,5};
@@ -207,13 +209,12 @@
exec_string(ist, strch(code_str_obj), FALSE, NULL);
check_exceptions(ist);
}
+ cmd_line_option_i_flg = (int)(intptr_t) get_attr(ist, sys_argv_obj, sym(ist, "i"));
main_argv_obj = get_attr(ist, sys_argv_obj, sym(ist, "argv"));
if (main_argv_obj && list_len(ist, main_argv_obj)) {
- new_thread_obj((apr_thread_start_t)main_thread, main_argv_obj);
- /* Grab this lock, so we know main1 thread has started */
- pr_lock(&thread_registry_lock); pr_unlock(&thread_registry_lock);
-
+ main1_thread_obj = new_thread_obj((apr_thread_start_t)main_thread, main_argv_obj);
+ main1_thread_ptr = main1_thread_obj->data.ptr;
}
threads = get_attr(ist, sys_argv_obj, sym(ist, "threads"));
@@ -239,8 +240,17 @@
if (!main_threads_started)
console(ist);
- else
- while(main_threads_running) apr_sleep(PAUSE_MS*1000);
+ else {
+ while(main_threads_running) {
+ apr_sleep(PAUSE_MS*1000);
+ if (cmd_line_option_i_flg && (!main1_thread_ptr || !main1_thread_ptr->running)) {
+ console(ist);
+ cmd_line_option_i_flg = FALSE;
+ }
+ }
+ if (cmd_line_option_i_flg)
+ console(ist);
+ }
#ifdef DEBUG_THREADS
printf("All main threads have terminated, now stopping memory manager ...\n");
Modified: trunk/status.txt
===================================================================
--- trunk/status.txt 2004-03-27 08:15:55 UTC (rev 149)
+++ trunk/status.txt 2004-03-27 08:47:20 UTC (rev 150)
@@ -6,7 +6,9 @@
--- help() in interactive console()
---- cmd-line code options missing (-i, -c, -d)
+--- -d -m -l cmd-line options missing
+--- memory bounds -> mem-mgr priorities
+--- -i interactive console needs globals and locals from main1 module
--- flesh out dlls, list.sort!(), dict stuff, string %, built-in funcs
@@ -18,7 +20,6 @@
--- add thread object so prothon code can create threads
---- memory bounds -> mem-mgr priorities
--- check for OverflowError in math routines
@@ -45,6 +46,7 @@
------------------------------ diff from python -------------------------------
+x'00' strings
Argv is an attribute in Main, not sys; sys.argv is more complicated version
_ in nums for appearance 0x7fff_ffff_ffff_ffff is most positive Int in prothon
5. and 5.e10 not valid, must be 5.0 and 5.0e10 (or 5e10), so that 48.chr() parses properly