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 /sml/trunk/src/system/smlnj/internal/int-sys.sml
ViewVC logotype

Annotation of /sml/trunk/src/system/smlnj/internal/int-sys.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 573 - (view) (download)

1 : blume 573 (* Copyright 1997 by AT&T Bell Laboratories *)
2 :     (* Copyright 1998 by Lucent Technologies *)
3 :     (* Copyright 1999 by Lucent Technologies *)
4 :     (* int-sys.sml *)
5 :    
6 :     (*
7 :     * This is the interactive system;
8 :     * At link-time (i.e., at bootstrap time) this code builds the boot
9 :     * environments, sets default signal handlers, and then dumps a heap.
10 :     * When the heap image restarts, the system goes interactive.
11 :     *
12 :     * (We do not want to go interactive before dumping the heap because it
13 :     * would mean that environments get loaded unnecessarily.)
14 :     *
15 :     * This code refers directly to structure Compiler, because by the time it
16 :     * gets compiled, CM's conditional compilation facility has already
17 :     * made sure that structure Compiler refers to the visible compiler
18 :     * for the current architecture.
19 :     *)
20 :     structure InteractiveSystem : sig end = struct
21 :    
22 :     (* first, we have to step back out of the boot directory... *)
23 :     val bootdir = OS.FileSys.getDir ()
24 :     val _ = OS.FileSys.chDir OS.Path.parentArc
25 :    
26 :     (* environment initializations *)
27 :     val { heapfile, procCmdLine } = BootEnv.init bootdir
28 :    
29 :     (* establish default signal handlers *)
30 :     fun handleINT _ = !Unsafe.topLevelCont
31 :     fun handleTERM _ = OS.Process.exit OS.Process.failure
32 :     fun ifSignal (sigName, handler) =
33 :     (case Signals.fromString sigName of
34 :     SOME s =>
35 :     (Signals.overrideHandler (s, Signals.HANDLER handler); ())
36 :     | _ => ())
37 :    
38 :     val _ =
39 :     (Signals.overrideHandler (Signals.sigINT, Signals.HANDLER handleINT);
40 :     Signals.overrideHandler (Signals.sigTERM, Signals.HANDLER handleTERM);
41 :     ifSignal ("QUIT", handleTERM))
42 :    
43 :     val _ = UseHook.useHook := Compiler.Interact.useFile
44 :    
45 :     (* launch interactive loop *)
46 :     val _ = (Compiler.Control.Print.say "Generating heap image...\n";
47 :     if SMLofNJ.exportML heapfile then
48 :     (SMLofNJ.Internals.resetTimers ();
49 :     Compiler.Stats.reset ();
50 :     print Compiler.banner;
51 :     print "\n";
52 :     getOpt (procCmdLine, fn () => ()) ();
53 :     Compiler.Interact.interact ())
54 :     else
55 :     (print "This is...\n";
56 :     print Compiler.banner;
57 :     print "\n";
58 :     OS.Process.exit OS.Process.success))
59 :     end

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