Re: Toplevel script mode

From: Ian T Zimmerman (itz@transbay.net)
Date: Tue Apr 06 1999 - 10:43:20 MET DST


To: caml-list@inria.fr
Subject: Re: Toplevel script mode
From: Ian T Zimmerman <itz@transbay.net>
Date: 06 Apr 1999 01:43:20 -0700

Right after sending off my preceding message I stepped into the shower
and immediately I had another brilliant idea :-) Why not make the
initfile name mutable, then user extensions can load a different one
(if they change the ref in the files they link).

Patch is cummulative:

--- /home/itz/toploop.ml Tue Apr 6 00:57:59 1999
+++ /usr/src/ocaml-2.02/toplevel/toploop.ml Tue Apr 6 01:32:49 1999
@@ -271,8 +271,11 @@
   Clflags.thread_safe := true;
   Compile.init_path()
 
+let initfile_name =
+ ref ".ocamlinit"
+
 let load_ocamlinit () =
- if Sys.file_exists ".ocamlinit" then ignore(use_silently ".ocamlinit")
+ if Sys.file_exists !initfile_name then ignore(use_silently !initfile_name)
 
 (* The interactive loop *)
 
@@ -311,7 +314,7 @@
 (* Execute a script *)
 
 let run_script name =
- Compile.init_path();
   toplevel_env := Compile.initial_env();
   Format.set_formatter_out_channel stderr;
+ load_ocamlinit ();
   use_silently name

-- 
Ian T Zimmerman                        <itz@transbay.net>
I came to the conclusion that what was wrong about the guillotine
was that the condemned man had no chance at all, absolutely none.
Albert Camus, _The Outsider_



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:21 MET