X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=codea%2Fsymtable.c;h=b38500040d542ab5fce25f7226da6b2ce2009237;hb=0d7fe2f8906adbb4095193c7564647f83bdc6959;hp=006b6dd3a9b9c0957540da9a8193d96643f8fbbf;hpb=eab7be7df0ec02d3100f5c6e430e0732834a12cf;p=uebersetzerbau-ss10.git diff --git a/codea/symtable.c b/codea/symtable.c index 006b6dd..b385000 100755 --- a/codea/symtable.c +++ b/codea/symtable.c @@ -3,7 +3,7 @@ #include #include "symtable.h" -#if 1 +#if 0 #define DD #endif @@ -21,20 +21,25 @@ struct symbol *tab_clone(struct symbol *tab) #endif while(elm != SYMNULL) { - ntab = tab_add_symbol(ntab, elm->ident, elm->type, 0, elm->param_index ? elm->param_index : 0); + ntab = tab_add_symbol(ntab, elm->ident, elm->type, 0, elm->param_index, elm->soffset); elm = elm->next; } return ntab; } -struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short check, int param_index) +struct symbol *tab_add_symbol(struct symbol *tab, char *ident, short type, short check, int param_index, int soffset) { struct symbol *elm = tab; struct symbol *new_elm; #ifdef DD - fprintf(stderr, "tab_add_symbol: tab(%08X), ident(%s), type(%i), check(%i), param_index(%i)\n", tab, ident, type, check, param_index); + fprintf(stderr, "tab_add_symbol: tab(%08X), ident(%s), type(%i), check(%i), param_index(%i), soffset(%i)\n", tab, ident, type, check, param_index, soffset); #endif + if(param_index >= 6) { + fprintf(stderr, "eine methode hat zu viele parameter (max. 6 inkl. this erlaubt)\n"); + exit(4); + } + if(tab_lookup(tab, ident, type) != SYMNULL) { if(check) { fprintf(stderr, "Identifier doppelt vorhanden: \"%s\"\n", ident); @@ -48,9 +53,8 @@ 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; - } + new_elm->param_index = param_index; + new_elm->soffset = soffset; if(tab == SYMNULL) { return new_elm; @@ -91,7 +95,7 @@ struct symbol *tab_merge(struct symbol *tab, struct symbol *to_add, short check) #endif while(elm != SYMNULL) { - ntab = tab_add_symbol(ntab, elm->ident, elm->type, check, elm->param_index ? elm->param_index : 0); + ntab = tab_add_symbol(ntab, elm->ident, elm->type, check, elm->param_index, elm->soffset); elm = elm->next; }