Project

General

Profile

« Previous | Next » 

Revision ca7ff3f7

Added by LĂ©lio Brun 8 months ago

reformatting

View differences:

src/verifiers.ml
3 3
let () = Sites.Plugins.Verifiers.load_all ()
4 4

  
5 5
let active = ref None
6
           
7
let options () = 
8
  List.flatten (
9
    List.map Options_management.verifier_opt (
10
      List.map (fun m ->
11
	let module M = (val m : VerifierType.S) in
12
	(M.name, M.activate, M.options)
13
      ) (verifiers ())
14
    ))
15
  
6

  
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 16
let verifier_list verifiers =
17
  List.fold_left (fun acc m ->
18
      let module M =  (val m : VerifierType.S) in
19
      (if acc = "" then "" else acc ^ ", ") ^ M.name
20
    ) "" verifiers
21
  
17
  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

  
22 23
let get_active () =
23 24
  match !active with
24
  | None ->
25
     begin
26
       (* check that a single one is active and register it *)
27
       let found =
28
         List.fold_left (fun found m ->
29
             let module M =  (val m : VerifierType.S) in
30
             if M.is_active () then
31
               m::found
32
             else
33
               found
34
           ) [] (verifiers ())
35
       in
36
       match found with
37
       | [] -> raise (Sys_error ("Please select one verifier in " ^ verifier_list (verifiers ())))
38
       | [m] -> active := Some m; m
39
       | _ -> raise (Sys_error ("Too many selected verifiers: " ^ verifier_list found))
40
     end
41

  
42
  | Some m -> m
43

  
25
  | 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
44 46

  
45
                
46
                (* Local Variables: *)
47
                (* compile-command:"make -C .." *)
48
                (* End: *)
47
(* Local Variables: *)
48
(* compile-command:"make -C .." *)
49
(* End: *)

Also available in: Unified diff