Project

General

Profile

Download (1.79 KB) Statistics
| Branch: | Tag: | Revision:
1
open Lustre_types
2

    
3
open PluginList
4

    
5
let () = Sites.Plugins.Plugins.load_all ()
6

    
7
let options () = 
8
  List.flatten (
9
    List.map Options_management.plugin_opt (
10
      List.map (fun m ->
11
	let module M = (val m : PluginType.S) in
12
	(M.name, M.activate, M.usage, M.options)
13
      ) (plugins ())
14
    ))
15

    
16
let init () =
17
  List.iter (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 (fun m ->
24
	let module M = (val m : PluginType.S) in
25
	M.check_force_stateful ()
26
  ) (plugins ())
27

    
28
let refine_machine_code prog machine_code =
29
  List.fold_left (fun accu m ->
30
    let module M = (val m : PluginType.S) in
31
    M.refine_machine_code prog accu
32
  ) machine_code (plugins ())
33

    
34

    
35
let c_backend_main_loop_body_prefix basename mname fmt () = 
36
  List.iter (fun (m: (module PluginType.S)) -> 
37
    let module M = (val m : PluginType.S) in
38
    M.c_backend_main_loop_body_prefix basename mname fmt ()) (plugins ())
39

    
40
let c_backend_main_loop_body_suffix fmt () = 
41
  List.iter (fun (m: (module PluginType.S)) -> 
42
    let module M = (val m : PluginType.S) in
43
    M.c_backend_main_loop_body_suffix fmt ()) (plugins ())
44

    
45
(* Specific treatment of annotations when inlining, specific of declared plugins *)
46

    
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: *)
(3-3/3)