diff --git a/lispBM/lispBM/repl-cps/repl.c b/lispBM/lispBM/repl-cps/repl.c index 78adc998..d6089d6a 100644 --- a/lispBM/lispBM/repl-cps/repl.c +++ b/lispBM/lispBM/repl-cps/repl.c @@ -457,32 +457,42 @@ int main(int argc, char **argv) { lbm_load_and_define_program(&string_tok, "prelude"); lbm_continue_eval(); - /* Something better is needed. - this sleep ís to ensure the string is alive until parsing + /* Something better is needed. + this sleep ís to ensure the string is alive until parsing is done */ sleep_callback(10000); } else if (strncmp(str, ":send", 5) == 0) { int id; int i_val; - + if (sscanf(str + 5, "%d%d", &id, &i_val) == 2) { lbm_pause_eval(); while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) { sleep_callback(10); } - + if (lbm_send_message((lbm_cid)id, lbm_enc_i(i_val)) == 0) { printf("Could not send message\n"); } - + lbm_continue_eval(); } else { printf("Incorrect arguments to send\n"); } - - } else { + } else if (strncmp(str, ":pause", 6) == 0) { + lbm_pause_eval_with_gc(30); + while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) { + sleep_callback(10); + } + printf("Evaluator paused\n"); + + } else if (strncmp(str, ":continue", 9) == 0) { + lbm_continue_eval(); + } else if (strncmp(str, ":step", 5) == 0) { + lbm_step_eval(); + } else { /* Get exclusive access to the heap */ lbm_pause_eval(); while(lbm_get_eval_state() != EVAL_CPS_STATE_PAUSED) { @@ -497,8 +507,8 @@ int main(int argc, char **argv) { lbm_continue_eval(); printf("started ctx: %u\n", cid); - /* Something better is needed. - this sleep ís to ensure the string is alive until parsing + /* Something better is needed. + this sleep ís to ensure the string is alive until parsing is done */ sleep_callback(10000); } diff --git a/lispBM/lispBM/src/eval_cps.c b/lispBM/lispBM/src/eval_cps.c index c8d08376..b6fb2d8d 100644 --- a/lispBM/lispBM/src/eval_cps.c +++ b/lispBM/lispBM/src/eval_cps.c @@ -1927,7 +1927,7 @@ void lbm_run_eval(void){ eval_cps_run_state = EVAL_CPS_STATE_RUNNING; break; case EVAL_CPS_STATE_STEP: - eval_cps_run_state = EVAL_CPS_STATE_PAUSED; + eval_cps_next_state = EVAL_CPS_STATE_PAUSED; break; case EVAL_CPS_STATE_PAUSED: if (eval_cps_run_state != EVAL_CPS_STATE_PAUSED) { @@ -1943,6 +1943,7 @@ void lbm_run_eval(void){ eval_running = false; continue; default: + eval_cps_run_state = eval_cps_next_state; break; }