Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec / src / tools / stateflow / semantics / cPS_transformer.ml @ 69c96b6c

History | View | Annotate | Download (2.03 KB)

1
open Basetypes
2
open ActiveStates
3

    
4
type mode_t =
5
  | Outer
6
  | Inner
7
  | Enter
8

    
9

    
10
type 't success_t = path_t -> 't
11
type 't fail_t = { local: 't; global: 't }
12
type 't wrapper_t = path_t -> 't -> 't
13

    
14
type ('a, 'b, 't) tag_t =
15
  | E : (path_t, path_t -> frontier_t -> 't, 't) tag_t
16
  | D : (path_t, 't, 't) tag_t
17
  | X : (path_t, frontier_t -> 't, 't) tag_t
18
  | J : (junction_name_t, 't wrapper_t -> 't success_t -> 't fail_t -> 't, 't) tag_t
19

    
20

    
21
type ('a, 'b, 't) theta_t = ('a, 'b, 't) tag_t -> 'a -> 'b
22

    
23
module type ThetaType =
24
sig
25
  type t
26
  val theta : ('a, 'b, t) theta_t
27
end
28

    
29
let pp_mode fmt mode =
30
  match mode with
31
  | Outer -> Format.fprintf fmt "Outer"
32
  | Inner -> Format.fprintf fmt "Inner"
33
  | Enter -> Format.fprintf fmt "Enter"
34

    
35

    
36
let pp_tag : type a b t. Format.formatter -> (a, b, t) tag_t -> unit =
37
  fun fmt tag ->
38
    match tag with
39
    | E -> Format.fprintf fmt "e"
40
    | D -> Format.fprintf fmt "d"
41
    | X -> Format.fprintf fmt "x"
42
    | J -> Format.fprintf fmt "j"
43

    
44

    
45
module TransformerStub =
46
struct
47
  type act_t = Action.t
48
  type cond_t = Condition.t
49

    
50
  let nil = Action.nil
51
  let aquote = Action.aquote
52
  let open_path = Action.open_path
53
  let close_path = Action.close_path
54
  let call = Action.call
55
  let pp_act = Action.pp_act
56

    
57
  let cquote = Condition.cquote
58
  let tru = Condition.tru
59
  let event = Condition.event
60
  let active = Condition.active
61
  let ( && ) = Condition.( && )
62
  let neg = Condition.neg
63
  let pp_cond = Condition.pp_cond
64
end
65

    
66
module type TransformerType =
67
sig
68
  type act_t = Action.t
69
  type cond_t = Condition.t
70
  type t
71

    
72
  include ActionType with type t := act_t
73
  include ConditionType with type t := cond_t
74

    
75
  val null : t
76
  val bot : t
77
  val ( >> ) : t -> t -> t
78
  val eval_act : (module ThetaType with type t = t) -> act_t -> t
79
  val eval_cond : cond_t -> t -> t -> t
80
  (* val mktransformer : t -> unit *)
81
  val mkprincipal : t -> LustreSpec.program
82
  val mkcomponent : 'c call_t -> 'c -> t -> LustreSpec.program
83
end
84

    
85
module type ComparableTransformerType =
86
sig
87
  include TransformerType
88

    
89
  val ( == ) : t -> t -> bool
90
end
91

    
92

    
93
  
94