Project

General

Profile

Download (8.22 KB) Statistics
| Branch: | Tag: | Revision:
1
(********************************************************************)
2
(*                                                                  *)
3
(*  The LustreC compiler toolset   /  The LustreC Development Team  *)
4
(*  Copyright 2012 -    --   ONERA - CNRS - INPT                    *)
5
(*                                                                  *)
6
(*  LustreC is free software, distributed WITHOUT ANY WARRANTY      *)
7
(*  under the terms of the GNU Lesser General Public License        *)
8
(*  version 2.1.                                                    *)
9
(*                                                                  *)
10
(********************************************************************)
11

    
12

    
13
open Lustre_types
14

    
15
module VDeclModule: sig
16
  type t
17
  val compare: t -> t -> int
18
end with type t = Lustre_types.var_decl
19

    
20
module VSet: sig
21
  include Set.S
22
  val pp: Format.formatter -> t -> unit 
23
  val get: ident -> t -> elt
24
end with type elt = Lustre_types.var_decl 
25
  
26
val dummy_type_dec: type_dec
27
val dummy_clock_dec: clock_dec
28

    
29
val mktyp: Location.t -> type_dec_desc -> type_dec
30
val mkclock: Location.t -> clock_dec_desc -> clock_dec
31
val mkvar_decl: Location.t -> ?orig:bool ->
32
  ident *
33
    type_dec *
34
    clock_dec *
35
    bool (* is const *) *
36
    expr option (* value *) *
37
    string option (* parent id *)
38
  -> var_decl
39

    
40
val dummy_var_decl: ident -> Types.type_expr -> var_decl
41

    
42
val var_decl_of_const: ?parentid:ident option -> const_desc -> var_decl
43
val mkexpr: Location.t ->  expr_desc -> expr
44
val mkeq: Location.t -> ident list * expr -> eq
45
val mkassert: Location.t -> expr -> assert_t
46
val mktop_decl: Location.t -> ident -> bool -> top_decl_desc -> top_decl
47
val mkpredef_call: Location.t -> ident -> expr list -> expr
48
val mk_new_name: (ident -> bool) -> ident -> ident
49
val mk_new_node_name: node_desc -> ident -> ident
50
val mktop: top_decl_desc -> top_decl
51

    
52
(* constructor for machine types *)
53
val mkinstr: (* ?lustre_expr:expr ->  *)?lustre_eq: eq -> ?instr_spec: Machine_code_types.value_t Spec_types.formula_t list -> Machine_code_types.instr_t_desc -> Machine_code_types.instr_t
54
val get_instr_desc: Machine_code_types.instr_t -> Machine_code_types.instr_t_desc
55
val update_instr_desc: Machine_code_types.instr_t -> Machine_code_types.instr_t_desc -> Machine_code_types.instr_t
56
  
57
(*val node_table : (ident, top_decl) Hashtbl.t*)
58
val print_node_table:  Format.formatter -> unit -> unit
59
val node_name: top_decl -> ident
60
val node_inputs: top_decl -> var_decl list
61
val node_from_name: ident -> top_decl
62
val update_node: ident -> top_decl -> unit
63
val is_generic_node: top_decl -> bool
64
val is_imported_node: top_decl -> bool
65
val is_contract: top_decl -> bool
66
val is_node_contract: node_desc -> bool
67
val get_node_contract: node_desc -> contract_desc
68
  
69
val consts_table: (ident, top_decl) Hashtbl.t
70
val print_consts_table:  Format.formatter -> unit -> unit
71
val type_table: (type_dec_desc, top_decl) Hashtbl.t
72
val print_type_table:  Format.formatter -> unit -> unit
73
val is_clock_dec_type: type_dec_desc -> bool
74
val get_repr_type: type_dec_desc -> type_dec_desc
75
val is_user_type: type_dec_desc -> bool
76
val coretype_equal: type_dec_desc -> type_dec_desc -> bool
77
val tag_default: label
78
val tag_table: (label, top_decl) Hashtbl.t
79
val field_table: (label, top_decl) Hashtbl.t
80

    
81
val get_enum_type_tags: type_dec_desc -> label list
82

    
83
val get_struct_type_fields: type_dec_desc -> (label * type_dec_desc) list
84

    
85
val consts_of_enum_type: top_decl -> top_decl list
86

    
87
val const_of_bool: bool -> constant
88
val const_is_bool: constant -> bool
89
val const_negation: constant -> constant
90
val const_or: constant -> constant -> constant
91
val const_and: constant -> constant -> constant
92
val const_xor: constant -> constant -> constant
93
val const_impl: constant -> constant -> constant
94

    
95
val get_var: ident -> var_decl list -> var_decl
96
val get_node_vars: node_desc -> var_decl list
97
val get_node_var: ident -> node_desc -> var_decl
98
val get_node_eqs: node_desc -> eq list * automata_desc list
99
val get_node_eq: ident -> node_desc -> eq
100
val get_node_interface: node_desc -> imported_node_desc
101

    
102
(* val get_const: ident -> constant *)
103

    
104
val sort_handlers : (label * 'a) list -> (label * 'a) list
105

    
106
val is_eq_expr: expr -> expr -> bool
107

    
108
(* val pp_error :  Format.formatter -> error -> unit *)
109

    
110
(* Caution, returns an untyped, unclocked, etc, expression *)
111
val is_tuple_expr : expr -> bool
112
val ident_of_expr : expr -> ident
113
val expr_of_vdecl : var_decl -> expr
114
val expr_of_ident : ident -> Location.t -> expr
115
val expr_list_of_expr : expr -> expr list
116
val expr_of_expr_list : Location.t -> expr list -> expr
117
val call_of_expr: expr -> (ident * expr list * expr option)
118
val expr_of_dimension: Dimension.dim_expr -> expr
119
val dimension_of_expr: expr -> Dimension.dim_expr
120
val dimension_of_const: Location.t -> constant -> Dimension.dim_expr
121
val expr_to_eexpr: expr -> eexpr
122
(* REMOVED, pushed in utils.ml   val new_tag : unit -> tag *)
123

    
124
val add_internal_funs: unit -> unit
125

    
126
val pp_prog_type : Format.formatter -> program_t -> unit
127

    
128
val pp_prog_clock : Format.formatter -> program_t -> unit
129

    
130
val const_of_top: top_decl -> const_desc
131
val node_of_top: top_decl -> node_desc
132
val imported_node_of_top: top_decl -> imported_node_desc
133
val typedef_of_top: top_decl -> typedef_desc
134
val dependency_of_top: top_decl -> (bool * ident)
135

    
136
val get_nodes : program_t -> top_decl list
137
val get_imported_nodes : program_t -> top_decl list
138
val get_consts : program_t -> top_decl list
139
val get_typedefs: program_t -> top_decl list
140
val get_dependencies : program_t -> top_decl list
141
(* val prog_unfold_consts: program_t -> program_t *)
142

    
143
(** Returns the node named ident in the provided program. Raise Not_found *)
144
val get_node : ident -> program_t -> node_desc
145

    
146
  
147
val rename_static: (ident -> Dimension.dim_expr) -> type_dec_desc -> type_dec_desc
148
val rename_carrier: (ident -> ident) -> clock_dec_desc -> clock_dec_desc
149

    
150
val get_expr_vars: expr -> Utils.ISet.t
151
(*val expr_replace_var: (ident -> ident) -> expr -> expr*)
152

    
153
val eq_replace_rhs_var: (ident -> bool) -> (ident -> ident) -> eq -> eq
154

    
155
(** val rename_expr f_node f_var expr *)
156
val rename_expr : (ident -> ident) -> (ident -> ident) -> expr -> expr
157

    
158
(** val rename_eq f_node f_var eq *)
159
val rename_eq : (ident -> ident) -> (ident -> ident) -> eq -> eq
160

    
161
(** val rename_aut f_node f_var aut *)
162
val rename_aut : (ident -> ident) -> (ident -> ident) -> automata_desc -> automata_desc
163

    
164
(** rename_prog f_node f_var f_const prog *)
165
val rename_prog: (ident -> ident) -> (ident -> ident) -> (ident -> ident) -> program_t -> program_t
166
val rename_node: (ident -> ident) -> (ident -> ident) -> node_desc -> node_desc
167

    
168
val substitute_expr: var_decl list -> eq list -> expr -> expr
169

    
170
val copy_var_decl: var_decl -> var_decl
171
val copy_const: const_desc -> const_desc
172
val copy_node: node_desc -> node_desc
173
val copy_top: top_decl -> top_decl
174
val copy_prog: top_decl list -> top_decl list
175

    
176
(** Annotation expression related functions *)
177
val mkeexpr: Location.t ->  expr -> eexpr
178
val empty_contract: contract_desc
179
val mk_contract_var: ident -> bool -> type_dec option -> expr -> Location.t -> contract_desc
180
val mk_contract_guarantees: string option -> eexpr -> contract_desc
181
val mk_contract_assume: string option -> eexpr -> contract_desc
182
val mk_contract_mode: ident -> eexpr list -> eexpr list -> Location.t -> contract_desc
183
val mk_contract_import: ident -> expr -> expr -> Location.t -> contract_desc
184
val merge_contracts:  contract_desc -> contract_desc -> contract_desc 
185
val extend_eexpr: (quantifier_type * var_decl list) list -> eexpr -> eexpr
186
val update_expr_annot: ident -> expr -> expr_annot -> expr
187
(* val mkpredef_call: Location.t -> ident -> eexpr list -> eexpr*)
188

    
189
val expr_contains_expr: tag -> expr -> bool
190

    
191
val reset_cpt_fresh: unit -> unit
192
  
193
(* mk_fresh_var parentid to be registered as parent_nodeid, vars is the list of existing vars in that context *)
194
val mk_fresh_var: (ident * var_decl list) -> Location.t -> Types.type_expr ->  Clocks.clock_expr -> var_decl
195

    
196
val find_eq: ident list -> eq list -> eq * eq list
197

    
198
val get_expr_calls: top_decl list -> expr -> Utils.ISet.t
199

    
200
(* val eq_has_arrows: eq -> bool *)
201

    
202
val push_negations: ?neg:bool -> expr -> expr
203

    
204
val add_pre_expr: ident list -> expr -> expr
205

    
206
val mk_eq: Location.t -> expr -> expr -> expr 
207

    
208
(* Simple transformations: eg computation over constants *)
209
val partial_eval: expr -> expr
210

    
211
  (* Local Variables: *)
212
(* compile-command:"make -C .." *)
213
(* End: *)
(16-16/66)