author | wenzelm |
Wed, 27 Mar 2013 16:38:25 +0100 | |
changeset 51553 | 63327f679cff |
parent 51312 | 0ce544fbb509 |
child 52686 | f4871fe80410 |
permissions | -rw-r--r-- |
48681
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
1 |
(* Title: Pure/System/command_line.ML |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
3 |
|
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
4 |
Support for Isabelle/ML command line tools. |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
5 |
*) |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
6 |
|
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
7 |
signature COMMAND_LINE = |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
8 |
sig |
48731
a45ba78abcc1
more casual exit back to ML toplevel, to accomodate commit in SML/NJ which continues at the saved point;
wenzelm
parents:
48681
diff
changeset
|
9 |
val tool: (unit -> int) -> unit |
51312
0ce544fbb509
more robust build error handling, e.g. missing outer syntax commands;
wenzelm
parents:
48731
diff
changeset
|
10 |
val tool0: (unit -> unit) -> unit |
48681
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
11 |
end; |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
12 |
|
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
13 |
structure Command_Line: COMMAND_LINE = |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
14 |
struct |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
15 |
|
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
16 |
fun tool body = |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
17 |
uninterruptible (fn restore_attributes => fn () => |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
18 |
let val rc = |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
19 |
restore_attributes body () handle exn => |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
20 |
(Output.error_msg (ML_Compiler.exn_message exn); if Exn.is_interrupt exn then 130 else 1); |
48731
a45ba78abcc1
more casual exit back to ML toplevel, to accomodate commit in SML/NJ which continues at the saved point;
wenzelm
parents:
48681
diff
changeset
|
21 |
in if rc = 0 then () else exit rc end) (); |
48681
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
22 |
|
51312
0ce544fbb509
more robust build error handling, e.g. missing outer syntax commands;
wenzelm
parents:
48731
diff
changeset
|
23 |
fun tool0 body = tool (fn () => (body (); 0)); |
0ce544fbb509
more robust build error handling, e.g. missing outer syntax commands;
wenzelm
parents:
48731
diff
changeset
|
24 |
|
48681
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
25 |
end; |
181b91e1d1c1
prefer general Command_Line.tool wrapper (cf. Scala version);
wenzelm
parents:
diff
changeset
|
26 |