Project

General

Profile

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