1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
(****************************************************************************)
(* the diy toolsuite *)
(* *)
(* Jade Alglave, University College London, UK. *)
(* Luc Maranget, INRIA Paris-Rocquencourt, France. *)
(* *)
(* Copyright 2012-present Institut National de Recherche en Informatique et *)
(* en Automatique and the authors. All rights reserved. *)
(* *)
(* This software is governed by the CeCILL-B license under French law and *)
(* abiding by the rules of distribution of free software. You can use, *)
(* modify and/ or redistribute the software under the terms of the CeCILL-B *)
(* license as circulated by CEA, CNRS and INRIA at the following URL *)
(* "http://www.cecill.info". We also give a copy in LICENSE.txt. *)
(****************************************************************************)
open Printf
let verbose = ref 0
let logs = ref []
let rename = ref []
let select = ref []
let names = ref []
let excl = ref []
let hexa = ref false
let int32 = ref true
let faulttype = ref true
let options =
let open CheckName in
[
("-q", Arg.Unit (fun _ -> verbose := -1),
"<non-default> be silent");
("-v", Arg.Unit (fun _ -> incr verbose),
"<non-default> show various diagnostics, repeat to increase verbosity");
parse_hexa hexa;
parse_int32 int32;
parse_rename rename;
parse_select select;
parse_names names;
parse_excl excl;
parse_faulttype faulttype;
]
let prog =
if Array.length Sys.argv > 0 then Sys.argv.(0)
else "moutcome"
let () =
Arg.parse options
(fun s -> logs := !logs @ [s])
(sprintf "Usage %s [options]* log
log is a log file names.
Options are:" prog)
let rename = !rename
let select = !select
let names = !names
let excl = !excl
let verbose = !verbose
let hexa = !hexa
let int32 = !int32
let log = match !logs with
| [log;] -> Some log
| [] -> None
| _ ->
eprintf "%s takes at most one argument\n" prog ;
exit 2
let faulttype = !faulttype
module Verbose = struct let verbose = verbose end
module LS = LogState.Make(Verbose)
module LL =
LexLog_tools.Make
(struct
let verbose = verbose
include CheckName.Make
(struct
let verbose = verbose
let rename = rename
let select = select
let names = names
let excl = excl
end)
let hexa = hexa
let int32 = int32
let acceptBig = true
let faulttype = faulttype
end)
let zyva log =
let test = match log with
| None -> LL.read_chan "stdin" stdin
| Some log -> LL.read_name log in
let n = LS.count_outcomes test in
printf "%i\n" n ;
()
let () =
try zyva log
with Misc.Fatal msg|Misc.UserError msg ->
eprintf "Fatal error: %s\n%!" msg
|