1 \ tag
: terminal
emulation
3 \ this
code implements
IEEE 1275-1994 ANNEX B
5 \
Copyright (C) 2003 Stefan Reinauer
7 \
See the file
"COPYING" for further information about
8 \
the copyright and warranty status
of this
work.
14 : (match-number
) ( x y
[1|2] [1|2] -- x
[z
] )
24 : (esc
-number
) ( maxchar
-- ?? ?? num
)
25 >r depth
>r
( R: depth maxchar
)
26 0 (sequence
) 2+ (escseq
) 2- ( 0 seq
+2 seqlen
-2 )
27 \
if numerical
, scan until
non-numerical
51 (escseq
) 1- (sequence
) + c
@ \ get
last character
in sequence
54 ascii
A of \
CUU - cursor up
64 ascii
B of \
CUD - cursor down
69 #lines 1- min to line#
72 ascii
C of \
CUF - cursor forward
77 #columns 1- min to column#
80 ascii
D of \
CUB - cursor backward
88 ascii
E of \
Cursor next
line (CNL)
89 \
FIXME - check agains
ANSI3.64
94 #lines 1- min to line#
101 #columns 1- min to column#
102 #lines 1- min to line#
108 #columns 1- min to column#
109 #lines 1- min to line#
114 #columns column# - delete-characters
115 #lines line# - delete-lines
119 #columns column# - delete-characters
159 ascii p
of \ normal
text colors
162 false to inverse
-screen
?
163 inverse
? 0= to inverse
?
167 ascii q
of \ inverse
text colors
169 inverse
-screen
? not
if
170 true to inverse
-screen
?
171 inverse
? 0= to inverse
?
176 \
Resets the display device
associated with the terminal emulator
.
183 : (term
-emit
) ( char
-- )
189 ." overflow in esc" cr
193 dup ascii
[ = if \ not
a [
197 0 to (escseq
) \ break out
of ESC sequence
199 drop \ don
't print breakout character
203 (sequence) (escseq) + c!
204 (escseq) 1+ to (escseq)
213 s" /screen" s" ring-bell"
214 execute-device-method
225 column# dup #columns = if
228 8 + -8 and ff and to column#
232 line# 1+ to line# 0 to column#
240 0 to column# 0 to line#
255 ['] (term
-emit
) to fb
-emit