Skip to content
Snippets Groups Projects
algo.mli 1.28 KiB
Newer Older
erwan's avatar
erwan committed
(* Time-stamp: <modified the 06/03/2019 (at 17:05) by Erwan Jahier> *)

(** Process programmer API *)
type value = I of int | F of float | B of bool | S of string
type local_env = string -> value (* XXX assez efficace ? *)
type action = string (* label?  *)

type varT = It | Nt | Ft | Bt | Et of int (* XXX what else ? *)
type vars = (string * varT) list 
    
type neighbor = {
  lenv:  local_env;
  n_vars: vars;
}

type enable_fun = neighbor list -> local_env -> action list
type step_fun = neighbor list -> local_env -> action -> local_env


(** Those 4 registering functions must be called! *)
type algo_id = string (* XXX comment s'en passer ??? *) 
val reg_vars : algo_id -> vars -> unit
val reg_enable : algo_id  -> enable_fun -> unit
val reg_step : algo_id  -> step_fun -> unit

(** nb: The initialisation done in the dot file have priority over this one *)
val reg_init_vars : algo_id -> local_env -> unit

(** util(s) *)
val value_to_string : value -> string





(**/**)
val verbose_level: int ref

(** raised by get_* functions *)
exception Unregistred of string * string

(** the following functions are used by sasa *)
val get_vars   : algo_id -> vars
val get_init_vars  : algo_id ->  (string * varT) list -> local_env 
val get_enable : algo_id -> enable_fun
val get_step   : algo_id -> step_fun