Project

General

Profile

Download (8.13 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
exception Error of Location.t * Error.error_kind
16
module VSet: sig
17
  include Set.S
18
  val pp: Format.formatter -> t -> unit 
19
  val get: ident -> t -> elt
20
end with type elt = Lustre_types.var_decl 
21
  
22
val dummy_type_dec: type_dec
23
val dummy_clock_dec: clock_dec
24

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

    
36
val dummy_var_decl: ident -> Types.type_expr -> var_decl
37

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

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

    
79
val get_enum_type_tags: type_dec_desc -> label list
80

    
81
val get_struct_type_fields: type_dec_desc -> (label * type_dec_desc) list
82

    
83
val consts_of_enum_type: top_decl -> top_decl list
84

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

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

    
100
(* val get_const: ident -> constant *)
101

    
102
val sort_handlers : (label * 'a) list -> (label * 'a) list
103

    
104
val is_eq_expr: expr -> expr -> bool
105

    
106
(* val pp_error :  Format.formatter -> error -> unit *)
107

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

    
122
val add_internal_funs: unit -> unit
123

    
124
val pp_prog_type : Format.formatter -> program_t -> unit
125

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

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

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

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

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

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

    
151
val eq_replace_rhs_var: (ident -> bool) -> (ident -> ident) -> eq -> eq
152

    
153
(** val rename_expr f_node f_var expr *)
154
val rename_expr : (ident -> ident) -> (ident -> ident) -> expr -> expr
155
(** val rename_eq f_node f_var eq *)
156
val rename_eq : (ident -> ident) -> (ident -> ident) -> eq -> eq
157
(** val rename_aut f_node f_var aut *)
158
val rename_aut : (ident -> ident) -> (ident -> ident) -> automata_desc -> automata_desc
159
(** rename_prog f_node f_var f_const prog *)
160
val rename_prog: (ident -> ident) -> (ident -> ident) -> (ident -> ident) -> program_t -> program_t
161
val rename_node: (ident -> ident) -> (ident -> ident) -> node_desc -> node_desc
162

    
163
val substitute_expr: var_decl list -> eq list -> expr -> expr
164

    
165
val copy_var_decl: var_decl -> var_decl
166
val copy_const: const_desc -> const_desc
167
val copy_node: node_desc -> node_desc
168
val copy_top: top_decl -> top_decl
169
val copy_prog: top_decl list -> top_decl list
170

    
171
(** Annotation expression related functions *)
172
val mkeexpr: Location.t ->  expr -> eexpr
173
val empty_contract: contract_desc
174
val mk_contract_var: ident -> bool -> type_dec option -> expr -> Location.t -> contract_desc
175
val mk_contract_guarantees: ?name:string -> eexpr -> contract_desc
176
val mk_contract_assume: ?name:string -> eexpr -> contract_desc
177
val mk_contract_mode: ident -> eexpr list -> eexpr list -> Location.t -> contract_desc
178
val mk_contract_import: ident -> expr -> expr -> Location.t -> contract_desc
179
val merge_contracts:  contract_desc -> contract_desc -> contract_desc 
180
val extend_eexpr: (quantifier_type * var_decl list) list -> eexpr -> eexpr
181
val update_expr_annot: ident -> expr -> expr_annot -> expr
182
(* val mkpredef_call: Location.t -> ident -> eexpr list -> eexpr*)
183

    
184
val expr_contains_expr: tag -> expr -> bool
185

    
186
val reset_cpt_fresh: unit -> unit
187
  
188
(* mk_fresh_var parentid to be registered as parent_nodeid, vars is the list of existing vars in that context *)
189
val mk_fresh_var: (ident * var_decl list) -> Location.t -> Types.type_expr ->  Clocks.clock_expr -> var_decl
190

    
191
val find_eq: ident list -> eq list -> eq * eq list
192

    
193
(* Extract a num to describe a real constant *)
194
val cst_real_to_num: Num.num -> int -> Num.num
195

    
196
val get_expr_calls: top_decl list -> expr -> Utils.ISet.t
197

    
198
val eq_has_arrows: eq -> bool
199

    
200
val push_negations: ?neg:bool -> expr -> expr
201

    
202
val add_pre_expr: ident list -> expr -> expr
203

    
204
val mk_eq: Location.t -> expr -> expr -> expr 
205
(* Local Variables: *)
206
(* compile-command:"make -C .." *)
207
(* End: *)
(17-17/67)