1
|
open Lustre_types
|
2
|
open PluginList
|
3
|
|
4
|
let () = Sites.Plugins.Plugins.load_all ()
|
5
|
|
6
|
let options () =
|
7
|
List.flatten
|
8
|
(List.map Options_management.plugin_opt
|
9
|
(List.map
|
10
|
(fun m ->
|
11
|
let module M = (val m : PluginType.S) in
|
12
|
M.name, M.activate, M.usage, M.options)
|
13
|
(plugins ())))
|
14
|
|
15
|
let init () =
|
16
|
List.iter
|
17
|
(fun m ->
|
18
|
let module M = (val m : PluginType.S) in
|
19
|
M.init ())
|
20
|
(plugins ())
|
21
|
|
22
|
let check_force_stateful () =
|
23
|
List.exists
|
24
|
(fun m ->
|
25
|
let module M = (val m : PluginType.S) in
|
26
|
M.check_force_stateful ())
|
27
|
(plugins ())
|
28
|
|
29
|
let refine_machine_code prog machine_code =
|
30
|
List.fold_left
|
31
|
(fun accu m ->
|
32
|
let module M = (val m : PluginType.S) in
|
33
|
M.refine_machine_code prog accu)
|
34
|
machine_code (plugins ())
|
35
|
|
36
|
let c_backend_main_loop_body_prefix basename mname fmt () =
|
37
|
List.iter
|
38
|
(fun (m : (module PluginType.S)) ->
|
39
|
let module M = (val m : PluginType.S) in
|
40
|
M.c_backend_main_loop_body_prefix basename mname fmt ())
|
41
|
(plugins ())
|
42
|
|
43
|
let c_backend_main_loop_body_suffix fmt () =
|
44
|
List.iter
|
45
|
(fun (m : (module PluginType.S)) ->
|
46
|
let module M = (val m : PluginType.S) in
|
47
|
M.c_backend_main_loop_body_suffix fmt ())
|
48
|
(plugins ())
|
49
|
|
50
|
(* Specific treatment of annotations when inlining, specific of declared plugins *)
|
51
|
|
52
|
let inline_annots rename_var_fun annot_list =
|
53
|
List.map
|
54
|
(fun ann ->
|
55
|
{
|
56
|
ann with
|
57
|
annots =
|
58
|
List.fold_left
|
59
|
(fun accu (sl, eexpr) ->
|
60
|
let items =
|
61
|
match sl with
|
62
|
| plugin_name :: args ->
|
63
|
if plugin_name = "salsa" then
|
64
|
match args with
|
65
|
| [ "ranges"; varname ] ->
|
66
|
[ [ "salsa"; "ranges"; rename_var_fun varname ], eexpr ]
|
67
|
| _ ->
|
68
|
[ sl, eexpr ]
|
69
|
else [ sl, eexpr ]
|
70
|
| _ ->
|
71
|
assert false
|
72
|
in
|
73
|
items @ accu)
|
74
|
[] ann.annots;
|
75
|
})
|
76
|
annot_list
|
77
|
|
78
|
(* Local Variables: *)
|
79
|
(* compile-command:"make -C .." *)
|
80
|
(* End: *)
|