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

SCM Repository

[smlnj] Diff of /sml/branches/SMLNJ/src/compiler/TopLevel/interact/interact.sml
ViewVC logotype

Diff of /sml/branches/SMLNJ/src/compiler/TopLevel/interact/interact.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 23, Thu Mar 12 00:49:56 1998 UTC revision 24, Thu Mar 12 00:49:58 1998 UTC
# Line 1  Line 1 
1  (* COPYRIGHT (c) 1996 Bell Laboratories. *)  (* COPYRIGHT (c) 1996 Bell Laboratories. *)
2  (* interact.sml *)  (* interact.sml *)
3    
4    signature INTERACT =
5    sig
6      exception Interrupt
7    
8      val interact : unit -> unit
9      val useFile : string -> unit
10    
11      val useStream : TextIO.instream -> unit
12      val evalStream : TextIO.instream * SCEnv.Env.environment ->
13                           SCEnv.Env.environment
14    
15      val installCompManager:
16          (Ast.dec *
17           { get: unit -> SCEnv.Env.environment,
18             set: SCEnv.Env.environment -> unit } *
19           { get: unit -> Environment.environment,
20             set: Environment.environment -> unit }
21           -> unit) option
22          -> unit
23    
24      (* The mUse functions should really be part of the Open Compiler *)
25      val mUseFile : (int->bool) -> string -> unit
26      val mUseFile_reset : unit -> unit
27      val mUseFile_add : (((unit -> unit) * string)list) -> unit
28      val mUseFile_list : unit -> (((unit -> unit)*string)list) list
29    
30    end  (* signature INTERACT *)
31    
32  functor Interact(EvalLoop : EVALLOOP) : INTERACT =  functor Interact(EvalLoop : EVALLOOP) : INTERACT =
33  struct  struct
34    exception Interrupt = EvalLoop.Interrupt    exception Interrupt = EvalLoop.Interrupt
35    
36   (* This is where CM can install itelf into.  Added for the purpose of   (*
37      * This is where CM can install itelf into.  Added for the purpose of
38    * autoloading. (blume)    * autoloading. (blume)
39    *)    *)
40    type envref = EnvRef.envref    type envref = EnvRef.envref
# Line 26  Line 55 
55                                                       "]\n"];                                                       "]\n"];
56                                 raise ErrorMsg.Error))))                                 raise ErrorMsg.Error))))
57    
58      val mUseFile_hiddenList =
59                ref [ [((fn () => (print "--mUseFile not reset!")),"Error!")] ];
60    
61      fun mUseFile_reset () = (mUseFile_hiddenList := [])
62      fun mUseFile_add   f  = (mUseFile_hiddenList := (f::(!mUseFile_hiddenList)))
63      fun mUseFile_list  () = (List.rev(!mUseFile_hiddenList))
64    
65      fun mUseFile (test) (fname: string) =
66          let fun repeat test n =
67                   if (test n) then (useFile fname; repeat test (n+1)) else ()
68          in repeat test 0 end
69    
70    fun useStream (stream: TextIO.instream) =    fun useStream (stream: TextIO.instream) =
71      EvalLoop.evalStream EvalLoop.stdParams ("<instream>", stream)      EvalLoop.evalStream EvalLoop.stdParams ("<instream>", stream)
72    
# Line 34  Line 75 
75        let val r = ref Environment.emptyEnv        let val r = ref Environment.emptyEnv
76            val localEnvRef = {get=(fn()=> !r),set=(fn x=>r:=x)}            val localEnvRef = {get=(fn()=> !r),set=(fn x=>r:=x)}
77            val b = ref baseEnv            val b = ref baseEnv
78            val baseEnvRef =            val baseEnvRef = {get=(fn()=> !b),set=(fn _ => raise Fail "evalStream")}
             {get=(fn()=> !b),set=(fn _ => raise Fail "evalStream")}  
79         in EvalLoop.evalStream         in EvalLoop.evalStream
80              ({compManagerHook = ref NONE,              ({compManagerHook = ref NONE,
81                (* ????  should CM get its hands into that? *)                (* ????  should CM get its hands into that? *)
82                baseEnvRef = baseEnvRef,                baseEnvRef = baseEnvRef,
83                localEnvRef=localEnvRef,                localEnvRef=localEnvRef,
84                transform=(fn x => x),                transform=(fn x => x), instrument=(fn _ => fn x => x),
               instrument=(fn _ => fn x => x),  
85                perform=(fn x => x),                perform=(fn x => x),
86                isolate= #isolate EvalLoop.stdParams,                isolate= #isolate EvalLoop.stdParams,
87                printer= #printer EvalLoop.stdParams})                printer= #printer EvalLoop.stdParams})
# Line 50  Line 89 
89            SCEnv.SC (#get localEnvRef ())            SCEnv.SC (#get localEnvRef ())
90        end        end
91    
   (* These mUse functions should really be part of the Open Compiler *)  
   val mUseFile_hiddenList =  
         ref [ [((fn () => (print "--mUseFile not reset!")),"Error!")] ];  
   
   fun mUseFile_reset () = (mUseFile_hiddenList := [])  
   fun mUseFile_add   f  = (mUseFile_hiddenList := (f::(!mUseFile_hiddenList)))  
   fun mUseFile_list  () = (List.rev(!mUseFile_hiddenList))  
   
   fun mUseFile (test) (fname: string) =  
       let fun repeat test n =  
                if (test n) then (useFile fname; repeat test (n+1)) else ()  
       in repeat test 0 end  
   
92  end (* functor Interact *)  end (* functor Interact *)

Legend:
Removed from v.23  
changed lines
  Added in v.24

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