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 |