void param_dehydrate(param_t **pp) { param_t *p; assert(pp); while ((p = *pp) != NULL && !isdehydrated(p)) { param_debug(p); ph_dehydrate(pp); if (p->Ptype && !isdehydrated(p->Ptype)) type_debug(p->Ptype); type_dehydrate(&p->Ptype); ph_dehydrate(&p->Pident); if (CPP) { el_dehydrate(&p->Pelem); type_dehydrate(&p->Pdeftype); if (p->Pptpl) param_dehydrate(&p->Pptpl); if (p->Psym) symbol_dehydrate(&p->Psym); if (p->PelemToken) token_dehydrate(&p->PelemToken); } pp = &p->Pnext; } }
void param_free(param_t **pparamlst) { param_t *p,*pn; #if !TX86 debug_assert(PARSER); #endif for (p = *pparamlst; p; p = pn) { param_debug(p); pn = p->Pnext; type_free(p->Ptype); #if TX86 mem_free(p->Pident); #else MEM_PH_FREE(p->Pident); #endif el_free(p->Pelem); type_free(p->Pdeftype); if (p->Pptpl) param_free(&p->Pptpl); #ifdef DEBUG p->id = 0; #endif p->Pnext = param_list; param_list = p; } *pparamlst = NULL; }
void param_hydrate(param_t **pp) { param_t *p; assert(pp); if (isdehydrated(*pp)) { while (*pp) { assert(isdehydrated(*pp)); p = (param_t *) ph_hydrate(pp); param_debug(p); type_hydrate(&p->Ptype); if (p->Ptype) type_debug(p->Ptype); ph_hydrate(&p->Pident); if (CPP) { el_hydrate(&p->Pelem); if (p->Pelem) elem_debug(p->Pelem); type_hydrate(&p->Pdeftype); if (p->Pptpl) param_hydrate(&p->Pptpl); if (p->Psym) symbol_hydrate(&p->Psym); if (p->PelemToken) token_hydrate(&p->PelemToken); } pp = &p->Pnext; } } }
param_t *param_append_type(param_t **pp,type *t) { param_t *p; p = param_calloc(); while (*pp) { param_debug(*pp); pp = &((*pp)->Pnext); /* find end of list */ } *pp = p; /* append p to list */ type_debug(t); p->Ptype = t; t->Tcount++; return p; }
void param_hydrate(param_t **pp) { param_t *p; assert(pp); if (isdehydrated(*pp)) { while (*pp) { assert(isdehydrated(*pp)); p = (param_t *) ph_hydrate(pp); #if SOURCE_4PARAMS p->Psrcpos.Sfilnum += File_Hydrate_Num; /* file number relative header build */ #endif param_debug(p); type_hydrate(&p->Ptype); if (p->Ptype) type_debug(p->Ptype); ph_hydrate(&p->Pident); if (CPP) { el_hydrate(&p->Pelem); if (p->Pelem) elem_debug(p->Pelem); type_hydrate(&p->Pdeftype); if (p->Pptpl) param_hydrate(&p->Pptpl); if (p->Psym) symbol_hydrate(&p->Psym); if (p->PelemToken) token_hydrate(&p->PelemToken); } pp = &p->Pnext; } } }
void type_print(type *t) { type_debug(t); dbg_printf("Tty="); WRTYxx(t->Tty); dbg_printf(" Tmangle=%d",t->Tmangle); dbg_printf(" Tflags=x%x",t->Tflags); dbg_printf(" Tcount=%d",t->Tcount); if (!(t->Tflags & TFsizeunknown) && tybasic(t->Tty) != TYvoid && tybasic(t->Tty) != TYident && tybasic(t->Tty) != TYmfunc && tybasic(t->Tty) != TYarray && tybasic(t->Tty) != TYtemplate) dbg_printf(" Tsize=%ld",type_size(t)); dbg_printf(" Tnext=%p",t->Tnext); switch (tybasic(t->Tty)) { case TYstruct: case TYmemptr: dbg_printf(" Ttag=%p,'%s'",t->Ttag,t->Ttag->Sident); //dbg_printf(" Sfldlst=%p",t->Ttag->Sstruct->Sfldlst); break; case TYarray: dbg_printf(" Tdim=%ld",t->Tdim); break; case TYident: dbg_printf(" Tident='%s'",t->Tident); break; case TYtemplate: dbg_printf(" Tsym='%s'",((typetemp_t *)t)->Tsym->Sident); { param_t *p; int i; i = 1; for (p = t->Tparamtypes; p; p = p->Pnext) { dbg_printf("\nTP%d (%p): ",i++,p); fflush(stdout); dbg_printf("Pident=%p,Ptype=%p,Pelem=%p,Pnext=%p ",p->Pident,p->Ptype,p->Pelem,p->Pnext); param_debug(p); if (p->Pident) printf("'%s' ", p->Pident); if (p->Ptype) type_print(p->Ptype); if (p->Pelem) elem_print(p->Pelem); } } break; default: if (tyfunc(t->Tty)) { param_t *p; int i; i = 1; for (p = t->Tparamtypes; p; p = p->Pnext) { dbg_printf("\nP%d (%p): ",i++,p); fflush(stdout); dbg_printf("Pident=%p,Ptype=%p,Pelem=%p,Pnext=%p ",p->Pident,p->Ptype,p->Pelem,p->Pnext); param_debug(p); if (p->Pident) printf("'%s' ", p->Pident); type_print(p->Ptype); } } break; } dbg_printf("\n"); if (t->Tnext) type_print(t->Tnext); }