X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=codea%2Fsymtable.c;h=006b6dd3a9b9c0957540da9a8193d96643f8fbbf;hb=eab7be7df0ec02d3100f5c6e430e0732834a12cf;hp=a889a1eedc634b24a1747f65b7ff5838a49c315a;hpb=fdf651dc3e6d5166926e9fac4bc21dcc3eb06fda;p=uebersetzerbau-ss10.git diff --git a/codea/symtable.c b/codea/symtable.c index a889a1e..006b6dd 100755 --- a/codea/symtable.c +++ b/codea/symtable.c @@ -3,7 +3,7 @@ #include #include "symtable.h" -#if 0 +#if 1 #define DD #endif @@ -17,22 +17,22 @@ struct symbol *tab_clone(struct symbol *tab) struct symbol *elm = tab; struct symbol *ntab = tab_new(); #ifdef DD - printf("tab_clone: tab(%08X)\n", tab); + fprintf(stderr, "tab_clone: tab(%08X)\n", tab); #endif while(elm != SYMNULL) { - ntab = tab_add_symbol(ntab, elm->ident, elm->type, 0); + ntab = tab_add_symbol(ntab, elm->ident, elm->type, 0, elm->param_index ? elm->param_index : 0); elm = elm->next; } return ntab; } -struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short check) +struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short check, int param_index) { struct symbol *elm = tab; struct symbol *new_elm; #ifdef DD - printf("tab_add_symbol: tab(%08X), ident(%s), type(%i), check(%i)\n", tab, ident, type, check); + fprintf(stderr, "tab_add_symbol: tab(%08X), ident(%s), type(%i), check(%i), param_index(%i)\n", tab, ident, type, check, param_index); #endif if(tab_lookup(tab, ident, type) != SYMNULL) { @@ -48,6 +48,9 @@ struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short new_elm->next = SYMNULL; new_elm->ident = strdup(ident); new_elm->type = type; + if(type == S_PARM) { + new_elm->param_index = param_index; + } if(tab == SYMNULL) { return new_elm; @@ -84,11 +87,11 @@ struct symbol *tab_merge(struct symbol *tab, struct symbol *to_add, short check) struct symbol *elm = to_add; struct symbol *ntab = tab_clone(tab); #ifdef DD - printf("tab_merge: tab(%08X), to_add(%08X), check(%i), ntab(%08X)\n", tab, to_add, check, ntab); + fprintf(stderr, "tab_merge: tab(%08X), to_add(%08X), check(%i), ntab(%08X)\n", tab, to_add, check, ntab); #endif while(elm != SYMNULL) { - ntab = tab_add_symbol(ntab, elm->ident, elm->type, check); + ntab = tab_add_symbol(ntab, elm->ident, elm->type, check, elm->param_index ? elm->param_index : 0); elm = elm->next; } @@ -122,7 +125,7 @@ void check(struct symbol *tab, char *ident, short type) { struct symbol *elm; #ifdef DD - printf("check: tab(%08X), ident(%s), type(%i), elm(%08X)\n", tab, ident, type, elm); + fprintf(stderr, "check: tab(%08X), ident(%s), type(%i), elm(%08X)\n", tab, ident, type, elm); #endif if(type & (S_VAR | S_PARM)) {