From: Peep P. <so...@us...> - 2004-07-21 12:09:28
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10349 Modified Files: debug.c Log Message: Some new operators; print_var can do arrays Index: debug.c =================================================================== RCS file: /cvsroot/agd/server/src/debug.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- debug.c 20 Jun 2004 14:01:57 -0000 1.18 +++ debug.c 21 Jul 2004 12:09:15 -0000 1.19 @@ -7,6 +7,7 @@ #include "compile.h" #include "lang.h" #include "instr.h" +#include "array.h" #ifdef DEBUG @@ -49,7 +50,7 @@ } #define NAME() if(v->name) printf("%s", v->name); -void print_var(variable_t *v, int values) +void print_var(variable_t *v) { static int lval_nested; @@ -58,13 +59,19 @@ return; } - if(!values) - return; - - printf("%s ", type2str(v->type)); - if(v->type & T_ARRAY) + if(v->type & T_ARRAY) { + int i; + array_t *a = v->u.a; + printf("({ "); + for(i=0;i<a->length;i++) { + print_var(&v->u.a->data[i]); + if(i+1 < a->length) + printf(", "); + } + printf(" })"); return; + } switch(v->type) { case T_INT: @@ -91,7 +98,7 @@ printf("infinite loop"); else { lval_nested = 1; - print_var(v->u.v, 1); + print_var(v->u.v); } lval_nested = 0; @@ -128,6 +135,7 @@ case F_MOD_EQ: return "F_MOD_EQ"; case F_ASSIGN: return "F_ASSIGN"; case F_POP: return "F_POP"; + case F_POP_N: return "F_POP_N"; case F_CALL_LFUN: return "F_CALL_LFUN"; case F_CALL_DFUN: return "F_CALL_DFUN"; case F_CALL_OTHER: return "F_CALL_OTHER"; @@ -219,6 +227,7 @@ int index, num; char *s; + case F_POP_N: case F_PUSH_INT: num = code[++i]; printf("%d", num); @@ -284,7 +293,7 @@ for(i = 0; i < p->numfunc; i++) { f = p->functions[i]; printf("Function %d:\n", i); - printf(" Type %d\n", f->type); + printf(" Type %s\n", type2str(f->type)); printf(" Arguments: "); /* print_var_arr(&f->args);*/ printf("\n"); |