blob: 9d69c11fe2ef3a9cf9a098b8f28e6572fcac4422 (
plain) (
blame)
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
|
include "../curses.h"
include "window.h"
# GETCH -- Get a character and display it in the window
int procedure getch ()
# B.Simon 01-Oct-90 Original
#--
int wgetch()
begin
return (wgetch (STDSCR))
end
int procedure wgetch (win)
pointer win # i: Window descriptor
#--
include "window.com"
char str[1]
int ch
pointer pwin
int k_get()
begin
str[1] = EOS
str[2] = EOS
pwin = warray[win]
if (WIN_FUNC(pwin) == NULL) {
call ps_synch
ch = k_get ()
if (ch < K_BASE) {
str[1] = ch
call waddstr (win, str)
}
} else {
call zcall3 (WIN_FUNC(pwin), win, str, 1)
if (str[1] == EOS) {
ch = k_get () # get pushed back character
} else {
ch = str[1]
}
}
return (ch)
end
|