Posted to c by dbohdan at Fri May 12 19:52:05 GMT 2017view raw
- static LILCALLBACK lil_value_t fnc_upeval(lil_t lil, size_t argc, lil_value_t* argv)
- {
- lil_env_t thisenv = lil->env;
- lil_env_t thisdownenv = lil->downenv;
- lil_value_t r;
- if (lil->rootenv == thisenv) return fnc_eval(lil, argc, argv);
- lil->env = thisenv->parent;
- lil->downenv = thisenv;
- r = fnc_eval(lil, argc, argv);
- lil->env = thisenv;
- lil->downenv = thisdownenv;
- return r;
- }
- static LILCALLBACK lil_value_t fnc_downeval(lil_t lil, size_t argc, lil_value_t* argv)
- {
- lil_value_t r;
- lil_env_t upenv = lil->env;
- lil_env_t downenv = lil->downenv;
- if (!downenv) return fnc_eval(lil, argc, argv);
- lil->downenv = NULL;
- lil->env = downenv;
- r = fnc_eval(lil, argc, argv);
- lil->downenv = downenv;
- lil->env = upenv;
- return r;
- }