Project

General

Profile

Download (1.18 KB) Statistics
| Branch: | Tag: | Revision:
1 ad4774b0 ploc
open VerifierList
2
3 719ae9fd Lélio Brun
let () = Sites.Plugins.Verifiers.load_all ()
4
5 ad4774b0 ploc
let active = ref None
6 ca7ff3f7 Lélio Brun
7
let options () =
8
  List.flatten
9
    (List.map Options_management.verifier_opt
10
       (List.map
11
          (fun m ->
12
            let module M = (val m : VerifierType.S) in
13
            M.name, M.activate, M.options)
14
          (verifiers ())))
15
16 ad4774b0 ploc
let verifier_list verifiers =
17 ca7ff3f7 Lélio Brun
  List.fold_left
18
    (fun acc m ->
19
      let module M = (val m : VerifierType.S) in
20
      (if acc = "" then "" else acc ^ ", ") ^ M.name)
21
    "" verifiers
22
23 ad4774b0 ploc
let get_active () =
24
  match !active with
25 ca7ff3f7 Lélio Brun
  | None -> (
26
    (* check that a single one is active and register it *)
27
    let found =
28
      List.fold_left
29
        (fun found m ->
30
          let module M = (val m : VerifierType.S) in
31
          if M.is_active () then m :: found else found)
32
        [] (verifiers ())
33
    in
34
    match found with
35
    | [] ->
36
      raise
37
        (Sys_error
38
           ("Please select one verifier in " ^ verifier_list (verifiers ())))
39
    | [ m ] ->
40
      active := Some m;
41
      m
42
    | _ ->
43
      raise (Sys_error ("Too many selected verifiers: " ^ verifier_list found)))
44
  | Some m ->
45
    m
46 ad4774b0 ploc
47 ca7ff3f7 Lélio Brun
(* Local Variables: *)
48
(* compile-command:"make -C .." *)
49
(* End: *)