3 v
=$
(cd $
(dirname $0) && git describe
--tags --dirty 2>/dev
/null ||
echo unknown
)
4 ocaml str.cma
-stdin "$1" "$v" <<EOF
5 let fixup = let open Str in
6 let dash = regexp {|\([^ ]*\) +- +\(.*\)|}
7 and head = regexp {|-----\(.*\)-----|} in
8 fun s -> global_replace dash "\\\\1\\t\\\\2" s |>
9 global_replace head "\\xc2\\xb7\\\\1";;
10 let rec iter ic = match input_line ic with
11 | s -> Printf.printf "%S;\\n" @@ fixup s; iter ic
12 | exception End_of_file -> ();;
13 Printf.printf "let keys = [\\n";
14 iter @@ open_in Sys.argv.(1);;
15 Printf.printf "];;\\nlet version = %S;;\\n" Sys.argv.(2);;