diff --git a/bin/process.ml b/bin/process.ml index cfd73e5ff7f99fcacefa1535e22175a6ba00cacc..9cd50914161fd16c2b6a49bf85fa50a15bd4c4b2 100644 --- a/bin/process.ml +++ b/bin/process.ml @@ -1,4 +1,4 @@ -(* Time-stamp: <modified the 09/03/2019 (at 11:41) by Erwan Jahier> *) +(* Time-stamp: <modified the 10/03/2019 (at 20:35) by Erwan Jahier> *) type t = { pid : string; @@ -29,7 +29,6 @@ let (make: Topology.node -> t) = user_init_env nl v | Some x -> ( match List.assoc_opt v vars with - | Some(Algo.Neighbor) | Some(Algo.It) | Some(Algo.Nt) -> I (int_of_string x) | Some(Algo.Bt) -> B (bool_of_string x) diff --git a/bin/stringOf.ml b/bin/stringOf.ml index 1515200ff3fd47e0284ab0ed195bcaacd3adcd99..228fa5a5e8b039fae8d6b293314d3891a6cc2dab 100644 --- a/bin/stringOf.ml +++ b/bin/stringOf.ml @@ -2,11 +2,10 @@ open Algo let (algo_varT: Algo.varT -> string) = function | It -> "int" - | Nt -> "pos_int" | Ft -> "float" | Bt -> "bool" | Et i -> Printf.sprintf "enum(%d)" i - | Neighbor -> "Neighbor" + | Nt -> "Neighbor" let (algo_vars : Algo.vars -> string) = fun vars -> String.concat "," (List.map (fun (n,t) -> Printf.sprintf "%s:%s" n (algo_varT t)) vars) diff --git a/lib/algo/algo.ml b/lib/algo/algo.ml index 3f4b8f43774551181d907e798669a9bb4f5fa2e6..3e4616960341a2e8da9edd731115db5352d3c609 100644 --- a/lib/algo/algo.ml +++ b/lib/algo/algo.ml @@ -1,7 +1,7 @@ -(* Time-stamp: <modified the 09/03/2019 (at 15:04) by Erwan Jahier> *) +(* Time-stamp: <modified the 10/03/2019 (at 20:35) by Erwan Jahier> *) (** Process programmer API *) -type varT = It | Nt | Ft | Bt | Et of int | Neighbor +type varT = It | Nt | Ft | Bt | Et of int type action = string (* juste un label *) type value = I of int | F of float | B of bool | S of string | N of int type local_env = string -> value @@ -35,12 +35,11 @@ let tbls = { let verbose_level = ref 0 let vart_to_rif_string = function - | It - | Nt -> "int" + | It -> "int" | Ft -> "real" | Bt -> "bool" | Et _i -> "int" - | Neighbor -> "int" + | Nt -> "int" let value_to_string = function | I i @@ -80,11 +79,10 @@ let (get_init_vars : algo_id -> (string * varT) list -> (neighbor list -> local_ (fun nl v -> match List.find_opt (fun (x,_t) -> x=v) vars with None -> failwith (v^" unknown var") - | Some(_,Neighbor) -> + | Some(_,Nt) -> assert (nl <> []); N (Random.int ((List.length nl)-1)) - | Some(_,It) - | Some(_,Nt) -> I (Random.int 100000) + | Some(_,It) -> I (Random.int 100000) | Some(_,Bt) -> B (Random.bool ()) | Some(_,Ft) -> F (Random.float max_float) | Some(_,Et i) -> I (Random.int i) diff --git a/lib/algo/algo.mli b/lib/algo/algo.mli index 4e4492c9d1e5c59be607586217b4c753e7ebc238..366b36a306261619e8392102105afc524bab66e3 100644 --- a/lib/algo/algo.mli +++ b/lib/algo/algo.mli @@ -1,12 +1,12 @@ -(* Time-stamp: <modified the 09/03/2019 (at 15:02) by Erwan Jahier> *) +(* Time-stamp: <modified the 10/03/2019 (at 20:38) by Erwan Jahier> *) (** Process programmer API *) type value = I of int | F of float | B of bool | S of string | N of int (* neighbor canal number *) -type local_env = string -> value (* XXX assez efficace ? *) -type action = string (* label? *) +type local_env = string -> value +type action = string (* label *) -type varT = It | Nt | Ft | Bt | Et of int | Neighbor +type varT = It | Nt | Ft | Bt | Et of int type vars = (string * varT) list type neighbor = { diff --git a/test/bfs-spanning-tree/p.ml b/test/bfs-spanning-tree/p.ml index ba4e5b982e99c1d4a466f0b48e392f668e485ab2..44e5efa68825924f581d4f3ba9d2c4c945051427 100644 --- a/test/bfs-spanning-tree/p.ml +++ b/test/bfs-spanning-tree/p.ml @@ -1,10 +1,10 @@ -(* Time-stamp: <modified the 09/03/2019 (at 12:45) by Erwan Jahier> *) +(* Time-stamp: <modified the 10/03/2019 (at 20:39) by Erwan Jahier> *) (* This is algo 5.4 in the book *) open Algo -let vars = ["d",It; "par",Neighbor ] +let vars = ["d",It; "par",Nt ] let d=10 let (init_vars: neighbor list -> local_env) =