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-06-08 20:19:14
|
Update of /cvsroot/agd/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10678 Modified Files: Ideas Log Message: Superscope globals. Index: Ideas =================================================================== RCS file: /cvsroot/agd/server/Ideas,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Ideas 7 Jun 2004 15:31:39 -0000 1.8 +++ Ideas 8 Jun 2004 20:18:43 -0000 1.9 @@ -1,5 +1,8 @@ This file contains features that will be or will be not in AGD in the future. lpc: + * superscope global variables. Maybe called world scope? + i.e. global foo; - then can be accessed from any object. + And this_object/this_player are driver-defined world globals. * default values for arguments int foo(int i, int j = 1); * Argument type grouping |
From: Peep P. <so...@us...> - 2004-06-07 15:59:19
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12142 Removed Files: lpc_incl.h std.h Log Message: Removed. --- std.h DELETED --- --- lpc_incl.h DELETED --- |
From: Peep P. <so...@us...> - 2004-06-07 15:58:57
|
Update of /cvsroot/agd/server/doc/dfuns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12035 Removed Files: platform version Log Message: Removed. --- platform DELETED --- --- version DELETED --- |
From: Peep P. <so...@us...> - 2004-06-07 15:55:05
|
Update of /cvsroot/agd/server/lib/sys In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11250 Modified Files: login.c master.c player.c Log Message: Updated to use the new forms of dfuns. Index: player.c =================================================================== RCS file: /cvsroot/agd/server/lib/sys/player.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- player.c 1 Apr 2004 19:17:13 -0000 1.13 +++ player.c 7 Jun 2004 15:54:56 -0000 1.14 @@ -86,13 +86,12 @@ if(!i) { string t = strftime(time(), "[%H:%M] "); - shout(t + capitalize(_name) + " says: " + - cmd + "\n", this_object()); + shout(t + capitalize(_name) + " says: "+cmd+"\n"); write(t + "You say: " + cmd + "\n"); } else { if(s == "quit") { shout(strftime(time(), "[%H:%M] ") + capitalize(_name) + - " has quit the game\n", this_object()); + " has quit the game\n"); destruct(this_object()); } else if(s == "uptime") { write("AGD " + version() + " has been running for " + ctime(uptime()) + ".\n"); @@ -131,5 +130,5 @@ } void net_dead() { - shout(_name + " went netdead!", 0); + shout(_name + " went netdead!"); } Index: master.c =================================================================== RCS file: /cvsroot/agd/server/lib/sys/master.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- master.c 1 Apr 2004 19:17:13 -0000 1.13 +++ master.c 7 Jun 2004 15:54:56 -0000 1.14 @@ -4,13 +4,13 @@ int crash(int signal) { if(signal == 11) { shout("Driver shutting down - " - "segmentation fault!\n", 0); + "segmentation fault!\n"); } else if(signal == 2) { - shout("Driver crashing - interrupted!\n", 0); + shout("Driver crashing - interrupted!\n"); } else if(signal) { - shout("Crashing on signal " + signal + "!\n", 0); + shout("Crashing on signal " + signal + "!\n"); } else { - shout("Driver crashing!\n", 0 /* nil */); + shout("Driver crashing!\n"); } return 1; } @@ -29,7 +29,11 @@ } void create(void) { - banner = "\n\t" + version() + " / " + platform() + "\n" + int *a; +/* a = ({ 1, 2, 3 }); + write("a[0]: " + a[0] + "\n");*/ + + banner = "\n\t" + __VERSION__ + " / " + __ARCH__ + "\n" + "\thttp://agd.sf.net\n\tag...@li...\n"; biggest = atoi(read_file("/doc/login/biggest")); } Index: login.c =================================================================== RCS file: /cvsroot/agd/server/lib/sys/login.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- login.c 28 Mar 2004 18:02:33 -0000 1.7 +++ login.c 7 Jun 2004 15:54:56 -0000 1.8 @@ -15,7 +15,7 @@ object ob; string t; - ob = clone_object("/sys/player"); + ob = clone_object("/sys/player"); if(!ob) { write("Uh-oh, the player object doesn't load!\n"); destruct(this_object()); @@ -24,7 +24,7 @@ ob->set_name(name); t = strftime(time(), "[%H:%M] "); - shout(t + name + " has joined the game\n", this_object()); + shout(t + name + " has joined the game\n"); write(t + "You have joined the game.\n"); write("Use '/help' to get a list of commands.\n"); exec(ob); |
From: Peep P. <so...@us...> - 2004-06-07 15:54:43
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11188 Modified Files: interpret.c Log Message: Temporary interpreter, doesn't work yet. Index: interpret.c =================================================================== RCS file: /cvsroot/agd/server/src/interpret.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- interpret.c 3 Apr 2004 20:19:08 -0000 1.18 +++ interpret.c 7 Jun 2004 15:54:34 -0000 1.19 @@ -1,9 +1,32 @@ +#include "compile_options.h" +#include "lpc.h" +#include "list.h" +#include "object.h" + +#include "net.h" +#include "interpret.h" +variable_t *sp, *fp; +control_stack_t control_stack[CONTROL_STACK_SIZE]; +control_stack_t *csp = control_stack; + + +void push_int(int i) { } +void push_void() { } +void push_string(char *s, int i) { } +void push_object(object_t *i) { } +void pop_control_stack(int i) { } +void push_control_stack() { } +void runtime(char *s) { } +variable_t* apply(object_t *ob, char *s, char *fmt, ...) { } +void init_interpreter() { } +int dont_debug_interpreter; +#if 0 #include <stdlib.h> #include <stdarg.h> #include <setjmp.h> #include "compile_options.h" #include "sys.h" -#include "array.h" +/*#include "array.h"*/ #include "lpc.h" #include "object.h" #include "net.h" @@ -151,8 +174,11 @@ void push_array(array_t *a, int type) { + printf("a.data[0]: "); print_var(a->data[0]); putchar('\n'); sp->type = T_ARRAY | type; sp->u.a = a; + printf("a: %p; sp->u.a: %p\n", a, sp->u.a); + printf("a.data[0]: "); print_var(sp->u.a->data[0]); putchar('\n'); /*ref_array(sp->u.a);*/ sp++; CHECK_SP() @@ -160,16 +186,26 @@ void do_assign(variable_t *lval, variable_t *rval) { - *lval = *rval; - switch(lval->type) { + lval->type = rval->type; + if(rval->type & T_ARRAY) { + lval->u.a = rval->u.a; + /*ref_array(lval->u.a);*/ + } else switch(rval->type & ~T_ARRAY) { case T_OBJECT: + lval->u.ob = rval->u.ob; ref_ob(lval->u.ob, lval); break; case T_STRING: + lval->string_type = rval->string_type; if(rval->string_type != ST_STATIC && rval->u.s) { lval->u.s = stringdup(rval->u.s); + } else { + lval->u.s = rval->u.s; } break; + case T_INT: + lval->u.i = rval->u.i; + break; } } @@ -259,7 +295,7 @@ #define GET_ARGS() arg[0] = sp[-1].u.i; pop_stack(); arg[1] = sp[-1].u.i; pop_stack(); -#define TAKE_SLICE() GET_ARGS() if(!sp[-1].u.s) runtime("taking substring of NULL string"); \ +#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; @@ -285,7 +321,8 @@ break; case F_PUSH_STRING: cp++; - push_string((char *)*cp, ST_STATIC); + tmps = this_prog->str_tbl[*cp]; + push_string(tmps, ST_STATIC); break; case F_PUSH_VOID: push_void(); @@ -296,12 +333,18 @@ case F_PUSH_ARRAY: { array_t *a = type_xmalloc(array_t); - init_array(a); arg[0] = *++cp; arg[1] = *++cp; + a->length = arg[1]; + a->data = calloc(arg[1], sizeof(variable_t*)); for(tmpi=0;tmpi<arg[1];tmpi++) { - array_push(a, --sp); + do_assign(&a->data[tmpi], --sp); + /* Note that we're not freeing the arguments, + * as they go into the array. */ } + printf("a0: "); print_var(a->data[0]); putchar('\n'); + sp -= arg[1]; + printf("a.data[0]: "); print_var(a->data[0]); putchar('\n'); push_array(a, arg[0]); } break; @@ -378,21 +421,34 @@ push_int(tmpi); break; case F_INDEX: - if(!sp[-2].u.s) { - runtime("taking element of NULL string"); - } arg[0] = sp[-1].u.i; pop_stack(); - arg[1] = sp[-1].u.s[arg[0]]; - pop_stack(); - push_int(arg[1]); + + if(sp[-1].type & T_ARRAY) { + if(!sp[-1].u.a) { + runtime("taking element of null array"); + } + if(arg[0] >= sp[-1].u.a->length || arg[0] < 0) { + runtime("index out of range"); + } + tmpvp = sp[-1].u.a->data[arg[0]]; + pop_stack(); + push_var(tmpvp); + } else { + if(!sp[-1].u.s) { + runtime("taking element of null string"); + } + arg[1] = sp[-1].u.s[arg[0]]; + pop_stack(); + push_int(arg[1]); + } break; case F_INDEX_LVALUE: /* A bit hacky. */ arg[0] = sp[-1].u.i; pop_stack(); if(!sp[-1].u.s) { - runtime("taking element of NULL string"); + runtime("taking element of null string"); } do_assign(sp, &sp[-1]); sp->u.s += arg[0]; @@ -508,7 +564,7 @@ } if(!tmpv.u.ob) { - runtime("call_other on NULL object"); + runtime("call_other on null object"); } tmpi = get_fun_index(tmpv.u.ob, tmps); @@ -691,4 +747,4 @@ have_error_context = 0; return fp; } - +#endif |
From: Peep P. <so...@us...> - 2004-06-07 15:54:15
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11108 Modified Files: lang.y Log Message: Wholly new compiler; still work-in-progress Index: lang.y =================================================================== RCS file: /cvsroot/agd/server/src/lang.y,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- lang.y 3 Apr 2004 20:19:08 -0000 1.16 +++ lang.y 7 Jun 2004 15:54:05 -0000 1.17 @@ -1,45 +1,68 @@ %{ -#include "std.h" -#include "lpc_incl.h" + +/* TODO: pop locals after returning from block */ +#include <stdlib.h> +#include "config.h" +#include "compile_options.h" + +#include "sys.h" +#include "list.h" [...2378 lines suppressed...] } +void do_inc_expr(expr_t *result, int type, int op) +{ + result->side_effect = 1; + result->direct_type = 0; + result->type = type; + check_operand(op, type, 0); + add_token(op); +} + +int add_string_to_table(char *s) { + int num; + char **tbl; + num = ++this_prog->num_str; + + tbl = this_prog->str_tbl = xrealloc(this_prog->str_tbl, num * sizeof(char *)); + tbl[num-1] = s; + return num - 1; +} |
From: Peep P. <so...@us...> - 2004-06-07 15:51:38
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10409/src Modified Files: Makefile.in config.h.in dfparse.h lang.h Log Message: Regenerated. Index: lang.h =================================================================== RCS file: /cvsroot/agd/server/src/lang.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- lang.h 1 Apr 2004 19:10:53 -0000 1.8 +++ lang.h 7 Jun 2004 15:51:29 -0000 1.9 @@ -29,14 +29,14 @@ /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { - L_RETURN = 258, - L_IF = 259, - L_ELSE = 260, - L_DO = 261, - L_WHILE = 262, - L_FOR = 263, - L_CONTINUE = 264, - L_BREAK = 265, + L_IF = 258, + L_ELSE = 259, + L_DO = 260, + L_WHILE = 261, + L_FOR = 262, + L_CONTINUE = 263, + L_BREAK = 264, + L_RETURN = 265, L_DATA_TYPE = 266, L_IDENTIFIER = 267, L_STRING = 268, @@ -48,42 +48,33 @@ L_OPEN_FUNP = 274, L_CLOSE_FUNP = 275, L_RANGE = 276, - L_ASSIGN = 277, - L_ME = 278, - L_PE = 279, - L_DE = 280, - L_MOE = 281, - L_MUE = 282, - L_POWE = 283, - L_AND = 284, - L_OR = 285, - L_NE = 286, - L_EQ = 287, - L_MINUS = 288, - L_PLUS = 289, - L_GE = 290, - L_LE = 291, - L_GT = 292, - L_LT = 293, - L_MOD = 294, - L_DIV = 295, - L_MUL = 296, - L_POW = 297, - L_DEREF = 298, - L_DEC = 299, - L_INC = 300, - L_NOT = 301, - L_NEG = 302 + L_MINUS_EQ = 277, + L_PLUS_EQ = 278, + L_DIV_EQ = 279, + L_MOD_EQ = 280, + L_MUL_EQ = 281, + L_POW_EQ = 282, + L_AND = 283, + L_OR = 284, + L_NE = 285, + L_EQ = 286, + L_GE = 287, + L_LE = 288, + L_POW = 289, + L_ARROW = 290, + L_DEC = 291, + L_INC = 292, + L_NEG = 293 }; #endif -#define L_RETURN 258 -#define L_IF 259 -#define L_ELSE 260 -#define L_DO 261 -#define L_WHILE 262 -#define L_FOR 263 -#define L_CONTINUE 264 -#define L_BREAK 265 +#define L_IF 258 +#define L_ELSE 259 +#define L_DO 260 +#define L_WHILE 261 +#define L_FOR 262 +#define L_CONTINUE 263 +#define L_BREAK 264 +#define L_RETURN 265 #define L_DATA_TYPE 266 #define L_IDENTIFIER 267 #define L_STRING 268 @@ -95,49 +86,42 @@ #define L_OPEN_FUNP 274 #define L_CLOSE_FUNP 275 #define L_RANGE 276 -#define L_ASSIGN 277 -#define L_ME 278 -#define L_PE 279 -#define L_DE 280 -#define L_MOE 281 -#define L_MUE 282 -#define L_POWE 283 -#define L_AND 284 -#define L_OR 285 -#define L_NE 286 -#define L_EQ 287 -#define L_MINUS 288 -#define L_PLUS 289 -#define L_GE 290 -#define L_LE 291 -#define L_GT 292 -#define L_LT 293 -#define L_MOD 294 -#define L_DIV 295 -#define L_MUL 296 -#define L_POW 297 -#define L_DEREF 298 -#define L_DEC 299 -#define L_INC 300 -#define L_NOT 301 -#define L_NEG 302 +#define L_MINUS_EQ 277 +#define L_PLUS_EQ 278 +#define L_DIV_EQ 279 +#define L_MOD_EQ 280 +#define L_MUL_EQ 281 +#define L_POW_EQ 282 +#define L_AND 283 +#define L_OR 284 +#define L_NE 285 +#define L_EQ 286 +#define L_GE 287 +#define L_LE 288 +#define L_POW 289 +#define L_ARROW 290 +#define L_DEC 291 +#define L_INC 292 +#define L_NEG 293 #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 30 "lang.y" +#line 52 "lang.y" typedef union YYSTYPE { char *str; int i; char c; /* used by lex.l */ - variable_t var; - array_t arr; + struct arr_t { + int length; + int *data; + } arr; expr_t expr; def_id_t *id; } YYSTYPE; /* Line 1240 of yacc.c. */ -#line 141 "lang.h" +#line 125 "lang.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 Index: config.h.in =================================================================== RCS file: /cvsroot/agd/server/src/config.h.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- config.h.in 1 Apr 2004 19:17:14 -0000 1.3 +++ config.h.in 7 Jun 2004 15:51:29 -0000 1.4 @@ -1,24 +1,8 @@ /* src/config.h.in. Generated from configure.ac by autoheader. */ -/* Define to 1 if you have the <arpa/inet.h> header file. */ -#undef HAVE_ARPA_INET_H - -/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. - */ -#undef HAVE_DIRENT_H - -/* Define to 1 if you have the <fcntl.h> header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `getcwd' function. */ -#undef HAVE_GETCWD - /* Define to 1 if you have the <inttypes.h> header file. */ #undef HAVE_INTTYPES_H -/* 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 @@ -31,62 +15,27 @@ /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ -#undef HAVE_NDIR_H - -/* Define to 1 if you have the <netinet/in.h> header file. */ -#undef HAVE_NETINET_IN_H - -/* Define to 1 if you have the `select' function. */ -#undef HAVE_SELECT - /* Define to 1 if the system has the type `size_t'. */ #undef HAVE_SIZE_T -/* Define to 1 if you have the `socket' function. */ -#undef HAVE_SOCKET - /* Define to 1 if the system has the type `socklen_t'. */ #undef HAVE_SOCKLEN_T -/* Define to 1 if you have the <stddef.h> header file. */ -#undef HAVE_STDDEF_H - /* Define to 1 if you have the <stdint.h> header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the <stdlib.h> header file. */ #undef HAVE_STDLIB_H -/* Define to 1 if you have the `strerror' function. */ -#undef HAVE_STRERROR - /* 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 <sys/dir.h> header file, and it defines `DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the <sys/socket.h> header file. */ -#undef HAVE_SYS_SOCKET_H - /* Define to 1 if you have the <sys/stat.h> header file. */ #undef HAVE_SYS_STAT_H -/* Define to 1 if you have the <sys/time.h> header file. */ -#undef HAVE_SYS_TIME_H - /* Define to 1 if you have the <sys/types.h> header file. */ #undef HAVE_SYS_TYPES_H @@ -120,18 +69,12 @@ /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS -/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your <sys/time.h> declares `struct tm'. */ -#undef TM_IN_SYS_TIME - /* Version number of package */ #undef VERSION +/* Yacc debug */ +#undef YYDEBUG + /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const Index: Makefile.in =================================================================== RCS file: /cvsroot/agd/server/src/Makefile.in,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- Makefile.in 1 Apr 2004 19:17:14 -0000 1.11 +++ Makefile.in 7 Jun 2004 15:51:29 -0000 1.12 @@ -113,7 +113,7 @@ AM_CFLAGS = -ansi -AM_YFLAGS = -d +AM_YFLAGS = -dv 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 dfparse.h lang.c lang.h lex.c + config.h.in dflex.c dfparse.c lang.c lex.c SOURCES = $(agd_SOURCES) $(dfparse_SOURCES) all: $(BUILT_SOURCES) config.h @@ -231,19 +231,9 @@ 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) @@ -435,13 +425,11 @@ 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 \ Index: dfparse.h =================================================================== RCS file: /cvsroot/agd/server/src/dfparse.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- dfparse.h 1 Apr 2004 19:10:53 -0000 1.5 +++ dfparse.h 7 Jun 2004 15:51:29 -0000 1.6 @@ -40,14 +40,17 @@ #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) -#line 57 "dfparse.y" +#line 53 "dfparse.y" typedef union YYSTYPE { char *s; int i; - array_t a; + struct arr_t { + int length; + long int *data; + } a; } YYSTYPE; /* Line 1240 of yacc.c. */ -#line 51 "dfparse.h" +#line 54 "dfparse.h" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 |
From: Peep P. <so...@us...> - 2004-06-07 15:51:38
|
Update of /cvsroot/agd/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10409 Modified Files: configure Log Message: Regenerated. Index: configure =================================================================== RCS file: /cvsroot/agd/server/configure,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- configure 1 Apr 2004 19:17:12 -0000 1.7 +++ configure 7 Jun 2004 15:51:29 -0000 1.8 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.ac revision 0.08. +# From configure.ac revision 0.09. # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for AGD 0.0.3. # @@ -857,7 +857,7 @@ --enable-dependency-tracking Do not reject slow dependency extractors --enable-profiling enable profiling support --disable-debug disable debugging symbols - --enable-bison-debug enable Bison debugging + --enable-yacc-debug enable Yacc debugging --enable-optimization set optimization level Some influential environment variables: @@ -3265,46 +3265,7 @@ if test "$LEX" = :; then LEX=${am_missing_run}flex fi -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - +#AC_PROG_AWK CFLAGS="" # Checks for configure options. @@ -3344,17 +3305,22 @@ echo "${ECHO_T}no" >&6 fi -echo "$as_me:$LINENO: checking whether to enable Bison debugging" >&5 -echo $ECHO_N "checking whether to enable Bison debugging... $ECHO_C" >&6 -# Check whether --enable-bison-debug or --disable-bison-debug was given. -if test "${enable_bison_debug+set}" = set; then - enableval="$enable_bison_debug" +echo "$as_me:$LINENO: checking whether to enable Yacc debugging" >&5 +echo $ECHO_N "checking whether to enable Yacc debugging... $ECHO_C" >&6 +# Check whether --enable-yacc-debug or --disable-yacc-debug was given. +if test "${enable_yacc_debug+set}" = set; then + enableval="$enable_yacc_debug" else - enable_bison_debug="no" + enable_yacc_debug="no" fi; -if test "x${enable_bison_debug}" != "xno"; then - YFLAGS="$YFLAGS -t" +if test "x${enable_yacc_debug}" != "xno"; then + +cat >>confdefs.h <<\_ACEOF +#define YYDEBUG 1 +_ACEOF + +# YFLAGS="$YFLAGS -t" echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else @@ -3387,79 +3353,9 @@ fi # Checks for libraries. - -echo "$as_me:$LINENO: checking for floor in -lm" >&5 -echo $ECHO_N "checking for floor in -lm... $ECHO_C" >&6 -if test "${ac_cv_lib_m_floor+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lm $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char floor (); -int -main () -{ -floor (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_m_floor=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_m_floor=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_m_floor" >&5 -echo "${ECHO_T}$ac_cv_lib_m_floor" >&6 -if test $ac_cv_lib_m_floor = yes; then - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBM 1 -_ACEOF - - LIBS="-lm $LIBS" - -fi - +##AC_CHECK_LIB(m, floor) # This was needed by bytes_string, + # which was needed by memory statistics, + # which doesn't exist anymore. ##AC_CHECK_LIB(resolv, accept) echo "$as_me:$LINENO: checking for gethostbyaddr in -lnsl" >&5 @@ -3609,6 +3505,10 @@ # Checks for header files. +#AC_HEADER_STDC +#AC_HEADER_DIRENT +#AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stddef.h sys/socket.h sys/time.h unistd.h winsock.h]) + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -4024,331 +3924,6 @@ fi - - - - - -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 -echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <$ac_hdr> - -int -main () -{ -if ((DIR *) 0) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 -_ACEOF - -ac_header_dirent=$ac_hdr; break -fi - -done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 -if test "${ac_cv_search_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in dir; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" - -fi - -else - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 -if test "${ac_cv_search_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in x; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" - -fi - -fi - # On IRIX 5.3, sys/types and inttypes.h are conflicting. @@ -4421,14 +3996,7 @@ - - - - - - - -for ac_header in arpa/inet.h fcntl.h netinet/in.h stddef.h sys/socket.h sys/time.h unistd.h winsock.h +for ac_header in winsock.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if eval "test \"\${$as_ac_Header+set}\" = set"; then @@ -4728,112 +4296,7 @@ # Checks for typedefs, structures, and compiler characteristics. -echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 -if test "${ac_cv_c_const+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset x; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - ccp = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - } -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_c_const=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_c_const=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 -if test $ac_cv_c_const = no; then - -cat >>confdefs.h <<\_ACEOF -#define const -_ACEOF - -fi - +#AC_C_CONST echo "$as_me:$LINENO: checking for size_t" >&5 echo $ECHO_N "checking for size_t... $ECHO_C" >&6 if test "${ac_cv_type_size_t+set}" = set; then @@ -4961,132 +4424,8 @@ fi -echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 -if test "${ac_cv_header_time+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <sys/time.h> -#include <time.h> - -int -main () -{ -if ((struct tm *) 0) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_time=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_time=no -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -echo "${ECHO_T}$ac_cv_header_time" >&6 -if test $ac_cv_header_time = yes; then - -cat >>confdefs.h <<\_ACEOF -#define TIME_WITH_SYS_TIME 1 -_ACEOF - -fi - -echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 -echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6 -if test "${ac_cv_struct_tm+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <time.h> - -int -main () -{ -struct tm *tp; tp->tm_sec; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_struct_tm=time.h -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_struct_tm=sys/time.h -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 -echo "${ECHO_T}$ac_cv_struct_tm" >&6 -if test $ac_cv_struct_tm = sys/time.h; then - -cat >>confdefs.h <<\_ACEOF -#define TM_IN_SYS_TIME 1 -_ACEOF - -fi - +#AC_HEADER_TIME +#AC_STRUCT_TM # Checks for library functions. #AC_FUNC_MALLOC @@ -5095,111 +4434,7 @@ #AC_FUNC_STRFTIME #AC_FUNC_VPRINTF #AC_CHECK_FUNCS([atexit floor getcwd memset select socket strchr strerror strstr]) - - - - - -for ac_func in getcwd memset select socket strerror -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. - For example, HP-UX 11i <limits.h> declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - +#AC_CHECK_FUNCS([getcwd memset select socket strerror]) cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure |
From: Peep P. <so...@us...> - 2004-06-07 15:50:28
|
Update of /cvsroot/agd/server In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10172 Modified Files: ChangeLog NEWS TODO Log Message: Updates for 0.0.3. Index: NEWS =================================================================== RCS file: /cvsroot/agd/server/NEWS,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- NEWS 1 Apr 2004 19:17:12 -0000 1.11 +++ NEWS 7 Jun 2004 15:50:19 -0000 1.12 @@ -1,5 +1,9 @@ Changes in 0.0.3: * Renamed interactivep() to interactive() + * Locals can now be defined in the middle of code. + * dfun platform() changed to a preprocessor macro __ARCH__, + version() to __VERSION__. + * New dfuns: throw() Features in 0.0.2-3: * Real string ranges like string[0..4] Index: TODO =================================================================== RCS file: /cvsroot/agd/server/TODO,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- TODO 1 Apr 2004 19:17:12 -0000 1.18 +++ TODO 7 Jun 2004 15:50:19 -0000 1.19 @@ -2,23 +2,31 @@ '!' means first-priority, '?' means trivial and not really important. + - dfparse.y: remove argument variants. Use combinations of mixed type and function overloading + - dfparse.y and dfdecl.in: remove all the c-name stuff, it's always "df_" + name + ? remove all the typedefs for the structs etc? Currently it's bad style. + - compile.c::compile_prog() should show global vars + - debug.c::print_code() should show functions' arguments + + ! new interpreter! + ? optimize string tables - remove repetitions + ! lang.y: while, for, break, continue + fix lvalues + test operators: + && || ?: + - documentation: * Small textbook about AGD's dialect of LPC * Short text describing main differences between LPC and C * Short text describing AGD and it's purposes, mainly for people coming from the AGI community. - - syntax highlighting scripts for AGD's LPC - * for vim; Me (solicit) will give it a try - * for emacs; I'm counting on you, elver! + - syntax highlighting scripts for AGD's LPC (vim, emacs) - - the famous host lookup daemon, so gethostbyaddr() won't block - - define_id system: - - if a variable is shadowed inside a block, then it needs to be - assigned a new index (?) - - argument variants (both d- and lfuns) + - the famous host lookup daemon, so gethostbyaddr() won't block. + Or maybe a separate thread with libpthread? - New configuration parser. - - Change 'errorlog' to 'debuglog', or change debug() to be an error + - Change 'errorlog' to just 'log', or change debug() to be an error logging facility, or remove the option completely. - Default error level option. - For lib: option - if it doesn't end in /, add it. @@ -28,36 +36,18 @@ - allow both .c and .lpc for file extensions (/usr/bin/file could recognize LPC, and editors can turn on syntax highlighting automatically) - Runtime token positions (with the F_NEWLINE operator). - - Some work could be done on i18n. For example, allow for multilingual yyerror-messages. - One way would be a master::error_msg() apply that takes a numeric code of the error - message and should return the string. Mudlib coders can code in their own language. - Interpreter. - three versions of runtime() - for dfuns (doesn't display line numbers) - for dynamically allocated strings (automatically frees the string after runtiming) - normal runtime - display stack trace (with line numbers and functions) when getting a runtime error -- keep interactive objects in a separate linked list, and make shout act on that list - Then change shout to take one argument, a string, and send to everyone except - this_player. - - destruct() - take object from all_objects and move to list_t *dested_objects; - then destruct_all() in net.c has less objects to traverse - - string table for each program, and F_PUSH_STRING takes index into the table - Repeated strings can be joined into one, and free_fun can free the strings. - - clean up includes, not everything needs everything in std.h and lpc_incl.h, etc. - Files that need it: - debug.c object.c vars.c lex.l lang.y + - keep interactive objects in a separate linked list, and make shout act on that list - Build system. * make maintainer-clean - should also remove src/dfparse.output and src/lang.output - shouldn't delete src/dfparse.h and src/lang.h - * make install should touch $prefix/agd/debug.log - * configure.ac: set YFLAGS to "--debug" or "-t" with ./configure --enable-bison-debug - - Compiler (lang.y): - - compile-time eval for < > <= >= == != ! (i.e. if(direct_type)) - - repeated code for functions with and without explicit return type + should also remove src/dfparse.output and src/lang.output + shouldn't delete src/dfparse.h and src/lang.h - LPC: - ? Error recovery for lpc.y ! arrays (T_ARRAY) - foreach(), switch() - all of the operators (/doc/lpc/operators) @@ -69,12 +59,9 @@ - Check if assigning too long a string. * m.. * ..n - * m..n,m..n + * m..n,o..p * !n - inheritance - ? 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 @@ -111,19 +98,22 @@ - hexadecimal: \0xnn - binary: \0bnnnnnnnn - multiline strings - ? better logging system + +? better logging system - print time using strftime() - log using lib's facilities (master::log()?) - different prefixes have different debuglevels - save to different files - ? only report undeclared identifiers once + ? only report undeclared identifiers once (this is generally a Bad Thing) + ? warn about unused variables ? initialization of global variables ? dfun overrides, :: operator -? check for lib root and folder of debug log with access() and exit gracefully if it fails. + ? check for lib root and folder of debug log with access() and exit gracefully if it fails. ? if we crash while running apply(master::crash), then we should rerun with debugging on - ? realloc wrapper to check for out of memory errors - ! on 64-bit, increase cp properly (points to between two instructions) ? IPv6 support? ? Supply a malloc implementation with statistics (a la MudOS)? ? Statistics and profiling + ? Some work could be done on i18n. For example, allow for multilingual yyerror-messages. + One way would be a master::error_msg() apply that takes a numeric code of the error + message and should return the string. Mudlib coders can code in their own language. Index: ChangeLog =================================================================== RCS file: /cvsroot/agd/server/ChangeLog,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- ChangeLog 1 Apr 2004 19:17:12 -0000 1.17 +++ ChangeLog 7 Jun 2004 15:50:19 -0000 1.18 @@ -1,5 +1,55 @@ 0.0.3: ---------------------------------------------------------------------------- +2004-06-04 + * dfdecl.in,dfuns.c: throw() dfun + * various: removed references to type_xmalloc, was a silly thing + * lang.y,interpret.c,debug.c: basic string tables + * sys.c: xrealloc() + * lex.l: one-liner comments (C++-style) can now span several lines + if they are ended with a slash. Like this: + // this comment \ + spans several \ + lines + * lex.l: added fake __VERSION__ and __ARCH__ macros + * net.c,object.c: destructed objects go to a list 'to_be_dested', which + destruct_all() will then traverse - less objects to go through +2004-05-30 + * dfuns.c: write() doesn't return anything anymore. + shout() now only takes one parameter - text to send, and + sends this to all interactive objects, excluding this_player. + These two changes imitate MudOS behaviour. + Trying to work more on AGD from now on. +2004-04-23 + * arch.h: OpenBSD +2004-04-17 + * compile.c: curr_f_check() now set curr_fun->code to NULL, fixes crasher. + * configure.ac: removed a lot of checks for things I don't see as + necessary. This probably hurts portability, but at least it's faster. + * configure.ac: Renamed --enable-bison-debug to --enable-yacc-debug. + And it now works. +2004-04-08 + * lang.y: More hacking, now compiles. + * Cleaned headers on some files. +2004-04-07 + * lang.y: More ugly, twisted grammar hacking. +2004-04-06 + * net.c: Didn't change to use HAVE_WINSOCK_H instead of WINSOCK. Ow. +2004-04-05 + * lang.y: Continued work. + Some highlights: + Reduced CPU and memory usage, and quite a lot. + Variables can be defined inside code. + lvalue statement, so expr_t uses less memory. +2004-04-04 + * sys.c,sys.h: removed memory statistics + * array.c,array.h: arrays are now only an LPC datatype, and not + in internal data structures. + * lang.y: MAJOR changes and improvements: + array_t's (as they are in array.h) are not used for compilation + anymore. No array_concats, no array_pushes, no array_removes + are called. Compilation should be many times faster now. + Also, code was kept in memory doubled - once in the actual + code, once in the expressions. This isn't so anymore. 2004-03-30 * dflex.l,lex.l,dfparse.y,lang.y: Removed lex.h and location_t, all of these now use Bison's YYLTYPE. |
From: Peep P. <so...@us...> - 2004-06-07 15:46:24
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9225 Modified Files: vars.c vars.h Log Message: Rearranged headers; various fixes Index: vars.c =================================================================== RCS file: /cvsroot/agd/server/src/vars.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- vars.c 3 Apr 2004 20:10:33 -0000 1.12 +++ vars.c 7 Jun 2004 15:46:15 -0000 1.13 @@ -1,12 +1,17 @@ -#include "std.h" -#include "lpc_incl.h" +/* #include "config.h" */ +/* #include "compile_options.h" */ +#include <stdlib.h> +/*#include "arch.h"*/ +#include "sys.h" +#include "list.h" +#include "lpc.h" +#include "object.h" void free_var(variable_t *v) { - switch(v->type) { - case T_INT: - case T_LVALUE: - break; + if(v->type & T_ARRAY) { + /* unref_array(v->u.a); */ + } else switch(v->type & ~T_ARRAY) { case T_OBJECT: unref_ob(v->u.ob, v); break; @@ -14,9 +19,6 @@ 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; } } @@ -74,6 +76,7 @@ } } +#if 0 /* Utterly useless, and do_assign() in interpret.c does this. */ variable_t *copy_var(variable_t *src) { @@ -92,6 +95,7 @@ return dest; } +#endif void init_var(variable_t *var) { @@ -120,7 +124,7 @@ if(!v1 || !v2) return NULL; - ret = type_xmalloc(variable_t); + ret = xmalloc(sizeof(variable_t)); ret->name = NULL; /* Just for debugging. Remove later. */ switch(v1->type) { @@ -240,13 +244,34 @@ /* lang.y uses this. */ char *type2str(int t) { + if(t & T_ARRAY) { + switch(t & ~T_ARRAY) { + case T_VOID: + return "array of void"; + case T_INT: + return "array of int"; + case T_STRING: + return "array of string"; + case T_OBJECT: + return "array of object"; + case T_LVALUE: + return "array of lvalue"; + default: + return "array of unknown"; + } + } + switch(t) { + case T_VOID: + return "void"; case T_INT: return "int"; case T_STRING: return "string"; case T_OBJECT: return "object"; + case T_LVALUE: + return "lvalue"; default: return "unknown"; } Index: vars.h =================================================================== RCS file: /cvsroot/agd/server/src/vars.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- vars.h 1 Apr 2004 19:10:53 -0000 1.7 +++ vars.h 7 Jun 2004 15:46:15 -0000 1.8 @@ -9,11 +9,4 @@ 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); -void assign_var(variable_t *dest, variable_t *src); -void assign_var_value(variable_t *var, void *val); -#endif - #endif |
From: Peep P. <so...@us...> - 2004-06-07 15:46:00
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9102 Modified Files: sys.c sys.h Log Message: Removed type_xmalloc, removed memory stats, added xrealloc Index: sys.h =================================================================== RCS file: /cvsroot/agd/server/src/sys.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- sys.h 1 Apr 2004 19:10:53 -0000 1.8 +++ sys.h 7 Jun 2004 15:45:51 -0000 1.9 @@ -2,10 +2,12 @@ #define _SYS_H /* memory allocation */ -#define type_xmalloc(type) (type *) xmalloc(sizeof(type)) +/*#define type_xmalloc(type) (type *) xmalloc(sizeof(type))*/ void *xmalloc(size_t bytes); +void *xrealloc(void *ptr, size_t bytes); void xfree(void *p); +#if 0 /* memory stats */ void mstats_summary(void); @@ -14,11 +16,14 @@ int free, free_on_null; int total_alloced; } mstats_t; +#endif /* configuration */ typedef struct { int port, heartbeat; +/* int exit_stats; +*/ char *lib_root, *error_log; char *master; int debuglevel; Index: sys.c =================================================================== RCS file: /cvsroot/agd/server/src/sys.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- sys.c 1 Apr 2004 19:10:53 -0000 1.13 +++ sys.c 7 Jun 2004 15:45:51 -0000 1.14 @@ -2,10 +2,10 @@ started in november 2003 by solicit changelog: + 4. June, 2004: wrote custom realloc() 2. December 2003: wrote custom malloc() */ -/* todo - custom realloc() */ #include "config.h" #include <stdlib.h> @@ -21,7 +21,9 @@ #include "compile_options.h" config_t conf; +/* static mstats_t mstats; +*/ #define CONFCHECK(x, y) if((x) == 0) { \ fprintf(stderr, "\""y": \" directive not found in config file.\n"); \ @@ -42,9 +44,10 @@ fprintf(stderr, "Can't open configuration file! (%s)\n", strerror(errno)); exit(5); } - +/* conf.exit_stats = 0; - +*/ + while(fscanf(f, "%s ", buf) != EOF) { line++; if(strncmp(buf, "port:", 5) == 0) { @@ -68,12 +71,12 @@ conf.error_log = stringdup(buf); continue; } - +/* if(strncmp(buf, "exitstats:", 11) == 0) { fscanf(f, "%d\n", &conf.exit_stats); continue; } - +*/ if(strncmp(buf, "master:", 8) == 0) { fscanf(f, "%s\n", buf); conf.master = stringdup(buf); @@ -98,6 +101,7 @@ CONFCHECK(conf.master, "master"); } +#if 0 char *bytes_string(int bytes) { static char buf[256]; @@ -141,29 +145,43 @@ printf(" Average bytes per call: %s\n", bytes_string(avg)); printf("----------------------------------------------------------\n"); } +#endif void *xmalloc(size_t bytes) { void *p; p = malloc(bytes); - mstats.alloc++; +/* mstats.alloc++;*/ if(!p) { fprintf(stderr, "Out of memory!\n"); - /* Call crash() ? */ + exit(1); /* Or crash()? */ + } + +/* mstats.total_alloced += bytes;*/ + return p; +} + +void *xrealloc(void *ptr, size_t bytes) +{ + void *p; + p = realloc(ptr, bytes); + + if(!p) { + fprintf(stderr, "Out of memory!\n"); + exit(1); } - mstats.total_alloced += bytes; return p; } #ifdef DEBUG void xfree(void *p) { - mstats.free++; +/* mstats.free++;*/ if(!p) { fprintf(stderr, "free() called on a nullpointer!\n"); - mstats.free_on_null++; +/* mstats.free_on_null++;*/ return; } |
From: Peep P. <so...@us...> - 2004-06-07 15:45:30
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9013 Modified Files: object.h Log Message: Removed uses of array_t. Index: object.h =================================================================== RCS file: /cvsroot/agd/server/src/object.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- object.h 1 Apr 2004 19:10:53 -0000 1.8 +++ object.h 7 Jun 2004 15:45:20 -0000 1.9 @@ -3,27 +3,39 @@ typedef struct { int type; - array_t args; - array_t code; + + int *args; + int numarg; + + long int *code; + int codelen; + unsigned int lineno; } function_t; typedef struct { - array_t functions; - array_t fun_table; + function_t **functions; /* This shouldn't be an array to pointers. */ + int numfunc; + char **fun_table; /* This should be a hash table. */ + + int num_str; + char **str_tbl; + int ref; } program_t; typedef struct object_t { char *name; + program_t *prog; - array_t variables; + variable_t *globals; + int numglobals; - int ref; - array_t refs; + int numref; + list_t refs; int flags; - struct object_t *location, *parent; + struct object_t *environment, *parent; struct object_t **inv; /* The interactive player associated with this object. */ |
From: Peep P. <so...@us...> - 2004-06-07 15:45:11
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8933 Modified Files: object.c Log Message: Rearranged headers; various fixes Index: object.c =================================================================== RCS file: /cvsroot/agd/server/src/object.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- object.c 1 Apr 2004 19:10:53 -0000 1.13 +++ object.c 7 Jun 2004 15:45:02 -0000 1.14 @@ -1,8 +1,22 @@ -/* Definitions of dfuns related to objects. */ -#include "std.h" -#include "lpc_incl.h" +/* +#include "config.h" +*/ +#include <stdlib.h> +/*#include "arch.h"*/ +#include "sys.h" +#include "compile_options.h" -list_t all_objects; +#include "list.h" +#include "lpc.h" +#include "object.h" +#include "net.h" +#include "vars.h" + +list_t all_objects, + to_be_dested; /* Objects which have the destructed flag + set, but are still in memory. This is so + that destruct_all() in net.c has less + objects to traverse. */ object_t *master; @@ -16,12 +30,9 @@ int i; function_t *f = p; - for(i=0;i<f->args.length;i++) - free_var(f->args.data[i]); - if(f->args.data) - xfree(f->args.data); + if(f->args) + xfree(f->args); - /* Can't do this. Need string tables. */ #if 0 for(i=0;i<f->code.length;i++) { if((int) f->code.data[i] == F_PUSH_STRING) { @@ -31,12 +42,14 @@ } } #endif - xfree(f->code.data); + + xfree(f->code); } void destruct(object_t *ob) { int i; + list_t *p; if(!ob) return; @@ -50,11 +63,13 @@ ob->iaob->ob = NULL; } - for(i=0;i<ob->refs.length;i++) { - variable_t *v = ob->refs.data[i]; + for(p=&ob->refs;p->next;p=p->next) { + variable_t *v = p->data; v->u.ob = NULL; } + list_remove(&all_objects, ob); + list_push(&to_be_dested, ob); #ifdef DEBUG debug("dfun", "destructed \"%s\"\n", ob->name); #endif @@ -62,11 +77,11 @@ void actual_destruct(object_t *ob) { - list_remove(&all_objects, ob); +/* list_remove(&all_objects, ob);*/ unref_prog(&ob->prog); - free_array(&ob->variables, (void (*)(void*))free_var); + free_array(&ob->globals, (void (*)(void*))free_var); if(ob->name) xfree(ob->name); @@ -77,24 +92,21 @@ { if(!ob) return; - array_push(&ob->refs, v); - ob->ref++; + + ob->numref++; + if(v) { + list_push(&ob->refs, v); + } } void unref_ob(object_t *ob, variable_t *v) { if(!ob) return; - array_remove_by_data(&ob->refs, v); - ob->ref--; -} -#if 0 -void ref_prog(program_t *prog) -{ - prog->ref++; + list_remove(&ob->refs, v); + ob->numref--; } -#endif void unref_prog(program_t **prog) { @@ -105,6 +117,11 @@ p->ref--; if(p->ref <= 0) { + int i; + for(i=0;i<p->num_str;i++) + xfree(p->str_tbl[i]); + xfree(p->str_tbl); + free_array(&p->functions, free_fun); free_array(&p->fun_table, NULL); xfree(p); @@ -121,7 +138,9 @@ for(p = &all_objects; p; p = p->next) { object_t *ob = p->data; - /* I'd rather not have the check for ob->name here. */ + /* I'd rather not have the check for ob->name here. + * It's only here because of net.c, which creates a temporary + * ob with NULL name. */ if(ob->name && strcmp(path, ob->name) == 0) { return ob; } @@ -165,7 +184,7 @@ } /* path = remove_extension(path); ? */ - ob = type_xmalloc(object_t); + ob = xmalloc(sizeof(object_t)); memset(ob, 0, sizeof(object_t)); ob->name = path; @@ -190,6 +209,7 @@ object_t *clone_object(char *path) { object_t *base_ob, *new_ob; + int i; base_ob = find_object(path); if(!base_ob) { @@ -203,7 +223,7 @@ #endif /* ref_ob(base_ob, NULL);*/ - new_ob = type_xmalloc(object_t); + new_ob = xmalloc(sizeof(object_t)); memset(new_ob, 0, sizeof(object_t)); new_ob->parent = base_ob; new_ob->name = xmalloc(strlen(base_ob->name) + 10); @@ -212,8 +232,14 @@ new_ob->prog = base_ob->prog; ref_prog(new_ob->prog); - /* Memory leak? */ - new_ob->variables = *copy_array(&base_ob->variables, (void*(*)(void*)) copy_var); + new_ob->numglobals = base_ob->numglobals; + new_ob->globals = xmalloc(sizeof(variable_t) * new_ob->numglobals); + for(i=0;i<new_ob->numglobals;i++) { + variable_t *v = &new_ob->globals[i]; + *v = base_ob->globals[i]; + if(v->name) + v->name = stringdup(v->name); + } apply(new_ob, "create", NULL); list_push(&all_objects, new_ob); |
From: Peep P. <so...@us...> - 2004-06-07 15:44:26
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8758 Modified Files: net.c Log Message: Rearranged headers; doesn't use type_xmalloc anymore; destruct_all takes from list to_be_dested Index: net.c =================================================================== RCS file: /cvsroot/agd/server/src/net.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- net.c 1 Apr 2004 19:10:53 -0000 1.14 +++ net.c 7 Jun 2004 15:44:17 -0000 1.15 @@ -10,31 +10,30 @@ #include "sys.h" #include "compile_options.h" #include "list.h" -#include "array.h" #include "lpc.h" #include "object.h" #include "net.h" #include "interpret.h" -#define LOOP_PLAYERS() for(i=0;i<players.length;i++) { player_t *pl = players.data[i]; +#define LOOP_PLAYERS() for(l=&players;l->next;l=l->next) { player_t *pl = l->data; - array_t players; +list_t players; -extern list_t all_objects; +extern list_t all_objects, to_be_dested; extern player_t *this_player; extern object_t *master, *this_ob; static int greatest_sockfd, listenfd; static fd_set readfds, writefds; -int do_write(char *s); +void do_write(char *s); void net_listen(unsigned short port) { struct sockaddr_in sin; int yes = 1; /* setsockopt(); */ -#ifdef WINSOCK +#if HAVE_WINSOCK_H WSADATA wsaData; if(WSAStartup(MAKEWORD(1, 1), &wsaData)) { fprintf(stderr, "Network error: Winsock initialization failed.\n"); @@ -87,9 +86,9 @@ object_t *player_ob; variable_t *login_ob, *pob; - p = type_xmalloc(player_t); + p = xmalloc(sizeof(player_t)); memset(p, 0, sizeof(player_t)); - array_push(&players, p); + list_push(&players, p); p->conn.socket = accept(listenfd, (struct sockaddr *)&p->conn.addr, &size); if(p->conn.socket > greatest_sockfd) @@ -98,7 +97,7 @@ /* p->conn.state = DEFAULT;*/ this_player = p; - player_ob = type_xmalloc(object_t); + player_ob = xmalloc(sizeof(object_t)); player_ob->iaob = p; player_ob->name = NULL; player_ob->prog = NULL; @@ -117,7 +116,7 @@ } p->ob = login_ob->u.ob; - this_ob = login_ob->u.ob; + this_ob = p->ob /*login_ob->u.ob*/; p->ob->iaob = p; apply(login_ob->u.ob, "logon", NULL); @@ -133,6 +132,7 @@ { int i; int fd = p->conn.socket; + list_t *l; if(p->conn.socket >= greatest_sockfd + 1) { p->conn.socket = 0; @@ -143,13 +143,13 @@ greatest_sockfd = pl->conn.socket; } } -#ifdef WINSOCK +#if HAVE_WINSOCK_H closesocket(fd); #else close(fd); #endif - array_remove_by_data(&players, p); + list_remove(&players, p); } void net_send(char *buf, int siz, player_t *p) @@ -216,7 +216,11 @@ void destruct_all(void) { list_t *p; - for(p = &all_objects; p; p=p->next) { + + if(!to_be_dested.data) + return; + + for(p = /*&all_objects*/ &to_be_dested; p; p=p->next) { object_t *ob = p->data; if(ob->flags & O_DESTRUCTED) actual_destruct(ob); @@ -227,6 +231,7 @@ { struct timeval timeout; int i; + list_t *l; while(1) { timeout.tv_sec = 0; |
From: Peep P. <so...@us...> - 2004-06-07 15:43:43
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8633 Modified Files: main.c Log Message: Rearranged headers. Index: main.c =================================================================== RCS file: /cvsroot/agd/server/src/main.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- main.c 1 Apr 2004 19:10:53 -0000 1.18 +++ main.c 7 Jun 2004 15:43:32 -0000 1.19 @@ -1,7 +1,7 @@ /* Adventure Game Driver - a graphical MUD driver with AGI-like graphics, using LPC for scripting - Copyright (C) 2003, 2004 Peep Pullerits <so...@es...> + Copyright (C) 2003, 2004 Peep Pullerits <pe...@li...> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -27,13 +27,9 @@ #include "arch.h" #include "sys.h" -#include "array.h" +#include "list.h" #include "lpc.h" #include "object.h" -/*#include "compile.h"*/ - -#include "net.h" -#include "interpret.h" extern object_t *master; static char *conf_file; @@ -185,16 +181,13 @@ parse_config(conf_file); check_logfile(); dfuns_init(); - generate_operator_table(); init_interpreter(); master = load_object(conf.master); if(!master) crash(0, "Master object doesn't load", 3); - ref_ob(master, NULL); + master->numref++; - if(conf.exit_stats) - atexit(mstats_summary); net_listen(conf.port); time(&startup_time); |
From: Peep P. <so...@us...> - 2004-06-07 15:43:21
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8566 Modified Files: lpc.h Log Message: Removed T_SPECIAL and uses of array_t Index: lpc.h =================================================================== RCS file: /cvsroot/agd/server/src/lpc.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- lpc.h 3 Apr 2004 20:19:08 -0000 1.8 +++ lpc.h 7 Jun 2004 15:43:11 -0000 1.9 @@ -15,9 +15,9 @@ #define T_LVALUE 0x10 /* Used by interpret.c. I'd rather not have it here, but as it also needs an union member, it would be too cluttered otherwise. */ -#define T_SPECIAL 0x20 /* For initializing variables in compile.c and lang.y */ #define T_ARRAY 0x80 /* Indicates an array datatype. */ +/* string_types */ #define ST_MALLOC 1 #define ST_STATIC 2 @@ -32,7 +32,7 @@ unsigned char c; #endif char *s; - array_t *a; + struct array_t *a; struct object_t *ob; struct variable_t *v; /* T_LVALUE */ } u; |
From: Peep P. <so...@us...> - 2004-06-07 15:43:05
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8481 Modified Files: list.c Log Message: Doesn't use type_xmalloc anymore Index: list.c =================================================================== RCS file: /cvsroot/agd/server/src/list.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- list.c 1 Apr 2004 19:10:53 -0000 1.6 +++ list.c 7 Jun 2004 15:42:56 -0000 1.7 @@ -25,7 +25,7 @@ p->data = data; } else { /* didn't find a reusable slot */ - p->next = type_xmalloc(list_t); + p->next = xmalloc(sizeof(list_t)); p = p->next; p->data = data; p->next = NULL; |
From: Peep P. <so...@us...> - 2004-06-07 15:42:47
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8440 Modified Files: lex.l Log Message: Support for multi-line C++ style comments; rearranged headers; added __VERSION__ and __ARCH__ Index: lex.l =================================================================== RCS file: /cvsroot/agd/server/src/lex.l,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- lex.l 3 Apr 2004 20:18:39 -0000 1.14 +++ lex.l 7 Jun 2004 15:42:38 -0000 1.15 @@ -1,19 +1,17 @@ -/* TODO: - // shouldn't end after an unmatched \ - i.e. - // foo \ - foo - The comment should span two lines. -*/ %x in_string in_string_backslash %x charconst charconstgotten charbackslash %x comment linecomment %{ +#include "config.h" #include "compile_options.h" -#include "lpc_incl.h" +#include "list.h" +#include "lpc.h" +#include "object.h" #include "compile.h" #include "lang.h" #include "sys.h" /* conf_t */ +#include "arch.h" + #define pos yylloc.first_column #define line yylloc.first_line @@ -48,37 +46,35 @@ char *string_buf_ptr; %% /* comments */ -"/*" pos += 2; BEGIN(comment); -"*/" { - comp_error("unmatched */"); - pos += 2; - BEGIN(INITIAL); +"/*" pos += 2; BEGIN(comment); +"*/" { + comp_error("unmatched */"); + pos += 2; + BEGIN(INITIAL); } <comment>{ "*/" pos += 2; BEGIN(INITIAL); - . pos++; - \n NEWLINE(); + . pos++; + \n NEWLINE(); } + "//" pos += 2; BEGIN(linecomment); <linecomment>{ - . pos++; - \n NEWLINE(); BEGIN(INITIAL); + \\\n NEWLINE(); + . pos++; + \n NEWLINE(); BEGIN(INITIAL); } /* strings */ -\" { - string_buf_ptr = string_buf; - pos++; - BEGIN(in_string); - } +"\"" string_buf_ptr = string_buf; pos++; BEGIN(in_string); <in_string>{ \\ pos++; BEGIN(in_string_backslash); - \" { - *string_buf_ptr = '\0'; - yylval.str = stringdup(string_buf); - BEGIN(INITIAL); - RET(s, string_buf, L_STRING); - } + \" { + *string_buf_ptr = '\0'; + yylval.str = stringdup(string_buf); + BEGIN(INITIAL); + RET(s, string_buf, L_STRING); + } [ ] STRING_PUTWHITESPACE(1); \t STRING_PUTWHITESPACE(8); . { @@ -90,15 +86,16 @@ } \n comp_error("multi-line string"); } + <in_string_backslash>{ - [nr] STRING_PUTCHAR2('\r', '\n'); - t STRING_PUTCHAR('\t'); - a STRING_PUTCHAR('\a'); - b STRING_PUTCHAR('\b'); - f STRING_PUTCHAR('\f'); - e STRING_PUTCHAR('\27'); - \" STRING_PUTCHAR('"'); - \\ STRING_PUTCHAR('\\'); + [nr] STRING_PUTCHAR2('\r', '\n'); + t STRING_PUTCHAR('\t'); + a STRING_PUTCHAR('\a'); + b STRING_PUTCHAR('\b'); + f STRING_PUTCHAR('\f'); + e STRING_PUTCHAR('\33'); + \" STRING_PUTCHAR('"'); + \\ STRING_PUTCHAR('\\'); \n { NEWLINE(); ignore_white_space = 1; @@ -122,8 +119,7 @@ yylval.i = *yytext; BEGIN(charconstgotten); RET(d, yylval.i, L_INTEGER); - } - + } } <charconstgotten>{ @@ -188,36 +184,35 @@ BEGIN(INITIAL); } } - + + /* fake preprocessor macros */ +"__VERSION__" { + yylval.str = PACKAGE_VERSION; + RET(s, "__VERSION__", L_STRING); + } +"__ARCH__" { + yylval.str = PLATFORM; + RET(s, "__ARCH__", L_STRING); + } + /* operators */ -">" RET(s, ">", L_GT); ">=" RET(s, ">=", L_GE); -"<" RET(s, "<", L_LT); "<=" RET(s, "<=", L_LE); "||" RET(s, "||", L_OR); "&&" RET(s, "&&", L_AND); -"-" RET(s, "-", L_MINUS); -"->" RET(s, "->", L_DEREF); +"->" RET(s, "->", L_ARROW); "--" RET(s, "--", L_DEC); -"!" RET(c, '!', L_NOT); "!=" RET(s, "!=", L_NE); -")" RET(c, ')', ')'); "==" RET(s, "==", L_EQ); -"=" RET(c, '=', L_ASSIGN); "++" RET(s, "++", L_INC); -"+" RET(c, '+', L_PLUS); "**" RET(s, "**", L_POW); -"**=" RET(s, "**=", L_POWE); -"*" RET(c, '*', L_MUL); -"/" RET(c, '/', L_DIV); -"%" RET(c, '%', L_MOD); -"+=" RET(s, "+=", L_PE); -"-=" RET(s, "-=", L_ME); -"*=" RET(s, "*=", L_MUE); -"/=" RET(s, "/=", L_DE); -"%=" RET(s, "%=", L_MOE); +"**=" RET(s, "**=", L_POW_EQ); +"+=" RET(s, "+=", L_PLUS_EQ); +"-=" RET(s, "-=", L_MINUS_EQ); +"*=" RET(s, "*=", L_MUL_EQ); +"/=" RET(s, "/=", L_DIV_EQ); +"%=" RET(s, "%=", L_MOD_EQ); ".." RET(s, "..", L_RANGE); -":" RET(s, ":", L_RANGE); "({" RET(s, "({", L_OPEN_ARRAY); "([" RET(s, "([", L_OPEN_MAPPING); @@ -233,16 +228,16 @@ [0-9]+ yylval.i = atoi(yytext); RET(d, yylval.i, L_INTEGER); return RET(s, "return", L_RETURN); -if RET(s, "if", L_IF); +if RET(s, "if", L_IF); else RET(s, "else", L_ELSE); -do RET(s, "do", L_DO); +do RET(s, "do", L_DO); while RET(s, "while", L_WHILE); break RET(s, "break", L_BREAK); continue RET(s, "continue", L_CONTINUE); -for RET(s, "for", L_FOR); +for RET(s, "for", L_FOR); void yylval.i = T_VOID; RET(s, "void", L_DATA_TYPE); -int yylval.i = T_INT; RET(s, "int", L_DATA_TYPE); +int yylval.i = T_INT; RET(s, "int", L_DATA_TYPE); string yylval.i = T_STRING; RET(s, "string", L_DATA_TYPE); mixed yylval.i = T_MIXED; RET(s, "mixed", L_DATA_TYPE); object yylval.i = T_OBJECT; RET(s, "object", L_DATA_TYPE); |
From: Peep P. <so...@us...> - 2004-06-07 15:41:44
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8193 Added Files: instr.h Log Message: Initial import. --- NEW FILE: instr.h --- #ifndef _INSTR_H #define _INSTR_H #define F_JUMP 1 /* Relative jump (jump forward by <n> instructions) */ #define F_JUMP_IF_FALSE 2 #define F_PUSH_INT 3 #define F_PUSH_STRING 4 #define F_PUSH_NULL_OBJECT 5 #define F_PUSH_VOID 6 /* For 'return;' */ #define F_PUSH_ARRAY 7 #define F_POP 10 /* Pops a variable off the stack. */ #define F_PUSH_LVAR 11 /* Pushes local variable <n> on stack. */ #define F_PUSH_LVAR_LVALUE 12 /* Pushes T_LVALUE to local var <n> */ #define F_PUSH_GVAR 13 /* Pushes global variable <n> on stack. */ #define F_PUSH_GVAR_LVALUE 14 #define F_RETURN 15 #define F_CALL_LFUN 16 #define F_CALL_DFUN 17 #define F_CALL_OTHER 18 #define F_ASSIGN 19 /* Pops two variables off the stack, and assigns upper one's value to the lower one. (the lower one should be a T_LVALUE) */ #define F_ADD 20 #define F_ADD_EQ 21 #define F_SUB 22 #define F_SUB_EQ 23 #define F_MUL 24 #define F_MUL_EQ 25 #define F_DIV 26 #define F_DIV_EQ 27 #define F_MOD 28 #define F_MOD_EQ 29 #define F_POW 30 #define F_POW_EQ 31 #define F_NOT 32 #define F_EQ 33 #define F_NE 34 #define F_GT 35 #define F_GE 36 #define F_LT 37 #define F_LE 38 #define F_NEG 39 #define F_AND 40 /* Have to keep these in because of check_operand() */ #define F_OR 41 /* */ #define F_POSTINC 42 #define F_PREINC 43 #define F_POSTDEC 44 #define F_PREDEC 45 #define F_INDEX 46 /* Single index into an array or string. */ #define F_INDEX_LVALUE 47 #define F_SLICE 48 #define F_SLICE_LVALUE 49 #define F_COMM 50 #define F_HIGHEST F_COMM #define F_NEWLINE 51 /* Increases the line number. Not used ATM. */ #endif |
From: Peep P. <so...@us...> - 2004-06-07 15:41:22
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8081 Modified Files: interpret.h Log Message: Bytecode instructions moved to instr.h Index: interpret.h =================================================================== RCS file: /cvsroot/agd/server/src/interpret.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- interpret.h 3 Apr 2004 20:19:08 -0000 1.13 +++ interpret.h 7 Jun 2004 15:41:13 -0000 1.14 @@ -1,65 +1,6 @@ #ifndef _INTERPRET_H #define _INTERPRET_H -/* instructions for the virtual machine */ - -#define F_JMP 1 /* Relative jump (jump forward by <n> instructions) */ -#define F_JMPF 2 /* Jump if false. Pops variable off the stack, jumps - forward by <n> if it's false. */ - -#define F_PUSH_INT 3 -#define F_PUSH_STRING 4 -#define F_PUSH_NULL_OBJECT 5 -#define F_PUSH_VOID 6 /* For 'return;' */ -#define F_PUSH_ARRAY 7 - -#define F_POP 10 /* Pops a variable off the stack. */ -#define F_PUSH_LVAR 11 /* Pushes local variable <n> on stack. */ -#define F_PUSH_LVAR_LVALUE 12 /* Pushes T_LVALUE to local var <n> */ -#define F_PUSH_GVAR 13 /* Pushes global variable <n> on stack. */ -#define F_PUSH_GVAR_LVALUE 14 -#define F_RETURN 15 -#define F_CALL_LFUN 16 -#define F_CALL_DFUN 17 -#define F_CALL_OTHER 18 -#define F_ASSIGN 19 /* Pops two variables off the stack, and assigns upper one's value - to the lower one. (the lower one should be a T_LVALUE) */ -#define F_ADD 20 -#define F_ADDA 21 -#define F_SUB 22 -#define F_SUBA 23 -#define F_MUL 24 -#define F_MULA 25 -#define F_DIV 26 -#define F_DIVA 27 -#define F_MOD 28 -#define F_MODA 29 -#define F_NOT 30 -#define F_EQ 31 -#define F_NE 32 -#define F_GT 33 -#define F_GE 34 -#define F_LT 35 -#define F_LE 36 -#define F_NEG 37 -#define F_AND 38 /* Have to keep these in because of check_operand() */ -#define F_OR 39 /* */ -#define F_POSTINC 40 -#define F_PREINC 41 -#define F_POSTDEC 42 -#define F_PREDEC 43 -#define F_INDEX 44 /* Single index into an array or string. */ -#define F_INDEX_LVALUE 45 -#define F_SLICE 46 -#define F_SLICE_LVALUE 47 -#define F_COMM 48 -#define F_POW 49 -#define F_POWE 50 - -#define F_HIGHEST F_POWE - -#define F_NEWLINE 51 /* Increases the line number. Not used ATM. */ - variable_t *apply(object_t *ob, char *fun, char *argfmt, ...); void runtime(char *s); @@ -71,7 +12,8 @@ int num_arg; int *cp; - array_t *code; + int **code; + int codelen; int fun, line; |
From: Peep P. <so...@us...> - 2004-06-07 15:41:05
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7936 Modified Files: dfuns.c Log Message: Doesn't use array_t; throw() dfun Index: dfuns.c =================================================================== RCS file: /cvsroot/agd/server/src/dfuns.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- dfuns.c 1 Apr 2004 19:10:53 -0000 1.18 +++ dfuns.c 7 Jun 2004 15:40:52 -0000 1.19 @@ -8,7 +8,6 @@ #include "sys.h" #include "compile_options.h" #include "list.h" -#include "array.h" #include "lpc.h" #include "object.h" #include "compile.h" @@ -20,61 +19,55 @@ extern list_t all_objects; extern time_t startup_time; /* for uptime() */ -extern array_t global_ids; void (**dfptr)(void); void dfuns_init(void) { int i, j, k; - array_t *args; + int *args; + int numarg; #include "dfdecl.h" - init_array(&global_ids); - dfptr = xmalloc(sizeof(void(*)(void)) * NUM_DF); for(i=0;i<NUM_DF;i++) { dfptr[i] = decl[i].fun; - args = type_xmalloc(array_t); - init_array(args); + numarg = 0; + args = NULL; for(j=0;j<decl[i].arglen;j++) { - if(!j) - j++; /* Feels like a hack. Any better ways? */ + if(j == 0) + j = 1; + /*if(!j)j++;*/ /* Feels like a hack. Any better ways? */ /* FIXME - implement variants in define_name */ for(k=0;k<decl[i].args[j];k++,j++) { if(k == 0) { /* remove this line if variants are implemented */ - array_push(args, (void *) decl[i].args[j+k]); + numarg++; + args = xrealloc(args, sizeof(int) * numarg); + args[numarg-1] = decl[i].args[j+k]; } } } - - define_id(decl[i].name, ID_DFUN, decl[i].ret, args); + define_id(decl[i].name, ID_DFUN, decl[i].ret, args, numarg); } } -/* Returns length of string, for now. If we need to account for errors - later, we'll do it later. */ -int do_write(char *s) +void do_write(char *s) { - int len; - - len = strlen(s); if(this_player) - net_send(s, len+1, this_player); + net_send(s, strlen(s)+1, this_player); else - fprintf(stderr, "%s", s); - return len; + printf("] %s", s); } -void shout(char *s, object_t *exclude) +void shout(char *s) { list_t *p; for(p = &all_objects; p; p = p->next) { object_t *ob = p->data; - if(ob != exclude) { + if(ob->iaob && ob != this_player->ob) { tell_object(ob, s); } } @@ -82,10 +75,9 @@ void df_write(void) { - int ret; - ret = do_write(fp->u.s); + do_write(fp->u.s); pop_stack(); - push_int(ret); + push_void(); } void df_input_to(void) @@ -131,11 +123,12 @@ void df_shout(void) { - shout(fp[0].u.s, fp[1].u.ob); - pop_stack(); pop_stack(); + shout(fp[0].u.s); + pop_stack(); push_void(); } +#if 0 void df_platform(void) { push_string(PLATFORM, ST_STATIC); @@ -145,6 +138,7 @@ { push_string(PACKAGE_VERSION, ST_STATIC); } +#endif void df_destruct(void) { @@ -337,7 +331,7 @@ } /* Filesystem. */ -df_read_file(void) +void df_read_file(void) { FILE *f; char *path; @@ -358,7 +352,7 @@ file_size = 0; while(fgets(buf, 256, f)) { int len = strlen(buf); - file_str = realloc(file_str, file_size + len + 1); + file_str = xrealloc(file_str, file_size + len + 1); p = file_str + file_size; file_size += len; strcpy(p, buf); @@ -369,3 +363,10 @@ push_string(file_str, ST_MALLOC); } +/* Misc. */ +void df_throw(void) +{ + runtime(fp->u.s); + pop_stack(); + push_void(); +} |
From: Peep P. <so...@us...> - 2004-06-07 15:40:13
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7757 Modified Files: dfparse.y Log Message: Fixed headers; doesn't use array_t Index: dfparse.y =================================================================== RCS file: /cvsroot/agd/server/src/dfparse.y,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- dfparse.y 1 Apr 2004 19:10:53 -0000 1.8 +++ dfparse.y 7 Jun 2004 15:40:03 -0000 1.9 @@ -1,9 +1,9 @@ /* parser for dfdecl - didn't try to muck with indendation in vim, so this has a different indent - style than lang.y Changelog: + 0.08: + * Not using array_{push,concat} etc anymore. No changes in output. 0.07: * prints index of function for easier debugging * now outputs prototypes @@ -25,16 +25,15 @@ Changes prior to 0.03 are undocumented. */ %{ -#include <stdlib.h> /* realloc */ -#include <stdio.h> /* FILE* */ +#include <stdlib.h> +#include <stdio.h> #include <errno.h> #include <time.h> #include "sys.h" /* xmalloc */ -#include "array.h" #include "lpc.h" -#define DFVERSION "0.07" +#define DFVERSION "0.08" #define DFDECL_T "typedef struct {\n\tint ret;\n\tchar *name;\n\tvoid (*fun)(void);\n\t"\ "int arglen;\n\tint args[%d];\n} dfdecl_t;\n" typedef struct { @@ -48,30 +47,32 @@ static int maxarglen; extern FILE *yyin; -/*YYLTYPE yylloc;*/ - -int find_linear_len(array_t *a); %} %union { char *s; int i; - array_t a; + struct arr_t { + int length; + long int *data; + } a; } %token <s> L_IDENTIFIER %token <i> L_DATA_TYPE %type <i> type -%type <a> arguments argument another_argument another_type +%type <a> arguments argument +%type <a> another_argument another_type +%type <a> argument_and_another type_and_another %% all: /* empty */ | all dfdecl -; + ; dfdecl: type L_IDENTIFIER '(' arguments ')' @@ -79,6 +80,8 @@ int i, j, index; dfdecl_t decl; + int find_linear_len(struct arr_t *a); + @1; /* To force bison to define yylloc. */ decl.ret = $1; @@ -89,74 +92,76 @@ if(decl.arglen) decl.args = xmalloc(sizeof(int) * decl.arglen); for(index=i=0;i<$4.length;i++) { - array_t *var = $4.data[i]; + struct arr_t *var = (struct arr_t *) $4.data[i]; + foo(); decl.args[index++] = var->length; for(j=0;j<var->length;j++) decl.args[index++] = (int) var->data[j]; } - dfdecl = realloc(dfdecl, sizeof(dfdecl_t) * ++numdecl); + dfdecl = xrealloc(dfdecl, sizeof(dfdecl_t) * ++numdecl); dfdecl[numdecl-1] = decl; } -; + ; -type: - L_DATA_TYPE /* optional_star */ - { - $$ = $1; - } -; +type: L_DATA_TYPE /* optional_star */; arguments: - /* empty */ - { - init_array(&$$); - } - | argument another_argument - { - init_array(&$$); - if($1.length) - array_push(&$$, copy_array(&$1, NULL)); - array_concat(&$$, &$2); - } -; + /* empty */ { $$.length = 0; } + | argument_and_another + ; -argument: - type another_type - { - init_array(&$$); - if($1 != T_VOID) - array_push(&$$, (void *) $1); - array_concat(&$$, &$2); - } -; +argument: type_and_another; another_argument: - /* empty */ - { - init_array(&$$); - } - | ',' argument another_argument + /* empty */ { $$.length = 0; } + | ',' argument_and_another { $$ = $2; } + ; + +argument_and_another: + argument another_argument { - init_array(&$$); - if($2.length) - array_push(&$$, copy_array(&$2, NULL)); - array_concat(&$$, &$3); + int i, foo; + + foo = $1.length ? 1 : 0; + $$.length = $2.length + foo; + $$.data = xmalloc(sizeof(struct arr_t*) * $$.length); + + if($1.length) { + struct arr_t *a = xmalloc(sizeof(struct arr_t)); + *a = $1; + $$.data[0] = (int) a; + } + + for(i=foo;i<$$.length;i++) { + $$.data[i] = $2.data[i-foo]; + } } -; - + ; + another_type: - /* empty */ - { - init_array(&$$); - } - | '|' type another_type + /* empty */ { $$.length = 0; } + | '|' type_and_another { $$ = $2; } + ; + +type_and_another: + type another_type { - init_array(&$$); - if($2 != T_VOID) - array_push(&$$, (void *) $2); - array_concat(&$$, &$3); + int i, foo; + + foo = $1 != T_VOID ? 1 : 0; + $$.length = $2.length + foo; + $$.data = xmalloc(sizeof(int) * $$.length); + + if($1 != T_VOID) { + $$.data[0] = $1; + } + + for(i=foo;i<$$.length;i++) { + $$.data[i] = $2.data[i-foo]; + } } -; + ; + %% int yyerror(char *s) { @@ -167,12 +172,12 @@ return 0; } -int find_linear_len(array_t *a) +int find_linear_len(struct arr_t *a) { int len; int i, j; for(len=i=0;i<a->length;i++,len++) { - array_t *p = a->data[i]; + struct arr_t *p = (struct arr_t *) a->data[i]; for(j=0;j<p->length;j++,len++); } return len; @@ -262,3 +267,5 @@ return 0; } +foo() { +} |
From: Peep P. <so...@us...> - 2004-06-07 15:39:49
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7665 Modified Files: dflex.l Log Message: Doesn't include array.h any more. Index: dflex.l =================================================================== RCS file: /cvsroot/agd/server/src/dflex.l,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- dflex.l 1 Apr 2004 19:10:53 -0000 1.2 +++ dflex.l 7 Jun 2004 15:39:39 -0000 1.3 @@ -2,7 +2,6 @@ %{ #include "compile_options.h" #include "sys.h" -#include "array.h" #include "lpc.h" #include "dfparse.h" #define pos yylloc.first_column |
From: Peep P. <so...@us...> - 2004-06-07 15:39:25
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7605 Modified Files: dfdecl.in Log Message: write() returns void; shout() takes only a string argument; removed version() and platform() Index: dfdecl.in =================================================================== RCS file: /cvsroot/agd/server/src/dfdecl.in,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- dfdecl.in 1 Apr 2004 19:17:14 -0000 1.11 +++ dfdecl.in 7 Jun 2004 15:39:16 -0000 1.12 @@ -17,8 +17,8 @@ # Expect lots of nasty error messages if you mess up here. # Interactives. -int write(string) -void shout(string, object) +void write(string) +void shout(string) void tell_object(object, string) int interactive(object) void input_to(string) @@ -35,10 +35,6 @@ # Filesystem. string read_file(string) -# misc -string version() -string platform() - # Numbers. int random(int) int atoi(string) @@ -51,10 +47,12 @@ # Objects. void destruct(object) object find_object(string) -object clone_object(string|object) +object clone_object(string) object this_object() object previous_object() object load_object(string) void exec(object) string file_name(object) +# Misc. +void throw(string) |
From: Peep P. <so...@us...> - 2004-06-07 15:38:55
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7453 Modified Files: debug.c Log Message: Fixed headers; changed to work with new compiler and bytecode Index: debug.c =================================================================== RCS file: /cvsroot/agd/server/src/debug.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- debug.c 3 Apr 2004 20:19:08 -0000 1.11 +++ debug.c 7 Jun 2004 15:38:46 -0000 1.12 @@ -1,14 +1,56 @@ -#include "std.h" -#include "lpc_incl.h" +/*#include "config.h"*/ +#include "compile_options.h" +#include "list.h" +#include "lpc.h" +#include "object.h" + +#include "compile.h" +#include "lang.h" +#include "instr.h" #ifdef DEBUG -#define NAME() if(v->name) printf("%s", v->name); -void print_var(variable_t *v, int values) +/* Puts out a string on stdout, without \n and \r. */ +void puts_nonl(char *s) { char buf[MAX_STRING_LENGTH]; - char *p, *bufptr; + char *bufptr; + + if(!s) + return; + + bufptr = buf; + while(*s) { + if(bufptr >= buf + MAX_STRING_LENGTH) { + puts("<string too long>"); + return; + } + + switch(*s) { + case '\n': + *bufptr++ = '\\'; + *bufptr++ = 'n'; + break; + case '\r': + *bufptr++ = '\\'; + *bufptr++ = 'r'; + break; + case '\t': + *bufptr++ = '\\'; + *bufptr++ = 't'; + break; + default: + *bufptr++ = *s; + } + s++; + } + *bufptr = '\0'; + printf("\"%s\"", buf); +} +#define NAME() if(v->name) printf("%s", v->name); +void print_var(variable_t *v, int values) +{ int lval_lvl; if(!v) { @@ -19,53 +61,30 @@ if(!values) return; - if(v->type & T_ARRAY) { - printf("array of "); - v->type &= ~T_ARRAY; - } + printf("%s ", type2str(v->type)); + if(v->type & T_ARRAY) + return; + switch(v->type) { case T_INT: - printf("int "); NAME(); printf("=%ld", v->u.i); break; case T_STRING: - printf("string "); NAME(); - if(v->u.s) { - p = v->u.s; - bufptr = buf; - while(*p) { - if(bufptr >= buf + MAX_STRING_LENGTH) { - printf("=<string too long>"); - goto get_out; - } - if(*p == '\n') { - *bufptr++ = '\\'; - *bufptr++ = 'n'; - } else if(*p != '\r') { - *bufptr++ = *p; - } - p++; - } - *bufptr = '\0'; - printf("=\"%s\"", buf); - } -get_out: + putchar('='); + puts_nonl(v->u.s); break; case T_VOID: - printf("void "); NAME(); break; case T_OBJECT: - printf("object "); NAME(); if(v->u.ob) printf("=<%s>", v->u.ob->name); else printf("=<NULL>"); break; case T_LVALUE: - printf("lvalue "); NAME(); printf("=<"); lval_lvl++; @@ -87,152 +106,56 @@ char *opc_name(int i) { switch(i) { - case F_PUSH_INT: - return "F_PUSH_INT"; - case F_PUSH_STRING: - return "F_PUSH_STRING"; - case F_PUSH_VOID: - return "F_PUSH_VOID"; - case F_PUSH_NULL_OBJECT: - return "F_PUSH_NULL_OBJECT"; - case F_PUSH_ARRAY: - return "F_PUSH_ARRAY"; - case F_PUSH_LVAR: - return "F_PUSH_LVAR"; - case F_PUSH_LVAR_LVALUE: - return "F_PUSH_LVAR_LVALUE"; - case F_PUSH_GVAR: - return "F_PUSH_GVAR"; - case F_PUSH_GVAR_LVALUE: - return "F_PUSH_GVAR_LVALUE"; - case F_ADD: - return "F_ADD"; - case F_SUB: - return "F_SUB"; - case F_MUL: - return "F_MUL"; - case F_DIV: - return "F_DIV"; - case F_MOD: - return "F_MOD"; - case F_ASSIGN: - return "F_ASSIGN"; - case F_POP: - return "F_POP"; - case F_CALL_LFUN: - return "F_CALL_LFUN"; - case F_CALL_DFUN: - return "F_CALL_DFUN"; - case F_CALL_OTHER: - return "F_CALL_OTHER"; - case F_JMP: - return "F_JMP"; - case F_JMPF: - return "F_JMPF"; - case F_EQ: - return "F_EQ"; - case F_NE: - return "F_NE"; - case F_AND: - return "F_AND"; - case F_OR: - return "F_OR"; - case F_NEG: - return "F_NEG"; - case F_NOT: - return "F_NOT"; - case F_GT: - return "F_GT"; - case F_GE: - return "F_GE"; - case F_LT: - return "F_LT"; - case F_LE: - return "F_LE"; - case F_POSTINC: - return "F_POSTINC"; - case F_PREINC: - return "F_PREINC"; - case F_POSTDEC: - return "F_POSTDEC"; - case F_PREDEC: - return "F_PREDEC"; - case F_INDEX: - return "F_INDEX"; - case F_INDEX_LVALUE: - return "F_INDEX_LVALUE"; - case F_SLICE: - return "F_SLICE"; - case F_SLICE_LVALUE: - return "F_SLICE_LVALUE"; - case F_RETURN: - return "F_RETURN"; - default: - return "unknown"; - } -} - -void print_vm_token(array_t *a, int *i) -{ - printf("@[%d]: %d/%s ", *i, (int)a->data[*i], opc_name((int)a->data[*i])); - - switch((int)a->data[*i]) { - int index, num; - char *s; - -/* case F_PUSH: - print_var(a->data[++*i], 1); - printf("\n"); - break;*/ - case F_PUSH_INT: - num = (int)a->data[++*i]; - printf("%d", num); - break; - case F_PUSH_STRING: - s = a->data[++*i]; - printf("\"%s\"", s); - break; - case F_PUSH_ARRAY: - num = (int)a->data[++*i]; - printf("type %d ", num); - num = (int)a->data[++*i]; - printf("%d", num); - break; - case F_CALL_DFUN: - index = (int)a->data[++*i]; - num = (int)a->data[++*i]; - printf("index %d num_arg: %d", index, num); - break; - case F_CALL_LFUN: - index = (int)a->data[++*i]; - num = (int)a->data[++*i]; - printf("index %d num_arg: %d", index, num); - break; - case F_CALL_OTHER: - s = a->data[++*i]; - num = (int)a->data[++*i]; - printf("fun \"%s\" num_arg: %d", s, num); - break; - case F_PUSH_LVAR: - case F_PUSH_LVAR_LVALUE: - printf("index %d", (int)a->data[++*i]); - break; - case F_PUSH_GVAR: - case F_PUSH_GVAR_LVALUE: - printf("index %d", (int)a->data[++*i]); - break; - case F_JMP: - num = (int)a->data[++*i]; - printf("%d (to %d)", num, *i + num); - break; - case F_JMPF: - num = (int)a->data[++*i]; - printf("%d (to %d)", num, *i + num); - break; + case F_PUSH_INT: return "F_PUSH_INT"; + case F_PUSH_STRING: return "F_PUSH_STRING"; + case F_PUSH_VOID: return "F_PUSH_VOID"; + case F_PUSH_NULL_OBJECT: return "F_PUSH_NULL_OBJECT"; + case F_PUSH_ARRAY: return "F_PUSH_ARRAY"; + case F_PUSH_LVAR: return "F_PUSH_LVAR"; + case F_PUSH_LVAR_LVALUE: return "F_PUSH_LVAR_LVALUE"; + case F_PUSH_GVAR: return "F_PUSH_GVAR"; + case F_PUSH_GVAR_LVALUE: return "F_PUSH_GVAR_LVALUE"; + case F_ADD: return "F_ADD"; + case F_ADD_EQ: return "F_ADD_EQ"; + case F_SUB: return "F_SUB"; + case F_SUB_EQ: return "F_SUB_EQ"; + case F_MUL: return "F_MUL"; + case F_MUL_EQ: return "F_MUL_EQ"; + case F_DIV: return "F_DIV"; + case F_DIV_EQ: return "F_DIV_EQ"; + case F_MOD: return "F_MOD"; + case F_MOD_EQ: return "F_MOD_EQ"; + case F_ASSIGN: return "F_ASSIGN"; + case F_POP: return "F_POP"; + case F_CALL_LFUN: return "F_CALL_LFUN"; + case F_CALL_DFUN: return "F_CALL_DFUN"; + case F_CALL_OTHER: return "F_CALL_OTHER"; + case F_JUMP: return "F_JUMP"; + case F_JUMP_IF_FALSE: return "F_JUMP_IF_FALSE"; + case F_EQ: return "F_EQ"; + case F_NE: return "F_NE"; + case F_AND: return "F_AND"; + case F_OR: return "F_OR"; + case F_NEG: return "F_NEG"; + case F_NOT: return "F_NOT"; + case F_GT: return "F_GT"; + case F_GE: return "F_GE"; + case F_LT: return "F_LT"; + case F_LE: return "F_LE"; + case F_POSTINC: return "F_POSTINC"; + case F_PREINC: return "F_PREINC"; + case F_POSTDEC: return "F_POSTDEC"; + case F_PREDEC: return "F_PREDEC"; + case F_INDEX: return "F_INDEX"; + case F_INDEX_LVALUE: return "F_INDEX_LVALUE"; + case F_SLICE: return "F_SLICE"; + case F_SLICE_LVALUE: return "F_SLICE_LVALUE"; + case F_RETURN: return "F_RETURN"; + default: return "unknown"; } - putchar('\n'); } +#if 0 void print_array(array_t *a) { int i; @@ -277,11 +200,77 @@ printf(" }) "); } -void print_vm_tokens(array_t *a) +#endif + +void print_instr(program_t *prog, function_t *f) { int i; - for(i = 0; i < a->length; i++) { - print_vm_token(a, &i); + long int *code; + int codelen; + + codelen = f->codelen; + code = f->code; + + for(i = 0; i < codelen; i++) { + printf("@[%d]: %d/%s ", i, code[i], opc_name(code[i])); + + switch(code[i]) { + int index, num; + char *s; + + /* case F_PUSH: + print_var(a->data[++*i], 1); + printf("\n"); + break;*/ + case F_PUSH_INT: + num = code[++i]; + printf("%d", num); + break; + case F_PUSH_STRING: + i++; + printf("%d (", code[i]); + puts_nonl(prog->str_tbl[code[i]]); + putchar(')'); +/* s = (char *) code[++i]; + printf("\"%s\"", s);*/ + break; + case F_PUSH_ARRAY: + num = code[++i]; + printf("type %d ", num); + num = code[++i]; + printf("%d", num); + break; + case F_CALL_DFUN: + index = code[++i]; + num = code[++i]; + printf("index %d num_arg: %d", index, num); + break; + case F_CALL_LFUN: + index = code[++i]; + num = code[++i]; + printf("index %d num_arg: %d", index, num); + break; + case F_CALL_OTHER: + s = (char *) code[++i]; + num = code[++i]; + printf("fun \"%s\" num_arg: %d", s, num); + break; + case F_PUSH_LVAR: + case F_PUSH_LVAR_LVALUE: + case F_PUSH_GVAR: + case F_PUSH_GVAR_LVALUE: + printf("index %d", code[++i]); + break; + case F_JUMP: + num = code[++i]; + printf("%d (to %d)", num, i + num); + break; + case F_JUMP_IF_FALSE: + num = code[++i]; + printf("%d (to %d)", num, i + num); + break; + } + putchar('\n'); } } @@ -291,15 +280,15 @@ function_t *f; printf("Functions: \n"); - for(i = 0; i < p->functions.length; i++) { - f = (function_t *) p->functions.data[i]; + for(i = 0; i < p->numfunc; i++) { + f = p->functions[i]; printf("Function %d:\n", i); printf(" Type %d\n", f->type); printf(" Arguments: "); - print_var_arr(&f->args); +/* print_var_arr(&f->args);*/ printf("\n"); printf(" Code:\n"); - print_vm_tokens(&f->code); + print_instr(p, f); printf("\n"); } if(i == 0) |