diff options
| author | Keith Packard <keithp@keithp.com> | 2018-01-06 17:29:10 -0800 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2018-01-06 17:31:43 -0800 | 
| commit | 16061947d4376b41e596d87f97ec53ec29d17644 (patch) | |
| tree | f7ad08f8810b0ea78cf282048eacb46d441a2ee1 /src/scheme/ao_scheme_eval.c | |
| parent | 39df849f0717d92a7d5bdf8aa5904bd4db1b467f (diff) | |
altos/scheme: Add ports. Split scheme code up.
And lots of other changes, including freeing unreferenced atoms.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/scheme/ao_scheme_eval.c')
| -rw-r--r-- | src/scheme/ao_scheme_eval.c | 15 | 
1 files changed, 9 insertions, 6 deletions
| diff --git a/src/scheme/ao_scheme_eval.c b/src/scheme/ao_scheme_eval.c index 91f6a84f..9536cb91 100644 --- a/src/scheme/ao_scheme_eval.c +++ b/src/scheme/ao_scheme_eval.c @@ -271,8 +271,10 @@ ao_scheme_eval_exec(void)  		}  		ao_scheme_v = v; -		ao_scheme_stack->values = AO_SCHEME_NIL; -		ao_scheme_stack->values_tail = AO_SCHEME_NIL; +		if (ao_scheme_stack->state != eval_exec) { +			ao_scheme_stack->values = AO_SCHEME_NIL; +			ao_scheme_stack->values_tail = AO_SCHEME_NIL; +		}  		DBGI(".. result "); DBG_POLY(ao_scheme_v); DBG ("\n");  		DBGI(".. frame "); DBG_POLY(ao_scheme_frame_poly(ao_scheme_frame_current)); DBG("\n");  		break; @@ -530,6 +532,7 @@ const char * const ao_scheme_state_names[] = {  	[eval_macro] = "macro",  }; +#ifdef AO_SCHEME_FEATURE_SAVE  /*   * Called at restore time to reset all execution state   */ @@ -547,6 +550,7 @@ ao_scheme_eval_restart(void)  {  	return ao_scheme_stack_push();  } +#endif /* AO_SCHEME_FEATURE_SAVE */  ao_poly  ao_scheme_eval(ao_poly _v) @@ -559,12 +563,11 @@ ao_scheme_eval(ao_poly _v)  		return AO_SCHEME_NIL;  	while (ao_scheme_stack) { -		if (!(*evals[ao_scheme_stack->state])() || ao_scheme_exception) { -			ao_scheme_stack_clear(); -			return AO_SCHEME_NIL; -		} +		if (!(*evals[ao_scheme_stack->state])() || ao_scheme_exception) +			break;  	}  	DBG_DO(if (ao_scheme_frame_current) {DBGI("frame left as "); DBG_POLY(ao_scheme_frame_poly(ao_scheme_frame_current)); DBG("\n");}); +	ao_scheme_stack = NULL;  	ao_scheme_frame_current = NULL;  	return ao_scheme_v;  } | 
