Revision ca7ff3f7
Added by Lélio Brun over 1 year ago
src/tools/stateflow/semantics/cPS_transformer.ml | ||
---|---|---|
1 | 1 |
open Basetypes |
2 | 2 |
|
3 |
type mode_t = |
|
4 |
| Outer |
|
5 |
| Inner |
|
6 |
| Enter |
|
7 |
|
|
3 |
type mode_t = Outer | Inner | Enter |
|
8 | 4 |
|
9 | 5 |
type 't success_t = path_t -> 't |
10 |
type 't fail_t = { local: 't; global: 't } |
|
6 |
|
|
7 |
type 't fail_t = { local : 't; global : 't } |
|
8 |
|
|
11 | 9 |
type 't wrapper_t = path_t -> 't -> 't |
12 | 10 |
|
13 | 11 |
type ('a, 'b, 't) tag_t = |
14 | 12 |
| E : (path_t, path_t -> frontier_t -> 't, 't) tag_t |
15 | 13 |
| D : (path_t, 't, 't) tag_t |
16 | 14 |
| X : (path_t, frontier_t -> 't, 't) tag_t |
17 |
| J : (junction_name_t, 't wrapper_t -> 't success_t -> 't fail_t -> 't, 't) tag_t |
|
18 |
|
|
15 |
| J |
|
16 |
: ( junction_name_t, |
|
17 |
't wrapper_t -> 't success_t -> 't fail_t -> 't, |
|
18 |
't ) |
|
19 |
tag_t |
|
19 | 20 |
|
20 | 21 |
type ('a, 'b, 't) theta_t = ('a, 'b, 't) tag_t -> 'a -> 'b |
21 | 22 |
|
22 |
module type ThetaType = |
|
23 |
sig |
|
23 |
module type ThetaType = sig |
|
24 | 24 |
type t |
25 |
|
|
25 | 26 |
val theta : ('a, 'b, t) theta_t |
26 | 27 |
end |
27 | 28 |
|
28 | 29 |
let pp_mode fmt mode = |
29 | 30 |
match mode with |
30 |
| Outer -> Format.fprintf fmt "Outer" |
|
31 |
| Inner -> Format.fprintf fmt "Inner" |
|
32 |
| Enter -> Format.fprintf fmt "Enter" |
|
33 |
|
|
31 |
| Outer -> |
|
32 |
Format.fprintf fmt "Outer" |
|
33 |
| Inner -> |
|
34 |
Format.fprintf fmt "Inner" |
|
35 |
| Enter -> |
|
36 |
Format.fprintf fmt "Enter" |
|
34 | 37 |
|
35 | 38 |
let pp_tag : type a b t. Format.formatter -> (a, b, t) tag_t -> unit = |
36 |
fun fmt tag -> |
|
37 |
match tag with |
|
38 |
| E -> Format.fprintf fmt "e" |
|
39 |
| D -> Format.fprintf fmt "d" |
|
40 |
| X -> Format.fprintf fmt "x" |
|
41 |
| J -> Format.fprintf fmt "j" |
|
42 |
|
|
43 |
|
|
44 |
module TransformerStub = |
|
45 |
struct |
|
39 |
fun fmt tag -> |
|
40 |
match tag with |
|
41 |
| E -> |
|
42 |
Format.fprintf fmt "e" |
|
43 |
| D -> |
|
44 |
Format.fprintf fmt "d" |
|
45 |
| X -> |
|
46 |
Format.fprintf fmt "x" |
|
47 |
| J -> |
|
48 |
Format.fprintf fmt "j" |
|
49 |
|
|
50 |
module TransformerStub = struct |
|
46 | 51 |
type act_t = Action.t |
52 |
|
|
47 | 53 |
type cond_t = Condition.t |
48 | 54 |
|
49 | 55 |
let nil = Action.nil |
56 |
|
|
50 | 57 |
let aquote = Action.aquote |
58 |
|
|
51 | 59 |
let open_path = Action.open_path |
60 |
|
|
52 | 61 |
let close_path = Action.close_path |
62 |
|
|
53 | 63 |
let call = Action.call |
64 |
|
|
54 | 65 |
let pp_act = Action.pp_act |
55 | 66 |
|
56 | 67 |
let cquote = Condition.cquote |
68 |
|
|
57 | 69 |
let tru = Condition.tru |
70 |
|
|
58 | 71 |
let event = Condition.event |
72 |
|
|
59 | 73 |
let active = Condition.active |
74 |
|
|
60 | 75 |
let ( && ) = Condition.( && ) |
76 |
|
|
61 | 77 |
let neg = Condition.neg |
78 |
|
|
62 | 79 |
let pp_cond = Condition.pp_cond |
63 | 80 |
end |
64 | 81 |
|
65 |
module type TransformerType = |
|
66 |
sig |
|
82 |
module type TransformerType = sig |
|
67 | 83 |
type act_t = Action.t |
84 |
|
|
68 | 85 |
type cond_t = Condition.t |
86 |
|
|
69 | 87 |
type t |
70 | 88 |
|
71 | 89 |
include ActionType with type t := act_t |
90 |
|
|
72 | 91 |
include ConditionType with type t := cond_t |
73 | 92 |
|
74 | 93 |
val null : t |
94 |
|
|
75 | 95 |
val bot : t |
96 |
|
|
76 | 97 |
val ( >> ) : t -> t -> t |
98 |
|
|
77 | 99 |
val eval_act : (module ThetaType with type t = t) -> act_t -> t |
100 |
|
|
78 | 101 |
val eval_cond : cond_t -> t -> t -> t |
102 |
|
|
79 | 103 |
(* val mktransformer : t -> unit *) |
80 | 104 |
val mkprincipal : t -> Lustre_types.program_t |
105 |
|
|
81 | 106 |
val mkcomponent : 'c call_t -> 'c -> t -> Lustre_types.program_t |
82 | 107 |
end |
83 | 108 |
|
84 |
module type ComparableTransformerType = |
|
85 |
sig |
|
109 |
module type ComparableTransformerType = sig |
|
86 | 110 |
include TransformerType |
87 | 111 |
|
88 | 112 |
val ( == ) : t -> t -> bool |
Also available in: Unified diff
reformatting