-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmachine_dependent_io.adb
More file actions
61 lines (53 loc) · 1.93 KB
/
machine_dependent_io.adb
File metadata and controls
61 lines (53 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
with Raw_IO;
with TUI_Constants; use TUI_Constants;
package body Machine_Dependent_IO is
procedure Put ( ch : in wide_character) is
begin
Raw_IO.Put( ch );
end Put;
procedure Put ( str : in wide_string) is
begin
Raw_IO.Put( str );
end Put;
procedure Get_Immediate( ch : out wide_character) is
begin
Raw_IO.Get_Immediate( ch );
if ch = wide_character'Val(0) then -- Function Key
Raw_IO.Get_Immediate ( ch );
case ch is
when 'H' => ch := C_UP; -- Up arrow
when 'P' => ch := C_DOWN; -- Down arrow
when 'M' => ch := C_RIGHT; -- Right arrow
when 'K' => ch := C_LEFT; -- Left arrow
when others => ch := '?'; -- Unknown
end case; -- ch
end if; -- a function key (ch = 16#00#)
end Get_Immediate;
procedure Put (file : in Ada.Wide_Text_IO.file_type;
ch : in wide_character) is
begin
Raw_IO.Put(file, ch );
end Put;
procedure Put (file : in Ada.Wide_Text_IO.file_type;
str : in wide_string) is
begin
Raw_IO.Put(file, str );
end Put;
procedure Get_Immediate(file : in Ada.Wide_Text_IO.file_type;
ch : out wide_character) is
begin
Raw_IO.Get_Immediate(file, ch );
if ch = wide_character'Val(0) then -- Function Key
Raw_IO.Get_Immediate ( ch );
case ch is
when 'H' => ch := C_UP; -- Up arrow
when 'P' => ch := C_DOWN; -- Down arrow
when 'M' => ch := C_RIGHT; -- Right arrow
when 'K' => ch := C_LEFT; -- Left arrow
when others => ch := '?'; -- Unknown
end case; -- ch
end if; -- a function key (ch = 16#00#)
end Get_Immediate;
begin
null;
end Machine_Dependent_IO;