Version française
Home     About     Download     Resources     Contact us    
Browse thread
Re: Toplevel script mode
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Ian T Zimmerman <itz@t...>
Subject: Re: Toplevel script mode

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_