(* Time-stamp: <modified the 06/06/2019 (at 11:14) by Erwan Jahier> *) module Dico = Map.Make(String) open Algo type t = local_env Dico.t let (nget: t -> string -> Algo.local_env) = fun e pid -> Printf.printf "get pid %s\n" pid; flush stdout; try ((Dico.find pid e) ) with Not_found -> failwith (Printf.sprintf "Unknown pid: %s" pid) let (get: t -> string -> string -> value) = fun e pid v -> try ((Dico.find pid e) v) with _ -> failwith (Printf.sprintf "Unknown value: %s.%s" pid v) let (nget_copy: Algo.vars -> t -> string -> Algo.local_env) = fun vars e pid -> Algo.copy_local_env vars (get e pid) let (get_copy: Algo.vars -> t -> string -> string -> value) = fun vars e pid -> Algo.copy_local_env vars (get e pid) let (nset: t -> string -> Algo.local_env -> t) = fun e pid lenv -> Dico.add pid lenv e let (set: t -> string -> string -> value -> t) = fun e pid v value -> Dico.add pid (fun x -> if x=v then value else Dico.find pid e x) e let (init:unit -> t) = fun () -> Dico.empty