rev 665 - in trunk: . src
SVN User <[email protected]> Sun, 27 Jun 2004 01:08:22 -0400
| Newsgroups | gmane.comp.lang.prothon.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: mark
Date: 2004-06-27 01:08:19 -0400 (Sun, 27 Jun 2004)
New Revision: 665
Modified:
trunk/STATUS.txt
trunk/src/builtins-core.c
trunk/src/console.c
trunk/src/interp.c
Log:
command error returns object instead of exception if no args, removed console kludge to add print command, print now always returns string, cleaned up exception print when no doc string, fixed exception print missing line feed
Modified: trunk/STATUS.txt
===================================================================
--- trunk/STATUS.txt 2004-06-25 06:37:18 UTC (rev 664)
+++ trunk/STATUS.txt 2004-06-27 05:08:19 UTC (rev 665)
@@ -1,9 +1,30 @@
----------------------- TO-DO (highest priority first) ------------------------
+--- command error -> returning the object instead of throwing an exception
+
+--- metaclasses not supported
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002409.html
+
+--- factory keyword, attrProxy_ object
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002442.html
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002444.html
+--- class keyword
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002445.html
+
--- OSThread, Thread, and Gate
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002124.html
--- lock keyword?
+--- thread keyword for param improvement?
+--- checking method? return values ???
+
+--- type keyword?
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002508.html
+
+--- assignment as expression ???
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002160.html
+
--- implement from Module import * ???
--- implement 1xc3fe ?
@@ -93,7 +114,6 @@
--- improve torture with list and dict tortures, random walk against new end
-
----------------------- TUTORIAL TO-DO ------------------------
iter_ (for loop)
@@ -112,6 +132,15 @@
console line editing
str_, call_
+----------------------- NON_CODING TO-DO ------------------------
+
+--- apt-get
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002450.html
+
+--- wiki
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002431.html
+ http://www.prothon.org/pipermail/prothon-user/2004-June/002443.html
+
---------------- Ideas to consider for inclusion ------------------------------
Psyco in std interpreter?
Modified: trunk/src/builtins-core.c
===================================================================
--- trunk/src/builtins-core.c 2004-06-25 06:37:18 UTC (rev 664)
+++ trunk/src/builtins-core.c 2004-06-27 05:08:19 UTC (rev 665)
@@ -407,14 +407,14 @@
}
if (llen == 0) strcpy(str, eol);
printf("%s", str);
- if (ist->in_console) {
- pr_free(str);
- return OBJ(NONE);
- } else {
+ //if (ist->in_console) {
+ // pr_free(str);
+ // return OBJ(NONE);
+ //} else {
res = NEW_STRING(str);
pr_free(str);
return res;
- }
+ //}
}
Modified: trunk/src/console.c
===================================================================
--- trunk/src/console.c 2004-06-25 06:37:18 UTC (rev 664)
+++ trunk/src/console.c 2004-06-27 05:08:19 UTC (rev 665)
@@ -182,7 +182,7 @@
#define PROTHON_HISTORY ".prothon_history"
void console(isp ist) {
- obj_p res, exc, new_self, new_locals;
+ obj_p res, new_self, new_locals;
frame_p frame = NULL;
char buf[16];
int ind_level = 0, colon_flg = FALSE;
@@ -231,21 +231,9 @@
colon_flg = (strlen(line) >= 2 && line[strlen(line)-2] == ':');
}
res = exec_string(ist, src, TRUE, &frame);
- if (exc = catch_exception(ist, OBJ(COMMAND_EXC), NULL)) {
- char* p;
- for (p=src; *p > ' '; p++);
- if (*p == 0 || *p == '\n') {
- char* src2 = pr_malloc(strlen(src)+10);
- strcpy(src2, "print ");
- strcat(src2, src);
- ist->frame = NULL;
- res = exec_string(ist, src2, TRUE, &frame);
- pr_free(src2);
- } else
- ist->exception_obj = exc;
- }
if (check_exceptions(ist)) {
ist->frame = NULL;
+ printf("\n");
} else {
if (res && res != OBJ(NONE)) {
char* res_str = as_str(ist, res);
Modified: trunk/src/interp.c
===================================================================
--- trunk/src/interp.c 2004-06-25 06:37:18 UTC (rev 664)
+++ trunk/src/interp.c 2004-06-27 05:08:19 UTC (rev 665)
@@ -739,9 +739,7 @@
obj_p do_return( isp ist, frame_p frame,
frame_p *switch_frame, frame_p *free_frame, obj_p return_value ){
obj_p res = NULL;
- if (fr_pc == fr_code->len && fr_sp == 0)
- fr_push(OBJ(NONE));
- if (fr_sp != 1) {
+ if (!(fr_pc == fr_code->len && fr_sp == 0) && fr_sp != 1) {
raise_exception(ist, OBJ(INTERNAL_EXC), "stack != 1 at return call");
return NULL;
}
@@ -1204,6 +1202,10 @@
fr_sp -= 2+2*param;
func_obj = fr_stack[fr_sp];
if (cmd_flag && !get_attr(ist, func_obj, SYM(COMMAND_))) {
+ if (param == 0) {
+ fr_sp++;
+ goto break_loc;
+ }
raise_exception( ist, OBJ(COMMAND_EXC), "Unknown: %s",
symch(ist, fr_data(1)) );
break;
@@ -1829,18 +1831,25 @@
}
if (bl) {
+ char *p, buf[256], buf2[80];
+ buf[0] = 0;
for (i = (int) list_len(ist, bl) - 1; i >= 0; i--){
obj_p exc = list_item(ist, bl, i);
-
if (exc && exc != OBJ(EXCEPTION) && has_proto(ist, exc, OBJ(EXCEPTION))) {
obj_p doc = get_attr(ist, exc, SYM(DOC_));
-
- if (doc && exc != orig_excobj)
- printf("%s, ", pr2c_strptr(ist, doc));
- else if (doc)
- printf("%s.\n\n", pr2c_strptr(ist, doc));
+ if (doc && i > 0) {
+ apr_snprintf(buf2, sizeof(buf2), "%s, ", pr2c_strptr(ist, doc));
+ if (strlen(buf)+strlen(buf2) < sizeof(buf)) strcat(buf, buf2);
+ } else if (doc) {
+ apr_snprintf(buf2, sizeof(buf2), "%s.\n\n", pr2c_strptr(ist, doc));
+ if (strlen(buf)+strlen(buf2) < sizeof(buf)) strcat(buf, buf2);
+ } else if (i == 0) {
+ for (p=buf+strlen(buf)-1; p > buf && *p != ','; p--);
+ *p = '.'; *(p+1) = 0;
+ }
}
}
+ printf("%s\n",buf);
}
return orig_excobj;
@@ -1851,12 +1860,10 @@
code_p code;
obj_p new_locals;
frame_p frame, new_frame;
- parse_state* state = parse_file_or_string(ist, NULL, str);
+ parse_state* state;
- if (check_exceptions(ist))
- return NULL;
- if (!state || !(code = (state->parse_results)))
- return NULL;
+ state = parse_file_or_string(ist, NULL, str); if_exc_return NULL;
+ if (!state || !(code = (state->parse_results))) return NULL;
#ifdef DUMP_MODULE_CODE
if (dump_module_code) {