From: Peep P. <so...@us...> - 2004-04-01 19:23:27
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18313 Modified Files: vars.h vars.c sys.h sys.c options object.h object.c net.h net.c main.c lpc_incl.h list.c lang.y lang.h dfuns.c dfparse.y dfparse.h dflex.l debug.c Log Message: Small cleanups, style changes, added missing prototypes etc. Index: net.h =================================================================== RCS file: /cvsroot/agd/server/src/net.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- net.h 20 Mar 2004 19:17:30 -0000 1.10 +++ net.h 1 Apr 2004 19:10:53 -0000 1.11 @@ -12,7 +12,7 @@ #include <sys/time.h> #include <sys/types.h> -#ifdef WINSOCK +#if HAVE_WINSOCK_H #include <winsock.h> #else #include <sys/socket.h> @@ -24,7 +24,7 @@ int socket; struct sockaddr_in addr; char recvbuf[NET_RECEIVEBUF]; - enum { DISCONNECTED = -1, DEFAULT, CONNECTED } state; +/* enum { DISCONNECTED = -1, DEFAULT, CONNECTED } state;*/ time_t last_active; } player_connection_t; Index: sys.c =================================================================== RCS file: /cvsroot/agd/server/src/sys.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- sys.c 28 Mar 2004 17:50:47 -0000 1.12 +++ sys.c 1 Apr 2004 19:10:53 -0000 1.13 @@ -6,13 +6,19 @@ */ /* todo - custom realloc() */ -#include "std.h" +#include "config.h" + +#include <stdlib.h> +#include <stdio.h> #include <errno.h> -#ifdef HAVE_MACHINE_TYPES_H +#include <math.h> +#if HAVE_MACHINE_TYPES_H #include <machine/types.h> #endif #include <dirent.h> -#include <math.h> + +#include "sys.h" +#include "compile_options.h" config_t conf; static mstats_t mstats; @@ -170,14 +176,11 @@ int legal_path(char *fn) { char *p; - p = fn; - if(p = strstr(p, "..")) - return 0; /* found it */ - else - return 1; + p = strstr(fn, ".."); + return !p; } -/* stringdup() isn't ANSI, so we need this replacement. */ +/* strdup() isn't ANSI, so we need this replacement. */ char *stringdup(char *s) { char *p = xmalloc(strlen(s) + 1); Index: list.c =================================================================== RCS file: /cvsroot/agd/server/src/list.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- list.c 15 Mar 2004 18:48:45 -0000 1.5 +++ list.c 1 Apr 2004 19:10:53 -0000 1.6 @@ -3,8 +3,9 @@ Based on (the old) array.c -solicit 06.12.03 */ -#include "std.h" -#include "lpc_incl.h" +#include <stdio.h> +#include "sys.h" +#include "list.h" void list_push(list_t *l, void *data) { Index: lang.h =================================================================== RCS file: /cvsroot/agd/server/src/lang.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- lang.h 28 Mar 2004 17:58:15 -0000 1.7 +++ lang.h 1 Apr 2004 19:10:53 -0000 1.8 @@ -126,7 +126,7 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 33 "lang.y" +#line 30 "lang.y" typedef union YYSTYPE { char *str; int i; @@ -145,5 +145,19 @@ extern YYSTYPE yylval; +#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED) +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + +extern YYLTYPE yylloc; Index: net.c =================================================================== RCS file: /cvsroot/agd/server/src/net.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- net.c 28 Mar 2004 17:57:04 -0000 1.13 +++ net.c 1 Apr 2004 19:10:53 -0000 1.14 @@ -5,9 +5,10 @@ #include <stdio.h> #include <string.h> +#include <errno.h> + #include "sys.h" #include "compile_options.h" - #include "list.h" #include "array.h" #include "lpc.h" @@ -15,10 +16,9 @@ #include "net.h" #include "interpret.h" -#include <errno.h> - #define LOOP_PLAYERS() for(i=0;i<players.length;i++) { player_t *pl = players.data[i]; -array_t players; + + array_t players; extern list_t all_objects; extern player_t *this_player; @@ -27,15 +27,7 @@ static int greatest_sockfd, listenfd; static fd_set readfds, writefds; -int find_player_nr(player_t *p) -{ - int i; - for(i = 0;i<players.length;i++) { - if(players.data[i] == p) - return i; - } - return -1; -} +int do_write(char *s); void net_listen(unsigned short port) { @@ -84,7 +76,8 @@ #ifdef HAVE_SOCKLEN_T socklen_t #elif defined(HAVE_SIZE_T) - size_t + size_t /* MacOSX has size_t, but takes int as argument + to accept. Tough case. */ #else int #endif @@ -92,6 +85,7 @@ player_t *p; object_t *player_ob; + variable_t *login_ob, *pob; p = type_xmalloc(player_t); memset(p, 0, sizeof(player_t)); @@ -101,7 +95,7 @@ if(p->conn.socket > greatest_sockfd) greatest_sockfd = p->conn.socket; - p->conn.state = DEFAULT; +/* p->conn.state = DEFAULT;*/ this_player = p; player_ob = type_xmalloc(object_t); @@ -109,41 +103,36 @@ player_ob->name = NULL; player_ob->prog = NULL; this_ob = p->ob = player_ob; - { - variable_t *login_ob, *pob; - login_ob = apply(master, "connect", NULL); - if(!login_ob || login_ob->type != T_OBJECT) - crash(0, "master::connect() is not working", 3); + login_ob = apply(master, "connect", NULL); + if(!login_ob || login_ob->type != T_OBJECT) + crash(0, "master::connect() is not working", 3); - if(!login_ob->u.ob) { - fprintf(stderr, "Warning: master::connect() didn't return an object.\n"); - do_write("Oops, glitch in world fabric - you didn't get a login object.\n"); - xfree(player_ob); - net_disconnect(p); - return; - } + if(!login_ob->u.ob) { + fprintf(stderr, "Warning: master::connect() didn't return an object.\n"); + do_write("Oops, glitch in world fabric - you didn't get a login object.\n"); + xfree(player_ob); + net_disconnect(p); + return; + } - p->ob = login_ob->u.ob; - this_ob = login_ob->u.ob; - p->ob->iaob = p; + p->ob = login_ob->u.ob; + this_ob = login_ob->u.ob; + p->ob->iaob = p; - apply(login_ob->u.ob, "logon", NULL); - if(this_player == p && p->ob == player_ob) { - return; - } + apply(login_ob->u.ob, "logon", NULL); + if(this_player == p && p->ob == player_ob) + return; - debug("net_accept", "player object was changed to %p; freeing player_ob %p\n", p->ob, player_ob); - /* player_ob is not needed anymore if we get this far. */ - xfree(player_ob); - } + debug("net_accept", "player object was changed to %p; freeing player_ob %p\n", p->ob, player_ob); + /* player_ob is not needed anymore if we get this far. */ + xfree(player_ob); } void net_disconnect(player_t *p) { int i; int fd = p->conn.socket; - int index = find_player_nr(p); if(p->conn.socket >= greatest_sockfd + 1) { p->conn.socket = 0; @@ -160,7 +149,7 @@ close(fd); #endif - array_remove(&players, index); + array_remove_by_data(&players, p); } void net_send(char *buf, int siz, player_t *p) @@ -202,7 +191,8 @@ void net_doread(player_t *pl) { - int ret = recv(pl->conn.socket, pl->conn.recvbuf, NET_RECEIVEBUF, 0); + int ret; + ret = recv(pl->conn.socket, pl->conn.recvbuf, NET_RECEIVEBUF, 0); switch(ret) { case -1: fprintf(stderr, "Error reading from player!\n"); @@ -213,7 +203,7 @@ /* the login object will have to restore this object's iaob */ pl->ob->iaob = NULL; } - pl->conn.state = DISCONNECTED; +/* pl->conn.state = DISCONNECTED;*/ break; default: net_read(pl); @@ -246,7 +236,7 @@ FD_SET(listenfd, &readfds); LOOP_PLAYERS() - if(pl->conn.state != DISCONNECTED) { + if(/*pl->conn.state != DISCONNECTED*/pl->ob) { FD_SET(pl->conn.socket, &readfds); /*FD_SET(pl->conn.socket, &writefds);*/ } Index: lpc_incl.h =================================================================== RCS file: /cvsroot/agd/server/src/lpc_incl.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- lpc_incl.h 28 Mar 2004 17:57:10 -0000 1.6 +++ lpc_incl.h 1 Apr 2004 19:10:53 -0000 1.7 @@ -5,14 +5,13 @@ #include "array.h" #include "lpc.h" #include "object.h" -#include "compile.h" +/*#include "compile.h"*/ #include "net.h" #include "interpret.h" -#include "dfuns.h" #include "vars.h" /*extern object_t *master;*/ -extern list_t all_objects; +/*extern list_t all_objects;*/ extern player_t *this_player; extern object_t *this_ob, *previous_ob; Index: dflex.l =================================================================== RCS file: /cvsroot/agd/server/src/dflex.l,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- dflex.l 12 Mar 2004 08:44:53 -0000 1.1 +++ dflex.l 1 Apr 2004 19:10:53 -0000 1.2 @@ -2,55 +2,55 @@ %{ #include "compile_options.h" #include "sys.h" -#include "lpc_incl.h" +#include "array.h" +#include "lpc.h" #include "dfparse.h" -#include "lex.h" - -extern YYLTYPE yylloc; +#define pos yylloc.first_column +#define line yylloc.first_line %} IDENTIFIER [a-zA-Z_][a-zA-Z0-9_]* %% /* comment parsing */ -"#" yylloc.pos++; BEGIN(comment); +"#" pos++; BEGIN(comment); <comment>{ - . yylloc.pos++; - \n yylloc.pos = 0; yylloc.line++; BEGIN(INITIAL); + . pos++; + \n pos = 0; line++; BEGIN(INITIAL); } /* everything else */ void { yylval.i = T_VOID; - yylloc.pos += 4; + pos += 4; return L_DATA_TYPE; } int { yylval.i = T_INT; - yylloc.pos += 3; + pos += 3; return L_DATA_TYPE; } string { yylval.i = T_STRING; - yylloc.pos += 6; + pos += 6; return L_DATA_TYPE; } mixed { yylval.i = T_MIXED; - yylloc.pos += 5; + pos += 5; return L_DATA_TYPE; } object { yylval.i = T_OBJECT; - yylloc.pos += 6; + pos += 6; return L_DATA_TYPE; } {IDENTIFIER} { char *s = (char *) stringdup(yytext); yylval.s = s; - yylloc.pos += strlen(s); + pos += strlen(s); return L_IDENTIFIER; } -[ \t] yylloc.pos++; /* ignore whitespace */ -. yylloc.pos++; return *yytext; -\n yylloc.pos = 0; yylloc.line++; +[ \t] pos++; /* ignore whitespace */ +. pos++; return *yytext; +\n line++; pos = 0; Index: dfparse.y =================================================================== RCS file: /cvsroot/agd/server/src/dfparse.y,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- dfparse.y 28 Mar 2004 17:58:30 -0000 1.7 +++ dfparse.y 1 Apr 2004 19:10:53 -0000 1.8 @@ -33,7 +33,6 @@ #include "sys.h" /* xmalloc */ #include "array.h" #include "lpc.h" -#include "lex.h" #define DFVERSION "0.07" #define DFDECL_T "typedef struct {\n\tint ret;\n\tchar *name;\n\tvoid (*fun)(void);\n\t"\ @@ -48,7 +47,8 @@ static int numdecl, failed; static int maxarglen; -YYLTYPE yylloc; +extern FILE *yyin; +/*YYLTYPE yylloc;*/ int find_linear_len(array_t *a); @@ -79,6 +79,8 @@ int i, j, index; dfdecl_t decl; + @1; /* To force bison to define yylloc. */ + decl.ret = $1; decl.name = $2; decl.arglen = find_linear_len(&$4); @@ -159,8 +161,9 @@ int yyerror(char *s) { failed = 1; - if(yylloc.pos) - fprintf(stderr, "dfparse: syntax error in dfdecl.in at %d:%d: %s\n", yylloc.line, yylloc.pos, s); + if(yylloc.first_column) + fprintf(stderr, "dfparse: syntax error in dfdecl.in at %d:%d: %s\n", + yylloc.first_line, yylloc.first_column, s); return 0; } @@ -237,7 +240,8 @@ fprintf(stderr, "Cannot open dfdecl.in: %s\n", strerror(errno)); exit(-1); } - yylloc.line = yylloc.pos = 1; + + yylloc.first_line = yylloc.first_column = 1; yyparse(); if(failed) { Index: debug.c =================================================================== RCS file: /cvsroot/agd/server/src/debug.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- debug.c 28 Mar 2004 17:59:59 -0000 1.9 +++ debug.c 1 Apr 2004 19:10:53 -0000 1.10 @@ -1,6 +1,5 @@ #include "std.h" #include "lpc_incl.h" -#include "debug.h" #ifdef DEBUG @@ -85,50 +84,6 @@ } } -void print_array(array_t *a) -{ - int i; - printf("data: %p; ", (void *) a->data); - printf("({"); - if(!a->data) { - printf(" })"); - return; - } - for(i = 0; i < a->length; i++) { - printf("%ld/%p", i, a->data[i]); - if(i + 1 < a->length) - printf(", "); - } - if(!i) printf(" "); - printf("})"); -} - -void print_var_arr(array_t *a) -{ - int i; - printf("({"); - for(i = 0; i < a->length; i++) { - print_var((variable_t *) a->data[i], 1); - if(i + 1 < a->length) - printf(","); - } - printf("})"); -} - -void print_vmt_arr(array_t *a) -{ - int j; - printf("({ "); - if(a) { - for(j=0;j<a->length;j++) { - print_vm_token(a, &j); - if(j+1<a->length) - printf(", "); - } - } - printf(" }) "); -} - char *opc_name(int i) { switch(i) { @@ -270,6 +225,50 @@ putchar('\n'); } +void print_array(array_t *a) +{ + int i; + printf("data: %p; ", (void *) a->data); + printf("({"); + if(!a->data) { + printf(" })"); + return; + } + for(i = 0; i < a->length; i++) { + printf("%ld/%p", i, a->data[i]); + if(i + 1 < a->length) + printf(", "); + } + if(!i) printf(" "); + printf("})"); +} + +void print_var_arr(array_t *a) +{ + int i; + printf("({"); + for(i = 0; i < a->length; i++) { + print_var((variable_t *) a->data[i], 1); + if(i + 1 < a->length) + printf(","); + } + printf("})"); +} + +void print_vmt_arr(array_t *a) +{ + int j; + printf("({ "); + if(a) { + for(j=0;j<a->length;j++) { + print_vm_token(a, &j); + if(j+1<a->length) + printf(", "); + } + } + printf(" }) "); +} + void print_vm_tokens(array_t *a) { int i; Index: object.c =================================================================== RCS file: /cvsroot/agd/server/src/object.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- object.c 28 Mar 2004 17:53:27 -0000 1.12 +++ object.c 1 Apr 2004 19:10:53 -0000 1.13 @@ -9,6 +9,8 @@ player_t *this_player; object_t *this_ob, *previous_ob; +program_t *compile_prog(char *path); + void free_fun(void *p) { int i; @@ -87,10 +89,12 @@ ob->ref--; } +#if 0 void ref_prog(program_t *prog) { prog->ref++; } +#endif void unref_prog(program_t **prog) { @@ -108,7 +112,7 @@ } } -object_t *find_object(char *s) +object_t *find_object(char *path) { list_t *p; @@ -118,7 +122,7 @@ for(p = &all_objects; p; p = p->next) { object_t *ob = p->data; /* I'd rather not have the check for ob->name here. */ - if(ob->name && strcmp(s, ob->name) == 0) { + if(ob->name && strcmp(path, ob->name) == 0) { return ob; } } @@ -144,8 +148,7 @@ ob = find_object(path); this_ob = ob; if(ob) { - /* Try to recompile the object's - * code. */ + /* Try to recompile the object's code. */ program_t *new_prog; new_prog = compile_prog(path); if(!new_prog) { @@ -184,19 +187,19 @@ return ob; } -object_t *clone_object(char *name) +object_t *clone_object(char *path) { object_t *base_ob, *new_ob; - base_ob = find_object(name); + base_ob = find_object(path); if(!base_ob) { - base_ob = load_object(name); + base_ob = load_object(path); if(!base_ob) return NULL; } #ifdef DEBUG - debug("dfun", "cloning object %s\n", name); + debug("dfun", "cloning object %s\n", path); #endif /* ref_ob(base_ob, NULL);*/ Index: sys.h =================================================================== RCS file: /cvsroot/agd/server/src/sys.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- sys.h 28 Mar 2004 17:50:47 -0000 1.7 +++ sys.h 1 Apr 2004 19:10:53 -0000 1.8 @@ -32,11 +32,11 @@ #define max(i, j) i > j ? i : j +char *add_extension(char *str); +char *absolute_path(char *path); + /* Defined in log.c */ int check_logfile(void); void debug(char *prefix, char *fmt, ...); -char *add_extension(char *str); -char *absolute_path(char *path); - #endif Index: vars.h =================================================================== RCS file: /cvsroot/agd/server/src/vars.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- vars.h 28 Mar 2004 17:49:32 -0000 1.6 +++ vars.h 1 Apr 2004 19:10:53 -0000 1.7 @@ -6,12 +6,14 @@ void init_var(variable_t *var); 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); +char *type2str(int t); + +#if 0 void append_to_var(variable_t *var1, variable_t *var2); variable_t *convert_var(variable_t *var, int type); -variable_t *add_vars(variable_t *v1, variable_t *v2); void assign_var(variable_t *dest, variable_t *src); void assign_var_value(variable_t *var, void *val); - -char *type2str(int t); +#endif #endif Index: dfuns.c =================================================================== RCS file: /cvsroot/agd/server/src/dfuns.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- dfuns.c 28 Mar 2004 17:58:46 -0000 1.17 +++ dfuns.c 1 Apr 2004 19:10:53 -0000 1.18 @@ -1,14 +1,28 @@ -#include "std.h" -#include "lpc_incl.h" -#include "dfuns.h" +#include <stdlib.h> +#include <stdio.h> #include <time.h> #include <errno.h> #include <netdb.h> /* for gethostbyaddr() */ +#include "arch.h" +#include "sys.h" +#include "compile_options.h" +#include "list.h" +#include "array.h" +#include "lpc.h" +#include "object.h" +#include "compile.h" +#include "net.h" +#include "interpret.h" + +extern player_t *this_player; +extern object_t *this_ob, *previous_ob; + +extern list_t all_objects; extern time_t startup_time; /* for uptime() */ +extern array_t global_ids; void (**dfptr)(void); -extern array_t global_ids; void dfuns_init(void) { @@ -178,7 +192,7 @@ push_object(ret); } -void df_interactivep(void) +void df_interactive(void) { object_t *ob = fp->u.ob; int ret = ob && ob->iaob; Index: lang.y =================================================================== RCS file: /cvsroot/agd/server/src/lang.y,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- lang.y 28 Mar 2004 17:57:49 -0000 1.14 +++ lang.y 1 Apr 2004 19:10:53 -0000 1.15 @@ -1,7 +1,7 @@ %{ #include "std.h" #include "lpc_incl.h" -#include "lex.h" +#include "compile.h" /* Used during compilation, replaced with F_JMP. Need to use two separate numbers for both, because one @@ -11,7 +11,7 @@ #define F_CONTINUE_MAGIC1 -3 #define F_CONTINUE_MAGIC2 -4 -YYLTYPE yylloc; +/*YYLTYPE yylloc;*/ /* Lexical tie-ins. */ static int global_type, @@ -20,9 +20,6 @@ continue_allowed; extern int scope_level; -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 make_lvalue(expr_t *e); %} @@ -95,6 +92,9 @@ %% all: program + { + @1; /* Make bison define yylloc. */ + } ; program: @@ -155,7 +155,7 @@ define_id(v->name, ID_ARG, v->type, NULL); } } - $<i>$ = yylloc.line; + $<i>$ = yylloc.first_line; } block_or_semi { @@ -269,7 +269,7 @@ define_id(v->name, ID_ARG, v->type, NULL); } } - $<i>$ = yylloc.line; + $<i>$ = yylloc.first_line; } block_or_semi { @@ -448,7 +448,7 @@ | break ';' { if(!break_allowed) { - comp_error("illegal break"); + comp_error("break used outside a loop"); } init_array(&$$); @@ -457,7 +457,7 @@ | continue ';' { if(!continue_allowed) { - comp_error("illegal continue"); + comp_error("continue used outside a loop"); } init_array(&$$); @@ -1600,24 +1600,12 @@ 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 && strlen($1.arr.data[1]))) { comp_error("not an object to '->'"); } init_array(&$$); -#if 0 - { - array_t *a = &$5, *res; - int i; - res = type_xmalloc(array_t); - init_array(res); - for(i=0;i<a->length;i++) { - array_push(res, copy_array(a->data[i], NULL)); - } - array_push(&$$, res); - } -#endif realargs = type_xmalloc(array_t); init_array(realargs); Index: object.h =================================================================== RCS file: /cvsroot/agd/server/src/object.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- object.h 28 Mar 2004 17:53:27 -0000 1.7 +++ object.h 1 Apr 2004 19:10:53 -0000 1.8 @@ -8,7 +8,7 @@ unsigned int lineno; } function_t; -typedef struct program_t { +typedef struct { array_t functions; array_t fun_table; int ref; @@ -17,7 +17,7 @@ typedef struct object_t { char *name; program_t *prog; - array_t /* * */ variables; + array_t variables; int ref; array_t refs; @@ -35,13 +35,12 @@ void destruct(object_t *ob); void ref_ob(object_t *ob, variable_t *v); void unref_ob(object_t *ob, variable_t *v); -void ref_prog(program_t *prog); +#define ref_prog(x) x->ref++ +/*void ref_prog(program_t *prog);*/ void unref_prog(program_t **prog); -object_t *find_object(char *name); +object_t *find_object(char *path); object_t *load_object(char *path); -object_t *clone_object(char *name); +object_t *clone_object(char *path); void tell_object(object_t *ob, char *s); -void do_exec(object_t *ob); -char *file_name(object_t *ob); #endif Index: dfparse.h =================================================================== RCS file: /cvsroot/agd/server/src/dfparse.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- dfparse.h 28 Mar 2004 17:59:06 -0000 1.4 +++ dfparse.h 1 Apr 2004 19:10:53 -0000 1.5 @@ -55,5 +55,19 @@ extern YYSTYPE yylval; +#if ! defined (YYLTYPE) && ! defined (YYLTYPE_IS_DECLARED) +typedef struct YYLTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +} YYLTYPE; +# define yyltype YYLTYPE /* obsolescent; will be withdrawn */ +# define YYLTYPE_IS_DECLARED 1 +# define YYLTYPE_IS_TRIVIAL 1 +#endif + +extern YYLTYPE yylloc; Index: options =================================================================== RCS file: /cvsroot/agd/server/src/options,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- options 12 Mar 2004 08:40:10 -0000 1.3 +++ options 1 Apr 2004 19:10:53 -0000 1.4 @@ -1,4 +1,4 @@ -# Default options for AGD 0.01. +# Default options for AGD 0.0.3. # You generally only need to edit the 'lib:' option. # External listening port. Index: main.c =================================================================== RCS file: /cvsroot/agd/server/src/main.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- main.c 28 Mar 2004 17:57:04 -0000 1.17 +++ main.c 1 Apr 2004 19:10:53 -0000 1.18 @@ -30,15 +30,13 @@ #include "array.h" #include "lpc.h" #include "object.h" -#include "compile.h" +/*#include "compile.h"*/ #include "net.h" #include "interpret.h" extern object_t *master; - static char *conf_file; - time_t startup_time; void crash(int sig, char *reason, int retval) @@ -165,7 +163,7 @@ #ifndef ALLOW_ROOT if(getuid() == 0) { printf("Please don't run AGD as root - this is a security risk at this point.\n"); - printf("Create a user for it or run it under your own account.\n"); + printf("See README in the source distribution for a longer discussion.\n"); exit(5); } #endif @@ -201,12 +199,8 @@ 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; } Index: vars.c =================================================================== RCS file: /cvsroot/agd/server/src/vars.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- vars.c 28 Mar 2004 17:49:33 -0000 1.10 +++ vars.c 1 Apr 2004 19:10:53 -0000 1.11 @@ -5,17 +5,18 @@ { switch(v->type) { case T_INT: + break; case T_OBJECT: + unref_ob(v->u.ob, v); break; case T_STRING: - if(v->u.s && v->string_type != ST_STATIC) + if(v->string_type != ST_STATIC) xfree(v->u.s); break; default: printf("warning, free_var() doesn't know about type %d\n", v->type); break; } - xfree(v); } int test_var(variable_t *v) @@ -72,6 +73,7 @@ } } +/* Utterly useless, and do_assign() in interpret.c does this. */ variable_t *copy_var(variable_t *src) { variable_t *dest; @@ -202,7 +204,7 @@ xfree(ret); return NULL; } - +#if 0 void assign_var(variable_t *dest, variable_t *src) { if(!src) @@ -232,6 +234,7 @@ break; } } +#endif /* lang.y uses this. */ char *type2str(int t) |