]> 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_r = " Load current status"
22 let help_s = "<version>  Start a stage with this version"
23 let help_t = "<pointer>  Toggle the selection of this pointed entry"
24 let help_w = " Save current status"
25 let help   = "Usage: roles [ -LXarw | -C <dir> | -s <version> | -t <pointer> | <file> ]*"
26
27 let new_stage s =
28   EE.new_stage (EU.version_of_string s)
29
30 let toggle_entry s =
31   EE.toggle_entry (EU.pointer_of_string s)
32
33 let process s =
34   match Filename.extension s with
35   | ".txt" -> EE.read_waiting s
36   | x      -> EU.raise_error (ET.EExt x)
37
38 let _main = try
39   Arg.parse [
40     "-C", Arg.String ((:=) EG.wd), help_C;
41     "-L", Arg.Set EG.debug_lexer, help_L;
42     "-X", Arg.Unit EG.clear, help_X;
43     "-a", Arg.Unit EE.add_role, help_a;
44     "-r", Arg.Unit EE.read_status, help_r;
45     "-s", Arg.String new_stage, help_s;
46     "-t", Arg.String toggle_entry, help_t;
47     "-w", Arg.Unit EE.write_status, help_w;
48   ] process help
49 with ET.Error e -> Printf.eprintf "roles: %s\n%!" (EU.string_of_error e)