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/trunk/src/compiler/TopLevel/interact/interact.sml
ViewVC logotype

Diff of /sml/trunk/src/compiler/TopLevel/interact/interact.sml

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

revision 44, Sun Mar 22 20:10:57 1998 UTC revision 45, Sun Mar 22 20:11:09 1998 UTC
# Line 1  Line 1 
1  (* COPYRIGHT (c) 1996 Bell Laboratories. *)  (* COPYRIGHT (c) 1996 Bell Laboratories. *)
2  (* interact.sml *)  (* interact.sml *)
3    
 signature INTERACT =  
 sig  
   exception Interrupt  
   
   val interact : unit -> unit  
   val useFile : string -> unit  
   
   val useStream : TextIO.instream -> unit  
   val evalStream : TextIO.instream * SCEnv.Env.environment ->  
                        SCEnv.Env.environment  
   
   val installCompManager:  
       (Ast.dec *  
        { get: unit -> SCEnv.Env.environment,  
          set: SCEnv.Env.environment -> unit } *  
        { get: unit -> Environment.environment,  
          set: Environment.environment -> unit }  
        -> unit) option  
       -> unit  
   
   (* The mUse functions should really be part of the Open Compiler *)  
   val mUseFile : (int->bool) -> string -> unit  
   val mUseFile_reset : unit -> unit  
   val mUseFile_add : (((unit -> unit) * string)list) -> unit  
   val mUseFile_list : unit -> (((unit -> unit)*string)list) list  
   
 end  (* signature INTERACT *)  
   
4  functor Interact(EvalLoop : EVALLOOP) : INTERACT =  functor Interact(EvalLoop : EVALLOOP) : INTERACT =
5  struct  struct
6    exception Interrupt = EvalLoop.Interrupt    exception Interrupt = EvalLoop.Interrupt
7    
8   (*   (* This is where CM can install itelf into.  Added for the purpose of
   * This is where CM can install itelf into.  Added for the purpose of  
9    * autoloading. (blume)    * autoloading. (blume)
10    *)    *)
11    type envref = EnvRef.envref    type envref = EnvRef.envref
# Line 55  Line 26 
26                                                       "]\n"];                                                       "]\n"];
27                                 raise ErrorMsg.Error))))                                 raise ErrorMsg.Error))))
28    
   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  
   
29    fun useStream (stream: TextIO.instream) =    fun useStream (stream: TextIO.instream) =
30        EvalLoop.evalStream EvalLoop.stdParams ("<instream>", stream)        EvalLoop.evalStream EvalLoop.stdParams ("<instream>", stream)
31    
# Line 75  Line 34 
34        let val r = ref Environment.emptyEnv        let val r = ref Environment.emptyEnv
35            val localEnvRef = {get=(fn()=> !r),set=(fn x=>r:=x)}            val localEnvRef = {get=(fn()=> !r),set=(fn x=>r:=x)}
36            val b = ref baseEnv            val b = ref baseEnv
37            val baseEnvRef = {get=(fn()=> !b),set=(fn _ => raise Fail "evalStream")}            val baseEnvRef =
38                {get=(fn()=> !b),set=(fn _ => raise Fail "evalStream")}
39         in EvalLoop.evalStream         in EvalLoop.evalStream
40              ({compManagerHook = ref NONE,              ({compManagerHook = ref NONE,
41                (* ????  should CM get its hands into that? *)                (* ????  should CM get its hands into that? *)
42                baseEnvRef = baseEnvRef,                baseEnvRef = baseEnvRef,
43                localEnvRef=localEnvRef,                localEnvRef=localEnvRef,
44                transform=(fn x => x), instrument=(fn _ => fn x => x),                transform=(fn x => x),
45                  instrument=(fn _ => fn x => x),
46                perform=(fn x => x),                perform=(fn x => x),
47                isolate= #isolate EvalLoop.stdParams,                isolate= #isolate EvalLoop.stdParams,
48                printer= #printer EvalLoop.stdParams})                printer= #printer EvalLoop.stdParams})
# Line 89  Line 50 
50            SCEnv.SC (#get localEnvRef ())            SCEnv.SC (#get localEnvRef ())
51        end        end
52    
53      (* These mUse functions should really be part of the Open Compiler *)
54      val mUseFile_hiddenList =
55            ref [ [((fn () => (print "--mUseFile not reset!")),"Error!")] ];
56    
57      fun mUseFile_reset () = (mUseFile_hiddenList := [])
58      fun mUseFile_add   f  = (mUseFile_hiddenList := (f::(!mUseFile_hiddenList)))
59      fun mUseFile_list  () = (List.rev(!mUseFile_hiddenList))
60    
61      fun mUseFile (test) (fname: string) =
62          let fun repeat test n =
63                   if (test n) then (useFile fname; repeat test (n+1)) else ()
64          in repeat test 0 end
65    
66  end (* functor Interact *)  end (* functor Interact *)

Legend:
Removed from v.44  
changed lines
  Added in v.45

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