You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
(180) |
Apr
(20) |
May
|
Jun
(91) |
Jul
(78) |
Aug
(18) |
Sep
|
Oct
|
Nov
|
Dec
|
---|
From: Peep P. <so...@us...> - 2004-07-21 12:13:23
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11107/src Modified Files: lang.h Log Message: Bing, changes\! Index: lang.h =================================================================== RCS file: /cvsroot/agd/server/src/lang.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- lang.h 12 Jun 2004 16:46:45 -0000 1.11 +++ lang.h 21 Jul 2004 12:13:09 -0000 1.12 @@ -108,7 +108,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 51 "lang.y" +#line 59 "lang.y" typedef union YYSTYPE { char *str; int i; |
From: Peep P. <so...@us...> - 2004-07-21 12:13:21
|
Update of /cvsroot/agd/server/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11107/lib Modified Files: ChangeLog Log Message: Bing, changes\! Index: ChangeLog =================================================================== RCS file: /cvsroot/agd/server/lib/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- ChangeLog 1 Apr 2004 19:17:13 -0000 1.2 +++ ChangeLog 21 Jul 2004 12:13:09 -0000 1.3 @@ -2,7 +2,10 @@ from the driver's. So, here it is, changelog for AGD's mudlib 0.2: 0.2: --------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +2004-06-23 + * fibonacci.c: removed + * sys/login.c: generate_name() now uses arrays (whee!) 2004-03-30 * Removed /beer.c. Useless. 2004-03-28 @@ -16,5 +19,5 @@ someone logs in. 0.1: --------------------------------------------------------------------------------- +------------------------------------------------------------------------------- * Changes in this version are undocumented. |
From: Peep P. <so...@us...> - 2004-07-21 12:11:31
|
Update of /cvsroot/agd/server/lib/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10766 Added Files: login.lpc master.lpc player.lpc Removed Files: login.c master.c player.c Log Message: Renamed to .lpc, and a whole lot more changes! --- master.c DELETED --- --- NEW FILE: login.lpc --- /* For later, when we do users()->query_name() */ string query_name() { return "someone not logged in yet"; } void logon() { write("Welcome! You are connecting from " /* + query_hostname(this_object()) + " ("*/ + query_ip(this_object()) + /*")"*/".\n"); write("\nEnter your name: "); input_to("logon2"); } void new_player(string name) { object ob; string t; ob = clone_object("/sys/player"); if(!ob) { write("Uh-oh, the player object doesn't load!\n"); destruct(this_object()); return; } ob->set_name(name); t = strftime(time(), "[%H:%M] "); shout(t + name + " has joined the game\n"); write(t + "You have joined the game.\n"); write("Use 'help' to get a list of commands.\n"); exec(ob); destruct(this_object()); } void logon2(string name) { object *ppl = users(); int i; for(i=0;i<sizeof(ppl);i++) { if(ppl[i]->query_name() == name) { write("Someone is already using that name. Try again.\n"); write("Enter name: "); input_to("logon2"); return; } } if(!name) { write("You didn't enter a name - should I generate " "a one for you? [Y/n] "); input_to("gen_or_not"); return; } new_player(name); } /* ARrrr, ARRrrays! */ string generate_name() { string *first; string *last; first = ({ "Vassili", "Ivan", "Dmitri", "Pjotr", "Vladimir", "Jossif" }); last = ({ "Aleksandrjevits", "Ivanov", "Vadimov", "Dmitrjevits", "Pjotrov" }); return first[random(sizeof(first))] + " " + last[random(sizeof(last))]; } void gen_or_not(string s) { if(!s || lower_case(s) == "y") { string str = generate_name(); write("Ok, you are now " + str + ".\n"); new_player(str); } else { write("Ok, enter a name then: "); input_to("logon2"); } } void net_dead() { /* Don't want to keep stray login objects. */ destruct(this_object()); } --- player.c DELETED --- --- NEW FILE: player.lpc --- string _name, last_cmd; int num_input; void create() { /* string foo = "foobar"; foo[4..5] = "ie"; write("foo: " + foo + "\n");*/ input_to("input"); } void set_name(string name) { _name = name; } string query_name() { return _name; } void write_help() { write("Available commands:\n" "\tsay: Says something to everyone logged on.\n" "\thelp: Displays this text.\n" "\tuptime: Shows for how long the driver has been running.\n" "\tversion: Shows AGD version information.\n" "\tquit: Quits the game.\n" "\ttime: Shows current time.\n" "\twho: Shows who's playing.\n" "\t.: Repeats last command.\n"); } /* Converts a time integer into a textual representation, * but doesn't return a date like asctime(), but returns * the length of the time period (61 = 1 minute and 1 second, * 3600 = 1 hour etc. Can anyone describe this better?) */ string ctime(int t) { int secs, mins, hrs, days; string ret; /* This could be done with a loop.. */ secs = t; if(secs >= 60) { secs %= 60; mins = t /= 60; if(mins >= 60) { mins %= 60; hrs = t /= 60; if(hrs >= 24) { hrs %= 24; days = t /= 24; } } } if(days) { ret += days + " day" + (days>1?"s":""); if(hrs || mins || secs) ret += " "; } if(hrs) { ret += hrs + " hour" + (hrs>1?"s":""); if(mins || secs) ret += " "; } if(mins) { ret += mins + " minute" + (mins>1?"s":""); if(secs) ret += " "; } if(secs) { ret += secs + " second" + (secs>1?"s":""); } return ret; } object do_update(string path) { object ret; ret = load_object(path); if(ret) { write("Updated " + path + ".\n"); } else { write("Failed to update " + path + "!\n"); } return ret; } void input(string cmd) { if(strlen(cmd) >= 3 && cmd[0..2] == "say") { string t = strftime(time(), "[%H:%M] "); string text = cmd[4..strlen(cmd)]; shout(t + capitalize(_name) + " says: "+ text +"\n"); write(t + "You say: " + text + "\n"); } else if(cmd == "quit") { shout(strftime(time(), "[%H:%M] ") + capitalize(_name) + " has quit the game.\n"); destruct(this_object()); } else if(cmd == "uptime") { write("AGD " + __VERSION__ + " has been running for " + ctime(uptime()) + ".\n"); } else if(cmd == "version") { "/sys/master"->write_version(); } else if(cmd == "help") { write_help(); } else if(strlen(cmd) >= 6 && cmd[0..5] == "update") { string filename = cmd[6..strlen(cmd)]; do_update(filename); } else if(cmd == "time") { int t = time(); write("The current time is: " + asctime(t) + ".\n"); } else if(cmd == "who") { object *ppl = users(); int i; for(;i<sizeof(ppl);i++) { write(i + ": " + ppl[i]->query_name() + "\n"); } if(sizeof(ppl) == 1) { write("Nobody else besides you. :(\n"); } else { write(sizeof(ppl) + " players.\n"); } } else if(cmd == ".") { if(last_cmd) { input(last_cmd); } else write("No last command.\n"); } else { write("Unknown command. Try 'help'.\n"); } if(cmd != ".") { last_cmd = cmd; num_input++; } input_to("input"); } void write_prompt() { write(_name + /* "@" + __HOSTNAME__ + */ ":" + num_input + "$ "); } void net_dead() { shout(_name + " went netdead!"); } --- login.c DELETED --- --- NEW FILE: master.lpc --- int biggest; int crash(int signal) { if(signal == 11) { shout("Driver shutting down - segmentation fault!\n"); } else if(signal == 2) { shout("Driver crashing - interrupted!\n"); } else if(signal) { shout("Crashing on signal " + signal + "!\n"); } else { shout("Driver crashing!\n"); } return 1; } void write_version() { write(read_file("/doc/login/" + random(biggest))); write("\n\t" + __VERSION__ + " / " + __ARCH__ + "\n" + "\thttp://agd.sf.net\n\tag...@li...\n"); } object connect() { object ob; write_version(); ob = clone_object("/sys/login"); return ob; } void create() { biggest = atoi(read_file("/doc/login/biggest")); } |
From: Peep P. <so...@us...> - 2004-07-21 12:10:32
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10607 Modified Files: array.h array.c Log Message: sub_arrays, free_array Index: array.c =================================================================== RCS file: /cvsroot/agd/server/src/array.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- array.c 14 Jun 2004 20:48:08 -0000 1.15 +++ array.c 21 Jul 2004 12:10:17 -0000 1.16 @@ -23,18 +23,18 @@ a->data = NULL; } -void free_array(array_t *a, void (*freefun)(variable_t *)) +void free_array(array_t *a, void (*freefun)(variable_t)) { int i; if(!freefun) - freefun = (void(*)(variable_t*))free; /* free_var? */ + freefun = (void(*)(variable_t))free; /* free_var? */ for(i=0;i<a->length;i++) freefun(a->data[i]); if(a->length) free(a->data); init_array(a); } - +#if 0 void array_push(array_t *a, variable_t *data) { if(!a) @@ -44,7 +44,7 @@ a->data = xrealloc(a->data, sizeof(void *) * a->length); a->data[a->length-1] = data; } - +#endif #if 0 void array_insert(array_t *a, void *data, int index) { @@ -131,6 +131,37 @@ a->ref--; if(a->ref < 0) printf("Warning: array[%p] ref < 0\n", a); - if(a->ref <= 0) + if(a->ref <= 0) { free_array(a, NULL); + } +} + +array_t *sub_arrays(array_t *a1, array_t *a2) { + array_t *ret; + int i, j; + int appears_in; + + ret = xmalloc(sizeof(array_t)); + ret->ref = 1; + ret->length = 0; + ret->data = NULL; + + for(i=0;i<a1->length;i++) { + appears_in = 0; + + for(j=0;j<a2->length;j++) { + if(!compare_vars(&a1->data[i], &a2->data[j])) { + appears_in = 1; + break; + } + } + + if(!appears_in) { + ret->length++; + ret->data = xrealloc(ret->data, sizeof(variable_t) * ret->length); + ret->data[ret->length-1] = a1->data[i]; + } + } + + return ret; } Index: array.h =================================================================== RCS file: /cvsroot/agd/server/src/array.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- array.h 8 Jun 2004 20:44:53 -0000 1.8 +++ array.h 21 Jul 2004 12:10:17 -0000 1.9 @@ -4,18 +4,19 @@ typedef struct array { int length; int ref; - variable_t **data; + variable_t *data; } array_t; void init_array(array_t *a); -void array_push(array_t *a, variable_t *data); -void free_array(array_t *a, void (*freefun)(variable_t *)); +/*void array_push(array_t *a, variable_t *data);*/ +void free_array(array_t *a, void (*freefun)(variable_t)); #define ref_array(a) a->ref++ /* void array_insert(array_t *a, void *data, int index); void array_remove(array_t *a, int index); array_t *copy_array(array_t *a, void *(*copyfun)(void *)); array_t *array_concat(array_t *a1, array_t *a2);*/ +array_t *sub_arrays(array_t *a1, array_t *a2); #endif |
From: Peep P. <so...@us...> - 2004-07-21 12:09:57
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10469 Modified Files: compile.c Log Message: Fixed some memory allocation problems Index: compile.c =================================================================== RCS file: /cvsroot/agd/server/src/compile.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- compile.c 20 Jun 2004 14:01:42 -0000 1.27 +++ compile.c 21 Jul 2004 12:09:47 -0000 1.28 @@ -152,7 +152,7 @@ } #ifdef DEBUG - debug("define_id", "hash collision! \"%s\" && \"%s\" == %d!\n", name, target->name, hash); + printf("[define_id] hash collision! \"%s\" && \"%s\" == %d!\n", name, target->name, hash); #endif temp = *elem; @@ -167,19 +167,25 @@ } idp->hashed_name = hash; - idp->name = stringdup(name); + idp->name = name; idp->type = type; idp->lpc_type = lpc_type; idp->args = args; idp->num_arg = num_arg; idp->base_scope = scope_level; idp->index = assign_index(idp->type); - +/* #ifdef DEBUG - debug("define_id", "%s [hash %u] base_scope %d index %d\n", - idp->name, strhash(idp->name), idp->base_scope, idp->index); + if(type != ID_DFUN && conf.debuglevel > 0) { + if(start_with_newline) { + start_with_newline = 0; + puts(""); + } + printf("[define_id] %s base_scope %d index %d\n", + idp->name, idp->base_scope, idp->index); + } #endif - +*/ return idp; } @@ -205,12 +211,12 @@ def_id_t *idp; unsigned hash = strhash(name); - /* Now look in local table. */ + /* First look in local table. */ idp = find_elem(lid_tbl, LOCAL_HASH_SIZE, hash); if(idp) return idp; - /* First look in global table. */ + /* Now look in global table. */ idp = find_elem(gid_tbl, GLOBAL_HASH_SIZE, hash); if(idp) return idp; @@ -264,7 +270,7 @@ idp = tbl[i].data; if(idp->base_scope > scope_level) { unassign_index(idp->type); - free(idp->name); + free(idp->name); /* xxx */ if(idp->args) free(idp->args); free(idp); @@ -345,6 +351,9 @@ { int x; +/* if(operand == T_ANY) + return 1;*/ + if(operand & T_ARRAY) x = TYPE_ARRAY; else switch(operand) { @@ -377,10 +386,12 @@ op = &operator_table[operator-F_ADD]; - if(!is_operand_valid(opr1, op) || + /* Urgh. */ + if((opr1 != T_ANY && opr2 != T_ANY) && + (!is_operand_valid(opr1, op) || (op->num_operand == 2 && opr2 && !is_operand_valid(opr2, op)) - || (op->both_same_type && opr1 != opr2)) { + || (op->both_same_type && opr1 != opr2))) { switch(op->num_operand) { case 1: sprintf(buf, "wrong type argument to unary "); @@ -416,17 +427,22 @@ void add_function(def_id_t *idp, int lineno) { - lineno = 0; /* XXX */ - if(idp->index < this_prog->numfunc) { /* Adding a definition for a prototype. */ function_t *f; f = this_prog->functions[idp->index]; f->type = idp->lpc_type; f->num_arg = idp->num_arg; +#if 0 + /* Urrrgh. The prototype already has args. */ f->args = xmalloc(sizeof(int) * f->num_arg); - memcpy(f->args, idp->args, f->num_arg); + memcpy(f->args, idp->args, f->num_arg * sizeof(int)); +#endif f->lineno = lineno; + f->line_numbers = NULL; + f->codelen = curr_fun->codelen; + f->code = xmalloc(sizeof(int) * f->codelen); + memcpy(f->code, curr_fun->code, f->codelen * sizeof(int)); } else { curr_fun_check(); curr_fun->type = idp->lpc_type; @@ -470,7 +486,7 @@ this_ob->numglobals++; this_ob->globals = xrealloc(this_ob->globals, this_ob->numglobals * sizeof(variable_t)); v = &this_ob->globals[this_ob->numglobals-1]; - v->name = name; + v->name = stringdup(name); /* Going to be stored. */ v->type = lpc_type; init_var(v); } else /* LVAR */{ |
From: Peep P. <so...@us...> - 2004-07-21 12:09:28
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10349 Modified Files: debug.c Log Message: Some new operators; print_var can do arrays Index: debug.c =================================================================== RCS file: /cvsroot/agd/server/src/debug.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- debug.c 20 Jun 2004 14:01:57 -0000 1.18 +++ debug.c 21 Jul 2004 12:09:15 -0000 1.19 @@ -7,6 +7,7 @@ #include "compile.h" #include "lang.h" #include "instr.h" +#include "array.h" #ifdef DEBUG @@ -49,7 +50,7 @@ } #define NAME() if(v->name) printf("%s", v->name); -void print_var(variable_t *v, int values) +void print_var(variable_t *v) { static int lval_nested; @@ -58,13 +59,19 @@ return; } - if(!values) - return; - - printf("%s ", type2str(v->type)); - if(v->type & T_ARRAY) + if(v->type & T_ARRAY) { + int i; + array_t *a = v->u.a; + printf("({ "); + for(i=0;i<a->length;i++) { + print_var(&v->u.a->data[i]); + if(i+1 < a->length) + printf(", "); + } + printf(" })"); return; + } switch(v->type) { case T_INT: @@ -91,7 +98,7 @@ printf("infinite loop"); else { lval_nested = 1; - print_var(v->u.v, 1); + print_var(v->u.v); } lval_nested = 0; @@ -128,6 +135,7 @@ case F_MOD_EQ: return "F_MOD_EQ"; case F_ASSIGN: return "F_ASSIGN"; case F_POP: return "F_POP"; + case F_POP_N: return "F_POP_N"; case F_CALL_LFUN: return "F_CALL_LFUN"; case F_CALL_DFUN: return "F_CALL_DFUN"; case F_CALL_OTHER: return "F_CALL_OTHER"; @@ -219,6 +227,7 @@ int index, num; char *s; + case F_POP_N: case F_PUSH_INT: num = code[++i]; printf("%d", num); @@ -284,7 +293,7 @@ for(i = 0; i < p->numfunc; i++) { f = p->functions[i]; printf("Function %d:\n", i); - printf(" Type %d\n", f->type); + printf(" Type %s\n", type2str(f->type)); printf(" Arguments: "); /* print_var_arr(&f->args);*/ printf("\n"); |
From: Peep P. <so...@us...> - 2004-07-21 12:08:51
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10266 Modified Files: dfdecl.in Log Message: debug_info, sizeof, users; changed comments Index: dfdecl.in =================================================================== RCS file: /cvsroot/agd/server/src/dfdecl.in,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- dfdecl.in 8 Jun 2004 20:31:29 -0000 1.13 +++ dfdecl.in 21 Jul 2004 12:08:43 -0000 1.14 @@ -4,11 +4,13 @@ # return-type dfun-name(type1, type2, typeN) # # dfun-name is the name as known by the LPC parser -# Possible types are string, int, object - both for return-type -# and argument types. +# Possible types are string, int, object. It can also be array by adding an +# asterisk to the end of the type name (i.e. an array of strings +# is 'string *'). An array of any type can be specified with just an +# asterisk (*). # -# return-type can also be 'void' if it doesn't return anything. - +# return-type can also be 'void' if the function doesn't return anything. +# # Expect lots of nasty error messages if you mess up here. # Interactives. @@ -39,6 +41,9 @@ string capitalize(string) string lower_case(string) +# Arrays. +int sizeof(*) + # Objects. void destruct(object) object find_object(string) @@ -48,6 +53,10 @@ object load_object(string) void exec(object) string file_name(object) +object *users() # Misc. void throw(string) + +# Debugging. +void debug_info(int) |
From: Peep P. <so...@us...> - 2004-07-21 12:08:29
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10223 Modified Files: dfparse.y Log Message: Uses a much simpler and smarter system; arrays Index: dfparse.y =================================================================== RCS file: /cvsroot/agd/server/src/dfparse.y,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dfparse.y 8 Jun 2004 20:36:41 -0000 1.10 +++ dfparse.y 21 Jul 2004 12:08:17 -0000 1.11 @@ -75,7 +75,7 @@ %token <s> L_IDENTIFIER %token <i> L_DATA_TYPE -%type <i> type +%type <i> type arg_type optional_star %type <a> arguments argument_and_another %% @@ -88,11 +88,7 @@ dfdecl: type L_IDENTIFIER '(' arguments ')' { -/* int i, j, index;*/ dfdecl_t decl; - -/* int find_linear_len(struct arr_t *a);*/ - decl.ret = $1; decl.name = $2; decl.num_arg = $4.len; @@ -103,64 +99,42 @@ dfdecl = xrealloc(dfdecl, sizeof(dfdecl_t) * ++numdecl); dfdecl[numdecl-1] = decl; -/* - decl.arglen = find_linear_len(&$4); - if(decl.arglen > maxarglen) - maxarglen = decl.arglen; - if(decl.arglen) - decl.args = xmalloc(sizeof(int) * decl.arglen); - for(index=i=0;i<$4.length;i++) { - struct arr_t *var = (struct arr_t *) $4.data[i]; - decl.args[index++] = var->length; - for(j=0;j<var->length;j++) - decl.args[index++] = (int) var->data[j]; - } - dfdecl = xrealloc(dfdecl, sizeof(dfdecl_t) * ++numdecl); - dfdecl[numdecl-1] = decl; -*/ - } ; -type: - L_DATA_TYPE /* optional_star */ +optional_star: + '*' { $$ = T_ARRAY; } + | /* empty */ { $$ = 0; } ; +type: + L_DATA_TYPE optional_star + { $$ = $1|$2; } + ; + +arg_type: + type + | '*' { $$ = T_ARRAY; } + ; + arguments: /* empty */ { $$.len = 0; } | argument_and_another ; argument_and_another: - type + arg_type { $$.len = 1; $$.data = xmalloc(sizeof(arr_t)); $$.data[0] = $1; } - | argument_and_another ',' type + | argument_and_another ',' arg_type { $$ = $1; $$.len++; $$.data = xrealloc($$.data, $$.len * sizeof(arr_t)); $$.data[$$.len-1] = $3; -/* - int i, foo; - - foo = $1.length ? 1 : 0; - $$.length = $2.length + foo; - $$.data = xmalloc(sizeof(struct arr_t*) * $$.length); - - if($1.length) { - struct arr_t *a = xmalloc(sizeof(struct arr_t)); - *a = $1; - $$.data[0] = (int) a; - } - - for(i=foo;i<$$.length;i++) { - $$.data[i] = $2.data[i-foo]; - } -*/ } ; @@ -174,21 +148,14 @@ return 0; } -#if 0 -int find_linear_len(struct arr_t *a) -{ - int len; - int i, j; - for(len=i=0;i<a->length;i++,len++) { - struct arr_t *p = (struct arr_t *) a->data[i]; - for(j=0;j<p->length;j++,len++); - } - return len; -} -#endif - void write_type(int t) { + if(t & T_ARRAY) { + write_type(t & ~T_ARRAY); + printf("|T_ARRAY"); + return; + } + /* Just for readability. */ switch(t) { case T_INT: @@ -211,7 +178,7 @@ void print_declarations(void) { - int i, j/*, k*/; + int i, j; printf("dfdecl_t decl[] = {\n"); for(i=0;i<numdecl;i++) { @@ -232,31 +199,7 @@ putchar(','); else putchar(' '); - -#if 0 - int len = dfdecl[i].args[j]; - printf(" %d,", len); - for(k=j+1;k-j<=len;k++) { - putchar(' '); - /* Just for readability. */ - switch(dfdecl[i].args[k]) { - case T_INT: printf("T_INT"); break; - case T_STRING: printf("T_STRING"); break; - case T_OBJECT: printf("T_OBJECT"); break; - case T_VOID: printf("T_VOID"); break; - default: printf("%d", dfdecl[i].args[k]); break; - } - if(k+j<=len && k+j+1 < dfdecl[i].arglen) - putchar(','); - else - putchar(' '); - } - j += len; -#endif } - -/* if(!j) - printf("0");*/ if(j) putchar('}'); printf(" }"); |
From: Peep P. <so...@us...> - 2004-07-21 12:07:21
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10081 Modified Files: dfuns.c Log Message: debug_info, sizeof, users Index: dfuns.c =================================================================== RCS file: /cvsroot/agd/server/src/dfuns.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- dfuns.c 20 Jun 2004 14:12:11 -0000 1.23 +++ dfuns.c 21 Jul 2004 12:07:13 -0000 1.24 @@ -13,10 +13,12 @@ #include "compile.h" #include "net.h" #include "interpret.h" +#include "array.h" extern player_t *this_player; extern object_t *this_ob, *previous_ob; +extern list_t players; extern list_t all_objects; extern time_t startup_time; /* for uptime() */ @@ -64,8 +66,11 @@ { if(this_player) net_send(s, strlen(s)+1, this_player); - else - printf("] %s", s); + else { + if(s[strlen(s)-1] == '\r') /* :\ */ + printf("] "); + printf("%s", s); + } } void shout(char *s) @@ -181,7 +186,7 @@ push_control_stack(); fp++; - ret = clone_object(csp[-1].fp->u.s); + ret = clone_object(csp[/*-1*/0].fp->u.s); pop_control_stack(1); pop_stack(); @@ -242,6 +247,22 @@ push_int(ret); } +void df_users(void) +{ + list_t *l; + array_t *ret; + ret = xmalloc(sizeof(array_t)); + init_array(ret); + for(l=&players;l;l=l->next) { + player_t *pl = l->data; + ret->length++; + ret->data = xrealloc(ret->data, ret->length * sizeof(variable_t)); + ret->data[ret->length-1].type = T_OBJECT; + ret->data[ret->length-1].u.ob = pl->ob; + } + push_array(ret, T_OBJECT); +} + /* Numbers. */ void df_random(void) { @@ -332,6 +353,15 @@ push_string(s, ST_MALLOC); } +/* Arrays. */ +void df_sizeof(void) +{ + array_t *arr; + arr = fp->u.a; + pop_stack(); + push_int(arr ? arr->length : 0); +} + /* Filesystem. */ void df_read_file(void) { @@ -371,3 +401,34 @@ pop_stack(); push_void(); } + +void show_all_obj(void) +{ + list_t *p; + puts("Printing all objects\n----------------------------------------"); + for(p = &all_objects; p; p=p->next) { + object_t *ob = p->data; + printf("%p", ob); + printf("; name %s;", ob->name); + putchar('\n'); + } + puts("----------------------------------------"); +} + +/* Debugging. */ +void df_debug_info(void) +{ + switch(fp->u.i) { + case 0: + show_all_obj(); + break; +/* case 1: + show_all_str(); + break; + case 2: + show_all_arr(); + break;*/ + } + pop_stack(); + push_void(); +} |
From: Peep P. <so...@us...> - 2004-07-21 12:06:41
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9963 Modified Files: instr.h Log Message: F_POP_N, F_POP_PENUL; removed F_NEWLINE Index: instr.h =================================================================== RCS file: /cvsroot/agd/server/src/instr.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- instr.h 12 Jun 2004 16:49:22 -0000 1.3 +++ instr.h 21 Jul 2004 12:06:31 -0000 1.4 @@ -10,7 +10,10 @@ #define F_PUSH_VOID 6 /* For 'return;' */ #define F_PUSH_ARRAY 7 -#define F_POP 10 /* Pops a variable off the stack. */ +#define F_POP 8 /* Pops a variable off the stack. */ +#define F_POP_N 9 /* Pops n variables off the stack. */ +#define F_POP_PENUL 10 /* Pops the penultimate variable, moving the last one + to its position - this is needed for F_CALL_OTHER */ #define F_PUSH_LVAR 11 /* Pushes local variable <n> on stack. */ #define F_PUSH_LVAR_LVALUE 12 /* Pushes T_LVALUE to local var <n> */ #define F_PUSH_GVAR 13 /* Pushes global variable <n> on stack. */ @@ -54,7 +57,4 @@ #define F_COMM 50 #define F_HIGHEST F_COMM - -#define F_NEWLINE 51 /* Increases the line number. Not used ATM. */ - #endif |
From: Peep P. <so...@us...> - 2004-07-21 12:06:13
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9576 Modified Files: interpret.c Log Message: On a runtime: function names are displayed this_player() isn't disconnected anymore a stack trace is shown the value stack is correctly cleared Proper arrays! (F_ADD, F_ADD_EQ, F_SUB, F_SUB_EQ support) Control stack is correctly popped when this_object is destructed in apply, csp->this_ob, previous_ob, code and codelen are correctly set Index: interpret.c =================================================================== RCS file: /cvsroot/agd/server/src/interpret.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- interpret.c 20 Jun 2004 14:03:53 -0000 1.25 +++ interpret.c 21 Jul 2004 12:05:59 -0000 1.26 @@ -2,7 +2,6 @@ #include <setjmp.h> #include <stdarg.h> -/*#include "config.h"*/ #include "compile_options.h" #include "sys.h" #include "lpc.h" @@ -24,21 +23,18 @@ int dont_debug_interpreter; #endif -/* Let's try to hold sp, fp, cp, codelen and code in csp */ /* This is the stack containing all local variables, function arguments and function return values. */ variable_t value_stack[VALUE_STACK_SIZE]; variable_t *sp = value_stack, /* Stack pointer after the last element pushed. */ *fp = value_stack; /* Frame pointer - where locals begin on the stack */ -int *cp; /* Code pointer into code->data */ -int *code, codelen; +int *cp; /* Code pointer into code->data */ +int *code, codelen; control_stack_t control_stack[CONTROL_STACK_SIZE]; control_stack_t *csp = control_stack; -#define CHECK_CSP() if(csp >= control_stack + CONTROL_STACK_SIZE) \ - runtime("control stack overflow (too deep recursion)"); #define CHECK_SP() if(sp >= value_stack + VALUE_STACK_SIZE) \ runtime("value stack overflow"); @@ -49,22 +45,36 @@ void call_function(object_t *ob, int index); extern char *opc_name(int i); -#if 0 +unsigned get_line_number(control_stack_t *p) { + return 42; +} + +char *get_fun_name(int num, control_stack_t *csp) { + if(num < 0) + return "*DFUN"; + if(csp->this_ob) { + if(csp->this_ob->prog) + return csp->this_ob->prog->fun_table[num]; + else + return "nil"; + } else + return this_ob->prog->fun_table[num]; +} void stack_trace(void) { int i, len; len = csp - &control_stack[0]; printf("Stack trace:\n"); - for(i=len;i>1;i--) { + for(i=len;i>0;i--) { control_stack_t *p = &control_stack[i]; - printf(" %s: function %d on line %d\n", - p->this_ob?p->this_ob->name:"unknown", p->fun, p->line); + printf("%d %s: function %d (%s) on line %d\n", + i, p->this_ob?p->this_ob->name:"unknown", + p->fun, get_fun_name(p->fun, p), + get_line_number(p)); } } -#endif -/* Need the F_NEWLINE operation for this. */ /* free_str: whether to free the string passed to it before * doing longjmp() or not - for dynamically allocated strings */ void _runtime(char *s, int free_str) @@ -72,29 +82,34 @@ char *buf; if(!this_ob) { - printf("%s on line %d (function %d)\n", s, csp->line, csp->fun); + printf("%s on line %d (function %s)\n", s, + get_line_number(csp), + get_fun_name(csp->fun, csp)); goto out; } buf = xmalloc(strlen(this_ob->name) + strlen(s) + 64); - sprintf(buf, "%s: %s on line %d (function %d)\n", this_ob->name, s, csp->line, csp->fun); + sprintf(buf, "%s: %s on line %d function %d (%s)\n", this_ob->name, s, + get_line_number(csp-1), + csp->fun, get_fun_name(csp->fun, csp)); printf(buf); if(this_player) { do_write(buf); - net_disconnect(this_player); +/* net_disconnect(this_player);*/ } free(buf); if(free_str) free(s); -/* stack_trace();*/ + stack_trace(); out: - while(csp > &control_stack[0]) { - pop_locals(); - pop_control_stack(1); - } + fp = value_stack; + pop_locals(); + csp = &control_stack[2]; + pop_control_stack(0); + longjmp(error_context, 1); } @@ -151,14 +166,12 @@ CHECK_SP() } +/* Has this a point? */ void push_array(array_t *a, int type) { - printf("a.data[0]: "); print_var(a->data[0]); putchar('\n'); sp->type = T_ARRAY | type; sp->u.a = a; - printf("a: %p; sp->u.a: %p\n", a, sp->u.a); - printf("a.data[0]: "); print_var(sp->u.a->data[0]); putchar('\n'); - /*ref_array(sp->u.a);*/ + ref_array(sp->u.a); sp++; CHECK_SP() } @@ -168,7 +181,7 @@ lval->type = rval->type; if(rval->type & T_ARRAY) { lval->u.a = rval->u.a; - /*ref_array(lval->u.a);*/ + ref_array(lval->u.a); } else switch(rval->type & ~T_ARRAY) { case T_OBJECT: lval->u.ob = rval->u.ob; @@ -188,26 +201,46 @@ } } -void do_assign_free(variable_t *lval, variable_t *rval) +#ifdef DEBUG +void show_control_stack(void) { - free_var(lval); - do_assign(lval, rval); + control_stack_t *_csp; + int i; + + printf("Control stack:\n"); + printf("csp: %d\n", csp - &control_stack[0]); + for(i=1;i<=csp-&control_stack[0];i++) { + _csp = &control_stack[i]; + printf("%d | cp: %d; fp: %d; sp: %d fun:%d(%s); ob:%p(%s) |\n", i, + _csp->cp ? _csp->cp - (_csp->code ? _csp->code : 0) : 0, + _csp->fp ? _csp->fp - &value_stack[0] : 0, + _csp->sp ? _csp->sp - &value_stack[0] : 0, + _csp->fun, get_fun_name(_csp->fun, _csp), + _csp->this_ob, _csp->this_ob->name); + } } -#ifdef DEBUG void show_stack(void) { int i; int len; - len = max(sp-&value_stack[0], fp-&value_stack[0]); - printf("sp: %d; fp: %d; cp: %d; csp: %d\n", sp ? sp - &value_stack[0] : 0, - fp ? fp - &value_stack[0] : 0, cp ? cp - code : 0, - csp ? csp - &control_stack[0] : 0); + variable_t *_sp; + control_stack_t *_csp; + + _sp = &value_stack[0]; + _csp = &control_stack[0]; + + len = max(sp-_sp, fp-_sp); + printf("sp: %d; fp: %d; cp: %d; csp: %d\n", + sp ? sp - _sp : 0, + fp ? fp - _sp : 0, + cp ? cp - code : 0, + csp ? csp - _csp : 0); printf("Value stack: |"); for(i=0;i<=len;i++) { putchar(' '); - if(value_stack[i].type) + if(value_stack[i].type && sp != value_stack+i) print_var(&value_stack[i]); else putchar('0'); @@ -220,23 +253,21 @@ putchar('|'); } putchar('\n'); - printf("Control stack:\n"); - for(i=0;i<=csp-&control_stack[0];i++) { - printf("%d | cp: %d; fp: %d; sp: %d fun:%d line:%d |\n", i, - control_stack[i].cp ? control_stack[i].cp - - (control_stack[i].code ? control_stack[i].code : 0) : 0, - control_stack[i].fp ? control_stack[i].fp - &value_stack[0] : 0, - control_stack[i].sp ? control_stack[i].sp - &value_stack[0] : 0, - control_stack[i].fun, control_stack[i].line); - } +/* show_control_stack();*/ } #else -/* foo! */ #define show_stack() #endif +void check_csp() { + if(csp >= control_stack + CONTROL_STACK_SIZE) + runtime("control stack overflow (too deep recursion)"); +} + void push_control_stack(void) { + csp++; + check_csp(); csp->previous_ob = previous_ob; csp->this_ob = this_ob; if(this_ob) @@ -246,17 +277,10 @@ csp->cp = cp; csp->code = code; csp->codelen = codelen; - csp++; - CHECK_CSP() } void pop_control_stack(int pop_sp) { - csp--; - if(csp < control_stack) { - runtime("control stack underflow"); - } - fp = csp->fp; if(pop_sp) sp = csp->sp; @@ -268,6 +292,11 @@ this_ob = csp->this_ob; if(this_ob && this_ob->iaob) this_player = /*this_ob->iaob*/ csp->this_player; + + csp--; + if(csp < control_stack) { + runtime("control stack underflow"); + } } /* Used by F_JUMP and F_JUMP_IF_FALSE to check if they jumped too far. */ @@ -286,12 +315,21 @@ fp = sp - csp->num_arg; } -void index_check(int *arg, char *str) +void index_check(variable_t *var, int *arg) { - if(!str) - runtime("taking element of null string"); - if(arg[0] < 0 || arg[0] > strlen(str)) - runtime("index out of range"); + if(var->type & T_ARRAY) { + if(!var->u.a) { + runtime("taking element of null array"); + } + if(arg[0] < 0 || arg[0] >= var->u.a->length) { + runtime("index out of range"); + } + } else if(var->type == T_STRING) { + if(!var->u.s) + runtime("taking element of null string"); + if(arg[0] < 0 || arg[0] > strlen(var->u.s)) + runtime("index out of range"); + } } variable_t *take_slice(int *arg) @@ -317,12 +355,11 @@ int tmpi, arg[2]; char *tmps; - /* csp is never at &control_stack[0] when we get here, so this is safe. */ saved_csp = csp - 1; again: #ifdef DEBUG - if(!dont_debug_interpreter) - debug("interpret", "Executing %s at %d\n", opc_name(*cp), cp - code); + if(!dont_debug_interpreter && conf.debuglevel > 0) + printf("[interpret] executing %s at %d\n", opc_name(*cp), cp - code); #endif switch(*cp) { case F_PUSH_INT: @@ -345,25 +382,39 @@ break; case F_PUSH_ARRAY: { - array_t *a = xmalloc(sizeof(array_t)); + array_t *a; + arg[0] = *++cp; arg[1] = *++cp; + a = xmalloc(sizeof(array_t)); a->length = arg[1]; - a->data = calloc(arg[1], sizeof(variable_t*)); - for(tmpi=0;tmpi<arg[1];tmpi++) { - do_assign(a->data[tmpi], --sp); - /* Note that we're not freeing the arguments, - * as they go into the array. */ + a->ref = 1; + if(a->length) { + a->data = xmalloc(a->length * sizeof(variable_t)); + for(tmpi=a->length-1;tmpi>=0;tmpi--) { + do_assign(&a->data[tmpi], --sp); +#ifdef DEBUG + a->data[tmpi].name = NULL; +#endif + + } } - printf("a0: "); print_var(a->data[0]); putchar('\n'); - sp -= arg[1]; - printf("a.data[0]: "); print_var(a->data[0]); putchar('\n'); push_array(a, arg[0]); } break; case F_POP: pop_stack(); break; + case F_POP_N: + cp++; + for(tmpi=0;tmpi<*cp;tmpi++) + pop_stack(); + break; + case F_POP_PENUL: + sp--; + free_var(sp-1); + do_assign(sp-1, sp); + break; case F_PUSH_LVAR: cp++; push_var(&fp[*cp]); @@ -397,26 +448,43 @@ push_int(*tmpvp->u.s); } else { tmpv = *sp[-2].u.v; - tmpvp = add_vars(&tmpv, sp-1); - do_assign(sp[-2].u.v, tmpvp); - pop_stack(); pop_stack(); - push_var(tmpvp); + if(tmpv.type & T_ARRAY) { + tmpvp = add_vars(&tmpv, sp-1); + do_assign(sp[-2].u.v, tmpvp); + pop_stack(); pop_stack(); + push_var(tmpvp); + } else { + tmpvp = add_vars(&tmpv, sp-1); + do_assign(sp[-2].u.v, tmpvp); + pop_stack(); pop_stack(); + push_var(tmpvp); + } } break; case F_SUB: - GET_ARGS(); - push_int(arg[0] - arg[1]); + tmpvp = sub_vars(sp-2, sp-1); + pop_stack(); pop_stack(); + push_var(tmpvp); +/* GET_ARGS(); + push_int(arg[0] - arg[1]);*/ break; case F_SUB_EQ: if(sp[-2].type == T_CHAR_PTR) { tmpi = sp[-2].u.s[0] - sp[-1].u.i; } else { tmpv = *sp[-2].u.v; - tmpi = tmpv.u.i - sp[-1].u.i; - sp[-2].u.v->u.i = tmpi; + if(tmpv.type & T_ARRAY) { + tmpvp = sub_vars(&tmpv, sp-1); + do_assign(sp[-2].u.v, tmpvp); + pop_stack(); pop_stack(); + push_var(tmpvp); + } else { + tmpi = tmpv.u.i - sp[-1].u.i; + sp[-2].u.v->u.i = tmpi; + pop_stack(); pop_stack(); + push_int(tmpi); + } } - pop_stack(); pop_stack(); - push_int(tmpi); break; case F_MUL: GET_ARGS(); @@ -528,18 +596,12 @@ pop_stack(); tmpvp = sp[-1].u.v; pop_stack(); - + if(tmpvp->type & T_ARRAY) { - if(!tmpvp->u.a) { - runtime("taking element of null array"); - } - if(arg[0] < 0 || arg[0] >= tmpvp->u.a->length) { - runtime("index out of range"); - } - tmpvp = tmpvp->u.a->data[arg[0]]; - push_var(tmpvp); + index_check(tmpvp, arg); + push_var(&tmpvp->u.a->data[arg[0]]); } else { - index_check(arg, tmpvp->u.s); + index_check(tmpvp, arg); arg[1] = tmpvp->u.s[arg[0]]; push_int(arg[1]); } @@ -549,12 +611,18 @@ pop_stack(); tmpvp = sp[-1].u.v; pop_stack(); - index_check(arg, tmpvp->u.s); - sp->type = T_CHAR_PTR; - sp->u.s = tmpvp->u.s + arg[0]; - sp++; - CHECK_SP() + if(tmpvp->type & T_ARRAY) { + index_check(tmpvp, arg); + push_lvalue(&tmpvp->u.a->data[arg[0]]); + } else { + index_check(tmpvp, arg); + + sp->type = T_CHAR_PTR; + sp->u.s = tmpvp->u.s + arg[0]; + sp++; + CHECK_SP() + } break; case F_SLICE: tmpvp = take_slice(arg); @@ -644,6 +712,7 @@ tmpi = *++cp; cp++; setup_frame(); + csp->fun = -tmpi-1; dfptr[tmpi](); pop_control_stack(0); break; @@ -692,26 +761,24 @@ printf("Unknown instruction %d\n", *cp); /* runtime here? */ break; } + #ifdef DEBUG if(conf.debuglevel > 2 && !dont_debug_interpreter) show_stack(); #endif + /* We return to the control level where we entered - we have finished. */ - if(csp == saved_csp) { -#ifdef DEBUG - debug("interpret", "csp (%d) == saved_csp (%d); returning\n", csp - &control_stack[0], saved_csp - &control_stack[0]); -#endif + if(csp == saved_csp) return; - } + /* Abnormal termination - need to pop unnecessary stuff off the stack. */ if(this_ob->flags & O_DESTRUCTED) { -#ifdef DEBUG - debug("interpret", "this_ob destructed; returning\n"); -#endif - pop_control_stack(1); + while(csp->this_ob == this_ob) + pop_control_stack(1); pop_locals(); return; } + cp++; goto again; } @@ -726,7 +793,7 @@ runtime_dyn(buf); } - csp->line = f->lineno; +/* csp->line = f->lineno;*/ csp->fun = index; i = f->num_arg - csp->num_arg; @@ -759,17 +826,6 @@ codelen = f->codelen; } -#if 0 -void init_interpreter(void) -{ - fp = sp = &value_stack[0]; - csp = &control_stack[0]; - csp->fp = fp; - csp->sp = sp; - cp = 0; -} -#endif - int get_fun_index(object_t *ob, char *fun_name) { int i; @@ -808,6 +864,11 @@ #ifdef DEBUG gettimeofday(&tm, NULL); #endif + +#ifdef DEBUG + if(conf.debuglevel) + printf("[lpc] apply \"%s\" on \"%s\"\n", fun, ob->name); +#endif push_control_stack(); @@ -838,10 +899,6 @@ } va_end(va); - -#ifdef DEBUG - debug("lpc", "apply \"%s\" on \"%s\"\n", fun, ob->name); -#endif if(!have_error_context) { if(setjmp(error_context)) { @@ -854,11 +911,17 @@ } call_function(ob, index); + csp->this_ob = this_ob; + csp->previous_ob = previous_ob; + csp->code = csp->cp = cp; + csp->codelen = codelen; + eval_instruction(); #ifdef DEBUG gettimeofday(&tm2, NULL); - debug("lpc", "apply \"%s\" done in %d microseconds\n", fun, tm2.tv_usec - tm.tv_usec); + if(conf.debuglevel) + printf("[lpc] apply \"%s\" done in %d microseconds\n", fun, tm2.tv_usec - tm.tv_usec); #endif have_error_context = 0; |
From: Peep P. <so...@us...> - 2004-07-21 12:02:47
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9490 Modified Files: interpret.h Log Message: Removed int line; Index: interpret.h =================================================================== RCS file: /cvsroot/agd/server/src/interpret.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- interpret.h 20 Jun 2004 14:04:08 -0000 1.16 +++ interpret.h 21 Jul 2004 12:02:37 -0000 1.17 @@ -18,7 +18,7 @@ int *code; int codelen; - int fun, line; + int fun; object_t *this_ob, *previous_ob; player_t *this_player; |
From: Peep P. <so...@us...> - 2004-07-21 12:02:03
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8902 Modified Files: lang.y Log Message: Moved T_ANY to lpc.h Rearranged some operator priorities. Fixed some expression types. the block_history system again - locals are F_POPped at the end of the block Added some missing free()'s Added arrays to function argument checking in fun_call Some really complicated checks for the right object in call_other! Index: lang.y =================================================================== RCS file: /cvsroot/agd/server/src/lang.y,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- lang.y 20 Jun 2004 14:04:45 -0000 1.23 +++ lang.y 21 Jul 2004 12:01:51 -0000 1.24 @@ -1,6 +1,9 @@ %{ /* local_vars and global_vars still need some work, - especially in not allowing 'void'. */ + especially in not allowing 'void'. + + int *a, *b, *c also doesn't work. sigh. +*/ #include <stdlib.h> #include "config.h" @@ -14,8 +17,6 @@ #include "vars.h" #include "compile.h" -#define T_ANY 0x30 - /* Used during compilation, replaced with F_JMP. Need to use two separate numbers for both, because one could easily appear on it's own in code. */ @@ -34,6 +35,8 @@ static int num_locals_pushed, dont_add_pop; +static int *block_history, hist_size; + extern int scope_level; extern program_t *this_prog; extern function_t *curr_fun; @@ -87,10 +90,10 @@ %left L_POW_EQ %left L_OR L_AND %left L_EQ L_NE -%left '+' '-' -%left ':' %left '?' %left '<' '>' L_LE L_GE +%left '+' '-' +%left ':' %left '*' '/' '%' %left L_POW %left L_ARROW @@ -208,7 +211,7 @@ } } - add_function(idp, $<i>3/*, &$8*/); + add_function(idp, @$.first_line); curr_fun_type = 0; } else { def_id_t *idp = $<id>3; @@ -219,7 +222,7 @@ free(buf); compile_warnings++; } else { - add_function(idp, $<i>7/*, NULL*/); + add_function(idp, @$.first_line); } } pop_scope(); @@ -275,7 +278,7 @@ $$.type = T_INT; add_two_tokens(F_PUSH_INT, $1); } - | defined_name + | defined_name /* This should not be a constant. */ { $$.side_effect = $$.direct_type = 0; $$.lval = 1; @@ -478,7 +481,11 @@ if($2.type != T_INT && $2.type != T_ANY) { comp_error("index must be integer"); } - $$.type = T_INT; + if($1.type == T_STRING) + $$.type = T_INT; + else + $$.type = $1.type & ~T_ARRAY; + add_token(F_INDEX); } | expr_open_bracket expr L_RANGE expr ']' @@ -486,7 +493,7 @@ $$.side_effect = $1.side_effect || $2.side_effect || $4.side_effect; $$.direct_type = 0; $$.lval = 1; - $$.type = T_STRING; + $$.type = $1.type; add_token(F_SLICE); } @@ -536,9 +543,13 @@ block: '{' { - scope_level++; - $<i>$ = num_locals_pushed; + if(hist_size <= scope_level) { + hist_size += 25; + block_history = realloc(block_history, sizeof(int)*hist_size); + } + block_history[scope_level-1] = num_locals_pushed; num_locals_pushed = 0; + scope_level++; } statements '}' { @@ -546,14 +557,14 @@ int num; /* Don't want F_POP after F_RETURN. */ if(!dont_add_pop) { - num = $<i>2 + num_locals_pushed; - num_locals_pushed = 0; - for(i=0;i<num;i++) - add_token(F_POP); - } else { + num = num_locals_pushed; + num += block_history[scope_level - 1]; + if(num) + add_two_tokens(F_POP_N, num); + } else dont_add_pop = 0; - num_locals_pushed = 0; - } + + num_locals_pushed = 0; pop_scope(); } ; @@ -585,8 +596,8 @@ sprintf(buf, "undeclared identifier '%s'", $1); comp_error(buf); free(buf); - free($1); /* WATCH OUT */ } + free($1); } ; @@ -671,7 +682,7 @@ } $$ = $1; - free($2); + /*free($2);*/ } ; @@ -781,7 +792,7 @@ } ; -string: string_con2 ; +string: string_con2; /*string_con1: string_con2 @@ -803,6 +814,8 @@ $$ = xmalloc(strlen($1) + strlen($2) + 1); strcpy($$, $1); $$ = strcat($$, $2); + free($1); + free($2); } ; @@ -915,8 +928,8 @@ } optional_expr { - if($6.side_effect) - add_token(F_POP); +/* if($6.side_effect) + add_token(F_POP);*/ add_two_tokens(F_JUMP_IF_FALSE, 0); $<i>$ = curr_fun->codelen - 1; } @@ -1024,13 +1037,19 @@ sprintf(buf, "too many arguments to %s", $1->name); comp_error(buf); free(buf); + goto clean_up; } else if($3.len < $1->num_arg) { buf = xmalloc(strlen($1->name) + 22); sprintf(buf, "too few arguments to %s", $1->name); comp_error(buf); free(buf); + goto clean_up; } else { for(i=0;i<$1->num_arg;i++) { + if(($1->args[i] == T_ARRAY && ($3.data[i] & T_ARRAY)) || + ($3.data[i] == T_ARRAY && ($1->args[i] & T_ARRAY))) + continue; + if($1->args[i] != T_ANY && $3.data[i] != T_ANY && $1->args[i] != $3.data[i]) { char *ts1, *ts2; @@ -1042,6 +1061,7 @@ i+1, $1->name, ts1, ts2); comp_error(buf); free(buf); + goto clean_up; break; } } @@ -1055,6 +1075,10 @@ } else /* ID_FUN */ add_token(F_CALL_LFUN); add_two_tokens($1->index, $3.len); + break; + +clean_up: + free($1->name); } ; @@ -1062,23 +1086,31 @@ expr L_ARROW L_IDENTIFIER '(' call_args ')' { int index; + int arg_type; $$.side_effect = 1; $$.direct_type = 0; $$.type = T_ANY; /* Can't really find out for call_other. */ - if($1.type != T_OBJECT && !($1.type == T_STRING - && $1.direct_type /*&& strlen($1.arr.data[1]) FIXME! */)) { + if($1.type == T_OBJECT || + ($1.type == T_STRING && $1.direct_type /*&& strlen($1.arr.data[1]) FIXME! */) || + ($1.type & T_ARRAY) && (($1.type & ~T_ARRAY) == T_OBJECT)) { + if($1.type & T_ARRAY) { + comp_error("call_other on arrays currently unimplented. use a for loop."); + } + index = add_string_to_table($3); + add_token(F_CALL_OTHER); + add_two_tokens(index, $5.len); + /* We can't remove the object from the stack + since it's before the arguments - that's + why this pop is necessary. + And it has to pop the penultimate item because + the return value is the last one, which + needs to be preserved. */ + add_token(F_POP_PENUL); + } else { comp_error("not an object to '->'"); } - - index = add_string_to_table($3); - add_token(F_CALL_OTHER); - add_two_tokens(index, $5.len); - /* We can't remove the object from the stack - since it's before the arguments - that's - why this pop is necessary. */ - add_token(F_POP); } ; @@ -1147,6 +1179,7 @@ result->direct_type = 0; result->lval = 0; + if(left->type && type2 && left->type != type2) { comp_error("type mismatch"); } @@ -1158,7 +1191,7 @@ { result->direct_type = 0; result->side_effect = op1->side_effect || op2->side_effect; - result->type = T_INT; + result->type = op1->type; check_operand(operator, op1->type, op2->type); add_token(operator); } |
From: Peep P. <so...@us...> - 2004-07-21 11:58:39
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8860 Modified Files: log.c Log Message: Removed unused code. Index: log.c =================================================================== RCS file: /cvsroot/agd/server/src/log.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- log.c 21 Mar 2004 13:26:00 -0000 1.7 +++ log.c 21 Jul 2004 11:58:30 -0000 1.8 @@ -1,7 +1,7 @@ #include <stdio.h> -#include "sys.h" #include <stdarg.h> #include <time.h> +#include "sys.h" /* To prevent flooding the user with error messages. */ static int suppress_nofd, /* If we have a file descriptor. */ @@ -46,16 +46,6 @@ return 1; } -#if 0 -/* If we are compiling the dfparse binary, dfuns.o is not linked - and thus we don't get do_time(). */ -#ifdef _DFUNS_H -#define WRITELOG(x) fprintf(x, "%s [%s] %s", do_time(), prefix, str) -#else -#define WRITELOG(x) fprintf(x, "[%s] %s", prefix, str) -#endif -#endif - #define WRITELOG(x) fprintf(x, "[%s] %s", prefix, str) /* this currently writes the errors into a generic error log, maybe we should |
From: Peep P. <so...@us...> - 2004-07-21 11:58:14
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8776 Modified Files: lpc.h Log Message: Moved T_ANY here since compile.c needs to use it in check_operand. Index: lpc.h =================================================================== RCS file: /cvsroot/agd/server/src/lpc.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- lpc.h 14 Jun 2004 20:57:52 -0000 1.11 +++ lpc.h 21 Jul 2004 11:57:57 -0000 1.12 @@ -13,6 +13,8 @@ #define T_OBJECT 0x04 #define T_MIXED 0x05 +#define T_ANY 0x06 + /* Used by interpret.c. I'd rather not have it here, but as it also needs an union member, it would be too cluttered otherwise. */ |
From: Peep P. <so...@us...> - 2004-07-21 11:57:48
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8714 Modified Files: main.c Log Message: General cleanup; frame pointer is set correctly before applying crash Index: main.c =================================================================== RCS file: /cvsroot/agd/server/src/main.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- main.c 20 Jun 2004 14:04:56 -0000 1.21 +++ main.c 21 Jul 2004 11:57:22 -0000 1.22 @@ -34,6 +34,7 @@ extern object_t *master; static char *conf_file; time_t startup_time; +extern variable_t *fp, *sp; void crash(int sig, char *reason, int retval) { @@ -47,11 +48,14 @@ signal(SIGPIPE, SIG_IGN); #ifdef DEBUG /* We generally do not want to debug the crash function. Causes unnecessary spam. */ - dont_debug_interpreter = 1; + dont_debug_interpreter = 0; #endif if(master) { - if(!apply(master, "crash", "i", sig)) + int ret; + fp = sp; + ret = apply(master, "crash", "i", sig); + if(!ret) fprintf(stderr, "master::crash() failed.\n"); else fprintf(stderr, "master::crash() called successfully.\n"); @@ -79,19 +83,18 @@ void usage(char *s) { printf("Usage: %s [options] [configuration file]\n", s); - printf("\tOptions:\n\t\t-d:\n\t\t Increase debug level\n" - "\t\t-?\n\t\t-v:\n\t\t Show version and quit\n"); + printf("\tOptions:\n\ + \t\t-d:\n\ + \t\t Increase debug level\n\ + \t\t-?\n\ + \t\t-v:\n\ + \t\t Show version and quit\n"); exit(5); } void print_version(void) { - printf("%s on %s", PACKAGE_STRING, PLATFORM); -#ifdef __GNUC__ - printf(", gcc %s", __VERSION__); -#endif - putchar('\n'); - + printf("%s for %s starting at %s", PACKAGE_STRING, PLATFORM, ctime(&startup_time)); #ifdef ARCH_README printf("Your computer architecture is not fully supported. " "Please read README.ARCH in the source directory.\n"); @@ -155,6 +158,9 @@ int main(int argc, char **argv) { parse_args(argc, argv); + + time(&startup_time); + srand(startup_time); print_version(); #ifndef ALLOW_ROOT @@ -183,17 +189,14 @@ check_logfile(); dfuns_init(); /* init_interpreter();*/ - + master = load_object(conf.master); if(!master) crash(0, "Master object doesn't load", 3); - master->numref++; +/* master->numref++; Is this really necessary? */ net_listen(conf.port); - time(&startup_time); - printf("Started at %s", ctime(&startup_time)); - srand(startup_time); printf("Accepting connections on port %d.\n", conf.port); net_loop(); return 0; |
From: Peep P. <so...@us...> - 2004-07-21 11:56:37
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8544 Modified Files: net.c Log Message: Do net_disconnect when player goes netdead Index: net.c =================================================================== RCS file: /cvsroot/agd/server/src/net.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- net.c 14 Jun 2004 20:48:08 -0000 1.18 +++ net.c 21 Jul 2004 11:56:28 -0000 1.19 @@ -205,6 +205,7 @@ /* the login object will have to restore this object's iaob */ pl->ob->iaob = NULL; } + net_disconnect(pl); break; default: net_read(pl); @@ -280,8 +281,9 @@ } } #endif - /* call heartbeats on objects here */ - destruct_all(); + /* call heartbeats on objects here */ + + destruct_all(); } /* while(1); */ } |
From: Peep P. <so...@us...> - 2004-07-21 11:56:08
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8447 Modified Files: object.h Log Message: Line number information. Index: object.h =================================================================== RCS file: /cvsroot/agd/server/src/object.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- object.h 8 Jun 2004 20:44:53 -0000 1.10 +++ object.h 21 Jul 2004 11:55:58 -0000 1.11 @@ -11,12 +11,13 @@ int codelen; unsigned int lineno; + unsigned *line_numbers; } function_t; typedef struct { - function_t **functions; /* This shouldn't be an array to pointers. */ + function_t **functions; int numfunc; - char **fun_table; /* This could be a hash table. */ + char **fun_table; int num_str; char **str_tbl; |
From: Peep P. <so...@us...> - 2004-07-21 11:55:48
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8408 Modified Files: object.c Log Message: Cleaned headers. Index: object.c =================================================================== RCS file: /cvsroot/agd/server/src/object.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- object.c 14 Jun 2004 20:58:32 -0000 1.17 +++ object.c 21 Jul 2004 11:55:39 -0000 1.18 @@ -1,11 +1,8 @@ -/* -#include "config.h" -*/ #include <stdlib.h> +/*#include "config.h"*/ +/*#include "arch.h"*/ #include "compile_options.h" #include "sys.h" - -/*#include "arch.h"*/ #include "list.h" #include "lpc.h" #include "object.h" @@ -107,6 +104,10 @@ list_remove(&ob->refs, v); ob->numref--; + if(ob->numref <= 0) { + printf("refs for %s = 0\n", ob->name); + destruct(ob); + } } void unref_prog(program_t **prog) |
From: Peep P. <so...@us...> - 2004-07-21 11:55:20
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8366 Modified Files: sys.c Log Message: Changed to use .lpc extensions. Index: sys.c =================================================================== RCS file: /cvsroot/agd/server/src/sys.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- sys.c 14 Jun 2004 20:48:08 -0000 1.16 +++ sys.c 21 Jul 2004 11:55:06 -0000 1.17 @@ -131,18 +131,18 @@ return p; } -/* This makes a copy of str, and adds ".c" to the end. */ +/* This makes a copy of str, and adds ".lpc" to the end. */ char *add_extension(char *str) { - char *buf; + char *buf, *p; int len = strlen(str); - if(str[len-2] != '.' && str[len-1] != 'c') { - buf = xmalloc(len + 3); - sprintf(buf, "%s.c", str); - } else { - buf = stringdup(str); - } + p = str + len - 5; + if(strcmp(p, ".lpc") == 0) + return stringdup(buf); + + buf = xmalloc(len + 5); + sprintf(buf, "%s.lpc", str); return buf; } |
From: Peep P. <so...@us...> - 2004-07-21 11:54:11
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8182 Modified Files: vars.c vars.h Log Message: Adding and substracting arrays. (add_vars and sub_vars) Index: vars.c =================================================================== RCS file: /cvsroot/agd/server/src/vars.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- vars.c 14 Jun 2004 20:48:08 -0000 1.15 +++ vars.c 21 Jul 2004 11:54:01 -0000 1.16 @@ -1,16 +1,44 @@ -/* #include "config.h" */ -/* #include "compile_options.h" */ +/* +#include "config.h" +#include "compile_options.h" +#include "arch.h" +*/ #include <stdlib.h> -/*#include "arch.h"*/ #include "sys.h" #include "list.h" #include "lpc.h" #include "object.h" +#include "array.h" + +void init_var(variable_t *var) +{ + if(var->type & T_ARRAY) { + var->u.a = xmalloc(sizeof(array_t)); + var->u.a->length = 0; + } else switch(var->type) { + case T_INT: + var->u.i = 0; + break; + case T_STRING: + var->u.s = ""; + var->string_type = ST_STATIC; + break; + case T_OBJECT: + var->u.ob = NULL; + break; + case T_VOID: + printf("trying to init T_VOID\n"); + break; + default: + printf("init_var(): unhandled var type %d\n", var->type); + break; + } +} void free_var(variable_t *v) { if(v->type & T_ARRAY) { - /* unref_array(v->u.a); */ + unref_array(v->u.a); } else switch(v->type & ~T_ARRAY) { case T_OBJECT: unref_ob(v->u.ob, v); @@ -98,24 +126,6 @@ } #endif -void init_var(variable_t *var) -{ - switch(var->type) { - case T_INT: var->u.i = 0; break; - case T_STRING: - var->u.s = ""; - var->string_type = ST_STATIC; - break; - case T_OBJECT: var->u.ob = NULL; break; - case T_VOID: - printf("trying to init T_VOID\n"); - break; - default: - printf("init_var(): unhandled var type %d\n", var->type); - break; - } -} - /* runtime addition of variables. */ variable_t *add_vars(variable_t *v1, variable_t *v2) { @@ -126,7 +136,27 @@ return NULL; ret = xmalloc(sizeof(variable_t)); - ret->name = NULL; /* Just for debugging. Remove later. */ +#ifdef DEBUG + ret->name = NULL; +#endif + + if(v1->type & T_ARRAY && v2->type & T_ARRAY) { + int i; + ret->type = v1->type; + ret->u.a = xmalloc(sizeof(array_t)); + ret->u.a->ref = 1; + ret->u.a->length = v1->u.a->length + v2->u.a->length; + ret->u.a->data = xmalloc(sizeof(variable_t) * ret->u.a->length); + + for(i=0;i<ret->u.a->length;i++) { + /* use do_assign? */ + if(i < v1->u.a->length) + ret->u.a->data[i] = v1->u.a->data[i]; + else + ret->u.a->data[i] = v2->u.a->data[i - v1->u.a->length]; + } + return ret; + } switch(v1->type) { case T_INT: @@ -210,39 +240,23 @@ free(ret); return NULL; } -#if 0 -void assign_var(variable_t *dest, variable_t *src) -{ - if(!src) - return; - switch(src->type & ~T_ARRAY) { - case 0: - printf("assign_var(): type 0\n"); - return; - case T_INT: - dest->u.i = src->u.i; - break; - case T_STRING: - if(src->u.s) { - dest->u.s = stringdup(src->u.s); - dest->string_type = ST_MALLOC; - } - break; - case T_OBJECT: - dest->u.ob = src->u.ob; - break; - case T_VOID: - printf("assign_var(): type T_VOID\n"); - break; - default: - printf("assign_var(): unknown type %d\n", src->type & ~T_ARRAY); - break; +variable_t *sub_vars(variable_t *var1, variable_t *var2) +{ + variable_t *ret; + + ret = xmalloc(sizeof(variable_t)); + + if(var1->type & T_ARRAY && var2->type & T_ARRAY) { + ret->type = var1->type; + ret->u.a = sub_arrays(var1->u.a, var2->u.a); + } else { + ret->type = T_INT; + ret->u.i = var1->u.i - var2->u.i; } + return ret; } -#endif -/* lang.y uses this. */ char *type2str(int t) { if(t & T_ARRAY) { Index: vars.h =================================================================== RCS file: /cvsroot/agd/server/src/vars.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- vars.h 7 Jun 2004 15:46:15 -0000 1.8 +++ vars.h 21 Jul 2004 11:54:01 -0000 1.9 @@ -7,6 +7,7 @@ int test_var(variable_t *v); int compare_vars(variable_t *v1, variable_t *v2); variable_t *add_vars(variable_t *v1, variable_t *v2); +variable_t *sub_vars(variable_t *v1, variable_t *v2); char *type2str(int t); #endif |
From: Peep P. <so...@us...> - 2004-06-23 21:17:38
|
Update of /cvsroot/agd/server/lib/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3306 Modified Files: login.c Log Message: Using arrays. Index: login.c =================================================================== RCS file: /cvsroot/agd/server/lib/sys/login.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- login.c 7 Jun 2004 15:54:56 -0000 1.8 +++ login.c 23 Jun 2004 21:17:30 -0000 1.9 @@ -41,49 +41,21 @@ new_player(name); } -/* Arrr, I want arrays! */ -/* - string generate_name() { - string *first, *last; - first = ({"Vassili", "Ivan","Dmitri","Pjotr", - "Vladimir", "Jossif"}); - last = ({"Aleksandrjevits", "Ivanov", "Vadimov", - "Dmitrjevits", "Pjotrov"}); - return first[random(sizeof(first))] + " " + - last[random(sizeof(last))]; - } -*/ +/* ARrrr, ARRrrays! */ string generate_name() { - string first, last; - int i; - - i = random(6); - if(i == 0) - first = "Vassili"; - else if(i == 1) - first = "Ivan"; - else if(i == 2) - first = "Dmitri"; - else if(i == 3) - first = "Pjotr"; - else if(i == 4) - first = "Vladimir"; - else if(i == 5) - first = "Jossif"; - - i = random(5); - if(i == 0) - last = "Aleksandrjevits"; - else if(i == 1) - last = "Ivanov"; - else if(i == 2) - last = "Vadimov"; - else if(i == 3) - last = "Dmitrjevits"; - else if(i == 4) - last = "Pjotrov"; + string *first; + string *last; + first = ({ + "Vassili", "Ivan", "Dmitri", + "Pjotr", "Vladimir", "Jossif" + }); - return first + " " + last; + last = ({ + "Aleksandrjevits", "Ivanov", "Vadimov", + "Dmitrjevits", "Pjotrov" + }); + return first[random(sizeof(first))] + " " + + last[random(sizeof(last))]; } void gen_or_not(string s) { |
From: Peep P. <so...@us...> - 2004-06-23 21:17:17
|
Update of /cvsroot/agd/server/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3168 Removed Files: fibonacci.c Log Message: Removed. --- fibonacci.c DELETED --- |
From: Peep P. <so...@us...> - 2004-06-20 14:12:19
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7678 Modified Files: dfuns.c Log Message: Uses runtime_dyn. Index: dfuns.c =================================================================== RCS file: /cvsroot/agd/server/src/dfuns.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- dfuns.c 14 Jun 2004 20:54:30 -0000 1.22 +++ dfuns.c 20 Jun 2004 14:12:11 -0000 1.23 @@ -346,7 +346,7 @@ if(!f) { char *buf = xmalloc(strlen(path) + 50); sprintf(buf, "can't open '%s' for reading!", path); - runtime(buf, 1); + runtime_dyn(buf); } file_str = NULL; @@ -367,7 +367,7 @@ /* Misc. */ void df_throw(void) { - runtime(fp->u.s, 0); + runtime(fp->u.s); pop_stack(); push_void(); } |
From: Peep P. <so...@us...> - 2004-06-20 14:05:26
|
Update of /cvsroot/agd/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1867 Modified Files: TODO ChangeLog Log Message: Changes. What can I say? Index: TODO =================================================================== RCS file: /cvsroot/agd/server/TODO,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- TODO 12 Jun 2004 20:13:12 -0000 1.22 +++ TODO 20 Jun 2004 14:05:16 -0000 1.23 @@ -1,22 +1,25 @@ Not necessarily in order of importance. '!' means first-priority, '?' means trivial and not really important. +'<' means low priority + + - allow 'string foo; foo[0]="a";' + - sprintf and printf - Interpreter. - - F_PUSH_NUM_INT <constant> <number> - - F_POP_N <number> - pops <number> elements off the stack - - runtime() for dfuns (doesn't display line numbers) - - display stack trace (with line numbers and functions) when getting a runtime error + ? F_PUSH_NUM_INT <constant> <number> + ? F_POP_N <number> - pops <number> elements off the stack + < runtime() for dfuns (doesn't display line numbers) + < display stack trace (with line numbers and functions) when getting a runtime error lang.y: - - do int i while(1); should either not be allowed - syntactically or should pop after it pushes ! break, continue + ! fix L_SLICE_LVALUE - - compile.c::compile_prog() should show global vars - - debug.c::print_code() should show functions' arguments + < compile.c::compile_prog() should show global vars + < debug.c::print_code() should show functions' arguments - - Do something about compile.c::pop_scope() - it's slow. + - Do something about compile.c::pop_scope() - it's slow (well, algorithmically speaking, at least). - New configuration parser. - Change 'errorlog' to just 'log', or change debug() to be an error @@ -50,7 +53,7 @@ - all of the operators (/doc/lpc/operators) - ',' - this takes some serious grammar-hacking, because comma as a function call argument is a separator for expressions. - ? mixed type + - mixed type - string slices (ranges) ! assigning to slices (F_SLICE_LVALUE etc.) - Check if assigning too long a string. @@ -91,22 +94,22 @@ #define __AUTHORS__ ? :) - character encoding inside strings: - decimal: \nnn - - octal: \0onnn + - octal: \0nnn - hexadecimal: \0xnn - - binary: \0bnnnnnnnn + - binary: \nnnnnnnnb - multiline strings ? Better function lookup table (prog->nametable)? O(1) would be nice. - ? better logging system + - better logging system - print time using strftime() - log using lib's facilities (master::log()?) - different prefixes have different debuglevels - save to different files ? only report undeclared identifiers once (this is generally a Bad Thing) - ? warn about unused variables - ? initialization of global variables - ? dfun overrides, :: operator + - warn about unused variables + - initialization of global variables + - dfun overrides, :: operator ? check for lib root and folder of debug log with access() and exit gracefully if it fails. ? if we crash while running apply(master::crash), then we should rerun with debugging on Index: ChangeLog =================================================================== RCS file: /cvsroot/agd/server/ChangeLog,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- ChangeLog 12 Jun 2004 20:13:12 -0000 1.20 +++ ChangeLog 20 Jun 2004 14:05:16 -0000 1.21 @@ -1,5 +1,16 @@ 0.0.3: ---------------------------------------------------------------------------- +2004-06-15 + * interpret.c: TAKE_SLICE is now a function instead of a macro + GET_ARGS changed: arg[0] is now the FIRST argument and + arg[1] is the SECOND, not vice versa. sanity! +2004-06-14 + * dfuns.c: input_to now checks for this_player - fixes crash + * interpret.c,lang.y: F_INDEX and F_INDEX_LVALUE work again. + * various: removed xfree - useless. + * lex.l: __VERSION__ and __ARCH__ now stringdup the strings before + returning - the strings could go into a program's string table, where + they get freed. 2004-06-12 * lang.y: lvalues work again * lang.y: removed the hacky rules to have statements without semicolons; |