Newer
Older
(* Time-stamp: <modified the 03/04/2019 (at 23:12) by Erwan Jahier> *)
type varT = It | Ft | Bt | Et of int | St | Nt | At of varT * int
type vars = (string * varT) list
type value = I of int | F of float | B of bool | E of int | S of string
type local_env = string -> value
type action = string (* label *)
pid: unit -> string; (* this info is not available in all modes (e.g., anonymous) *)
reply: unit -> int; (* ditto *)
}
type enable_fun = neighbor list -> local_env -> action list
type step_fun = neighbor list -> local_env -> action -> local_env
(** Those 3 registering functions must be called! *)
val reg_vars : algo_id -> vars -> unit
val reg_enable : algo_id -> enable_fun -> unit
val reg_step : algo_id -> step_fun -> unit
(** raised by sasa if one of the function above is not called *)
exception Unregistred of string * string
(** This one is not mandatory. The initialisation done in the dot
file have priority over this one. *)
val reg_init_vars : algo_id -> (neighbor list -> local_env) -> unit
(** Mandatory in custom mode only. *)
val reg_actions : algo_id -> action list -> unit
(** util(s) *)
val value_to_string : value -> string
(**/**)
(** functions below are not part of the API *)
val vart_to_rif_decl: varT -> string -> (string * string) list
val vart_to_rif_string: varT -> string -> string
val verbose_level: int ref
(** the following functions are used by sasa *)
val get_vars : algo_id -> vars
val get_enable : algo_id -> enable_fun
val get_step : algo_id -> step_fun
val get_init_vars : algo_id -> (string * varT) list -> (neighbor list -> local_env)
val get_actions : algo_id -> action list