Commit 4d6f889f authored by erwan's avatar erwan
Browse files

rdbg: save/restore the sasa state between each step to allow backward moves.

parent 35aa3bc2
(* Time-stamp: <modified the 03/04/2019 (at 23:02) by Erwan Jahier> *)
(* Time-stamp: <modified the 07/05/2019 (at 17:50) by Erwan Jahier> *)
(** Process programmer API *)
type varT = It | Ft | Bt | Et of int | St | Nt | At of varT * int
......@@ -18,12 +18,12 @@ type neighbor = {
type enable_fun = neighbor list -> local_env -> action list
type step_fun = neighbor list -> local_env -> action -> local_env
type int_tables = {
vars: (string, vars) Hashtbl.t;
type internal_tables = {
vars : (string, vars) Hashtbl.t;
init_vars: (string, neighbor list -> local_env) Hashtbl.t;
enable: (string, enable_fun) Hashtbl.t;
step: (string, step_fun) Hashtbl.t;
actions: (string, action list) Hashtbl.t;
enable : (string, enable_fun) Hashtbl.t;
step : (string, step_fun) Hashtbl.t;
actions : (string, action list) Hashtbl.t;
}
let tbls = {
......@@ -118,11 +118,14 @@ let rec (init_var: neighbor list -> varT -> value) =
| At(t,i) -> A(Array.make i (init_var nl t))
let (reg_init_vars : algo_id -> (neighbor list -> local_env) -> unit) = fun algo_id x ->
let (reg_init_vars : algo_id -> (neighbor list -> local_env) -> unit) =
fun algo_id x ->
if !verbose_level > 0 then Printf.printf "Registering %s init_vars\n" algo_id;
flush stdout;
Hashtbl.replace tbls.init_vars algo_id x
let (get_init_vars : algo_id -> (string * varT) list -> (neighbor list -> local_env)) =
let (get_init_vars : algo_id -> (string * varT) list ->
(neighbor list -> local_env)) =
fun algo_id vars ->
let default_env =
(fun nl v ->
......@@ -137,7 +140,8 @@ let (get_init_vars : algo_id -> (string * varT) list -> (neighbor list -> local_
try user_env nl v
with e ->
if !verbose_level > 1 then
Printf.eprintf "No init value for '%s' in user init function (%s).\n" v
Printf.eprintf
"No init value for '%s' in user init function (%s).\n" v
(Printexc.to_string e);
default_env nl v)
with Not_found ->
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment