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/IntSys/int-sys.sml
ViewVC logotype

Annotation of /sml/trunk/src/system/IntSys/int-sys.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 476 - (view) (download)

1 : monnier 416 (* 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 :     (* environment initializations *)
23 :     val heapfile = BootEnv.init ()
24 :    
25 :     (* establish default signal handlers *)
26 :     fun handleINT _ = !Unsafe.topLevelCont
27 :     fun handleTERM _ = OS.Process.exit OS.Process.failure
28 :     fun ifSignal (sigName, handler) =
29 :     (case Signals.fromString sigName of
30 :     SOME s =>
31 :     (Signals.overrideHandler (s, Signals.HANDLER handler); ())
32 :     | _ => ())
33 :    
34 :     val _ =
35 :     (Signals.overrideHandler (Signals.sigINT, Signals.HANDLER handleINT);
36 :     Signals.overrideHandler (Signals.sigTERM, Signals.HANDLER handleTERM);
37 :     ifSignal ("QUIT", handleTERM))
38 :    
39 :     val _ = UseHook.useHook := Compiler.Interact.useFile
40 :    
41 :     (* launch interactive loop *)
42 :     val _ = (Compiler.Control.Print.say "Generating heap image...\n";
43 :     if SMLofNJ.exportML heapfile then
44 :     (SMLofNJ.Internals.resetTimers ();
45 :     Compiler.Stats.reset ();
46 :     print Compiler.banner;
47 :     print "\n";
48 : monnier 475 CM0.procCmdLine ();
49 : monnier 416 Compiler.Interact.interact())
50 :     else
51 :     (print "This is...\n";
52 :     print Compiler.banner;
53 :     print "\n";
54 :     OS.Process.exit OS.Process.success))
55 :     end

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