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-03-18 21:00:56
|
Update of /cvsroot/agd/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2863 Modified Files: BUGS ChangeLog Ideas NEWS TODO Log Message: Updates for 0.0.2-2. Index: ChangeLog =================================================================== RCS file: /cvsroot/agd/server/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ChangeLog 16 Mar 2004 20:17:32 -0000 1.5 +++ ChangeLog 18 Mar 2004 20:51:16 -0000 1.6 @@ -1,6 +1,22 @@ 0.0.2-2: -2004-03-16 ---------------------------------------------------------------------------- +2004-03-17 + * make sure thre is a correct number of arguments on the stack - + "void create(int i) { }" won't crash anymore. + * fixed crash with "int i = 1;" - now uses F_PUSH_LVAR_LVALUE + * net_dead() is now called in the player object, not the + master. login.c can now destruct itself if a logining player + disconnects. + * Rewrote asctime() in LPC, renamed to ctime(). This is quite an + achievement. + * Fixed crash with functions with implicit type. + * Bison debug is turned in with debuglevel > 4. + * New dfuns: strlen, capitalize, lower_case + * String ranges: str[i]. + * Fixed a crash in lang.y (fun_call tried to get $1->args, even if $1 + was null). +2004-03-16 + * Character constants ('x'). All same escape codes as strings. * ? : operator. * new dfun: random() * checking for return type @@ -8,6 +24,7 @@ * compile_options.h: added DEFAULT_FUNCTION_TYPE * functions with implicit type )defined like 'fun_name(int i) { }' now work again. + 0.0.2-1: ---------------------------------------------------------------------------- 2004-03-16 Index: Ideas =================================================================== RCS file: /cvsroot/agd/server/Ideas,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- Ideas 15 Mar 2004 18:53:35 -0000 1.2 +++ Ideas 18 Mar 2004 20:51:16 -0000 1.3 @@ -1,5 +1,4 @@ This file contains features that are not necessary, but would be cool to have. - lpc: * if(x == 1 || == 2 && != 3) * Argument type grouping @@ -7,6 +6,6 @@ * k integer constants: 100k equals to 100000 1k equals to 1000 etc. - * the same for K, M + * the same for K, M (suggested by elver) K (or maybe Kb / KB) = 1024 M = 1024 * 1024 Index: BUGS =================================================================== RCS file: /cvsroot/agd/server/BUGS,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- BUGS 16 Mar 2004 20:17:32 -0000 1.3 +++ BUGS 18 Mar 2004 20:51:16 -0000 1.4 @@ -5,4 +5,32 @@ - the define_id system is more or less not operational. * int i; void foo(int i); should be valid with a warning + - + [lpc] apply "write_prompt" done in 410 microseconds + + Program received signal SIGINT, Interrupt. + 0x40119758 in select () from /lib/tls/libc.so.6 + (gdb) handle SIGINT pass + SIGINT is used by the debugger. + Are you sure you want to change it? (y or n) y + Signal Stop Print Pass to program Description + SIGINT Yes Yes Yes Interrupt + (gdb) c + Continuing. + Crashing: Interrupted + [lpc] apply "crash" on "/sys/master.c" + [interpret] call_function 0 on /sys/master.c + + Program received signal SIGSEGV, Segmentation fault. + 0x08055fe7 in net_send (buf=0x808d878 "Crashing on signal 2!\r\n", siz=24, p=0x80728c8) at net.c:164 + 164 send(this_player->conn.socket, buf, siz, 0); + (gdb) print this_player + $1 = (player_t *) 0xa0d3000 + (gdb) print *this_player + Cannot access memory at address 0xa0d3000 + - + string s; + s = s + "abc"; + will result in "0abc" + - continue from here.. Index: NEWS =================================================================== RCS file: /cvsroot/agd/server/NEWS,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- NEWS 16 Mar 2004 20:17:32 -0000 1.2 +++ NEWS 18 Mar 2004 20:51:16 -0000 1.3 @@ -1,5 +1,8 @@ New things in this version (0.0.2-2) that you might find useful: - * Dfuns: random + * String ranges and character constants (you can now do things like s[1] = 'a') + * Dfuns: random, strlen, capitalize, lower_case + * Removed dfun asctime(). This can and should be done with LPC, and there's an example + of it in lib/sys/player Features in 0.0.2: * Additional escape codes: \\, \", \t, \a, \b, \f, \e Index: TODO =================================================================== RCS file: /cvsroot/agd/server/TODO,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- TODO 16 Mar 2004 20:17:32 -0000 1.5 +++ TODO 18 Mar 2004 20:51:16 -0000 1.6 @@ -15,7 +15,7 @@ ! for(), foreach(), switch() ! all of the operators (/doc/lpc/operators) - mixed type - ! string ranges + ! string ranges (str[0..1,2..3]) ! continue; and break; - allow to define locals inside statements like: create() { write("\n"); int i; i = 1; int j; j = 2; } @@ -26,6 +26,11 @@ definitions and if anything is found, it opens up another buffer (pushes it on flex's stack), containing the macro replacement, which will then get parsed again. if no macros match, REJECT() is called and flex tries to match with next available rule + - predefined names: + #define __AGD__ 1 + #define __VERSION__ PACKAGE_VERSION + #define __ARCH__ PLATFORM + #define __HOST__ system hostname, from somewhere. - character encoding inside strings: - decimal: \nnn - octal: \0onnn @@ -33,6 +38,8 @@ - binary: \0bnnnnnnnn - dfuns: query_ip() for players. + - mudlib: + /update command - better logging system - log using lib's facilities (master::log()?) - different prefixes have different debuglevels @@ -54,3 +61,8 @@ - clean up includes, not everything needs everything in std.h and lpc_incl.h, etc. - make maintainer-clean should also remove src/dfparse.output and src/lang.output - compile-time eval for < > <= >= == != ! + - lang.y: + fun_call compare_args result >0 error (lang.y:1216) should show datatypes as strings, not ints + compare_args(): 0 should be any valid type (shout("a", 0) should be ok) + - or maybe use NULL or nil + - if we crash while running apply(master::crash), then we should rerun with debugging on |
From: Peep P. <so...@us...> - 2004-03-18 20:59:56
|
Update of /cvsroot/agd/server/doc/lpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2756 Modified Files: operators Log Message: Range operator. Index: operators =================================================================== RCS file: /cvsroot/agd/server/doc/lpc/operators,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- operators 16 Mar 2004 20:14:58 -0000 1.2 +++ operators 18 Mar 2004 20:50:16 -0000 1.3 @@ -30,6 +30,7 @@ the current object; i.e. ob->call() would execute the function call() in object ob. ?: trinary conditional (if-then-else) * , binary comma - left and right side are evaluated, then right side discarded. + [] (F_RANGE) arithmetic: + binary addition * (F_ADD) |
From: Peep P. <so...@us...> - 2004-03-18 20:59:39
|
Update of /cvsroot/agd/server/lib/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2659 Modified Files: login.c Log Message: Added name generator. Index: login.c =================================================================== RCS file: /cvsroot/agd/server/lib/sys/login.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- login.c 12 Mar 2004 08:50:10 -0000 1.3 +++ login.c 18 Mar 2004 20:49:57 -0000 1.4 @@ -4,15 +4,14 @@ } void logon() { - write("Welcome! Available commands are: '/quit', '/uptime', '.'\n"); write("\nEnter your name: "); input_to("logon2"); } -void logon2(string name) { +void new_player(string name) { object ob; + ob = clone_object("/sys/player"); - if(!ob) { write("Uh-oh, the player object doesn't load!\n"); destruct(this_object()); @@ -21,7 +20,79 @@ ob->set_name(name); shout(time() + ": " + name + " has joined the game\n", this_object()); - write(time() + ": You have joined the game.\n"); + write(time() + ": You have joined the game. Use '/help' for " + "a list of commands.\n"); exec(ob); destruct(this_object()); } + +void logon2(string name) { + 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); +} + +/* 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))]; + } +*/ +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"; + + return first + " " + 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()); +} |
From: Peep P. <so...@us...> - 2004-03-18 20:59:29
|
Update of /cvsroot/agd/server/lib/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2630 Modified Files: master.c Log Message: Small changes. Index: master.c =================================================================== RCS file: /cvsroot/agd/server/lib/sys/master.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- master.c 16 Mar 2004 20:14:37 -0000 1.7 +++ master.c 18 Mar 2004 20:49:49 -0000 1.8 @@ -11,22 +11,21 @@ return 1; } +void write_version() { + write(banner); +} + object connect() { object ob; - write(banner); + write_version(); ob = clone_object("/sys/login"); return ob; } -void net_dead(object player) { - shout(player->query_name() + " went netdead!\n", (object)0); -} - -void create(void) -{ +void create(void) { banner = " _______ _______ _____\n\ | _ | __| \\\n\ | | | | -- |\n\ |___|___|_______|_____/\n\ - \t\tv0.0.2 on " + platform() + "\n"; + \t\tv" + version() + " / " + platform() + "\n"; } |
From: Peep P. <so...@us...> - 2004-03-18 20:59:19
|
Update of /cvsroot/agd/server/lib/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2558 Modified Files: player.c Log Message: New features; ctime() in LPC. Index: player.c =================================================================== RCS file: /cvsroot/agd/server/lib/sys/player.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- player.c 16 Mar 2004 14:02:55 -0000 1.6 +++ player.c 18 Mar 2004 20:49:37 -0000 1.7 @@ -1,9 +1,6 @@ string _name, last_cmd; -void input(string in); -void set_name(string name); - -void create(void) { +void create() { input_to("input"); } @@ -11,40 +8,93 @@ _name = name; } -string query_name() -{ +string query_name() { return _name; } -void do_cmd(string cmd) -{ - if(cmd == "/quit") { - shout(time() + ": " + _name + " has quit the game\n", this_object()); - destruct(this_object()); - } else if(cmd == "/uptime") { - write("The driver has been running for " + asctime(uptime()) + "\n"); - } else if(cmd == "/print_objs") { - print_objs(); - } else { - shout(time() + ": " + _name + " said: " + cmd + "\n", this_object()); - write(time() + ": You say: " + cmd + "\n"); +void write_help() { + write("Available commands:\n"); + write("\t/help: Displays this text.\n"); + write("\t/uptime: Shows for how long the driver has been running.\n"); + write("\t/version: Shows AGD version information.\n"); + write("\t/quit: Quits the game.\n"); + write("\t/.: Repeats last command.\n"); +} + +/* Converts a time integer into a textual representation */ +string ctime(int t) { + int secs, mins, hrs, days; + string ret; + + secs = t; + if(secs >= 60) { + secs /*%=*/ = secs % 60; + mins = t /*/=*/ = t / 60; + if(mins >= 60) { + mins /*%=*/ = mins % 60; + hrs = t /*/=*/ = t / 60; + if(hrs > 24) { + hrs /*%=*/ = hrs % 24; + days = t / 24; + } + } + } + + ret = ""; /* :-( */ + if(days) + ret/* +=*/ = ret + days + " day" + days>1?"s":"" + " "; + if(hrs) + ret/* +=*/ = ret + hrs + " hour" + hrs>1?"s":"" + " "; + if(mins) + ret/* +=*/ = ret + mins + " minute" + mins>1?"s":"" + " "; + if(secs) { + ret/* +=*/ = ret + secs + " second" + secs>1?"s":"" + " "; } + return ret; } -void input(string in) -{ - if(in == ".") { - if(last_cmd) - do_cmd(last_cmd); - else - write("No last command.\n"); +void input(string cmd) { + if(cmd[0] == '/') { +/* switch(cmd[1..]) { + case "quit": + break; + case "uptime": + break; + case "print_objs": + break; + }*/ + if(cmd == "/quit") { + shout(time() + ": " + capitalize(_name) + " has quit the game\n", this_object()); + destruct(this_object()); + } else if(cmd == "/uptime") { + write("The driver has been running for " + ctime(uptime()) + "\n"); + } else if(cmd == "/print_objs") { + print_objs(); + } else if(cmd == "/version") { + "/sys/master"->write_version(); + } else if(cmd == "/help") { + write_help(); + } else if(cmd == "/.") { + if(last_cmd) { + input(last_cmd); + } else + write("No last command.\n"); + } else { + write("Unknown command.\n"); + } } else { - do_cmd(in); - last_cmd = in; + shout(time() + ": " + capitalize(_name) + " says: " + cmd + "\n", this_object()); + write(time() + ": You say: " + cmd + "\n"); } + if(cmd != "/.") + last_cmd = cmd; input_to("input"); } void write_prompt() { write("> "); } + +void net_dead() { + shout(_name + " went netdead!", (object)0); +} |
From: Peep P. <so...@us...> - 2004-03-18 20:58:51
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2440 Modified Files: Makefile.am Log Message: Added dependency for dfdecl.in for dfdecl.h Index: Makefile.am =================================================================== RCS file: /cvsroot/agd/server/src/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 16 Mar 2004 20:13:34 -0000 1.7 +++ Makefile.am 18 Mar 2004 20:49:10 -0000 1.8 @@ -16,7 +16,7 @@ dflex.c: dfparse.c -dfdecl.h: dfparse +dfdecl.h: dfdecl.in dfparse ./dfparse >dfdecl.h BUILT_SOURCES = dfdecl.h |
From: Peep P. <so...@us...> - 2004-03-18 20:58:36
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2355 Modified Files: compile.c Log Message: Cleanups, fixes. Index: compile.c =================================================================== RCS file: /cvsroot/agd/server/src/compile.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- compile.c 15 Mar 2004 18:46:59 -0000 1.12 +++ compile.c 18 Mar 2004 20:48:52 -0000 1.13 @@ -15,13 +15,13 @@ numdfuns, numlfuns; array_t local_ids, global_ids; -static int locals_level; +/*static int locals_level;*/ static array_t *curr_block; static array_t block_history; -#ifdef YYDEBUG +/*#ifdef YYDEBUG*/ extern int yydebug; -#endif +/*#endif*/ static int start_with_newline; @@ -111,10 +111,12 @@ /* free_id(id);*/ numlvars--; array_remove(&local_ids, i); + i--; /* Element was removed, so don't increase index. */ } else if(id->type == ID_GVAR && id->base_scope > scope_level) { /* free_id(id);*/ numgvars--; array_remove(&local_ids, i); + i--; } } } @@ -127,8 +129,7 @@ int both_same_type; /* For binary operators - must both operands be of the same type? */ } operator_t; -#define NUM_OPERATORS F_PREDEC - F_SUB -static operator_t operator_table[NUM_OPERATORS]; +static operator_t operator_table[F_HIGHEST-F_ADD]; #define SET_OPERATOR(op_name, num, bothsame, int_valid, str_valid, ob_valid) \ operator_table[i].name = op_name;\ @@ -141,7 +142,7 @@ void generate_operator_table(void) { int i; - for(i=0;i<NUM_OPERATORS;i++) { + for(i=0;i<=F_HIGHEST;i++) { /* 4 - T_INT, T_STRING, T_VOID(unused), T_OBJECT */ switch(i + F_ADD) { case F_ADD: SET_OPERATOR("+", 2, 0, 1, 1, 0); break; @@ -173,6 +174,8 @@ case F_NE: SET_OPERATOR("!=", 2, 1, 1, 1, 1); break; case F_AND: SET_OPERATOR("&&", 2, 0, 1, 1, 1); break; case F_OR: SET_OPERATOR("||", 2, 0, 1, 1, 1); break; + + case F_RANGE: SET_OPERATOR("[]", 1, 0, 0, 1, 0); break; } } } @@ -194,6 +197,8 @@ if(!opr1) return; + memset(buf, 0, sizeof buf); + op = &operator_table[operator-F_ADD]; if(op->valid[opr1-1] == 0 || (op->num_operand == 2 && opr2 @@ -208,6 +213,9 @@ case 3: sprintf(buf, "invalid operands to trinary "); break; + default: + sprintf(buf, "KALA\n"); + break; } sprintf(buf, "%s%s", buf, op->name); comp_error(buf); @@ -301,33 +309,13 @@ curr_f = NULL; } -#if 0 - if((index = nametable_find(TYPE_FUN | SCOPE_LOCAL, name, &cob->prog->nametable)) > -1) { - /* The function already exists - we're giving a definition for a declaration. */ - if(index >= fun_has_definition.allocated) - array_push(&fun_has_definition, (void *) index); - fun_has_definition.data[index] = (void *) 1; - fun_has_definition.length = index + 1; - cob->prog->functions.data[index] = curr_f; - } else { - array_push(&cob->prog->functions, curr_f); - nametable_add(TYPE_FUN | SCOPE_LOCAL, name, - cob->prog->functions.length-1, &cob->prog->nametable); - nametable_sort(&cob->prog->nametable); - } -#endif } void add_variable(array_t *vars, int type) { int i, numvars, num; -/* int global;*/ array_t *target; -/* global = scope & SCOPE_GLOBAL; - target = global ? &cob->prog->nametable : &temp_nametable; - numvars = target->length;*/ - for(i=0;i<vars->length;i++) { variable_t *var = vars->data[i]; array_t *assign = NULL; @@ -345,7 +333,7 @@ init_var(var); if(type == ID_GVAR) { - array_push(&cob/*->prog*/->variables, var); + array_push(&cob->variables, var); } else /* LVAR */{ switch(var->type) { case T_INT: @@ -365,14 +353,6 @@ } } -#if 0 - num = find_variable(var->name); - if(num == -1) - num = numvars++; - nametable_add(TYPE_VAR | scope, var->name, num, target); - define_name(TYPE_VAR | scope, var->name, var->type, NULL, 0); - nametable_sort(target); -#endif define_id(var->name, type, var->type, NULL); /* Only for locals right now. But watch out! */ @@ -380,9 +360,7 @@ def_id_t *id; /* Could use numlocals, since we just defined it. */ id = find_id(var->name); -/* int index; - index = nametable_find(TYPE_VAR | SCOPE_LOCAL, var->name, &temp_nametable);*/ - array_push(curr_block, (void *) F_PUSH_LVAR); + array_push(curr_block, (void *) F_PUSH_LVAR_LVALUE); array_push(curr_block, (void *) id->index); array_concat(curr_block, assign); array_push(curr_block, (void *) F_ASSIGN); @@ -399,8 +377,8 @@ init_array(curr_block); /* if(!locals_level) { free_array(&temp_variables, (void (*)(void*))free_var); - }*/ - locals_level++; + } + locals_level++;*/ } array_t add_block(array_t *stmt) @@ -416,31 +394,13 @@ { pop_scope(); curr_block = array_pop(&block_history); - if(locals_level > 0) +/* if(locals_level > 0) locals_level--; -/* if(!locals_level) { + if(!locals_level) { free_array(&temp_nametable, (void (*)(void*))free_ntentry NULL); }*/ } -#if 0 -/* This generates a table for function name lookups. */ -void generate_fun_table(void) -{ - int i; - init_array(&cob->prog->fun_table); - for(i=0;i<local_ids.length;i++) { - id_t *id = local_ids.data[i]; - printf("id: %s type %d index %d\n", id->name, id->type, id->index); - if(id->type == ID_FUN) { - array_push(&cob->prog->fun_table, id->name); - array_push(&cob->prog->fun_table, (void *) id->index); - printf("pushed\n"); - } - } -} -#endif - int compare_args(array_t *arg1, array_t *arg2) { int i; @@ -483,16 +443,17 @@ /* This does the actual formatting. */ void display_error(char *s) { - char *buf; +/* char *buf;*/ if(start_with_newline) { - do_write("\n"); +/* do_write("\n");*/ + putchar('\n'); start_with_newline = 0; } - buf = xmalloc(strlen(s) + 256); - sprintf(buf, "%s:%d:%d: %s\n", curr_fn, yylloc.line, yylloc.pos, s); - do_write(buf); - xfree(buf); +/* buf = xmalloc(strlen(s) + 256); + s*/printf(/*buf, */"%s:%d:%d: %s\n", curr_fn, yylloc.line, yylloc.pos, s); +/* do_write(buf); + xfree(buf);*/ } /* This is the function called by bison, probably with the argument "parse error" @@ -513,7 +474,7 @@ init_array(&cob->prog->functions); init_array(&cob->prog->fun_table); - init_array(&cob/*->prog*/->variables); + init_array(&cob->variables); numlvars = numgvars = 0; numdfuns = numlfuns = 0; @@ -550,9 +511,8 @@ return 0; } -/*#define FREE_LOCALS() xfree(file_name); xfree(ob->name); xfree(ob)*/ #define END_COMPILE() cob = NULL; start_with_newline = 0; actual_destruct(ob); xfree(file_name); return NULL -object_t *int_load_object(char *fn) +object_t *load_object(char *fn) { char *file_name, *our_fn; object_t *ob; @@ -592,12 +552,6 @@ start_with_newline = 1; -#if 0 - if(!dir_exists(file_name, 0)) { - printf("failed (dir doesn't exist)\n"); - END_COMPILE(); - } -#endif if(access(file_name, R_OK)) { printf("failed (file not accessable)\n"); END_COMPILE(); @@ -614,9 +568,10 @@ parse_init(); curr_fn = ob->name; -#if defined(DEBUG) && defined(YYDEBUG) - if(conf.debuglevel > 3) +#if defined(DEBUG)/* && defined(YYDEBUG)*/ + if(conf.debuglevel > 4) { yydebug = 1; + } #endif if(yyparse() > 0 || compile_errors) { @@ -629,16 +584,12 @@ } printf(" - failed\n"); END_COMPILE(); -/* FREE_LOCALS();*/ } if(check_fun_definitions()) { END_COMPILE(); } -/* generate_fun_table();*/ - - /*nametable_sort(&cob->prog->nametable);*/ ref_prog(ob->prog); list_push(&all_objects, ob); |
From: Peep P. <so...@us...> - 2004-03-18 20:58:08
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2253 Modified Files: compile.h Log Message: Renamed int_load_object to load_object. Index: compile.h =================================================================== RCS file: /cvsroot/agd/server/src/compile.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- compile.h 12 Mar 2004 16:03:10 -0000 1.9 +++ compile.h 18 Mar 2004 20:48:25 -0000 1.10 @@ -48,7 +48,7 @@ #define comp_error(s) display_error(s); compile_errors++ #define comp_warning(s) display_error("warning: "s); compile_warnings++ -object_t *int_load_object(char *fn); +object_t *load_object(char *fn); void *copy_nt_entry(void *voide); void *copy_fun(void *voidf); |
From: Peep P. <so...@us...> - 2004-03-18 20:57:50
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2159 Modified Files: debug.c Log Message: F_RANGE operator. Index: debug.c =================================================================== RCS file: /cvsroot/agd/server/src/debug.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- debug.c 15 Mar 2004 18:53:36 -0000 1.7 +++ debug.c 18 Mar 2004 20:48:09 -0000 1.8 @@ -199,6 +199,8 @@ return "F_POSTDEC"; case F_PREDEC: return "F_PREDEC"; + case F_RANGE: + return "F_RANGE"; case F_RETURN: return "F_RETURN"; default: |
From: Peep P. <so...@us...> - 2004-03-18 20:57:30
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2050 Modified Files: dfparse.y Log Message: Prints index of function. Index: dfparse.y =================================================================== RCS file: /cvsroot/agd/server/src/dfparse.y,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dfparse.y 16 Mar 2004 14:11:26 -0000 1.5 +++ dfparse.y 18 Mar 2004 20:47:48 -0000 1.6 @@ -5,6 +5,7 @@ Changelog: 0.07: + * prints index of function for easier debugging * now outputs prototypes * removed c_name * function pointer name is always df_"dfun_name" @@ -196,7 +197,7 @@ } #endif - printf("\t{ %d, \"%s\", (void (*)(void))df_%s, ", dfdecl[i].ret, dfdecl[i].name, dfdecl[i].name); + printf("\t/* %d */ { %d, \"%s\", (void (*)(void))df_%s, ", i, dfdecl[i].ret, dfdecl[i].name, dfdecl[i].name); #if 0 if(c_name_dynamic) xfree(c_name); |
From: Peep P. <so...@us...> - 2004-03-18 20:57:24
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1995 Modified Files: dfuns.c dfdecl.in Log Message: Added lower_case, capitalize, strlen, removed asctime Index: dfuns.c =================================================================== RCS file: /cvsroot/agd/server/src/dfuns.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- dfuns.c 16 Mar 2004 20:12:37 -0000 1.12 +++ dfuns.c 18 Mar 2004 20:47:36 -0000 1.13 @@ -137,15 +137,18 @@ void df_clone_object(void) { object_t *ret; - variable_t *saved_fp; +/* variable_t *saved_fp;*/ - saved_fp = fp; - fp++; - ret = clone_object(saved_fp->u.s); + push_control_stack(); +/* saved_fp = fp; + fp++;*/ + ret = clone_object(/*saved_*/fp->u.s); /* clone_object() might, or might not call create() and therefore decrease fp. * We have to decrement manually if needed. */ - if(fp > saved_fp) +/* if(fp > saved_fp) { fp--; + }*/ + pop_control_stack(1); pop_stack(); push_object(ret); @@ -192,44 +195,9 @@ void df_uptime(void) { time_t t; time(&t); -/* ret.u.i = total_hb * conf.heartbeat / 1000000;*/ push_int(t - startup_time); } -/* Should be done in the mudlib - much easier in LPC. */ -#define WRITE_BUFFER(plur, sing) if(plur) { if(bufptr > buf) bufptr[-1] = ' ';\ - bufptr += sprintf(bufptr, "%d "#sing"%c", plur, plur>1?'s':0) + (plur>1); } -void df_asctime(void) -{ - int secs, mins, hrs, days; - static char buf[256]; - char *bufptr; - - days = hrs = mins = 0; - secs = fp->u.i; - if(secs >= 60) { - secs %= 60; - mins = fp->u.i /= 60; - if(mins >= 60) { - mins %= 60; - hrs = fp->u.i /= 60; - if(hrs > 24) { - hrs %= 24; - days = fp->u.i / 24; - } - } - } - - memset(buf, 0, 256); - bufptr = buf; - WRITE_BUFFER(days, day) - WRITE_BUFFER(hrs, hour) - WRITE_BUFFER(mins, minute) - WRITE_BUFFER(secs, second) - pop_stack(); - push_string(&buf, ST_STATIC); -} - void df_query_idle(void) { int ret; @@ -250,6 +218,39 @@ push_int(j); } +/* Strings. */ +void df_strlen(void) +{ + int i; + i = strlen(fp->u.s); + pop_stack(); + push_int(i); +} + +void df_capitalize(void) +{ + char *s; + s = stringdup(fp->u.s); + s[0] = toupper(s[0]); + pop_stack(); + push_string(s, ST_MALLOC); +} + +void df_lower_case(void) +{ + char *s; + int i, len; + + len = strlen(fp->u.s); + s = xmalloc(len); + for(i=0;i<len;i++) { + s[i] = tolower(fp->u.s[i]); + } + pop_stack(); + push_string(s, ST_MALLOC); +} + +/* Debugging. */ void df_print_objs(void) { print_objs(); Index: dfdecl.in =================================================================== RCS file: /cvsroot/agd/server/src/dfdecl.in,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dfdecl.in 16 Mar 2004 20:12:37 -0000 1.5 +++ dfdecl.in 18 Mar 2004 20:47:36 -0000 1.6 @@ -29,8 +29,14 @@ string version() string platform() int uptime() -string asctime(int) int random(int) +# Removed. +# string asctime(int) + +# strings +int strlen(string) +string capitalize(string) +string lower_case(string) # objects void destruct(object) |
From: Peep P. <so...@us...> - 2004-03-18 20:56:53
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1867 Modified Files: interpret.c Log Message: Fixes and changes, cleanup. Index: interpret.c =================================================================== RCS file: /cvsroot/agd/server/src/interpret.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- interpret.c 16 Mar 2004 14:12:07 -0000 1.11 +++ interpret.c 18 Mar 2004 20:47:08 -0000 1.12 @@ -4,14 +4,10 @@ #include <stdarg.h> #include <setjmp.h> -int stop_execution; - char *opc_name(int i); -/* jmp_buf error_context; int have_error_context; -*/ #ifdef DEBUG int dont_debug_interpreter; @@ -22,7 +18,7 @@ /* 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 to the last element pushed. */ +variable_t *sp = value_stack, /* Stack pointer after the last element pushed. */ *fp; /* Frame pointer - where locals begin on the stack */ int *cp; /* Code pointer into code->data */ @@ -39,12 +35,12 @@ 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)"); return; } -#define CHECK_SP() if(sp >= value_stack + VALUE_STACK_SIZE) {\ - runtime("value stack overflow"); return; } +#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"); -void (**dfptr)(void); +extern void (**dfptr)(void); void call_function(object_t *ob, int index); void do_assign(variable_t *lval, variable_t *rval); @@ -68,8 +64,7 @@ } out: - stop_execution = 1; -/* longjmp(error_context, 1);*/ + longjmp(error_context, 1); } int get_fun_index(object_t *ob, char *fun) @@ -116,6 +111,14 @@ CHECK_SP() } +void push_lvalue(variable_t *v) +{ + sp->type = T_LVALUE; + sp->u.v = v; + sp++; + CHECK_SP() +} + void free_value(variable_t *v); void push_var(variable_t *v) { @@ -226,7 +229,6 @@ csp--; if(csp < control_stack) { runtime("control stack underflow"); - return; } fp = csp->fp; @@ -296,14 +298,11 @@ break; case F_PUSH_LVAR_LVALUE: cp++; - sp->type = T_LVALUE; - sp->u.v = &fp[*cp]; - if(sp->u.v == sp) { + push_lvalue(&fp[*cp]); +/* if(sp->u.v == sp) { runtime("lvalue points to itself"); return; - } - sp++; - CHECK_SP() + }*/ break; case F_PUSH_GVAR: cp++; @@ -311,10 +310,7 @@ break; case F_PUSH_GVAR_LVALUE: cp++; - sp->type = T_LVALUE; - sp->u.v = this_ob->variables.data[*cp]; - sp++; - CHECK_SP() + push_lvalue(this_ob->variables.data[*cp]); break; case F_ADD: tmp = add_vars(sp-2, sp-1); @@ -368,6 +364,19 @@ tmpi = --tmp->u.i; push_int(tmpi); break; + case F_RANGE: + tmpi = sp[-2].u.s[sp[-1].u.i]; + pop_stack(); pop_stack(); + push_int(tmpi); + break; + case F_RANGE_LVALUE: + /* A bit hacky. */ + *sp = sp[-2]; + sp->u.s += sp[-1].u.i; + pop_stack(); pop_stack(); + push_var(sp+2); + push_lvalue(sp-1); + break; case F_JMPF: sp--; if(!test_var(sp)) { @@ -459,10 +468,20 @@ name = (char *) *++cp; ++cp; sp--; - ob = sp->u.ob; + if(sp->type == T_OBJECT) { + ob = sp->u.ob; + } else { + char *s; + /* T_STRING */ + s = sp->u.s; + ob = find_object(s); + if(!ob) { + ob = load_object(s); + } + } + if(!ob) { runtime("call_other on NULL object"); - return; } index = get_fun_index(ob, name); @@ -477,9 +496,13 @@ case F_RETURN: { variable_t tmp; - tmp = sp[-1]; + do_assign(&tmp, sp-1); + pop_locals(); push_var(&tmp); - pop_control_stack(1); + if(csp == saved_csp + 1) + pop_control_stack(1); + else + pop_control_stack(0); } break; default: @@ -491,13 +514,13 @@ show_stack(); #endif /* We return to the control level where we entered - we have finished. */ - if(csp == saved_csp) { /*&control_stack[0]*/ + if(csp == saved_csp) { debug("interpret", "csp (%d) == saved_csp (%d); returning\n", csp - &control_stack[0], saved_csp - &control_stack[0]); return; } /* Abnormal termination - need to pop unnecessary stuff off the stack. */ - if(stop_execution || this_ob->flags & O_DESTRUCTED) { - debug("interpret", "stop_execution(%d) or this_ob destructed (%d); returning\n", stop_execution, this_ob->flags & O_DESTRUCTED); + if(this_ob->flags & O_DESTRUCTED) { + debug("interpret", "this_ob destructed; returning\n"); /* Should we pop to the bottom? */ pop_control_stack(1); pop_locals(); @@ -507,28 +530,37 @@ goto again; } -/* This calls function number index in object ob. - The return value goes at fp[-1]. -*/ void call_function(object_t *ob, int index) { - int i; + int i, j; function_t *f; f = ob->prog->functions.data[index]; if(!f) { char buf[256]; sprintf(buf, "function %d doesn't exist in object \"%s\"", index, ob->name); runtime(buf); - return; } /* funcno = index; lineno = f->lineno;*/ -/* - if(csp->num_arg < f->args.length) { - + + i = f->args.length - csp->num_arg; + if(i > 0) { + for(j=0;j<i;j++) { + switch((*(variable_t*)f->args.data[j]).type) { + case T_INT: + push_int(0); + break; + case T_OBJECT: + push_object(NULL); + break; + case T_STRING: + push_string("0", ST_STATIC); + break; + } + } } -*/ + #ifdef DEBUG debug("interpret", "call_function %d on %s\n", index, ob->name); #endif @@ -550,7 +582,6 @@ csp->fp = fp; csp->sp = sp; cp = 0; - stop_execution = 0; } /* apply(): This is what the driver uses to call functions in LPC objects @@ -567,6 +598,7 @@ int index; va_list va; char *p; + int i, j; #ifdef DEBUG struct timeval tm, tm2; #endif @@ -613,7 +645,6 @@ debug("lpc", "apply \"%s\" on \"%s\"\n", fun, ob->name); #endif -#if 0 if(!have_error_context) { if(setjmp(error_context)) { /* setjmp() returned a value, @@ -622,7 +653,6 @@ } have_error_context = 1; } -#endif call_function(ob, index); eval_instruction(); |
From: Peep P. <so...@us...> - 2004-03-18 20:56:34
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1768 Modified Files: interpret.h Log Message: String ranges. Index: interpret.h =================================================================== RCS file: /cvsroot/agd/server/src/interpret.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- interpret.h 12 Mar 2004 08:40:10 -0000 1.6 +++ interpret.h 18 Mar 2004 20:46:50 -0000 1.7 @@ -42,8 +42,11 @@ #define F_POSTINC 35 #define F_PREINC 36 #define F_POSTDEC 37 -/* Always make sure this is the last. check_operand() depends on it. */ #define F_PREDEC 38 +#define F_RANGE 39 +#define F_RANGE_LVALUE 40 + +#define F_HIGHEST F_RANGE_LVALUE #define F_NEWLINE 50 /* Increases the line number. Not used ATM. */ |
From: Peep P. <so...@us...> - 2004-03-18 20:56:22
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1708 Modified Files: lang.y Log Message: String ranges. Index: lang.y =================================================================== RCS file: /cvsroot/agd/server/src/lang.y,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- lang.y 16 Mar 2004 20:12:21 -0000 1.5 +++ lang.y 18 Mar 2004 20:46:39 -0000 1.6 @@ -15,7 +15,8 @@ int compare_args(array_t *arg1, array_t *arg2); #define MAKE_LVALUE(x) if((int)x.arr.data[0] == F_PUSH_LVAR) x.arr.data[0] = (void *)F_PUSH_LVAR_LVALUE;\ - else if((int)x.arr.data[0] == F_PUSH_GVAR) x.arr.data[0] = (void*)F_PUSH_GVAR_LVALUE; + else if((int)x.arr.data[0] == F_PUSH_GVAR) x.arr.data[0] = (void*)F_PUSH_GVAR_LVALUE;\ + else if((int)x.arr.data[x.arr.length-1] == F_RANGE) x.arr.data[x.arr.length-1] = (void*)F_RANGE_LVALUE\ %} %expect 1 @@ -46,14 +47,16 @@ /* operators */ %right L_ASSIGN %left L_OR L_AND -%left L_LT L_GT L_LE L_GE %left L_EQ L_NE %left L_PLUS L_MINUS +%left ':' +%left '?' +%left L_LT L_GT L_LE L_GE %left L_MUL L_DIV L_MOD -%right '?' ':' %left L_DEREF /* L_DEREF _is_ a valid lval for call_other. i.e: ob->get_another_ob()->call(), as long as ob->get_another_ob() returns T_OBJECT. */ +%right '[' ']' %nonassoc L_NEG L_NOT L_INC L_DEC %nonassoc L_TYPECAST @@ -66,7 +69,7 @@ %type <var> var_def %type <arr> call_args call_arg_list -%type <expr> expr optional_expr +%type <expr> expr optional_expr range_expr %type <arr> return if else do_while while %type <arr> fun_call call_other %type <arr> statements statement @@ -136,7 +139,6 @@ define_id(v->name, ID_ARG, v->type, NULL); } } - /*scope_level--;*/ $<i>$ = yylloc.line; } block_or_semi @@ -234,7 +236,7 @@ { def_id_t *idp; int i; - idp = $<id>2; + idp = $<id>3; idp->args = copy_array(&$5, NULL); scope_level++; @@ -249,7 +251,6 @@ define_id(v->name, ID_ARG, v->type, NULL); } } - /*scope_level--;*/ $<i>$ = yylloc.line; } block_or_semi @@ -285,10 +286,12 @@ case T_VOID: array_push(&$8, (void *) F_PUSH_VOID); break; - array_push(&$8, (void *) F_RETURN); - if(warn) - comp_error("control reaches end of non-void function"); } + array_push(&$8, (void *) F_RETURN); + if(warn) { + comp_error("control reaches end of non-void function"); + } + } add_function(idp, $<i>7, &$8); @@ -759,6 +762,7 @@ $$.side_effect = 1; $$.lval = $$.direct_type = 0; $$.type = $2.type; + init_array(&$$.arr); MAKE_LVALUE($2); array_concat(&$$.arr, &$2.arr); @@ -770,6 +774,7 @@ $$.side_effect = 1; $$.lval = $$.direct_type = 0; $$.type = $2.type; + init_array(&$$.arr); if($2.direct_type) { array_push(&$$.arr, (void *) F_PUSH_INT); @@ -783,7 +788,8 @@ { check_operand(F_NOT, $2.type, 0); $$.lval = $$.side_effect = $$.direct_type = 0; - $$.type = $2.type; + $$.type = T_INT; + init_array(&$$.arr); array_concat(&$$.arr, &$2.arr); array_push(&$$.arr, (void *) F_NOT); @@ -794,6 +800,7 @@ $$.lval = $$.direct_type = 0; $$.side_effect = $1.side_effect || $3.side_effect; + $$.type = T_INT; init_array(&$$.arr); array_concat(&$$.arr, &$1.arr); @@ -806,6 +813,7 @@ $$.lval = $$.direct_type = 0; $$.side_effect = $1.side_effect || $3.side_effect; + $$.type = T_INT; init_array(&$$.arr); array_concat(&$$.arr, &$1.arr); @@ -818,6 +826,7 @@ $$.lval = $$.direct_type = 0; $$.side_effect = $1.side_effect || $3.side_effect; + $$.type = T_INT; init_array(&$$.arr); array_concat(&$$.arr, &$1.arr); @@ -830,6 +839,7 @@ $$.lval = $$.direct_type = 0; $$.side_effect = $1.side_effect || $3.side_effect; + $$.type = T_INT; init_array(&$$.arr); array_concat(&$$.arr, &$1.arr); @@ -842,6 +852,7 @@ $$.lval = $$.direct_type = 0; $$.side_effect = $1.side_effect || $3.side_effect; + $$.type = T_INT; init_array(&$$.arr); array_concat(&$$.arr, &$1.arr); @@ -866,6 +877,7 @@ $$.lval = $$.direct_type = 0; $$.side_effect = $1.side_effect || $3.side_effect; + $$.type = T_INT; init_array(&$$.arr); @@ -888,6 +900,7 @@ $$.lval = $$.direct_type = 0; $$.side_effect = $1.side_effect || $3.side_effect; + $$.type = T_INT; init_array(&$$.arr); @@ -925,32 +938,7 @@ array_push(&$$.arr, (void *) $5.arr.length + 1); array_concat(&$$.arr, &$5.arr); } - | string - { - $$.lval = $$.side_effect = 0; - $$.direct_type = 1; - $$.type = T_STRING; - /* int index = add_string_to_table($1); - array_push(&$$.arr, (void *) F_PUSH_STRING); - array_push(&$$.arr, (void *) index); */ - init_array(&$$.arr); - array_push(&$$.arr, (void *) F_PUSH_STRING); - array_push(&$$.arr, $1); - } - | L_INTEGER - { - $$.lval = $$.side_effect = 0; - $$.direct_type = 1; - $$.type = T_INT; - init_array(&$$.arr); - array_push(&$$.arr, (void *) F_PUSH_INT); - array_push(&$$.arr, (void *) $1); - } - | defined_name '[' expr ']' - { - comp_error("ranges not supported yet"); - } - | '(' expr ')' /* Probably needs a precedence fix. */ + | '(' expr ')' { $$ = $2; /* Could cause problems. */ } @@ -975,14 +963,18 @@ { $$.side_effect = 1; $$.lval = $$.direct_type = 0; - $$.type = (int) array_pop(&$1); + init_array(&$$.arr); - array_concat(&$$.arr, &$1); + if($1.length) { + $$.type = (int) array_pop(&$1); + array_concat(&$$.arr, &$1); + } } | defined_name { $$.side_effect = $$.direct_type = 0; $$.lval = 1; + $$.type = 0; init_array(&$$.arr); if($1) { @@ -999,6 +991,19 @@ $$.type = $1->lpc_type; } } + | expr '[' range_expr ']' + { + $$.lval = 1; + $$.direct_type = 0; + $$.side_effect = 0; + $$.type = T_INT; + check_operand(F_RANGE, $1.type, 0); + + init_array(&$$.arr); + array_concat(&$$.arr, &$1.arr); + array_concat(&$$.arr, &$3.arr); + array_push(&$$.arr, (void *) F_RANGE); + } | expr L_ASSIGN expr { if(!$1.lval) { @@ -1018,8 +1023,50 @@ array_concat(&$$.arr, &$3.arr); array_push(&$$.arr, (void *) F_ASSIGN); } + | string + { + $$.lval = $$.side_effect = 0; + $$.direct_type = 1; + $$.type = T_STRING; + /* int index = add_string_to_table($1); + array_push(&$$.arr, (void *) F_PUSH_STRING); + array_push(&$$.arr, (void *) index); */ + init_array(&$$.arr); + array_push(&$$.arr, (void *) F_PUSH_STRING); + array_push(&$$.arr, $1); + } + | L_INTEGER + { + $$.lval = $$.side_effect = 0; + $$.direct_type = 1; + $$.type = T_INT; + init_array(&$$.arr); + array_push(&$$.arr, (void *) F_PUSH_INT); + array_push(&$$.arr, (void *) $1); + } ; - + +range_expr: + expr + { + if($1.type != T_INT) { + comp_error("index must be integer"); + } + $$ = $1; + } +/* | L_INTEGER '..' L_INTEGER + { + if($3 > $1) { + comp_error("range second element should be bigger than first"); + } + array_push(&$$, (void *) F_BEGIN); + array_push(&$$, (void *) $1); + array_push(&$$, (void *) F_END); + array_push(&$$, (void *) $3); + } +*/ + ; + string: string_con2 ; @@ -1036,6 +1083,8 @@ L_STRING | string_con2 L_STRING { + printf("$1.len: %d; $2.len: %d\n", strlen($1), strlen($2)); + printf("$1: %s; $2: %s\n", $1, $2); $$ = strcat($1, $2); } ; @@ -1145,6 +1194,11 @@ expr_t *e = $3.data[i]; array_push(&tempargs, (void *) e->type); } + + if(!$1) { + break; + } + i = compare_args($1->args, &tempargs); switch(i) { @@ -1162,7 +1216,7 @@ break; default: /* > 0 */ sprintf(buf, "Argument %d type mismatch for %s - expected %d, got %d", - i, $1, $1->args->data[i], tempargs.data[i]); + i, $1->name, $1->args->data[i], tempargs.data[i]); comp_error(buf); break; } @@ -1229,7 +1283,7 @@ int i; array_t *realargs; - if($1.type != T_OBJECT || ($1.type == T_STRING && !$1.direct_type)) { + if($1.type != T_OBJECT && !($1.type == T_STRING && $1.direct_type)) { comp_error("not an object to '->'"); } |
From: Peep P. <so...@us...> - 2004-03-18 20:56:01
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1603 Modified Files: lex.l Log Message: Added character constants. Index: lex.l =================================================================== RCS file: /cvsroot/agd/server/src/lex.l,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- lex.l 12 Mar 2004 08:40:10 -0000 1.5 +++ lex.l 18 Mar 2004 20:46:20 -0000 1.6 @@ -6,6 +6,7 @@ The comment should span two lines. */ %x in_string in_string_backslash +%x charconst charconstgotten charbackslash %x comment linecomment %option yylineno %{ @@ -28,7 +29,8 @@ futurepos, #endif warned_newlines, - ignore_white_space; + ignore_white_space, + warned_charconst; #ifdef DEBUG #define RET(type, value, tok) \ @@ -136,6 +138,85 @@ } } + /* character constants */ +' BEGIN(charconst); +<charconst>{ + ' BEGIN(INITIAL); + \\ { + BEGIN(charbackslash); + } + . { + yylval.i = *yytext; + BEGIN(charconstgotten); + RET(d, yylval.i, L_INTEGER); + } + +} + +<charconstgotten>{ + ' { + warned_charconst = 0; + BEGIN(INITIAL); + } + . { + printf("anything\n"); + warned_charconst = 1; + comp_error("multi-character character constant"); + } +} + +<charbackslash>{ + ' { + yylval.i = '\''; + RET(c, '\'', L_INTEGER); + BEGIN(charconstgotten); + } + n { + yylval.i = '\n'; + BEGIN(charconstgotten); + RET(d, yylval.i, L_INTEGER); + } + r { + yylval.i = '\r'; + BEGIN(charconstgotten); + RET(c, '\r', L_INTEGER); + } + t { + yylval.i = '\t'; + BEGIN(charconstgotten); + RET(c, '\t', L_INTEGER); + } + a { + yylval.i = '\a'; + BEGIN(charconstgotten); + RET(c, '\a', L_INTEGER); + } + b { + yylval.i = '\b'; + BEGIN(charconstgotten); + RET(c, '\b', L_INTEGER); + } + f { + yylval.i = '\f'; + BEGIN(charconstgotten); + RET(c, '\f', L_INTEGER); + } + e { + yylval.i = '\27'; + BEGIN(charconstgotten); + RET(c, '\27', L_INTEGER); + } + \\ { + yylval.i = '\\'; + BEGIN(charconstgotten); + RET(c, '\\', L_INTEGER); + } + . { + comp_error("invalid escape code"); + BEGIN(INITIAL); + } +} + /* operators */ ">" RET(s, ">", L_GT); ">=" RET(s, ">=", L_GE); |
From: Peep P. <so...@us...> - 2004-03-18 20:55:51
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1522 Modified Files: main.c Log Message: Cleanup. Index: main.c =================================================================== RCS file: /cvsroot/agd/server/src/main.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- main.c 16 Mar 2004 20:11:46 -0000 1.11 +++ main.c 18 Mar 2004 20:46:10 -0000 1.12 @@ -26,7 +26,7 @@ static char *conf_file; -void crash(int argument, char *reason, int retval) +void crash(int sig, char *reason, int retval) { #ifdef DEBUG extern int dont_debug_interpreter; @@ -42,7 +42,7 @@ #endif if(master) { - if(!apply(master, "crash", "i", argument)) + if(!apply(master, "crash", "i", sig)) fprintf(stderr, "master::crash() failed.\n"); else fprintf(stderr, "master::crash() called successfully.\n"); @@ -81,7 +81,6 @@ #ifdef __GNUC__ printf("gcc %s\n", __VERSION__); #endif - printf("Bug reports, suggestions, ideas etc to %s\n", PACKAGE_BUGREPORT); #ifdef ARCH_README printf("Your computer architecture is not fully supported. " @@ -159,7 +158,7 @@ generate_operator_table(); init_interpreter(); - master = int_load_object(conf.master); + master = load_object(conf.master); if(!master) crash(0, "Master object doesn't load", 3); ref_ob(master, NULL); |
From: Peep P. <so...@us...> - 2004-03-18 20:55:33
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1421 Modified Files: net.c Log Message: Cleanup. Index: net.c =================================================================== RCS file: /cvsroot/agd/server/src/net.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- net.c 15 Mar 2004 18:50:10 -0000 1.7 +++ net.c 18 Mar 2004 20:45:47 -0000 1.8 @@ -22,18 +22,6 @@ return -1; } -#if 0 -void remove_player(int nr) -{ - int i; - for(i=nr;i<numplayers;i++) { - if(i + 1 < numplayers) - players[i] = players[i+1]; - } - numplayers--; -} -#endif - void net_listen(unsigned short port) { struct sockaddr_in sin; @@ -42,7 +30,7 @@ #ifdef WINSOCK WSADATA wsaData; if(WSAStartup(MAKEWORD(1, 1), &wsaData)) { - fprintf(stderr, "Network error: winsock init failed.\n"); + fprintf(stderr, "Network error: Winsock initialization failed.\n"); exit(2); } #endif @@ -114,9 +102,10 @@ crash(0, "master::connect() is not working", 3); if(!login_ob->u.ob) { - /* More freedom to the coder! Doesn't have to return anything if not needed. */ printf("Warning: master::connect() didn't return an object.\n"); + do_write("Oops, glitch in world fabric - you didn't get an object.\n"); xfree(player_ob); + net_disconnect(p); return; } @@ -206,14 +195,15 @@ fprintf(stderr, "Error reading from player!\n"); /* fall through, and make them netdead */ case 0: - apply(master, "net_dead", "o", pl->ob); - /* the login object will have to restore this object's iaob */ - pl->ob->iaob = NULL; + apply(pl->ob, "net_dead", "o", pl->ob); + if(pl->ob) { + /* the login object will have to restore this object's iaob */ + pl->ob->iaob = NULL; + } pl->conn.state = DISCONNECTED; break; default: net_read(pl); -/* pl->conn.idle = 0;*/ break; } } |
From: Peep P. <so...@us...> - 2004-03-18 20:55:15
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1270 Modified Files: net.h Log Message: Cleanup. Index: net.h =================================================================== RCS file: /cvsroot/agd/server/src/net.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- net.h 15 Mar 2004 18:50:10 -0000 1.8 +++ net.h 18 Mar 2004 20:45:33 -0000 1.9 @@ -26,7 +26,6 @@ char recvbuf[NET_RECEIVEBUF]; enum { DISCONNECTED = -1, DEFAULT, CONNECTED } state; time_t last_active; -/* unsigned long int idle;*/ } player_connection_t; typedef struct player_t { |
From: Peep P. <so...@us...> - 2004-03-18 20:55:02
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1231 Modified Files: object.c object.h Log Message: Renamed int_load_object to load_object. Index: object.c =================================================================== RCS file: /cvsroot/agd/server/src/object.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- object.c 16 Mar 2004 14:13:24 -0000 1.7 +++ object.c 18 Mar 2004 20:45:20 -0000 1.8 @@ -40,7 +40,6 @@ void destruct(object_t *ob) { -/* list_t *p;*/ int i; if(!ob) @@ -48,23 +47,20 @@ ob->flags |= O_DESTRUCTED; - if(ob->parent) - unref_ob(ob->parent, NULL); + unref_ob(ob->parent, NULL); if(ob->iaob) { net_disconnect(ob->iaob); ob->iaob->ob = NULL; } -/* for(p = &ob->refs; p; p=p->next) { - variable_t *v = p->data; - v->u.ob = NULL; - }*/ for(i=0;i<ob->refs.length;i++) { variable_t *v = ob->refs.data[i]; v->u.ob = NULL; } - + +#ifdef DEBUG debug("dfun", "destructed \"%s\"\n", ob->name); +#endif } void actual_destruct(object_t *ob) @@ -149,18 +145,13 @@ return NULL; } -object_t *load_object(char *name) -{ - return int_load_object(name); -} - object_t *clone_object(char *name) { object_t *base_ob, *new_ob; base_ob = find_object(name); if(!base_ob) { - base_ob = int_load_object(name); + base_ob = load_object(name); if(!base_ob) return NULL; } Index: object.h =================================================================== RCS file: /cvsroot/agd/server/src/object.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- object.h 15 Mar 2004 18:49:30 -0000 1.5 +++ object.h 18 Mar 2004 20:45:20 -0000 1.6 @@ -38,7 +38,6 @@ void ref_prog(program_t *prog); int unref_prog(program_t *prog); object_t *find_object(char *name); -object_t *load_object(char *name); object_t *clone_object(char *name); int interactivep(object_t *ob); /* |
From: Peep P. <so...@us...> - 2004-03-16 20:27:22
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28562/src Modified Files: Makefile.in Log Message: Raised version to agd-0.0.2-2. Index: Makefile.in =================================================================== RCS file: /cvsroot/agd/server/src/Makefile.in,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Makefile.in 16 Mar 2004 14:35:26 -0000 1.6 +++ Makefile.in 16 Mar 2004 20:17:32 -0000 1.7 @@ -113,7 +113,7 @@ AM_CFLAGS = -ansi -AM_YFLAGS = -dv +AM_YFLAGS = -d EXTRA_DIST = dfparse.h lang.h dist_pkgdata_DATA = options @@ -174,7 +174,7 @@ DATA = $(dist_pkgdata_DATA) DIST_COMMON = $(dist_pkgdata_DATA) $(srcdir)/Makefile.in Makefile.am \ - config.h.in dflex.c dfparse.c lang.c lex.c + config.h.in dflex.c dfparse.c dfparse.h lang.c lang.h lex.c SOURCES = $(agd_SOURCES) $(dfparse_SOURCES) all: $(BUILT_SOURCES) config.h @@ -231,9 +231,19 @@ clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +lang.h: lang.c + @if test ! -f $@; then \ + rm -f lang.c; \ + $(MAKE) lang.c; \ + else :; fi agd$(EXEEXT): $(agd_OBJECTS) $(agd_DEPENDENCIES) @rm -f agd$(EXEEXT) $(LINK) $(agd_LDFLAGS) $(agd_OBJECTS) $(agd_LDADD) $(LIBS) +dfparse.h: dfparse.c + @if test ! -f $@; then \ + rm -f dfparse.c; \ + $(MAKE) dfparse.c; \ + else :; fi dfparse$(EXEEXT): $(dfparse_OBJECTS) $(dfparse_DEPENDENCIES) @rm -f dfparse$(EXEEXT) $(LINK) $(dfparse_LDFLAGS) $(dfparse_OBJECTS) $(dfparse_LDADD) $(LIBS) @@ -425,11 +435,13 @@ maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." + -rm -f dfparse.h -rm -f lex.c -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -rm -f dflex.c -rm -f dfparse.c -rm -f lang.c + -rm -f lang.h clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \ |
From: Peep P. <so...@us...> - 2004-03-16 20:27:06
|
Update of /cvsroot/agd/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28562 Modified Files: BUGS ChangeLog NEWS README TODO configure configure.ac Log Message: Raised version to agd-0.0.2-2. Index: README =================================================================== RCS file: /cvsroot/agd/server/README,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- README 16 Mar 2004 14:19:43 -0000 1.2 +++ README 16 Mar 2004 20:17:32 -0000 1.3 @@ -1,6 +1,6 @@ -------------------------------------- Adventure Game Driver - 0.0.2-1, March 16, 2004 + 0.0.2-2, March 16, 2004 http://agd.sf.net Peep Pullerits <so...@es...> -------------------------------------- Index: configure.ac =================================================================== RCS file: /cvsroot/agd/server/configure.ac,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- configure.ac 16 Mar 2004 14:19:43 -0000 1.3 +++ configure.ac 16 Mar 2004 20:17:32 -0000 1.4 @@ -1,5 +1,5 @@ # Process this file with autoconf to produce a configure script. -AC_INIT(AGD, 0.0.2-1, [so...@es...]) +AC_INIT(AGD, 0.0.2-2, [so...@es...]) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR(src/dfparse.y) AM_CONFIG_HEADER(src/config.h) Index: configure =================================================================== RCS file: /cvsroot/agd/server/configure,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- configure 16 Mar 2004 14:35:26 -0000 1.3 +++ configure 16 Mar 2004 20:17:32 -0000 1.4 @@ -1,7 +1,7 @@ #! /bin/sh # From configure.ac revision 0.06. # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for AGD 0.0.2-1. +# Generated by GNU Autoconf 2.59 for AGD 0.0.2-2. # # Report bugs to <so...@es...>. # @@ -270,8 +270,8 @@ # Identity of this package. PACKAGE_NAME='AGD' PACKAGE_TARNAME='agd' -PACKAGE_VERSION='0.0.2-1' -PACKAGE_STRING='AGD 0.0.2-1' +PACKAGE_VERSION='0.0.2-2' +PACKAGE_STRING='AGD 0.0.2-2' PACKAGE_BUGREPORT='so...@es...' ac_unique_file="src/dfparse.y" @@ -782,7 +782,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures AGD 0.0.2-1 to adapt to many kinds of systems. +\`configure' configures AGD 0.0.2-2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -844,7 +844,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of AGD 0.0.2-1:";; + short | recursive ) echo "Configuration of AGD 0.0.2-2:";; esac cat <<\_ACEOF @@ -964,7 +964,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -AGD configure 0.0.2-1 +AGD configure 0.0.2-2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -978,7 +978,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by AGD $as_me 0.0.2-1, which was +It was created by AGD $as_me 0.0.2-2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -1589,7 +1589,7 @@ # Define the identity of the package. PACKAGE='agd' - VERSION='0.0.2-1' + VERSION='0.0.2-2' cat >>confdefs.h <<_ACEOF @@ -6278,7 +6278,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by AGD $as_me 0.0.2-1, which was +This file was extended by AGD $as_me 0.0.2-2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6341,7 +6341,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -AGD config.status 0.0.2-1 +AGD config.status 0.0.2-2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Index: ChangeLog =================================================================== RCS file: /cvsroot/agd/server/ChangeLog,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ChangeLog 16 Mar 2004 14:19:43 -0000 1.4 +++ ChangeLog 16 Mar 2004 20:17:32 -0000 1.5 @@ -1,3 +1,13 @@ +0.0.2-2: +2004-03-16 +---------------------------------------------------------------------------- + * ? : operator. + * new dfun: random() + * checking for return type + (int main() { return "abc"; } errors now) + * compile_options.h: added DEFAULT_FUNCTION_TYPE + * functions with implicit type )defined like 'fun_name(int i) { }' now + work again. 0.0.2-1: ---------------------------------------------------------------------------- 2004-03-16 Index: NEWS =================================================================== RCS file: /cvsroot/agd/server/NEWS,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- NEWS 12 Mar 2004 08:32:10 -0000 1.1 +++ NEWS 16 Mar 2004 20:17:32 -0000 1.2 @@ -1,4 +1,7 @@ -New things in this version (0.0.2) that you might find useful: +New things in this version (0.0.2-2) that you might find useful: + * Dfuns: random + +Features in 0.0.2: * Additional escape codes: \\, \", \t, \a, \b, \f, \e * Operators: > >= < <= && || * / % * while(), do..while() Index: TODO =================================================================== RCS file: /cvsroot/agd/server/TODO,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- TODO 16 Mar 2004 14:42:44 -0000 1.4 +++ TODO 16 Mar 2004 20:17:32 -0000 1.5 @@ -8,7 +8,6 @@ - Statistics and profiling ! better conf file handling (see src/log.c) - change 'errorlog' to 'debuglog'? - - debug() prototype from log.h to sys.h, if possible. - scripting: - inheritance - better error recovery for lpc.y @@ -18,6 +17,9 @@ - mixed type ! string ranges ! continue; and break; + - allow to define locals inside statements + like: create() { write("\n"); int i; i = 1; int j; j = 2; } + And maybe disable this with #pragma traditional-lpc ? - lexer: - preprocessor (read flex(1)) a {IDENTIFIER} rule first up in the rule list which goes through all of the macro @@ -31,18 +33,14 @@ - binary: \0bnnnnnnnn - dfuns: query_ip() for players. - int random(int highest) - better logging system - log using lib's facilities (master::log()?) - different prefixes have different debuglevels - save to different files - ! syntactical checking in lpc.y - namely: - enforce proper return type from function (and expr must be NULL for void funs) - - reserved keywords (can't be used as identifiers) (this is probably in already) - - only report undeclared identifiers once + - only report undeclared identifiers once - initialization of global variables - dfun overrides, :: operator - - qsort&bsearch for define_id in compile.c + - qsort&bsearch for define_id in compile.c (or maybe use a hashtable with O(1) lookup and insert) - qsort&bsearch for nametable, _again_ - allow both .c and .lpc for file extensions (?) - runtime token positions. @@ -54,6 +52,5 @@ int foo(int i, int j = 1); - string table for each program, and F_PUSH_STRING takes index into the table - clean up includes, not everything needs everything in std.h and lpc_incl.h, etc. - - for div, mul and mod - if both sides are direct_type, calculate result at compile-time - - compile-time eval for < > <= >= == != ! - make maintainer-clean should also remove src/dfparse.output and src/lang.output + - compile-time eval for < > <= >= == != ! Index: BUGS =================================================================== RCS file: /cvsroot/agd/server/BUGS,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- BUGS 16 Mar 2004 14:19:43 -0000 1.2 +++ BUGS 16 Mar 2004 20:17:32 -0000 1.3 @@ -2,6 +2,7 @@ - the future_pos system in lex.l is acting up. - src/options and src/compile_options.h don't honor $prefix. Could use a shell script and sed to do substitutions. - - int i; void foo(int i); should be valid with a warning + - the define_id system is more or less not operational. + * int i; void foo(int i); should be valid with a warning - continue from here.. |
From: Peep P. <so...@us...> - 2004-03-16 20:24:29
|
Update of /cvsroot/agd/server/doc/lpc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28055 Modified Files: operators Log Message: Marked ?: operator as DONE Index: operators =================================================================== RCS file: /cvsroot/agd/server/doc/lpc/operators,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- operators 15 Mar 2004 18:57:45 -0000 1.1 +++ operators 16 Mar 2004 20:14:58 -0000 1.2 @@ -28,7 +28,7 @@ -> binary call_other * (F_CALL_OTHER) note: This is different from C's ->. in LPC it calls a function in an object other than the current object; i.e. ob->call() would execute the function call() in object ob. - ?: trinary conditional (if-then-else) + ?: trinary conditional (if-then-else) * , binary comma - left and right side are evaluated, then right side discarded. arithmetic: |
From: Peep P. <so...@us...> - 2004-03-16 20:23:58
|
Update of /cvsroot/agd/server/lib/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27976 Modified Files: master.c Log Message: Little change in indentation. Index: master.c =================================================================== RCS file: /cvsroot/agd/server/lib/sys/master.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- master.c 12 Mar 2004 08:50:10 -0000 1.6 +++ master.c 16 Mar 2004 20:14:37 -0000 1.7 @@ -23,10 +23,10 @@ } void create(void) -{ banner = " _______ _______ _____\n\ +{ + banner = " _______ _______ _____\n\ | _ | __| \\\n\ | | | | -- |\n\ |___|___|_______|_____/\n\ \t\tv0.0.2 on " + platform() + "\n"; } - |
From: Peep P. <so...@us...> - 2004-03-16 20:23:18
|
Update of /cvsroot/agd/server/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27831 Modified Files: beer.c Log Message: Using if..else for faster code. Index: beer.c =================================================================== RCS file: /cvsroot/agd/server/lib/beer.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- beer.c 16 Mar 2004 14:02:55 -0000 1.1 +++ beer.c 16 Mar 2004 20:13:57 -0000 1.2 @@ -1,25 +1,25 @@ void one_bottle(int i) { if(i==10) write("Ten "); - if(i==9) + else if(i==9) write("Nine "); - if(i==8) + else if(i==8) write("Eight "); - if(i==7) + else if(i==7) write("Seven "); - if(i==6) + else if(i==6) write("Six "); - if(i==5) + else if(i==5) write("Five "); - if(i==4) + else if(i==4) write("Four "); - if(i==3) + else if(i==3) write("Three "); - if(i==2) + else if(i==2) write("Two "); - if(i==1) + else if(i==1) write("One "); - if(!i) { + else if(!i) { write("No bottles of beer on the wall.\n"); return; } |
From: Peep P. <so...@us...> - 2004-03-16 20:22:57
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27774 Modified Files: Makefile.am Log Message: Changed default YFLAGS to -d instead of -dv. Index: Makefile.am =================================================================== RCS file: /cvsroot/agd/server/src/Makefile.am,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Makefile.am 16 Mar 2004 14:32:27 -0000 1.6 +++ Makefile.am 16 Mar 2004 20:13:34 -0000 1.7 @@ -4,7 +4,7 @@ ## AM_CPPFLAGS = -I. ## -I$(srcdir)/dfun -AM_YFLAGS = -dv +AM_YFLAGS = -d ##AUTOMAKE_OPTIONS = subdir-objects EXTRA_DIST = dfparse.h lang.h @@ -29,4 +29,3 @@ agd_LDADD = @LEXLIB@ lex.c: lang.c - |