Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19724/src Modified Files: Makefile.in arch.h array.c compile.c compile.h compile_options.h config.h.in dfdecl.in interpret.c interpret.h lex.l Log Message: Major cleanups. Index: compile.h =================================================================== RCS file: /cvsroot/agd/server/src/compile.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- compile.h 28 Mar 2004 18:08:30 -0000 1.11 +++ compile.h 1 Apr 2004 19:17:14 -0000 1.12 @@ -18,11 +18,9 @@ int has_been_called; array_t *args; /* For ID_FUN_PROT and ID_FUN */ } def_id_t; - void define_id(char *name, int type, int lpc_type, array_t *args); def_id_t *find_id(char *name); -/* lang.y stuff */ typedef struct { int side_effect, lval; int type, direct_type; @@ -31,15 +29,18 @@ int check_operand(int operator, int opr1, int opr2); -void do_addition(array_t *res, array_t *a1, array_t *a2); - int get_fun_index(object_t *ob, char *fun); void add_variable(array_t *vars, int scope); +void add_function(def_id_t *idp, int lineno, array_t *code); + +void redeclaration_error(def_id_t *id, int new_type); +int compare_args(array_t *arg1, array_t *arg2); void new_block_level(void); array_t add_block(array_t *stmt); void end_block_level(void); + /* Warnings and errors. */ extern int compile_errors, compile_warnings; void display_error(char *s); @@ -48,9 +49,4 @@ #define comp_error(s) display_error(s); compile_errors++ #define comp_warning(s) display_error("warning: "s); compile_warnings++ -/*object_t *load_object(char *fn);*/ -program_t *compile_prog(char *path); - -void *copy_nt_entry(void *voide); #endif - Index: interpret.h =================================================================== RCS file: /cvsroot/agd/server/src/interpret.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- interpret.h 28 Mar 2004 17:58:16 -0000 1.10 +++ interpret.h 1 Apr 2004 19:17:14 -0000 1.11 @@ -7,7 +7,6 @@ #define F_JMPF 2 /* Jump if false. Pops variable off the stack, jumps forward by <n> if it's false. */ -/* Used to be F_PUSH, separated them. */ #define F_PUSH_INT 3 #define F_PUSH_STRING 4 #define F_PUSH_NULL_OBJECT 5 @@ -68,11 +67,15 @@ typedef struct { variable_t *sp, *fp; + int num_arg; + int *cp; array_t *code; + + int fun, line; + object_t *this_ob, *previous_ob; player_t *this_player; - int num_arg; } control_stack_t; extern control_stack_t *csp; Index: compile_options.h =================================================================== RCS file: /cvsroot/agd/server/src/compile_options.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- compile_options.h 21 Mar 2004 13:43:50 -0000 1.12 +++ compile_options.h 1 Apr 2004 19:17:14 -0000 1.13 @@ -43,7 +43,9 @@ /* Define this if you want to allow root to run AGD, * BUT ONLY IF YOU REALLY KNOW WHAT YOU ARE DOING! - * AGD is probably not very secure at this point. */ + * AGD is probably not very secure at this point. + * I will not take responsibility for anything that happens + * because of this. */ #undef ALLOW_ROOT #endif Index: config.h.in =================================================================== RCS file: /cvsroot/agd/server/src/config.h.in,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- config.h.in 12 Mar 2004 16:03:52 -0000 1.2 +++ config.h.in 1 Apr 2004 19:17:14 -0000 1.3 @@ -3,22 +3,13 @@ /* Define to 1 if you have the <arpa/inet.h> header file. */ #undef HAVE_ARPA_INET_H -/* Define to 1 if you have the `atexit' function. */ -#undef HAVE_ATEXIT - /* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#undef HAVE_DOPRNT - /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H -/* Define to 1 if you have the `floor' function. */ -#undef HAVE_FLOOR - /* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD @@ -28,16 +19,15 @@ /* Define to 1 if you have the `m' library (-lm). */ #undef HAVE_LIBM +/* Define to 1 if you have the `nsl' library (-lnsl). */ +#undef HAVE_LIBNSL + /* Define to 1 if you have the `socket' library (-lsocket). */ #undef HAVE_LIBSOCKET /* Define to 1 if you have the <machine/types.h> header file. */ #undef HAVE_MACHINE_TYPES_H -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H @@ -71,24 +61,15 @@ /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR -/* Define to 1 if you have the `strftime' function. */ -#undef HAVE_STRFTIME - /* Define to 1 if you have the <strings.h> header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the <string.h> header file. */ #undef HAVE_STRING_H -/* Define to 1 if you have the `strstr' function. */ -#undef HAVE_STRSTR - /* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H @@ -112,8 +93,8 @@ /* Define to 1 if you have the <unistd.h> header file. */ #undef HAVE_UNISTD_H -/* Define to 1 if you have the `vprintf' function. */ -#undef HAVE_VPRINTF +/* Define to 1 if you have the <winsock.h> header file. */ +#undef HAVE_WINSOCK_H /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O @@ -136,17 +117,6 @@ /* Define to the version of this package. */ #undef PACKAGE_VERSION -/* Define to 1 if the C compiler supports function prototypes. */ -#undef PROTOTYPES - -/* Define as the return type of signal handlers (`int' or `void'). */ -#undef RETSIGTYPE - -/* Define to 1 if the `setvbuf' function takes the buffering type as its - second argument and the buffer pointer as the third, as on System V before - release 3. */ -#undef SETVBUF_REVERSED - /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -163,11 +133,5 @@ `char[]'. */ #undef YYTEXT_POINTER -/* Define like PROTOTYPES; this can be used by system headers. */ -#undef __PROTOTYPES - /* Define to empty if `const' does not conform to ANSI C. */ #undef const - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc Index: Makefile.in =================================================================== RCS file: /cvsroot/agd/server/src/Makefile.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- Makefile.in 28 Mar 2004 18:08:51 -0000 1.10 +++ Makefile.in 1 Apr 2004 19:17:14 -0000 1.11 @@ -113,7 +113,7 @@ AM_CFLAGS = -ansi -AM_YFLAGS = -d +AM_YFLAGS = -d EXTRA_DIST = dfparse.h lang.h dist_pkgdata_DATA = options Index: interpret.c =================================================================== RCS file: /cvsroot/agd/server/src/interpret.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- interpret.c 28 Mar 2004 17:58:15 -0000 1.16 +++ interpret.c 1 Apr 2004 19:17:14 -0000 1.17 @@ -1,10 +1,17 @@ -#include "std.h" -#include "lpc_incl.h" -#include "dfuns.h" +#include <stdlib.h> #include <stdarg.h> #include <setjmp.h> +#include "compile_options.h" +#include "sys.h" +#include "array.h" +#include "lpc.h" +#include "object.h" +#include "net.h" +#include "interpret.h" +#include "vars.h" -char *opc_name(int i); +extern player_t *this_player; +extern object_t *this_ob, *previous_ob; jmp_buf error_context; int have_error_context; @@ -13,8 +20,6 @@ int dont_debug_interpreter; #endif -static int lineno, funcno; - /* This is the stack containing all local variables, function arguments and function return values. */ variable_t value_stack[VALUE_STACK_SIZE]; @@ -37,7 +42,19 @@ void call_function(object_t *ob, int index); void do_assign(variable_t *lval, variable_t *rval); void pop_control_stack(int pop_sp); -void free_value(variable_t *v); +char *opc_name(int i); + +void stack_trace(void) +{ + int i, len; + len = csp - &control_stack[0]; + printf("Stack trace:\n"); + for(i=len;i>1;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); + } +} /* Need the F_NEWLINE operation for this. */ void runtime(char *s) @@ -45,24 +62,24 @@ char *buf; if(!this_ob) { - printf("%s on line %d (function %d)\n", s, lineno, funcno); + printf("%s on line %d (function %d)\n", s, csp->line, csp->fun); 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, lineno, funcno); - + sprintf(buf, "%s: %s on line %d (function %d)\n", this_ob->name, s, csp->line, csp->fun); printf(buf); if(this_player) { do_write(buf); net_disconnect(this_player); } - xfree(buf); +/* stack_trace();*/ + out: if(csp > &control_stack[0]) { - /*pop_locals();*/ + pop_locals(); pop_control_stack(1); } longjmp(error_context, 1); @@ -125,31 +142,13 @@ if(v) do_assign(sp, v); else { - free_value(sp); + free_var(sp); sp->type = 0; } sp++; CHECK_SP() } -void free_value(variable_t *v) -{ -/* if(v->name) { - xfree(v->name); - }*/ - - switch(v->type) { - case T_STRING: - if(v->string_type != ST_STATIC && v->u.s) { - xfree(v->u.s); - } - break; - case T_OBJECT: - unref_ob(v->u.ob, v); - break; - } -} - void do_assign(variable_t *lval, variable_t *rval) { *lval = *rval; @@ -167,7 +166,7 @@ void do_assign_free(variable_t *lval, variable_t *rval) { - free_value(lval); + free_var(lval); do_assign(lval, rval); } @@ -198,11 +197,13 @@ } putchar('\n'); printf("Control stack:\n"); - for(i=0;i<=csp-&control_stack[0]+1;i++) { - printf("%d | cp: %d; fp: %d; sp: %d |\n", i, - control_stack[i].cp ? control_stack[i].cp - (csp->code ? (int *) csp->code->data : 0) : 0, + 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 ? (int *) control_stack[i].code->data : 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].sp ? control_stack[i].sp - &value_stack[0] : 0, + control_stack[i].fun, control_stack[i].line); } } #else @@ -212,7 +213,7 @@ void push_control_stack(void) { -/* csp->previous_ob = previous_ob;*/ + csp->previous_ob = previous_ob; csp->this_ob = this_ob; if(this_ob) csp->this_player = this_ob->iaob; @@ -237,7 +238,7 @@ cp = csp->cp; code = csp->code; -/* previous_ob = csp->previous_ob;*/ + previous_ob = csp->previous_ob; this_ob = csp->this_ob; if(this_ob && this_ob->iaob) this_player = /*this_ob->iaob*/ csp->this_player; @@ -247,17 +248,13 @@ #define CHECK_OVERRUN() if((int *) cp >= (int *) code->data + code->length) {\ debug("interpret", "Ran over end of array: returning\n"); return; } -/*#define GET_ARGS() tmpi = 0; while(tmpi < 2) { \ - tmp = --sp; if(tmp->type == T_LVALUE) tmp = tmp->u.v;\ - arg[tmpi] = tmp->u.i; tmpi++; free_value(sp); }*/ #define GET_ARGS() arg[0] = sp[-1].u.i; pop_stack(); arg[1] = sp[-1].u.i; pop_stack(); -#define SETUP_CALL_FRAME() tmpi = *++cp; cp++; push_control_stack(); \ - csp->num_arg = *cp; fp = sp - csp->num_arg - #define TAKE_SLICE() GET_ARGS() if(!sp[-1].u.s) runtime("taking substring of NULL string"); \ if(arg[1] >= strlen(sp[-1].u.s) || arg[1] < 0 || arg[1] > arg[0]) runtime("substring out of range"); \ +#define SETUP_FRAME() push_control_stack(); csp->num_arg = *cp; fp = sp - csp->num_arg; + void eval_instruction(void) { variable_t *tmpvp, tmpv; @@ -408,7 +405,7 @@ } else { cp++; } - free_value(sp); + free_var(sp); CHECK_OVERRUN() break; case F_JMP: @@ -441,7 +438,7 @@ case F_NOT: sp--; tmpi = test_var(sp); - free_value(sp); + free_var(sp); push_int(!tmpi); break; case F_GT: @@ -461,12 +458,16 @@ push_int(arg[1] <= arg[0] ? 1 : 0); break; case F_CALL_LFUN: - SETUP_CALL_FRAME(); + tmpi = *++cp; + cp++; + SETUP_FRAME(); call_function(this_ob, tmpi); goto again; break; case F_CALL_DFUN: - SETUP_CALL_FRAME(); + tmpi = *++cp; + cp++; + SETUP_FRAME(); dfptr[tmpi](); pop_control_stack(0); break; @@ -490,10 +491,10 @@ } tmpi = get_fun_index(tmpv.u.ob, tmps); - free_value(sp); - push_control_stack(); - csp->num_arg = *cp; - fp = sp - csp->num_arg; + free_var(sp); + if(tmpi == -1) + runtime("function doesn't exist"); + SETUP_FRAME(); call_function(tmpv.u.ob, tmpi); goto again; break; @@ -526,7 +527,6 @@ #ifdef DEBUG debug("interpret", "this_ob destructed; returning\n"); #endif - /* Should we pop to the bottom? */ pop_control_stack(1); pop_locals(); return; @@ -547,8 +547,8 @@ runtime(buf); } -/* funcno = index; - lineno = f->lineno;*/ + csp->line = f->lineno; + csp->fun = index; i = f->args.length - csp->num_arg; if(i > 0) { @@ -561,7 +561,7 @@ push_object(NULL); break; case T_STRING: - push_string("0", ST_STATIC); + push_string("", ST_STATIC); break; } } @@ -570,15 +570,13 @@ #ifdef DEBUG debug("interpret", "call_function %d on %s\n", index, ob->name); #endif -/* previous_ob = this_ob;*/ + previous_ob = this_ob; this_ob = ob; if(this_ob->iaob) this_player = this_ob->iaob; cp = (int *) &f->code.data[0]; code = &f->code; - -/* funcno = 0;*/ } void init_interpreter(void) @@ -655,6 +653,7 @@ if(setjmp(error_context)) { /* setjmp() returned a value, * so we got here by longjmp(). */ + have_error_context = 0; return NULL; } have_error_context = 1; @@ -667,6 +666,8 @@ gettimeofday(&tm2, NULL); debug("lpc", "apply \"%s\" done in %d microseconds\n", fun, tm2.tv_usec - tm.tv_usec); #endif + + have_error_context = 0; return fp; } Index: compile.c =================================================================== RCS file: /cvsroot/agd/server/src/compile.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- compile.c 28 Mar 2004 17:54:29 -0000 1.18 +++ compile.c 1 Apr 2004 19:17:14 -0000 1.19 @@ -1,7 +1,16 @@ -#include "std.h" +#include <stdio.h> #include <errno.h> -#include "lex.h" /* for yylloc */ -#include "lpc_incl.h" +#include "sys.h" +#include "compile_options.h" +#include "array.h" +#include "lpc.h" +#include "object.h" +#include "compile.h" +#include "net.h" +#include "interpret.h" +#include "lang.h" + +extern object_t *this_ob; static program_t *this_prog; static function_t *curr_f; /* TODO: rename to curr_fun. */ @@ -24,6 +33,8 @@ static int start_with_newline; +extern FILE *yyin; + /* define_id functions. */ void define_id(char *name, int type, int lpc_type, array_t *args) { @@ -243,11 +254,6 @@ are set in the code. */ operator_t *op; - if(opr1 == T_VOID) { - printf("valid_operand(): T_VOID\n"); - return; - } - if(!opr1) return; @@ -255,9 +261,11 @@ memset(buf, 0, sizeof buf); op = &operator_table[operator-F_ADD]; + if(op->valid[opr1-1] == 0 || (op->num_operand == 2 && opr2 - && op->both_same_type && opr1 != opr2)) { + && op->valid[opr2-1] == 0) + || (op->both_same_type && opr1 != opr2)) { switch(op->num_operand) { case 1: sprintf(buf, "wrong type argument to unary "); @@ -494,7 +502,8 @@ } /* buf = xmalloc(strlen(s) + 256); - s*/printf(/*buf, */"%s:%d:%d: %s\n", this_file, yylloc.line, yylloc.pos, s); + s*/printf(/*buf, */"%s:%d:%d: %s\n", this_file, + yylloc.first_line, yylloc.first_column, s); /* do_write(buf); xfree(buf);*/ } @@ -527,8 +536,7 @@ free_array(&local_ids, free_id); init_array(&block_history); - yylloc.pos = 0; - yylloc.line = 1; + yylloc.first_line = yylloc.first_column = 1; yyreset(); } @@ -565,12 +573,12 @@ path = add_extension(path); #ifdef DEBUG - if(conf.debuglevel > 1) + if(conf.debuglevel) gettimeofday(&tm, NULL); #endif real_path = absolute_path(path); - printf("compiling %s...", path); + printf("compiling %s... ", path); start_with_newline = 1; yyin = fopen(real_path, "r"); @@ -616,18 +624,15 @@ ref_prog(prog); -#ifdef DEBUG printf("done"); - if(conf.debuglevel > 1) { + +#ifdef DEBUG + if(conf.debuglevel) { gettimeofday(&tm2, NULL); printf(" in %d microseconds\n", abs(tm2.tv_usec - tm.tv_usec)); } else { putchar('\n'); } -#else - printf("done\n"); -#endif -#ifdef DEBUG if(conf.debuglevel > 1) { printf("Printing code for program %s:\n", path); printf("Globals: \n"); @@ -635,6 +640,8 @@ printf("\n"); print_code(prog); } +#else + putchar('\n'); #endif out: Index: dfdecl.in =================================================================== RCS file: /cvsroot/agd/server/src/dfdecl.in,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- dfdecl.in 28 Mar 2004 17:59:23 -0000 1.10 +++ dfdecl.in 1 Apr 2004 19:17:14 -0000 1.11 @@ -20,7 +20,7 @@ int write(string) void shout(string, object) void tell_object(object, string) -int interactivep(object) +int interactive(object) void input_to(string) int query_idle(object) string query_ip(object) Index: lex.l =================================================================== RCS file: /cvsroot/agd/server/src/lex.l,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- lex.l 28 Mar 2004 17:57:19 -0000 1.12 +++ lex.l 1 Apr 2004 19:17:14 -0000 1.13 @@ -8,56 +8,38 @@ %x in_string in_string_backslash %x charconst charconstgotten charbackslash %x comment linecomment -%option yylineno %{ #include "compile_options.h" #include "lpc_incl.h" +#include "compile.h" #include "lang.h" -#include "lex.h" /* for yylloc */ #include "sys.h" /* conf_t */ +#define pos yylloc.first_column +#define line yylloc.first_line -#undef USE_FUTUREPOS - -/* i'm not sure why can't use yylloc outside of the .y file - something to do with the --bison-locations option? */ - -/* using custom struct for now, see lex.h */ -extern YYLTYPE yylloc; - -static int -#ifdef USE_FUTUREPOS - futurepos, -#endif - warned_newlines, +static int warned_newlines, ignore_white_space, warned_charconst; #ifdef DEBUG #define RET(type, value, tok) \ - MOVE(yyleng); \ + pos += yyleng; \ if(conf.debuglevel > 3) \ - printf("yylex(): %"#type"; pos: %d\n", value, yylloc.pos); \ - yylloc.line = yylineno; \ + printf("yylex(): %"#type"; pos: %d\n", value, pos); \ return tok #else -#define RET(type, value, tok) MOVE(yyleng); yylloc.line = yylineno; return tok -#endif - -#ifdef USE_FUTUREPOS -#define MOVE(x) yylloc.pos += futurepos; futurepos = x -#else -#define MOVE(x) yylloc.pos += x +#define RET(type, value, tok) return tok #endif -#define NEWLINE() yylloc.pos = 0; yylloc.line = yylineno +#define NEWLINE() pos = 1; line++ #define STRCHECK() if(string_buf_ptr - string_buf >= MAX_STRING_LENGTH) {\ comp_error("maximum string length exceeded!\n"); BEGIN(INITIAL); } -#define STRING_PUTCHAR(x) STRCHECK() MOVE(1); *string_buf_ptr++ = x; BEGIN(in_string); +#define STRING_PUTCHAR(x) STRCHECK() pos++; *string_buf_ptr++ = x; BEGIN(in_string); #define STRING_PUTWHITESPACE(x) STRCHECK() if(!ignore_white_space) \ - *string_buf_ptr++ = yytext[0]; MOVE(x); -#define STRING_PUTCHAR2(x, x2) STRCHECK() MOVE(1); *string_buf_ptr++ = x; *string_buf_ptr++ = x2; BEGIN(in_string); + *string_buf_ptr++ = yytext[0]; pos += x; +#define STRING_PUTCHAR2(x, x2) STRCHECK() pos++; *string_buf_ptr++ = x; *string_buf_ptr++ = x2; BEGIN(in_string); %} IDENTIFIER [a-zA-Z_][a-zA-Z0-9_]* @@ -66,38 +48,31 @@ char *string_buf_ptr; %% /* comments */ -"/*" MOVE(2); BEGIN(comment); +"/*" pos += 2; BEGIN(comment); "*/" { comp_error("unmatched */"); + pos += 2; BEGIN(INITIAL); } <comment>{ - "*/" MOVE(2); BEGIN(INITIAL); - . MOVE(1); - \n { - NEWLINE(); - } + "*/" pos += 2; BEGIN(INITIAL); + . pos++; + \n NEWLINE(); } -"//" MOVE(2); BEGIN(linecomment); +"//" pos += 2; BEGIN(linecomment); <linecomment>{ - . MOVE(1); - \n { - NEWLINE(); - BEGIN(INITIAL); - } + . pos++; + \n NEWLINE(); BEGIN(INITIAL); } /* strings */ \" { string_buf_ptr = string_buf; - MOVE(1); + pos++; BEGIN(in_string); } <in_string>{ - \\ { - MOVE(1); - BEGIN(in_string_backslash); - } + \\ pos++; BEGIN(in_string_backslash); \" { *string_buf_ptr = '\0'; yylval.str = stringdup(string_buf); @@ -111,7 +86,7 @@ if(ignore_white_space) ignore_white_space = 0; *string_buf_ptr++ = yytext[0]; - MOVE(1); + pos++; } \n comp_error("multi-line string"); } @@ -133,7 +108,7 @@ char buf[128]; sprintf(buf, "invalid escape code (%c)", *yytext); comp_error(buf); - MOVE(1); + pos++; BEGIN(INITIAL); } } @@ -142,9 +117,7 @@ ' BEGIN(charconst); <charconst>{ ' BEGIN(INITIAL); - \\ { - BEGIN(charbackslash); - } + \\ BEGIN(charbackslash); . { yylval.i = *yytext; BEGIN(charconstgotten); @@ -159,7 +132,6 @@ BEGIN(INITIAL); } . { - printf("anything\n"); warned_charconst = 1; comp_error("multi-character character constant"); } @@ -202,9 +174,9 @@ RET(c, '\f', L_INTEGER); } e { - yylval.i = '\27'; + yylval.i = '\33'; BEGIN(charconstgotten); - RET(c, '\27', L_INTEGER); + RET(c, '\33', L_INTEGER); } \\ { yylval.i = '\\'; @@ -279,14 +251,14 @@ yylval.str = str; RET(s, str, L_IDENTIFIER); } -" " MOVE(1); -\t MOVE(8); +" " pos++; +\t pos += 8; \r { if(!warned_newlines) { comp_warning("non-Unix newlines"); warned_newlines = 1; } - MOVE(1); + pos++; } \n NEWLINE(); . RET(c, *yytext, *yytext); @@ -295,9 +267,5 @@ void yyreset(void) { - yylineno = 1; warned_newlines = 0; -#ifdef USE_FUTUREPOS - futurepos = 0; -#endif } Index: arch.h =================================================================== RCS file: /cvsroot/agd/server/src/arch.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- arch.h 21 Mar 2004 16:37:06 -0000 1.7 +++ arch.h 1 Apr 2004 19:17:14 -0000 1.8 @@ -9,7 +9,7 @@ #ifdef _WIN32 #define OPSYS "Windows" -#define WINSOCK +/*#define WINSOCK*/ #endif #ifdef __FreeBSD__ Index: array.c =================================================================== RCS file: /cvsroot/agd/server/src/array.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- array.c 20 Mar 2004 20:26:36 -0000 1.11 +++ array.c 1 Apr 2004 19:17:14 -0000 1.12 @@ -7,9 +7,10 @@ Arrays also aren't linked lists of variable_t's anymore, this is a generic data structure now. */ - -#include "std.h" -#include "lpc_incl.h" +#include <stdlib.h> +#include "compile_options.h" +#include "sys.h" +#include "array.h" void init_array(array_t *a) { |