DISABLE FDs (REMOVE ME).
[jackhill/mal.git] / vhdl / pkg_readline.vhdl
1 library STD;
2 use STD.textio.all;
3
4 package pkg_readline is
5 procedure mal_printline(l: string);
6 procedure mal_readline(prompt: string; eof_detected: out boolean; l: inout line);
7 end package pkg_readline;
8
9 package body pkg_readline is
10 type charfile is file of character;
11 file stdout_char: charfile open write_mode is "STD_OUTPUT";
12
13 procedure mal_printstr(l: string) is
14 begin
15 for i in l'range loop
16 write(stdout_char, l(i));
17 end loop;
18 end procedure mal_printstr;
19
20 procedure mal_printline(l: string) is
21 begin
22 mal_printstr(l);
23 write(stdout_char, LF);
24 end procedure mal_printline;
25
26 procedure mal_readline(prompt: string; eof_detected: out boolean; l: inout line) is
27 begin
28 mal_printstr(prompt);
29 if endfile(input) then
30 eof_detected := true;
31 else
32 readline(input, l);
33 eof_detected := false;
34 end if;
35 end procedure mal_readline;
36 end package body pkg_readline;