Project

General

Profile

Download (2.12 KB) Statistics
| Branch: | Tag: | Revision:
1
open Lustrec
2
open Basetypes
3
open ActiveStates
4

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

    
10

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

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

    
21

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

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

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

    
36

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

    
45

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

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

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

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

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

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

    
86
module type ComparableTransformerType =
87
sig
88
  include TransformerType
89

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

    
93
(* Local Variables: *)
94
(* compile-command:"make -C ../../../.." *)
95
(* End: *)
(7-7/10)