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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
include <ttyset.h>
include <error.h>
include <fset.h>
include <gio.h>
include "gtr.h"
include "grc.h"
# GTR_WAITPAGE -- Print the "hit return to continue" message on the terminal
# screen and wait for the user to respond before returning to graphics mode.
# Redrawing of the graphics frame is optional.
procedure gtr_waitpage (fd, stream)
int fd # output file
int stream # graphics stream
int key, i
pointer tty, tr
int getci(), ttystati()
pointer ttyodes(), gtr_init()
errchk gtr_init, ttyodes
begin
tr = gtr_init (stream)
tty = ttyodes ("terminal")
repeat {
# Print prompt in standout mode.
call ttyclearln (fd, tty)
call ttyso (fd, tty, YES)
call fprintf (fd,
"[space=cmhelp,return=quit+redraw,q=quit+noredraw]")
call ttyso (fd, tty, NO)
call flush (fd)
# Wait for user to hit a key. This is done in text mode via
# a raw getc rather than via a cursor read to avoid switching to
# graphics mode. On some terminals with separate text and
# graphics planes a switch to graphics mode turns off the text
# plane.
call fseti (STDIN, F_RAW, YES)
if (getci (STDIN, key) == EOF)
key = '\r'
call fseti (STDIN, F_RAW, NO)
# Take the action commanded by the user. At present the morehelp
# option merely prints cursor mode help; this is appropriate
# because the first waitpage call occurs after printing user help
# in response to ? (or after a :.show).
switch (key) {
case 'q':
# Quit, do not clear graphics and redraw.
if (TR_PAGE(tr) == NO) {
# If screen paging is disabled (text drawn underneath
# transparent graphics overlay), clear the text frame
# only, using the clear line function.
do i = 1, ttystati (tty, TTY_NLINES) {
call ttygoto (fd, tty, 1, i)
call ttyclearln (fd, tty)
}
} else
call ttyclearln (fd, tty)
call flush (fd)
call gki_reactivatews (stream, 0)
break
case '\r', '\n':
# Quit, clear graphics and redraw.
call ttyclearln (fd, tty)
call flush (fd)
call gki_reactivatews (stream, 0)
call gtr_redraw (stream)
break
case ' ':
# Print cursor mode help.
iferr (call pagefile (KEYSFILE, "cursor mode help"))
call erract (EA_WARN)
default:
# Illegal keystroke.
call printf ("\007")
call flush (STDOUT)
}
}
call ttycdes (tty)
end
|