SCM Repository
Annotation of /sml/trunk/src/ml-lex/export-lex.sml
Parent Directory
|
Revision Log
Revision 651 - (view) (download)
1 : | monnier | 249 | (* export-lex.sml |
2 : | * | ||
3 : | * $Log$ | ||
4 : | monnier | 651 | * Revision 1.3 2000/06/01 18:33:42 monnier |
5 : | * bring revisions from the vendor branch to the trunk | ||
6 : | * | ||
7 : | blume | 569 | * Revision 1.2 2000/03/07 04:01:05 blume |
8 : | * - size info in BOOTLIST | ||
9 : | * * no fixed upper limits for number of bootfiles or length of | ||
10 : | * bootfile names in runtime | ||
11 : | * * falling back to old behavior if no BOOTLIST size info found | ||
12 : | * - allocation size heuristics in .run-sml | ||
13 : | * * tries to read cache size from /proc/cpuinfo (this is important for | ||
14 : | * small-cache Celeron systems!) | ||
15 : | * - install.sh robustified | ||
16 : | * - CM manual updates | ||
17 : | * - paranoid mode | ||
18 : | * * no more CMB.deliver() (i.e., all done by CMB.make()) | ||
19 : | * * can re-use existing sml.boot.* files | ||
20 : | * * init.cmi now treated as library | ||
21 : | * * library stamps for consistency checks | ||
22 : | * - sml.boot.<arch>-<os>/PIDMAP file | ||
23 : | * * This file is read by the CM startup code. This is used to minimize | ||
24 : | * the amount of dynamic state that needs to be stowed away for the | ||
25 : | * purpose of sharing between interactive system and user code. | ||
26 : | * - CM.Anchor.anchor instead of CM.Anchor.{set,cancel} | ||
27 : | * * Upon request by Elsa. Anchors now controlled by get-set-pair | ||
28 : | * like most other CM state variables. | ||
29 : | * - Compiler.CMSA eliminated | ||
30 : | * * No longer supported by CM anyway. | ||
31 : | * - fixed bugs in pickler that kept biting Stefan | ||
32 : | * * past refs to past refs (was caused by the possibility that | ||
33 : | * ad-hoc sharing is more discriminating than hash-cons sharing) | ||
34 : | * * integer overflow on LargeInt.minInt | ||
35 : | * - ml-{lex,yacc} build scripts now use new mechanism | ||
36 : | * for building standalone programs | ||
37 : | * - fixed several gcc -Wall warnings that were caused by missing header | ||
38 : | * files, missing initializations, etc., in runtime (not all warnings | ||
39 : | * eliminated, though) | ||
40 : | * | ||
41 : | * Revision 1.1.1.9.4.1 2000/02/20 14:44:33 blume | ||
42 : | * CMB.deliver merged with CMB.make; runtime boot code made more flexible | ||
43 : | * | ||
44 : | monnier | 498 | * Revision 1.1.1.9 1999/12/07 15:40:25 monnier |
45 : | * version 110.25 | ||
46 : | monnier | 249 | * |
47 : | * Revision 1.2 1997/03/03 17:10:35 george | ||
48 : | * moved callcc related functions to SMLofNJ.Cont | ||
49 : | * | ||
50 : | # Revision 1.1.1.1 1997/01/14 01:38:01 george | ||
51 : | # Version 109.24 | ||
52 : | # | ||
53 : | * Revision 1.3 1996/02/26 16:55:18 jhr | ||
54 : | * Moved exportFn/exportML to SMLofNJ structure. | ||
55 : | * | ||
56 : | * Revision 1.2 1996/02/26 15:02:26 george | ||
57 : | * print no longer overloaded. | ||
58 : | * use of makestring has been removed and replaced with Int.toString .. | ||
59 : | * use of IO replaced with TextIO | ||
60 : | * | ||
61 : | * Revision 1.1.1.1 1996/01/31 16:01:15 george | ||
62 : | * Version 109 | ||
63 : | * | ||
64 : | *) | ||
65 : | |||
66 : | structure ExportLexGen : sig | ||
67 : | val lexGen : (string * string list) -> OS.Process.status | ||
68 : | blume | 569 | end = struct |
69 : | monnier | 249 | |
70 : | exception Interrupt | ||
71 : | |||
72 : | (* This function applies operation to (). If it handles an interrupt | ||
73 : | * signal (Control-C), it raises the exception Interrupt. Example: | ||
74 : | * (handleInterrupt foo) handle Interrupt => print "Bang!\n" | ||
75 : | *) | ||
76 : | fun handleInterrupt (operation : unit -> unit) = | ||
77 : | let exception Done | ||
78 : | val old'handler = Signals.inqHandler(Signals.sigINT) | ||
79 : | fun reset'handler () = | ||
80 : | Signals.setHandler(Signals.sigINT, old'handler) | ||
81 : | in (SMLofNJ.Cont.callcc (fn k => | ||
82 : | (Signals.setHandler(Signals.sigINT, Signals.HANDLER(fn _ => k)); | ||
83 : | operation (); | ||
84 : | raise Done)); | ||
85 : | raise Interrupt) | ||
86 : | handle Done => (reset'handler ()) | ||
87 : | | exn => (reset'handler (); raise exn) | ||
88 : | end | ||
89 : | |||
90 : | fun err msg = TextIO.output(TextIO.stdErr, String.concat msg) | ||
91 : | |||
92 : | fun lexGen (name, args) = let | ||
93 : | blume | 569 | fun lex_gen () = |
94 : | case args of | ||
95 : | [] => (err [name, ": missing filename\n"]; | ||
96 : | OS.Process.exit OS.Process.failure) | ||
97 : | | files => List.app LexGen.lexGen files | ||
98 : | in | ||
99 : | (handleInterrupt lex_gen; OS.Process.success) | ||
100 : | handle Interrupt => (err [name, ": Interrupt\n"]; OS.Process.failure) | ||
101 : | | any => (err [name, ": uncaught exception ", | ||
102 : | exnMessage any, "\n"]; | ||
103 : | OS.Process.failure) | ||
104 : | end | ||
105 : | end |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |