Project

General

Profile

Revision 3769b712 src/tools/stateflow/semantics/cPS_evaluator.ml

View differences:

src/tools/stateflow/semantics/cPS_evaluator.ml
7 7
     - Evaluator module
8 8
 *)
9 9

  
10
  let _main_ _ = 
10
 open Lustrec
11

  
12
  let _main_ _ = function 
11 13
    | Eval ->
12 14
     let module Model = (val model) in
13 15
     let module T = CPS_transformer.Evaluator in
......
37 39
  
38 40
  let final_env, cpt =
39 41
    List.fold_left (fun (env, cpt) event ->
40
      Format.printf "#### %i@.%a@." cpt ActiveStates.Env.pp_env env;
42
      Format.printf "#### %i@.%a@." cpt ActiveStates.Lustrec.Env.pp_env env;
41 43
      Format.printf "-- Event %a --@." Basetypes.pp_event event;
42 44
      let env', actions_performed = func (event, env) in
43 45
      let _ =
......
52 54
      env', cpt+1
53 55
    ) (init_env, 1) t
54 56
  in
55
  Format.printf "#### %i@.%a@." cpt ActiveStates.Env.pp_env final_env;
57
  Format.printf "#### %i@.%a@." cpt ActiveStates.Lustrec.Env.pp_env final_env;
56 58
  ()
57 59

  
58 60

  
59 61
    type truc = A of base_action_t | C of base_condition_t
60
module Evaluator : TransformerType with type t = (event_t * bool ActiveStates.Env.t * truc list) -> (event_t * bool ActiveStates.Env.t * truc list ) =
62
module Evaluator : TransformerType with type t = (event_t * bool ActiveStates.Lustrec.Env.t * truc list) -> (event_t * bool ActiveStates.Lustrec.Env.t * truc list ) =
61 63
struct
62 64
  include TransformerStub
63
  type env_t = event_t * bool ActiveStates.Env.t * truc list (* Don't care for values yet *)
65
  type env_t = event_t * bool ActiveStates.Lustrec.Env.t * truc list (* Don't care for values yet *)
64 66
  type t = env_t -> env_t
65 67
 
66 68
  let null rho = rho
......
77 79

  
78 80
  let ( ?? ) b tr = if b then tr else null
79 81

  
80
  let eval_open p (evt, rho, al)  = (evt, ActiveStates.Env.add p true rho, al)
81
  let eval_close p (evt, rho, al) = (evt, ActiveStates.Env.add p false rho, al)
82
  let eval_open p (evt, rho, al)  = (evt, ActiveStates.Lustrec.Env.add p true rho, al)
83
  let eval_close p (evt, rho, al) = (evt, ActiveStates.Lustrec.Env.add p false rho, al)
82 84
  let eval_call : type c. (module ThetaType with type t = t) -> c call_t -> c -> t =
83 85
    fun kenv ->
84 86
    let module Theta = (val kenv : ThetaType with type t = t) in	      
......
101 103
    (* Format.printf "----- cond = %a@." Condition.pp_cond condition; *)
102 104
    match condition with
103 105
    | Condition.True               -> ok
104
    | Condition.Active p           -> (fun ((evt, env, al) as rho) -> if ActiveStates.Env.find p env then ok rho else ko rho)
106
    | Condition.Active p           -> (fun ((evt, env, al) as rho) -> if ActiveStates.Lustrec.Env.find p env then ok rho else ko rho)
105 107
    | Condition.Event e            -> (fun ((evt, env, al) as rho) -> match evt with None -> ko rho | Some e' -> if e=e' then ok rho else ko rho)
106 108
    | Condition.Neg cond           -> eval_cond cond ko ok
107 109
    | Condition.And (cond1, cond2) -> eval_cond cond1 (eval_cond cond2 ok ko) ko

Also available in: Unified diff