(* Copyright (C) 2000, HELM Team. * * This file is part of HELM, an Hypertextual, Electronic * Library of Mathematics, developed at the Computer Science * Department, University of Bologna, Italy. * * HELM is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * HELM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HELM; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, * MA 02111-1307, USA. * * For details, see the HELM World-Wide-Web page, * http://cs.unibo.it/helm/. *) module AO = AutOutput module MA = MetaAut module MO = MetaOutput let main = let version_string = "Helena Checker 0.8.0 M (June 2008)" in let summary = ref 0 in let set_summary i = summary := i in let print_version () = print_endline version_string; exit 0 in let read_file name = if !summary > 0 then Printf.printf "Processing file: %s\n" name; flush stdout; let ich = open_in name in let lexbuf = Lexing.from_channel ich in let book = AutParser.book AutLexer.token lexbuf in close_in ich; if !summary > 1 then AO.count (AO.print_counters Cps.id) AO.initial_counters book; let f env = if !summary > 1 then MO.count (MO.print_counters Cps.id) MO.initial_counters env in MA.meta_of_aut f book in let help = "Usage: helena [ -V | -S ] ..." in let help_S = " Set summary level" in let help_V = " Show version information" in Arg.parse [ ("-S", Arg.Int set_summary, help_S); ("-V", Arg.Unit print_version, help_V) ] read_file help