summaryrefslogtreecommitdiff
path: root/toplevel/toploop.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1997-04-08 15:18:38 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1997-04-08 15:18:38 +0000
commit6c63d34fdbd8c7c0e1219f81da40759076775792 (patch)
tree98ad80e5ca614b32900939cc0bfbd5cdb9e48d72 /toplevel/toploop.ml
parentb846e7b3d3b7aa4b081050b78f523df63341c400 (diff)
downloadocaml-6c63d34fdbd8c7c0e1219f81da40759076775792.tar.gz
Pour que ca marche avec les threads: remplacement de la fonction de
lecture au clavier et faire comme si on avait -thread sur la ligne de commande. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@1491 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'toplevel/toploop.ml')
-rw-r--r--toplevel/toploop.ml11
1 files changed, 6 insertions, 5 deletions
diff --git a/toplevel/toploop.ml b/toplevel/toploop.ml
index 0362c7960d..2e16e33456 100644
--- a/toplevel/toploop.ml
+++ b/toplevel/toploop.ml
@@ -170,15 +170,15 @@ let execute_phrase phr =
(* Reading function *)
-external input_scan_line : in_channel -> int = "input_scan_line"
-
let first_line = ref true
let refill_lexbuf buffer len =
output_string stdout (if !first_line then "# " else " "); flush stdout;
first_line := false;
- let n = min len (abs(input_scan_line stdin)) in
- input stdin buffer 0 n
+ let i = ref 0 in
+ while !i < len && (let c = input_char stdin in buffer.[!i] <- c; c <> '\n')
+ do incr i done;
+ !i + 1
(* Discard everything already in a lexer buffer *)
@@ -188,11 +188,12 @@ let empty_lexbuf lb =
lb.lex_curr_pos <- l
(* Toplevel initialization. Performed here instead of at the
- beginning of loop() so that user code linked in with cslmktop
+ beginning of loop() so that user code linked in with ocamlmktop
can call directives from Topdirs. *)
let _ =
Symtable.init_toplevel();
+ Clflags.thread_safe := true;
Compile.init_path();
Sys.interactive := true