Skip to content
Snippets Groups Projects
env.ml 724 B
Newer Older
(* Time-stamp: <modified the 11/06/2019 (at 16:26) by Erwan Jahier> *)
erwan's avatar
erwan committed

module Dico = Map.Make(String)

open Algo
type t = local_env Dico.t 

let (get: t -> string -> Algo.local_env) =
  fun e pid  ->
    (*     Printf.printf "<-- get pid %s\n" pid; flush stdout;  *)
    try ((Dico.find pid e))
    with e ->
      failwith (Printf.sprintf "Unknown pid: %s (%s)" pid  (Printexc.to_string e))
let (get_copy: Algo.vars -> t -> string -> Algo.local_env) =
erwan's avatar
erwan committed
  fun vars e pid ->
    Algo.copy_local_env vars (get e pid)
let (set: t -> string -> Algo.local_env -> t) =
erwan's avatar
erwan committed
  fun e pid lenv ->
    (*     Printf.printf "--> set pid %s\n" pid; flush stdout;  *)
erwan's avatar
erwan committed
    Dico.add pid lenv e
erwan's avatar
erwan committed
let (init:unit -> t) = fun () -> Dico.empty