]> matita.cs.unibo.it Git - helm.git/blob - matita/matita/contribs/lambdadelta/bin/roles/roles.ml
update in binaries for λδ
[helm.git] / matita / matita / contribs / lambdadelta / bin / roles / roles.ml
1 (*
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.
5     ||I||
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_______________________________________________________________ *)
11
12 module EE = RolesEngine
13 module EG = RolesGlobal
14 module ET = RolesTypes
15 module EU = RolesUtils
16
17 let help_C = "<dir>  Set this working directory (default: current directory)"
18 let help_L = " Debug osn lexer"
19 let help_X = " Reset all options to defaults"
20 let help_a = " Add selected names to a role"
21 let help_m = " Add roles relating matching names"
22 let help_o = "<version>  Add top objects for this stage"
23 let help_p = " Print current status on standard output"
24 let help_r = " Load current status"
25 let help_s = "<version>  Start a stage with this version"
26 let help_t = "<pointer>  Toggle the selection of this pointed entry"
27 let help_w = " Save current status"
28 let help   = "Usage: roles [ -LXamprw | -C <dir> | -os <version> | -t <pointer> | <file> ]*"
29
30 let add_tops s =
31   EE.add_tops (EU.version_of_string s)
32
33 let new_stage s =
34   EE.new_stage (EU.version_of_string s)
35
36 let toggle_entry s =
37   EE.toggle_entry (EU.pointer_of_string s)
38
39 let process s =
40   match Filename.extension s with
41   | ".txt" -> EE.read_waiting s
42   | x      -> EU.raise_error (ET.EWrongExt x)
43
44 let _main = try
45   Arg.parse [
46     "-C", Arg.String ((:=) EG.wd), help_C;
47     "-L", Arg.Set EG.debug_lexer, help_L;
48     "-X", Arg.Unit EG.clear, help_X;
49     "-a", Arg.Unit EE.add_role, help_a;
50     "-m", Arg.Unit EE.add_matching, help_m;
51     "-o", Arg.String add_tops, help_o;
52     "-p", Arg.Unit EE.print_status, help_p;
53     "-r", Arg.Unit EE.read_status, help_r;
54     "-s", Arg.String new_stage, help_s;
55     "-t", Arg.String toggle_entry, help_t;
56     "-w", Arg.Unit EE.write_status, help_w;
57   ] process help
58 with ET.Error e -> Printf.eprintf "roles: %s\n%!" (EU.string_of_error e)