1 |
(* export-lex.sml |
(* export-lex.sml |
2 |
* |
* |
3 |
* $Log$ |
* Revision 1.2 2000/03/07 04:01:05 blume |
4 |
* Revision 1.1.1.9 1999/12/07 15:40:25 monnier |
* - build script now use new ml-build mechanism |
|
* version 110.25 |
|
|
* |
|
|
* Revision 1.2 1997/03/03 17:10:35 george |
|
|
* moved callcc related functions to SMLofNJ.Cont |
|
|
* |
|
|
# Revision 1.1.1.1 1997/01/14 01:38:01 george |
|
|
# Version 109.24 |
|
|
# |
|
|
* Revision 1.3 1996/02/26 16:55:18 jhr |
|
|
* Moved exportFn/exportML to SMLofNJ structure. |
|
|
* |
|
|
* Revision 1.2 1996/02/26 15:02:26 george |
|
|
* print no longer overloaded. |
|
|
* use of makestring has been removed and replaced with Int.toString .. |
|
|
* use of IO replaced with TextIO |
|
|
* |
|
|
* Revision 1.1.1.1 1996/01/31 16:01:15 george |
|
|
* Version 109 |
|
|
* |
|
5 |
*) |
*) |
|
|
|
6 |
structure ExportLexGen : sig |
structure ExportLexGen : sig |
|
|
|
|
val export : string -> unit |
|
7 |
val lexGen : (string * string list) -> OS.Process.status |
val lexGen : (string * string list) -> OS.Process.status |
|
|
|
8 |
end = struct |
end = struct |
9 |
|
|
10 |
exception Interrupt |
exception Interrupt |
30 |
fun err msg = TextIO.output(TextIO.stdErr, String.concat msg) |
fun err msg = TextIO.output(TextIO.stdErr, String.concat msg) |
31 |
|
|
32 |
fun lexGen (name, args) = let |
fun lexGen (name, args) = let |
33 |
fun lex_gen () = (case args |
fun lex_gen () = |
34 |
of [] => ( |
case args of |
35 |
err [name, ": missing filename\n"]; |
[] => (err [name, ": missing filename\n"]; |
36 |
OS.Process.exit OS.Process.failure) |
OS.Process.exit OS.Process.failure) |
37 |
| files => List.app LexGen.lexGen files |
| files => List.app LexGen.lexGen files |
|
(* end case *)) |
|
38 |
in |
in |
39 |
(handleInterrupt lex_gen; OS.Process.success) |
(handleInterrupt lex_gen; OS.Process.success) |
40 |
handle Interrupt => ( |
handle Interrupt => (err [name, ": Interrupt\n"]; OS.Process.failure) |
41 |
err [name, ": Interrupt\n"]; |
| any => (err [name, ": uncaught exception ", |
42 |
OS.Process.failure) |
exnMessage any, "\n"]; |
|
| any => ( |
|
|
err [ |
|
|
name, ": uncaught exception ", exnMessage any, "\n" |
|
|
]; |
|
43 |
OS.Process.failure) |
OS.Process.failure) |
44 |
end |
end |
|
|
|
|
fun export name = SMLofNJ.exportFn (name, lexGen); |
|
45 |
end |
end |