X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=matita%2Fcomponents%2Fbinaries%2Fmac%2Fmac.ml;h=18bba1746e7a6afc3188202902a314f1575c72f2;hb=127be10fa95b5b347887241e046d72e432944e61;hp=d5826e619461beaed3462885fd74d4ffb618e246;hpb=9f47f7b4e9b99484b02b3b6f4d71a049b3389565;p=helm.git diff --git a/matita/components/binaries/mac/mac.ml b/matita/components/binaries/mac/mac.ml index d5826e619..18bba1746 100644 --- a/matita/components/binaries/mac/mac.ml +++ b/matita/components/binaries/mac/mac.ml @@ -1,14 +1,26 @@ +(* + ||M|| This file is part of HELM, an Hypertextual, Electronic + ||A|| Library of Mathematics, developed at the Computer Science + ||T|| Department, University of Bologna, Italy. + ||I|| + ||T|| HELM is free software; you can redistribute it and/or + ||A|| modify it under the terms of the GNU General Public License + \ / version 2 or (at your option) any later version. + \ / This software is distributed as is, NO WARRANTY. + V_______________________________________________________________ *) + module A = Arg module P = Printf module O = Options module L = Lexer -let help = "Usage: mac [ -LX ]* [ ]*" +let help = "Usage: mac [ -LXQV | -p ]* [ ]*" let help_L = " Activate lexer debugging" let help_Q = " Read data from standard input" let help_V = " Show version information" let help_X = " Reset options and counters" +let help_p = " Assume characters per page (default: 5120)" let active = ref false @@ -17,7 +29,7 @@ let process_channel ich = L.token lexbuf; active := true let output_version () = - P.printf "mac 0.1.0 M - November 2012\n" + P.printf "mac 0.1.1 M - July 2013\n" let process_stdin () = process_channel stdin @@ -26,8 +38,14 @@ let process_file fname = let ich = open_in fname in process_channel ich; close_in ich +let set_page i = + if i > 0 then O.page := i + let output_count () = - if !active then P.printf "%u\n" !O.count + if !active then + let pages = !O.count / !O.page in + let pages = if !O.count mod !O.page = 0 then pages else succ pages in + P.printf "%u %u\n" !O.count pages let main () = A.parse [