Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /ml-lex/releases/release-110.80/export-lex.sml
ViewVC logotype

Annotation of /ml-lex/releases/release-110.80/export-lex.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 652 - (view) (download)
Original Path: sml/trunk/src/ml-lex/export-lex.sml

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

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0