2 ||M|| This file is part of HELM, an Hypertextual, Electronic
3 ||A|| Library of Mathematics, developed at the Computer Science
4 ||T|| Department, University of Bologna, Italy.
6 ||T|| HELM is free software; you can redistribute it and/or
7 ||A|| modify it under the terms of the GNU General Public License
8 \ / version 2 or (at your option) any later version.
9 \ / This software is distributed as is, NO WARRANTY.
10 V_______________________________________________________________ *)
18 let help = "Usage: mac [ -LXQV | -p <int> ]* [ <file> ]*"
19 let help_L = " Activate lexer debugging"
20 let help_Q = " Read data from standard input"
21 let help_V = " Show version information"
22 let help_X = " Reset options and counters"
23 let help_p = "<int> Assume <int> characters per page (default: 5120)"
25 let active = ref false
27 let process_channel ich =
28 let lexbuf = Lexing.from_channel ich in
29 L.token lexbuf; active := true
31 let output_version () =
32 P.printf "mac 0.1.1 M - July 2013\n"
34 let process_stdin () =
37 let process_file fname =
38 let ich = open_in fname in
39 process_channel ich; close_in ich
42 if i > 0 then O.page := i
46 let pages = !O.count / !O.page in
47 let pages = if !O.count mod !O.page = 0 then pages else succ pages in
48 P.printf "%u %u\n" !O.count pages
52 "-L", A.Set O.debug_lexer, help_L;
53 "-Q", Arg.Unit process_stdin, help_Q;
54 "-V", Arg.Unit output_version, help_V;
55 "-X", A.Unit O.clear, help_X;