int eppic_addsvs(int type, var_t*sv) { int curlev=svlev; if(svlev==S_MAXDEEP) { eppic_error("Svars stack overflow"); } else { svs[svlev].type=type; svs[svlev].svs=sv; eppic_setsvlev(eppic_getsvlev()+1); /* perform automatic initializations */ eppic_inivars(sv, type==S_PARSE); /* if S_FILE then we are entering a function so start a newset of stack variables */ if(type == S_FILE ) { (void)eppic_addsvs(S_AUTO, (var_t*)eppic_newvlist()); } } return curlev; }
eppic_vpop() { if(vlev) { eppic_setsvlev(sidx[--vlev]); } else eppic_error("Too many parse var pops!"); }
void eppic_popjmp(int type) { if(!njmps) { eppic_error("Pop underflow!"); } njmps--; if(jmps[njmps].type != type) { eppic_error("Wrong pop! %d vs %d", jmps[njmps].type, type); } eppic_setsvlev(jmps[njmps].svlev); }
/* Switch context to a break, continue or return end point. If we are popoing a break we trash the continues. If we are poping a return then we trash the current break and continue. */ void eppic_dojmp(int type, void *val) { if(njmps > 1) { jmp_buf *env; while(njmps && jmps[--njmps].type!=type); if(jmps[njmps].val) *(jmps[njmps].val)=val; env=jmps[njmps].env; /* reset the variable level too... */ eppic_setsvlev(jmps[njmps].svlev); longjmp(*env, 1); /* NOT REACHED */ } else eppic_parseback(); /* we use the same code for initializing static and automatic variables. In the case of statiuc variables is the initizer expression throws an error then there's no J_EXIT jump context and njmps is null. It's treated as a parsing error */ }