void call() { char *loc, *temp; int lvartemp; loc = find_func(token); if(loc==NULL) sntx_err(FUNC_UNDEF); else { lvartemp = lvartos; get_args(); temp = prog; func_push(lvartemp); prog = loc; get_params(); interp_block(); prog = temp; lvartos = func_pop(); } }
/* Call a function. */ void call(void) { char *loc, *temp; int lvartemp; loc = find_func(token); /* find entry point of function */ if(loc == NULL) sntx_err(FUNC_UNDEF); /* function not defined */ else { lvartemp = lvartos; /* save local var stack index */ get_args(); /* get function arguments */ temp = prog; /* save return location */ func_push(lvartemp); /* save local var stack index */ prog = loc; /* reset prog to start of function */ get_params(); /* load the function's parameters with the values of the arguments */ interp_block(); /* interpret the function */ prog = temp; /* reset the program pointer */ lvartos = func_pop(); /* reset the local var stack */ } }