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

(** Process programmer API *)
type value = I of int | F of float | B of bool | S of string
           | N of int  (* neighbor canal number *)
erwan's avatar
erwan committed
type local_env = string -> value (* XXX assez efficace ? *)
type action = string (* label?  *)

type varT = It | Nt | Ft | Bt | Et of int | Neighbor
erwan's avatar
erwan committed
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 -> (neighbor list -> local_env) -> unit
erwan's avatar
erwan committed

(** 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 -> (neighbor list -> local_env) 
erwan's avatar
erwan committed
val get_enable : algo_id -> enable_fun
val get_step   : algo_id -> step_fun