This repository has been archived on 2024-01-18. You can view files and clone it, but cannot push or open issues or pull requests.
compilation/flap/src/utilities/stdUserInput.ml
2023-10-04 15:40:22 +02:00

22 lines
423 B
OCaml

let prompt = ref ""
let set_prompt = ( := ) prompt
let print_prompt () =
output_string stdout !prompt;
flush stdout
let input_char =
let display_prompt = ref true in
let ask stdin =
if !display_prompt then begin
display_prompt := false;
print_prompt ()
end;
let c = input_char stdin in
if c = '\n' then display_prompt := true;
String.make 1 c
in
ask
let set_ascii () = ()