]> 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 module WE = WebEngine
17
18 let help_B = "<url>  Set this base url (default: http://helm.cs.unibo.it/lambdadelta/)"
19 let help_C = "<dir>  Set this relative working directory (default: invocation directory)"
20 let help_L = " Debug osn lexer"
21 let help_W = " Run as an LWS application"
22 let help_X = " Reset all options to defaults"
23 let help_a = " Add selected names to a role"
24 let help_d = " Remove selected names from roles"
25 let help_m = " Add roles relating matching names"
26 let help_n = "<version>  Start a stage with this version"
27 let help_o = " Turn waiting names into top objects"
28 let help_p = " Print current status on standard output"
29 let help_r = " Load current status"
30 let help_s = "<pointer>  Toggle the selection of this pointed entry"
31 let help_t = "<version>  Add top objects for this stage"
32 let help_w = " Save current status"
33 let help_x = "<pointer>  Toggle the expansion of this pointed entry"
34 let help   = "Usage: roles [ -LWXadmprw | -B <url> | -C <dir> | -nt <version> | -sx <pointer> | <file> ]*"
35
36 let change_cwd s =
37   EG.cwd := Filename.concat !EG.cwd s
38
39 let add_tops s =
40   EE.add_tops (EU.stage_of_string s)
41
42 let new_stage s =
43   EE.new_stage (EU.stage_of_string s)
44
45 let select_entry s =
46   EE.select_entry (EU.pointer_of_string s)
47
48 let expand_entry s =
49   EE.expand_entry (EU.pointer_of_string s)
50
51 let process s =
52   match Filename.extension s with
53   | ".txt" -> EE.read_waiting s
54   | x      -> EU.raise_error (ET.EWrongExt x)
55
56 let _main = try
57   Arg.parse [
58     "-B", Arg.String ((:=) EG.base_url), help_B;
59     "-C", Arg.String change_cwd, help_C;
60     "-L", Arg.Set EG.debug_lexer, help_L;
61     "-W", Arg.Unit WE.init, help_W;
62     "-X", Arg.Unit EG.clear, help_X;
63     "-a", Arg.Unit EE.add_role, help_a;
64     "-d", Arg.Unit EE.remove_roles, help_d;
65     "-m", Arg.Unit EE.add_matching, help_m;
66     "-n", Arg.String new_stage, help_n;
67     "-o", Arg.Unit EE.make_tops, help_o;
68     "-p", Arg.Unit EE.print_status, help_p;
69     "-r", Arg.Unit EE.read_status, help_r;
70     "-s", Arg.String select_entry, help_s;
71     "-t", Arg.String add_tops, help_t;
72     "-w", Arg.Unit EE.write_status, help_w;
73     "-x", Arg.String expand_entry, help_x;
74   ] process help
75 with ET.Error e -> Printf.eprintf "roles: %s\n%!" (EU.string_of_error e)