lustrec / src / plugins.ml @ 3340aff0
History | View | Annotate | Download (1.66 KB)
1 | 8446bf03 | ploc | open Lustre_types |
---|---|---|---|
2 | 2b476ad8 | xthirioux | |
3 | 1954d776 | ploc | open PluginList |
4 | 2b476ad8 | xthirioux | |
5 | |||
6 | f6acf47b | ploc | let options () = |
7 | List.flatten ( |
||
8 | 1bff14ac | ploc | List.map Options_management.plugin_opt ( |
9 | f6acf47b | ploc | List.map (fun m -> |
10 | let module M = (val m : PluginType.PluginType) in |
||
11 | (M.name, M.activate, M.options) |
||
12 | ) plugins |
||
13 | )) |
||
14 | 2b476ad8 | xthirioux | |
15 | f6acf47b | ploc | let check_force_stateful () = |
16 | List.exists (fun m -> |
||
17 | let module M = (val m : PluginType.PluginType) in |
||
18 | M.check_force_stateful () |
||
19 | ) plugins |
||
20 | |||
21 | let refine_machine_code prog machine_code = |
||
22 | List.fold_left (fun accu m -> |
||
23 | let module M = (val m : PluginType.PluginType) in |
||
24 | M.refine_machine_code prog accu |
||
25 | ) machine_code plugins |
||
26 | |||
27 | |||
28 | 7ab1c5bd | ploc | let c_backend_main_loop_body_prefix basename mname fmt () = |
29 | List.iter (fun (m: (module PluginType.PluginType)) -> |
||
30 | let module M = (val m : PluginType.PluginType) in |
||
31 | M.c_backend_main_loop_body_prefix basename mname fmt ()) plugins |
||
32 | |||
33 | f6acf47b | ploc | let c_backend_main_loop_body_suffix fmt () = |
34 | List.iter (fun (m: (module PluginType.PluginType)) -> |
||
35 | let module M = (val m : PluginType.PluginType) in |
||
36 | M.c_backend_main_loop_body_suffix fmt ()) plugins |
||
37 | |||
38 | (* Specific treatment of annotations when inlining, specific of declared plugins *) |
||
39 | 2b476ad8 | xthirioux | |
40 | let inline_annots rename_var_fun annot_list = |
||
41 | List.map ( |
||
42 | fun ann -> |
||
43 | { ann with |
||
44 | annots = List.fold_left ( |
||
45 | fun accu (sl, eexpr) -> |
||
46 | let items = |
||
47 | match sl with |
||
48 | | plugin_name::args -> |
||
49 | if plugin_name = "salsa" then |
||
50 | match args with |
||
51 | | ["ranges";varname] -> |
||
52 | [["salsa";"ranges";(rename_var_fun varname)], eexpr] |
||
53 | | _ -> [(sl, eexpr)] |
||
54 | else |
||
55 | [(sl, eexpr)] |
||
56 | | _ -> assert false |
||
57 | in |
||
58 | items@accu |
||
59 | ) [] ann.annots |
||
60 | } |
||
61 | ) annot_list |
||
62 | |||
63 | (* Local Variables: *) |
||
64 | (* compile-command:"make -C .." *) |
||
65 | (* End: *) |