author | Claus Gittinger <cg@exept.de> |
Tue, 23 Jul 2013 16:25:04 +0200 | |
changeset 4293 | ade403689ce1 |
parent 4291 | fd935fa1dfec |
child 4296 | c52538ab6102 |
permissions | -rw-r--r-- |
1361 | 1 |
" |
2 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
2076 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
930 | 14 |
TerminalView subclass:#VT100TerminalView |
998 | 15 |
instanceVariableNames:'currentParam parameters lastCursorLine' |
4269 | 16 |
classVariableNames:'TraceCSI' |
920 | 17 |
poolDictionaries:'' |
18 |
category:'Views-TerminalViews' |
|
19 |
! |
|
20 |
||
927 | 21 |
!VT100TerminalView class methodsFor:'documentation'! |
22 |
||
2116 | 23 |
ansiEscapes |
24 |
" |
|
4291 | 25 |
see also: http://www.vt100.net/docs/vt100-ug/chapter3.html |
26 |
||
2116 | 27 |
ANSI ESCAPE SEQUENCES |
28 |
=============================================================================== |
|
29 |
Wherever you see '#', that should be replaced by the appropriate number. |
|
30 |
||
31 |
ESC code sequence Function |
|
32 |
------------------- --------------------------- |
|
33 |
Cursor Controls: |
|
34 |
ESC[#;#H or ESC[#;#f Moves cusor to line #, column # |
|
35 |
ESC[#A Moves cursor up # lines |
|
36 |
ESC[#B Moves cursor down # lines |
|
37 |
ESC[#C Moves cursor forward # spaces |
|
38 |
ESC[#D Moves cursor back # spaces |
|
39 |
ESC[#;#R Reports current cursor line & column |
|
40 |
ESC[s Saves cursor position for recall later |
|
41 |
ESC[u Return to saved cursor position |
|
42 |
||
43 |
Erase Functions: |
|
44 |
ESC[2J Clear screen and home cursor |
|
45 |
ESC[K Clear to end of line |
|
46 |
||
47 |
Set Graphics Rendition: |
|
48 |
ESC[#;#;....;#m Set display attributes where # is |
|
49 |
0 for normal display |
|
50 |
1 for bold on |
|
51 |
4 underline (mono only) |
|
52 |
5 blink on |
|
53 |
7 reverse video on |
|
54 |
8 nondisplayed (invisible) |
|
55 |
30 black foreground |
|
56 |
31 red foreground |
|
57 |
32 green foreground |
|
58 |
33 yellow foreground |
|
59 |
34 blue foreground |
|
60 |
35 magenta foreground |
|
61 |
36 cyan foreground |
|
62 |
37 white foreground |
|
63 |
40 black background |
|
64 |
41 red background |
|
65 |
42 green background |
|
66 |
43 yellow background |
|
67 |
44 blue background |
|
68 |
45 magenta background |
|
69 |
46 cyan background |
|
70 |
47 white background |
|
71 |
||
72 |
ESC[=#;7h or Put screen in indicated mode where # is |
|
73 |
ESC[=h or 0 for 40 x 25 black & white |
|
74 |
ESC[=0h or 1 for 40 x 25 color |
|
75 |
ESC[?7h 2 for 80 x 25 b&w |
|
76 |
3 for 80 x 25 color |
|
77 |
4 for 320 x 200 color graphics |
|
78 |
5 for 320 x 200 b & w graphics |
|
79 |
6 for 640 x 200 b & w graphics |
|
80 |
7 to wrap at end of line |
|
81 |
||
82 |
ESC[=#;7l or ESC[=l or Resets mode # set with above command |
|
83 |
ESC[=0l or ESC[?7l |
|
84 |
||
85 |
Keyboard Reassignments: |
|
86 |
ESC[#;#;...p Keyboard reassignment. The first ASCII |
|
87 |
or ESC[""string""p code defines which code is to be |
|
88 |
or ESC[#;""string"";#; changed. The remaining codes define |
|
89 |
#;""string"";#p what it is to be changed to. |
|
90 |
||
91 |
E.g. Reassign the Q and q keys to the A and a keys (and vice versa). |
|
92 |
ESC [65;81p A becomes Q |
|
93 |
ESC [97;113p a becomes q |
|
94 |
ESC [81;65p Q becomes A |
|
95 |
ESC [113;97p q becomes a |
|
96 |
||
97 |
E.g. Reassign the F10 key to a DIR command. |
|
98 |
ESC [0;68;""dir"";13p The 0;68 is the extended ASCII code |
|
99 |
for the F10 key and 13 is the ASCII |
|
100 |
code for a carriage return. |
|
101 |
||
102 |
Other function key codes F1=59,F2=60,F3=61,F4=62,F5=63 |
|
103 |
F6=64,F7=65,F8=66,F9=67,F10=68 |
|
104 |
" |
|
105 |
! |
|
106 |
||
1361 | 107 |
copyright |
108 |
" |
|
109 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
110 |
All Rights Reserved |
|
111 |
||
112 |
This software is furnished under a license and may be used |
|
113 |
only in accordance with the terms of that license and with the |
|
114 |
inclusion of the above copyright notice. This software may not |
|
115 |
be provided or otherwise made available to, or used by, any |
|
116 |
other person. No title to or ownership of the software is |
|
117 |
hereby transferred. |
|
118 |
" |
|
119 |
||
120 |
||
121 |
! |
|
122 |
||
927 | 123 |
documentation |
124 |
" |
|
1418 | 125 |
A VT100 terminal emulator. |
126 |
Most of the functionality is inherited from my superclass, |
|
127 |
I redefine/specialize certain methods for VT100 escape sequences |
|
128 |
and vt100 keyboard codes |
|
927 | 129 |
|
1419 | 130 |
BUGS: |
131 |
VT100 wrapMode (at right margin) is not supported |
|
132 |
this may lead to wrong display when a vi is started in a small window. |
|
133 |
||
927 | 134 |
[start with:] |
135 |
VT100TerminalView openShell |
|
1418 | 136 |
|
137 |
[see also:] |
|
138 |
VT52TerminalView |
|
139 |
TelnetTool |
|
927 | 140 |
" |
141 |
||
142 |
||
143 |
! ! |
|
920 | 144 |
|
932 | 145 |
!VT100TerminalView methodsFor:'defaults'! |
927 | 146 |
|
4293 | 147 |
vt100AlternativeKeyCodes |
148 |
"return the alternative vt100 keyCode table" |
|
149 |
||
150 |
^ IdentityDictionary withKeysAndValues: |
|
151 |
#( |
|
152 |
#CursorUp '\eOA' |
|
153 |
#CursorDown '\eOB' |
|
154 |
#CursorRight '\eOC' |
|
155 |
#CursorLeft '\eOD' |
|
156 |
#Home '\eOH' |
|
157 |
#Escape '\e' |
|
158 |
#BackSpace '\b' |
|
159 |
#Return '\r' |
|
160 |
#Delete '\0177' |
|
161 |
#Tab '\t' |
|
162 |
||
163 |
#F1 '\eOP' |
|
164 |
#F2 '\eOQ' |
|
165 |
#F3 '\eOR' |
|
166 |
#F4 '\eOS' |
|
167 |
#F5 '\eOt' |
|
168 |
#F6 '\eOu' |
|
169 |
#F7 '\eOv' |
|
170 |
#F8 '\eOl' |
|
171 |
#F9 '\eOw' |
|
172 |
) |
|
173 |
! |
|
174 |
||
927 | 175 |
vt100KeyCodes |
1420 | 176 |
"return a vt100 keyCode table" |
177 |
||
927 | 178 |
^ IdentityDictionary withKeysAndValues: |
179 |
#( |
|
180 |
#CursorUp '\e[A' |
|
181 |
#CursorDown '\e[B' |
|
182 |
#CursorRight '\e[C' |
|
183 |
#CursorLeft '\e[D' |
|
4293 | 184 |
|
927 | 185 |
#Home '\e[H' |
186 |
#Escape '\e' |
|
187 |
#BackSpace '\b' |
|
188 |
#Return '\r' |
|
976 | 189 |
#Delete '\0177' |
1357 | 190 |
#Tab '\t' |
1352 | 191 |
|
192 |
#F1 '\eOP' |
|
193 |
#F2 '\eOQ' |
|
194 |
#F3 '\eOR' |
|
195 |
#F4 '\eOS' |
|
196 |
#F5 '\eOt' |
|
197 |
#F6 '\eOu' |
|
198 |
#F7 '\eOv' |
|
199 |
#F8 '\eOl' |
|
200 |
#F9 '\eOw' |
|
927 | 201 |
) |
202 |
||
203 |
"Created: / 10.6.1998 / 15:13:01 / cg" |
|
1357 | 204 |
"Modified: / 5.5.1999 / 15:01:32 / cg" |
927 | 205 |
! ! |
206 |
||
207 |
!VT100TerminalView methodsFor:'functions'! |
|
208 |
||
209 |
addLines |
|
1420 | 210 |
"Add the appropriate number of blank lines (param 1) |
211 |
at the cursor position." |
|
927 | 212 |
|
1420 | 213 |
self addLines:((parameters at:1) max:1). |
927 | 214 |
self endOfSequence |
215 |
||
216 |
"Created: / 10.6.1998 / 14:48:03 / cg" |
|
217 |
! |
|
218 |
||
1420 | 219 |
addLines:aNumber |
927 | 220 |
"Add aNumber blank lines at the position indicated by the cursor." |
221 |
||
1420 | 222 |
aNumber timesRepeat:[ |
927 | 223 |
self insertLine:'' before:cursorLine |
224 |
] |
|
225 |
||
226 |
"Created: / 10.6.1998 / 14:49:30 / cg" |
|
227 |
! |
|
228 |
||
949 | 229 |
autoMargin:aBoolean |
230 |
"set/clear autowrap at end of line (not yet implemented)" |
|
231 |
||
2268 | 232 |
autoWrapFlag := aBoolean |
949 | 233 |
! |
234 |
||
2192 | 235 |
clearLines:arg |
1420 | 236 |
"Clear some part of the current line, as indicated by the first parameter: |
237 |
0 - clear to EOL |
|
238 |
1 - clear from beginning to cursorCol |
|
239 |
2 - clear entire line |
|
240 |
" |
|
927 | 241 |
|
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
242 |
arg = 0 ifTrue: [^self doClearToEndOfLine]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
243 |
arg = 1 ifTrue: [^self doClearFromBeginningOfLine]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
244 |
arg = 2 ifTrue: [^self doClearEntireLine] |
927 | 245 |
|
246 |
"Created: / 10.6.1998 / 14:44:22 / cg" |
|
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
247 |
"Modified: / 21.7.1998 / 20:07:42 / cg" |
927 | 248 |
! |
249 |
||
949 | 250 |
deleteCharacters |
1420 | 251 |
"Delete the appropriate number of characters (param 1) |
252 |
at the cursor position." |
|
949 | 253 |
|
254 |
|n| |
|
255 |
||
256 |
n := ((parameters at: 1) max: 1). |
|
257 |
self deleteFromLine:cursorLine col:cursorCol toLine:cursorLine col:cursorCol+n-1. |
|
258 |
||
259 |
"Created: / 12.6.1998 / 21:19:02 / cg" |
|
260 |
"Modified: / 12.6.1998 / 21:19:15 / cg" |
|
261 |
! |
|
262 |
||
2192 | 263 |
displayMode:p1 |
1420 | 264 |
"Set the current display mode (emphasis) as specified by param 1." |
927 | 265 |
|
2192 | 266 |
|clrName| |
1352 | 267 |
|
268 |
||
1020 | 269 |
"/ self endEntry. |
1352 | 270 |
p1 == 1 ifTrue:[ |
951 | 271 |
"/ ESC-[-1-m -> bold |
272 |
||
1287
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
273 |
"/ workaround: windows bold fonts are |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
274 |
"/ wider, leading to ugly looking output |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
275 |
"/ Therefore, use red color instead of bold |
1667 | 276 |
device platformName = 'WIN32' ifTrue:[ |
1287
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
277 |
self color:Color red. |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
278 |
] ifFalse:[ |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
279 |
self bold. |
48e6c847a554
use red color instead of bold
Claus Gittinger <cg@exept.de>
parents:
1056
diff
changeset
|
280 |
]. |
951 | 281 |
^ self. |
282 |
]. |
|
1352 | 283 |
p1 == 4 ifTrue:[ |
284 |
"/ ESC-[-4-m -> underline |
|
285 |
||
286 |
self underline. |
|
287 |
^ self. |
|
288 |
]. |
|
289 |
p1 == 5 ifTrue:[ |
|
290 |
"/ ESC-[-5-m -> blink |
|
291 |
||
292 |
self color:Color blue. |
|
293 |
^ self. |
|
294 |
]. |
|
295 |
p1 == 7 ifTrue:[ |
|
296 |
"/ ESC-[-7-m -> reverse |
|
951 | 297 |
|
978 | 298 |
self reverse. |
299 |
^ self. |
|
300 |
]. |
|
2116 | 301 |
p1 == 8 ifTrue:[ |
302 |
"/ ESC-[-8-m -> invisible |
|
303 |
^ self. |
|
304 |
]. |
|
305 |
(p1 between:30 and:37) ifTrue:[ |
|
306 |
"/ ESC-[-30-m -> black fg color |
|
307 |
"/ ESC-[-31-m -> red fg color |
|
308 |
"/ ... |
|
309 |
"/ ESC-[-37-m -> white fg color |
|
310 |
clrName := #(black red green yellow blue magenta cyan white) at:(p1-30+1). |
|
311 |
self color:(Color perform:clrName). |
|
312 |
^ self. |
|
313 |
]. |
|
314 |
(p1 between:40 and:47) ifTrue:[ |
|
315 |
"/ ESC-[-40-m -> black bg color |
|
316 |
"/ ... |
|
317 |
"/ ESC-[-47-m -> white bg color |
|
318 |
clrName := #(black red green yellow blue magenta cyan white) at:(p1-40+1). |
|
319 |
self bgColor:(Color perform:clrName). |
|
320 |
^ self. |
|
321 |
]. |
|
1020 | 322 |
|
978 | 323 |
"/ ESC-[-any-m -> normal |
324 |
self normal. |
|
927 | 325 |
|
326 |
"Created: / 10.6.1998 / 15:01:16 / cg" |
|
1352 | 327 |
"Modified: / 5.5.1999 / 00:53:15 / cg" |
927 | 328 |
! |
329 |
||
2192 | 330 |
doClearDisplay:arg |
1420 | 331 |
"Clear some part of the current screen, as indicated by the first parameter. |
332 |
0 - clear to endOfScreen |
|
333 |
1 - clear from beginning of screen to cursorCol |
|
334 |
2 - clear entire screen |
|
335 |
" |
|
1001
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
336 |
|
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
337 |
arg = 0 ifTrue: [^self doClearToEndOfScreen]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
338 |
arg = 1 ifTrue: [^self doClearFromBeginningOfScreen]. |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
339 |
arg = 2 ifTrue: [^self doClearEntireScreen] |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
340 |
|
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
341 |
"Created: / 21.7.1998 / 20:05:07 / cg" |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
342 |
"Modified: / 21.7.1998 / 20:07:36 / cg" |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
343 |
! |
7fe14ad43ae3
fixed clear-to-end-of-screen function.
Claus Gittinger <cg@exept.de>
parents:
998
diff
changeset
|
344 |
|
1020 | 345 |
insertCharacters |
1420 | 346 |
"Insert the appropriate number of spaces (param 1) at the cursor position." |
949 | 347 |
|
348 |
|s| |
|
349 |
||
350 |
s := String new:((parameters at: 1) max: 1). |
|
1420 | 351 |
self insertStringWithoutCRs:s atLine:cursorLine col:cursorCol. |
949 | 352 |
|
353 |
"Modified: / 12.6.1998 / 21:14:25 / cg" |
|
1020 | 354 |
"Created: / 28.7.1998 / 00:53:51 / cg" |
949 | 355 |
! |
356 |
||
927 | 357 |
move |
358 |
"Move to the locations indicated by the first and second parameters." |
|
359 |
||
2217 | 360 |
| row column | |
361 |
||
362 |
row := (self getParameter:1 withDefault:1). |
|
363 |
column := (self getParameter:2 withDefault:1). |
|
2202 | 364 |
Debug ifTrue:[ |
2217 | 365 |
Transcript show:'move to column/row:'; show:column; show:'/'; showCR:row. |
366 |
]. |
|
367 |
self moveToX:column y:row. |
|
927 | 368 |
|
369 |
"Created: / 10.6.1998 / 14:40:01 / cg" |
|
978 | 370 |
"Modified: / 20.6.1998 / 18:49:12 / cg" |
927 | 371 |
! |
372 |
||
373 |
moveToX: xLocation y: yLocation |
|
374 |
"Position the cursor at the location given by xLocation and yLocation. |
|
375 |
Ignore the command if the parameters are outside the allowable range." |
|
376 |
||
2192 | 377 |
Debug ifTrue:[ |
378 |
Transcript show:'numberOfColumns '; showCR:numberOfColumns. |
|
379 |
Transcript show:'numberOfLines '; showCR:numberOfLines. |
|
380 |
]. |
|
978 | 381 |
"/ (xLocation < 1 or: [xLocation > numberOfColumns]) ifTrue: [^self]. |
382 |
"/ (yLocation < 1 or: [yLocation > numberOfLines]) ifTrue: [^self]. |
|
952 | 383 |
|
949 | 384 |
self cursorVisibleLine:yLocation col:xLocation. |
927 | 385 |
|
386 |
"Created: / 10.6.1998 / 14:40:49 / cg" |
|
978 | 387 |
"Modified: / 20.6.1998 / 20:27:11 / cg" |
927 | 388 |
! |
389 |
||
944 | 390 |
reportTerminalType |
1420 | 391 |
"currently, only cursor position is supported (param 6)" |
392 |
||
944 | 393 |
(parameters at: 1) == 6 ifTrue:[ |
394 |
"/ report position |
|
1020 | 395 |
self endEntry. |
4286 | 396 |
Debug ifTrue:[ |
397 |
Transcript showCR:'report terminal type' |
|
398 |
]. |
|
944 | 399 |
inStream nextPut:(Character esc). |
400 |
inStream nextPutAll:'[' |
|
401 |
, cursorLine printString |
|
402 |
, ';' |
|
403 |
, cursorCol printString |
|
404 |
, 'R'. |
|
405 |
^ self |
|
406 |
]. |
|
407 |
(parameters at: 1) == 7 ifTrue:[ |
|
408 |
"/ display name |
|
409 |
]. |
|
410 |
||
411 |
"Created: / 11.6.1998 / 23:05:50 / cg" |
|
1020 | 412 |
"Modified: / 28.7.1998 / 00:54:30 / cg" |
944 | 413 |
! |
414 |
||
927 | 415 |
resetDefaults |
416 |
"Reset the default parameters" |
|
417 |
||
2192 | 418 |
|l1 l2| |
949 | 419 |
|
978 | 420 |
|
949 | 421 |
l1 := (parameters at: 1). |
422 |
l2 := (parameters at: 2). |
|
2192 | 423 |
Debug ifTrue:[ |
424 |
Transcript show:'resetDefaults:'; show:l1;show:' ';showCR:l2. |
|
425 |
]. |
|
949 | 426 |
(l1 ~~ 0 and:[l2 ~~ 0]) ifTrue:[ |
427 |
rangeStartLine := l1. |
|
428 |
rangeEndLine := l2. |
|
429 |
] ifFalse:[ |
|
978 | 430 |
"/ self halt. |
949 | 431 |
]. |
432 |
||
978 | 433 |
"/ (rangeStartLine == 1 and:[rangeEndLine == numberOfLines]) ifTrue:[ |
434 |
"/ rangeEndLine := rangeStartLine := nil. |
|
435 |
"/ ]. |
|
436 |
||
4291 | 437 |
alternateKeypadMode := false. |
978 | 438 |
"/ autoLineFeed := false. |
439 |
"/ autoMargin := true. |
|
440 |
"/ displayMode := 0. "Normal display"!! !! |
|
927 | 441 |
|
442 |
"Created: / 10.6.1998 / 14:50:53 / cg" |
|
978 | 443 |
"Modified: / 20.6.1998 / 20:28:26 / cg" |
920 | 444 |
! ! |
445 |
||
446 |
!VT100TerminalView methodsFor:'initialization'! |
|
447 |
||
927 | 448 |
initialize |
449 |
super initialize. |
|
949 | 450 |
|
2268 | 451 |
autoWrapFlag := true. |
4291 | 452 |
alternateKeypadMode := false. |
2192 | 453 |
parameters := Array new:8. |
927 | 454 |
self endOfSequence |
455 |
||
456 |
"Created: / 10.6.1998 / 14:46:07 / cg" |
|
953 | 457 |
"Modified: / 13.6.1998 / 13:58:01 / cg" |
927 | 458 |
! |
459 |
||
460 |
initializeKeyboardSequences |
|
1420 | 461 |
"setup my keyboard sequences for a vt100" |
462 |
||
927 | 463 |
kbdSequences := (self vt100KeyCodes) |
464 |
||
465 |
"Modified: / 9.6.1998 / 20:49:21 / cg" |
|
466 |
"Created: / 10.6.1998 / 15:12:32 / cg" |
|
467 |
! ! |
|
468 |
||
4269 | 469 |
!VT100TerminalView methodsFor:'misc'! |
470 |
||
471 |
traceCSI:char |
|
472 |
state infoPrint. '-' infoPrint. |
|
473 |
char asciiValue > 32 ifTrue:[ |
|
474 |
char infoPrint. |
|
475 |
] ifFalse:[ |
|
476 |
'0x' infoPrint. char codePoint hexPrintString infoPrint. |
|
477 |
]. |
|
478 |
currentParam > 1 ifTrue:[ |
|
479 |
' ' infoPrint. |
|
480 |
(parameters at:1) infoPrintCR. |
|
481 |
||
482 |
currentParam > 2 ifTrue:[ |
|
483 |
' ' infoPrint. |
|
484 |
(parameters at:2) infoPrintCR. |
|
485 |
||
486 |
currentParam > 3 ifTrue:[ |
|
487 |
' ' infoPrint. |
|
488 |
(parameters at:3) infoPrintCR. |
|
489 |
]. |
|
490 |
]. |
|
491 |
]. |
|
492 |
! ! |
|
493 |
||
4221 | 494 |
!VT100TerminalView methodsFor:'os functions (xterm)'! |
495 |
||
496 |
osCommand |
|
497 |
|cmdKey cmdValue| |
|
498 |
||
499 |
cmdKey := parameters at:1. |
|
500 |
cmdValue := parameters at:2. |
|
4269 | 501 |
|
4221 | 502 |
cmdKey == 0 ifTrue:[ |
503 |
"/ change icon name and window title |
|
504 |
masterWindow notNil ifTrue:[ |
|
505 |
masterWindow label:cmdValue. |
|
506 |
masterWindow iconLabel:cmdValue. |
|
507 |
]. |
|
508 |
self endOfSequence. |
|
509 |
^ self. |
|
510 |
]. |
|
511 |
cmdKey == 1 ifTrue:[ |
|
512 |
"/ change icon name |
|
513 |
masterWindow notNil ifTrue:[ |
|
514 |
masterWindow iconLabel:cmdValue. |
|
515 |
]. |
|
516 |
self endOfSequence. |
|
517 |
^ self. |
|
518 |
]. |
|
519 |
cmdKey == 2 ifTrue:[ |
|
520 |
"/ change window title |
|
521 |
masterWindow notNil ifTrue:[ |
|
522 |
masterWindow label:cmdValue. |
|
523 |
]. |
|
524 |
self endOfSequence. |
|
525 |
^ self. |
|
526 |
]. |
|
527 |
cmdKey == 3 ifTrue:[ |
|
528 |
"/ set x property |
|
529 |
self endOfSequence. |
|
530 |
^ self. |
|
531 |
]. |
|
532 |
cmdKey == 4 ifTrue:[ |
|
533 |
"/ change color |
|
534 |
self endOfSequence. |
|
535 |
^ self. |
|
536 |
]. |
|
537 |
self breakPoint:#cg. |
|
538 |
self endOfSequence |
|
539 |
! ! |
|
540 |
||
2498 | 541 |
!VT100TerminalView methodsFor:'processing-input'! |
927 | 542 |
|
2194 | 543 |
addToParameter:char |
927 | 544 |
"The parameter char is a digit. Add it to the current parameter." |
545 |
||
546 |
| param | |
|
547 |
||
2192 | 548 |
param := (parameters at:currentParam) ? 0. |
927 | 549 |
parameters at:currentParam put:(param * 10 + char digitValue) |
550 |
||
551 |
"Created: / 10.6.1998 / 14:39:00 / cg" |
|
552 |
! |
|
553 |
||
1420 | 554 |
endOfSequence |
555 |
"private - reset state-machine at end of escape-sequence" |
|
927 | 556 |
|
557 |
state := 0. |
|
558 |
currentParam := 1. |
|
2192 | 559 |
"/ parameters := Array new:8 withAll:0. |
560 |
parameters atAllPut:nil. |
|
927 | 561 |
|
562 |
"Created: / 10.6.1998 / 14:30:40 / cg" |
|
563 |
"Modified: / 10.6.1998 / 14:30:57 / cg" |
|
564 |
! |
|
565 |
||
4269 | 566 |
evaluateProcessCharacter:char return:aSymbol |
2207 | 567 |
" evaluate the return value of the process state methods except for state 0 |
568 |
" |
|
569 |
||
4271 | 570 |
aSymbol isNil ifTrue:[ |
571 |
^ self. |
|
572 |
]. |
|
2207 | 573 |
aSymbol == #waitForNextChar ifTrue:[ |
574 |
^ self. |
|
575 |
]. |
|
576 |
aSymbol == #unknown ifTrue:[ |
|
4270 | 577 |
('VT100TerminalView [info]: unknown character %1 in state %2' |
4269 | 578 |
bindWith:(char codePoint hexPrintString) |
579 |
with:state) infoPrintCR. |
|
2207 | 580 |
self doNothing. |
581 |
^ self |
|
582 |
]. |
|
583 |
aSymbol == #sequenceComplete ifTrue:[ |
|
584 |
self endOfSequence. |
|
585 |
^ self. |
|
586 |
]. |
|
4269 | 587 |
self halt:'unexpected return value from state processing' |
2207 | 588 |
! |
589 |
||
590 |
nextPut:char |
|
4286 | 591 |
" process a character (i.e. from the shell's output)" |
937 | 592 |
|
2202 | 593 |
|processCharacterReturn| |
932 | 594 |
|
2192 | 595 |
Debug ifTrue:[ |
2202 | 596 |
Transcript |
4286 | 597 |
show:'VT100: nextPut - state: '; show:state; |
598 |
show:' got: '; |
|
2202 | 599 |
showCR:char storeString |
2192 | 600 |
]. |
4291 | 601 |
"/ char == Character return ifTrue:[self halt]. |
4289 | 602 |
state == 0 ifTrue:[ |
603 |
processCharacterReturn := self processState0:char. |
|
604 |
self evaluateProcessCharacter:char return:processCharacterReturn. |
|
605 |
^ self |
|
606 |
]. |
|
2207 | 607 |
state == #gotReturn ifTrue:[ |
608 |
processCharacterReturn := self processStateGotReturn:char. |
|
609 |
processCharacterReturn == #sequenceComplete ifTrue:[ |
|
2350
0f9ca9ecf77a
the state have to be reset if sequence is complete in #gotReturn
penk
parents:
2268
diff
changeset
|
610 |
self endOfSequence. |
2207 | 611 |
^ self. |
612 |
]. |
|
4269 | 613 |
^ self |
2207 | 614 |
]. |
615 |
state == #gotESC ifTrue:[ |
|
616 |
processCharacterReturn := self processStateGotESC:char. |
|
4269 | 617 |
self evaluateProcessCharacter:char return:processCharacterReturn. |
2207 | 618 |
^ self. |
927 | 619 |
]. |
2207 | 620 |
state == #gotCSI ifTrue:[ |
621 |
processCharacterReturn := self processStateGotCSI:char. |
|
4269 | 622 |
self evaluateProcessCharacter:char return:processCharacterReturn. |
2207 | 623 |
^ self. |
2202 | 624 |
]. |
2207 | 625 |
state == #gotCSI2 ifTrue:[ |
626 |
processCharacterReturn := self processStateGotCSI2:char. |
|
4269 | 627 |
self evaluateProcessCharacter:char return:processCharacterReturn. |
2207 | 628 |
^ self. |
2192 | 629 |
]. |
2207 | 630 |
state == #gotCSI3 ifTrue:[ |
631 |
processCharacterReturn := self processStateGotCSI3:char. |
|
4269 | 632 |
self evaluateProcessCharacter:char return:processCharacterReturn. |
2207 | 633 |
^ self. |
2192 | 634 |
]. |
2207 | 635 |
state == #gotXTERMCSI ifTrue:[ |
636 |
processCharacterReturn := self processStateGotXTERMCSI:char. |
|
4269 | 637 |
self evaluateProcessCharacter:char return:processCharacterReturn. |
2207 | 638 |
^ self. |
927 | 639 |
]. |
4221 | 640 |
state == #gotXTERMCSI2 ifTrue:[ |
641 |
processCharacterReturn := self processStateGotXTERMCSI2:char. |
|
4269 | 642 |
self evaluateProcessCharacter:char return:processCharacterReturn. |
4221 | 643 |
^ self. |
644 |
]. |
|
645 |
self halt:'unknown state'. |
|
2192 | 646 |
self doNothing. |
647 |
^ self |
|
2202 | 648 |
! |
649 |
||
2207 | 650 |
processState0:char |
2202 | 651 |
" change state or processing character; return |
652 |
#waitForNextChar - state was changed and wait for next characters |
|
653 |
#sequenceComplete - command processed |
|
654 |
#unknown - unknown character for this state |
|
655 |
" |
|
656 |
||
657 |
char asciiValue < 32 ifTrue:[ |
|
2207 | 658 |
(char == Character esc) ifTrue:[ |
659 |
state := #gotESC. |
|
660 |
^ #waitForNextChar |
|
661 |
]. |
|
4269 | 662 |
|
2202 | 663 |
( char == Character nl "nl or '\n'" |
4283 | 664 |
or:[(char == (Character value:16r0b))]) ifTrue:[ |
2207 | 665 |
translateNLToCRNL == true ifTrue:[ |
666 |
self endEntry. |
|
667 |
self cursorToBeginOfLine. |
|
668 |
]. |
|
2202 | 669 |
self endEntry. |
670 |
self doCursorDown:1. |
|
2207 | 671 |
^ #waitForNextChar. |
2202 | 672 |
]. |
4269 | 673 |
|
2202 | 674 |
(char == Character return) ifTrue:[ |
4291 | 675 |
(rangeEndLine notNil and:[rangeEndLine ~~ numberOfLines]) ifTrue:[ |
2202 | 676 |
self endEntry. |
677 |
self cursorToBeginOfLine. |
|
678 |
] ifFalse:[ |
|
679 |
state := #gotReturn. |
|
680 |
]. |
|
2207 | 681 |
^ #waitForNextChar. |
2202 | 682 |
]. |
4269 | 683 |
|
2202 | 684 |
(char == Character backspace) ifTrue:[ |
685 |
self endEntry. |
|
686 |
self cursorLeft. |
|
2207 | 687 |
^ #waitForNextChar "/ doBackspace |
2202 | 688 |
]. |
4269 | 689 |
|
2202 | 690 |
(char == Character bell) ifTrue:[ |
2782 | 691 |
self shown ifTrue:[ |
692 |
self beep. |
|
693 |
]. |
|
2207 | 694 |
^ #waitForNextChar |
2202 | 695 |
]. |
4269 | 696 |
|
2202 | 697 |
(char == (Character value:5)) ifTrue:[ |
698 |
"/ Transmission answerback message |
|
699 |
self reportTerminalType. |
|
2207 | 700 |
^ #waitForNextChar |
2202 | 701 |
]. |
4269 | 702 |
|
2202 | 703 |
( char == (Character value:16r18) "/Cancel |
704 |
or:[ char == (Character value:16r1A) "/Substitute |
|
705 |
]) ifTrue:[ |
|
706 |
self nextPut:(Character value:16r2). |
|
2207 | 707 |
^ #waitForNextChar |
2202 | 708 |
] |
4269 | 709 |
|
2207 | 710 |
" |
4269 | 711 |
all unsupported control characters (also vt102): |
2207 | 712 |
Character value:16r3 ->End of text |
713 |
Character value:16r4 ->End of transmission |
|
714 |
Character tab ->Horizontal tab |
|
715 |
Character value:16rc ->Form feed |
|
716 |
Character value:16re ->SO shift out |
|
717 |
Character value:16rf ->SI shift in |
|
718 |
Character value:16r11 ->Device control 1 |
|
719 |
Character value:16r13 ->Device control 3 |
|
720 |
". |
|
721 |
char ~~ Character tab ifTrue:[ |
|
722 |
char asciiValue ~~ 0 ifTrue:[ |
|
723 |
('VT100 [info]: unhandled control key: ' , char storeString) infoPrintCR. |
|
724 |
]. |
|
725 |
^ #waitForNextChar. |
|
726 |
] |
|
2202 | 727 |
]. |
4289 | 728 |
super nextPut:char. |
4271 | 729 |
^ nil |
2192 | 730 |
! |
731 |
||
732 |
processStateGotCSI2:char |
|
733 |
" change state or processing character; return |
|
734 |
#waitForNextChar - state was changed and wait for next characters |
|
735 |
#sequenceComplete - command processed |
|
736 |
#unknown - unknown character for this state |
|
737 |
" |
|
738 |
||
739 |
char == $; ifTrue: [ |
|
740 |
currentParam := (currentParam + 1) min: 8. |
|
741 |
^ #waitForNextChar |
|
742 |
]. |
|
743 |
char isDigit ifTrue: [ |
|
2194 | 744 |
self addToParameter:char. |
2192 | 745 |
^ #waitForNextChar |
746 |
]. |
|
4269 | 747 |
|
748 |
TraceCSI == true ifTrue:[ self traceCSI:char ]. |
|
749 |
(char == $l or:[char == $h]) ifTrue: [ |
|
2192 | 750 |
"/ (parameters at: 1) = 1 ifTrue: [app_cur_keys:(char == $h)]. |
751 |
"/ (parameters at: 1) = 2 ifTrue: [mode132:(char == $h)]. |
|
752 |
"/ (parameters at: 1) = 4 ifTrue: [smoothScroll:(char == $h)]. |
|
753 |
"/ (parameters at: 1) = 5 ifTrue: [reverseVideo:(char == $h)]. |
|
754 |
"/ (parameters at: 1) = 6 ifTrue: [decom:(char == $h)]. |
|
755 |
self endEntry. |
|
756 |
(parameters at: 1) = 7 ifTrue: [self autoMargin:(char == $h)]. |
|
757 |
^ #sequenceComplete |
|
758 |
]. |
|
759 |
^ #unknown |
|
760 |
! |
|
761 |
||
762 |
processStateGotCSI3:char |
|
763 |
" change state or processing character; return |
|
764 |
#waitForNextChar - state was changed and wait for next characters |
|
765 |
#sequenceComplete - command processed |
|
766 |
#unknown - unknown character for this state |
|
767 |
" |
|
768 |
||
4269 | 769 |
TraceCSI == true ifTrue:[ self traceCSI:char ]. |
2192 | 770 |
^ #unknown |
771 |
! |
|
772 |
||
773 |
processStateGotCSI:char |
|
774 |
" change state or processing character; return |
|
775 |
#waitForNextChar - state was changed and wait for next characters |
|
776 |
#sequenceComplete - command processed |
|
777 |
#unknown - unknown character for this state |
|
778 |
" |
|
779 |
||
780 |
char == $? ifTrue: [ |
|
781 |
state := #gotCSI2. |
|
782 |
^ #waitForNextChar |
|
783 |
]. |
|
784 |
char == $; ifTrue:[ |
|
785 |
currentParam := (currentParam + 1) min: 8. |
|
786 |
^ #waitForNextChar |
|
787 |
]. |
|
788 |
char isDigit ifTrue: [ |
|
789 |
self addToParameter:char. |
|
790 |
^ #waitForNextChar |
|
791 |
]. |
|
4269 | 792 |
|
793 |
TraceCSI == true ifTrue:[ self traceCSI:char ]. |
|
2192 | 794 |
char == $@ ifTrue: [ |
795 |
self endEntry. |
|
796 |
self insertCharacters. |
|
797 |
^ #sequenceComplete |
|
798 |
]. |
|
799 |
char == $A ifTrue: [ |
|
800 |
"/ ESC[#A - Moves cursor up # lines |
|
801 |
self endEntry. |
|
2202 | 802 |
self doCursorUp:(self getParameter:1 withDefault:1). |
2192 | 803 |
^ #sequenceComplete |
804 |
]. |
|
805 |
char == $B ifTrue: [ |
|
806 |
"/ ESC[#B - Moves cursor down # lines |
|
807 |
self endEntry. |
|
2202 | 808 |
self doCursorDown:(self getParameter:1 withDefault:1). |
2192 | 809 |
^ #sequenceComplete |
810 |
]. |
|
811 |
char == $C ifTrue: [ |
|
812 |
"/ ESC[#C - Moves cursor forward # spaces |
|
813 |
self endEntry. |
|
2202 | 814 |
self doCursorRight:(self getParameter:1 withDefault:1). |
2192 | 815 |
^ #sequenceComplete |
816 |
]. |
|
817 |
char == $D ifTrue: [ |
|
818 |
"/ ESC[#D - Moves cursor back # spaces |
|
819 |
self endEntry. |
|
2202 | 820 |
self doCursorLeft:(self getParameter:1 withDefault:1). |
2192 | 821 |
^ #sequenceComplete |
822 |
]. |
|
2202 | 823 |
(char == $H or:[char == $f]) ifTrue: [ |
2192 | 824 |
"/ ESC[#;#H or ESC[#;#f - Moves cusor to line #, column # |
825 |
self endEntry. |
|
2202 | 826 |
self move. |
2192 | 827 |
^ #sequenceComplete |
828 |
]. |
|
829 |
char == $J ifTrue: [ |
|
2217 | 830 |
"/ ESC[0J - Clear screen to end |
831 |
"/ ESC[1J - Clear screen from beginning |
|
2192 | 832 |
"/ ESC[2J - Clear entire screen and home cursor |
833 |
self endEntry. |
|
2207 | 834 |
self doClearDisplay:(self getParameter:1 withDefault:0). |
2192 | 835 |
^ #sequenceComplete |
836 |
]. |
|
837 |
char == $K ifTrue: [ |
|
838 |
"/ ESC[K - Clear to end of line |
|
839 |
self endEntry. |
|
2207 | 840 |
self clearLines:(self getParameter:1 withDefault:0). |
2192 | 841 |
Debug ifTrue:[ |
842 |
Transcript showCR:'clear to EOL'. |
|
843 |
]. |
|
844 |
^ #sequenceComplete |
|
845 |
]. |
|
846 |
char == $L ifTrue: [ |
|
847 |
self endEntry. |
|
848 |
self insertLines. |
|
849 |
^ #sequenceComplete |
|
850 |
]. |
|
851 |
char == $M ifTrue: [ |
|
852 |
self endEntry. |
|
853 |
self deleteLines. |
|
854 |
^ #sequenceComplete |
|
855 |
]. |
|
856 |
char == $P ifTrue: [ |
|
857 |
self endEntry. |
|
858 |
self deleteCharacters. |
|
859 |
^ #sequenceComplete |
|
860 |
]. |
|
2202 | 861 |
char == $R ifTrue: [ |
2192 | 862 |
"/ ESC[#;#R - Reports current cursor line & column |
2207 | 863 |
^ #unknown |
2192 | 864 |
]. |
865 |
(char == $c) ifTrue:[ |
|
866 |
"/ terminal-type query 3 |
|
867 |
self reportTerminalType. |
|
868 |
^ #sequenceComplete |
|
869 |
]. |
|
870 |
char == $n ifTrue: [ |
|
871 |
self report. |
|
872 |
^ #sequenceComplete |
|
873 |
]. |
|
874 |
char == $m ifTrue: [ |
|
2207 | 875 |
self displayMode:(self getParameter:1 withDefault:0). |
2192 | 876 |
^ #sequenceComplete |
877 |
]. |
|
878 |
char == $r ifTrue: [ |
|
879 |
self endEntry. |
|
880 |
self resetDefaults. |
|
881 |
^ #sequenceComplete |
|
882 |
]. |
|
883 |
char == $s ifTrue: [ |
|
884 |
"/ ESC[s - Saves cursor position for recall later |
|
885 |
self endEntry. |
|
886 |
^ #sequenceComplete |
|
887 |
]. |
|
888 |
char == $u ifTrue: [ |
|
889 |
"/ ESC[u - Return to saved cursor position |
|
890 |
self endEntry. |
|
891 |
^ #sequenceComplete |
|
892 |
]. |
|
893 |
^ #unknown |
|
894 |
! |
|
895 |
||
896 |
processStateGotESC:char |
|
897 |
" change state or processing character; return |
|
898 |
#waitForNextChar - state was changed and wait for next characters |
|
899 |
#sequenceComplete - command processed |
|
900 |
#unknown - unknown character for this state |
|
901 |
" |
|
902 |
||
903 |
char == $[ ifTrue: [ |
|
904 |
"/ ESC-[ |
|
905 |
state := #gotCSI. |
|
906 |
^ #waitForNextChar |
|
907 |
]. |
|
908 |
char == $] ifTrue: [ |
|
909 |
"/ ESC-] |
|
910 |
"/xterm sequence |
|
911 |
state := #gotXTERMCSI. |
|
912 |
^ #waitForNextChar |
|
913 |
]. |
|
914 |
char == $( ifTrue: [ |
|
915 |
"/ ESC-( |
|
916 |
"/ todo: set-charset 0 ... |
|
917 |
state := #gotCSI3. |
|
918 |
^ #waitForNextChar |
|
919 |
]. |
|
4269 | 920 |
|
921 |
TraceCSI == true ifTrue:[ self traceCSI:char ]. |
|
2192 | 922 |
char == $) ifTrue: [ |
923 |
"/ ESC-( |
|
924 |
"/ todo: set-charset 1 ... |
|
2207 | 925 |
^ #unknown |
2192 | 926 |
]. |
927 |
char == $7 ifTrue:[ |
|
928 |
"/ ESC-7 |
|
929 |
self endEntry. |
|
930 |
self saveCursor. |
|
931 |
^ #sequenceComplete |
|
932 |
]. |
|
933 |
char == $8 ifTrue:[ |
|
934 |
"/ ESC-7 |
|
935 |
self endEntry. |
|
936 |
self restoreCursor. |
|
937 |
^ #sequenceComplete |
|
938 |
]. |
|
939 |
char == $M ifTrue:[ |
|
2217 | 940 |
"/ ESC-M cursor up |
2192 | 941 |
self endEntry. |
942 |
self doCursorUp:1. |
|
943 |
^ #sequenceComplete |
|
944 |
]. |
|
945 |
char == $D ifTrue:[ |
|
2217 | 946 |
"/ ESC-D Index cursor down one line in same column |
2192 | 947 |
self endEntry. |
948 |
self doCursorDown:1. |
|
949 |
^ #sequenceComplete |
|
950 |
]. |
|
951 |
char == $E ifTrue:[ |
|
952 |
"/ ESC-E |
|
953 |
"/ TODO add_lines |
|
2217 | 954 |
self endEntry. |
955 |
self cursorReturn. |
|
2192 | 956 |
^ #sequenceComplete |
957 |
]. |
|
958 |
(char == $Z) ifTrue:[ |
|
959 |
"/ terminal-type query 2 |
|
960 |
self reportTerminalType. |
|
961 |
^ #sequenceComplete |
|
962 |
]. |
|
963 |
char == $= ifTrue: [ |
|
4291 | 964 |
"/ enter application keypad mode |
2192 | 965 |
"/ ESC-= |
4291 | 966 |
alternateKeypadMode := true. |
4293 | 967 |
kbdSequences := (self vt100AlternativeKeyCodes). |
4291 | 968 |
^ #sequenceComplete |
2192 | 969 |
]. |
970 |
char == $> ifTrue: [ |
|
4291 | 971 |
"/ exit application keypad mode |
2192 | 972 |
"/ ESC-< |
4291 | 973 |
alternateKeypadMode := false. |
4293 | 974 |
kbdSequences := (self vt100KeyCodes). |
4291 | 975 |
^ #sequenceComplete |
2192 | 976 |
]. |
977 |
^ #unknown |
|
978 |
! |
|
979 |
||
2202 | 980 |
processStateGotReturn:char |
981 |
" change state or processing character; return |
|
982 |
#waitForNextChar - state was changed and wait for next characters |
|
983 |
#sequenceComplete - command processed |
|
984 |
#unknown - unknown character for this state |
|
985 |
" |
|
986 |
||
2207 | 987 |
state := 0. |
2202 | 988 |
char == Character nl ifTrue:[ |
989 |
"/ cr-nl |
|
990 |
"/ stay in buffering mode. |
|
2207 | 991 |
super nextPut:Character cr. |
992 |
^ #sequenceComplete. |
|
2202 | 993 |
]. |
4291 | 994 |
|
2202 | 995 |
self endEntry. |
996 |
self cursorToBeginOfLine. |
|
4286 | 997 |
|
998 |
(char == Character esc) ifTrue:[ |
|
999 |
state := #gotESC. |
|
1000 |
]. |
|
2202 | 1001 |
"/ continue in initial state |
2207 | 1002 |
^ #waitForNextChar |
2202 | 1003 |
! |
1004 |
||
4221 | 1005 |
processStateGotXTERMCSI2:char |
1006 |
" change state or processing character; return |
|
1007 |
#waitForNextChar - state was changed and wait for next characters |
|
1008 |
#sequenceComplete - command processed |
|
1009 |
#unknown - unknown character for this state |
|
1010 |
" |
|
1011 |
||
1012 |
char == (Character value:7) ifTrue: [ |
|
4269 | 1013 |
TraceCSI == true ifTrue:[ self traceCSI:char ]. |
4221 | 1014 |
parameters at:currentParam put:(parameters at:currentParam) contents. |
1015 |
self osCommand. |
|
1016 |
^ #sequenceComplete |
|
1017 |
]. |
|
1018 |
"/ add to parameter |
|
1019 |
(parameters at:currentParam) nextPut:char. |
|
1020 |
^ #waitForNextChar |
|
1021 |
! |
|
1022 |
||
2192 | 1023 |
processStateGotXTERMCSI:char |
1024 |
" change state or processing character; return |
|
1025 |
#waitForNextChar - state was changed and wait for next characters |
|
1026 |
#sequenceComplete - command processed |
|
1027 |
#unknown - unknown character for this state |
|
1028 |
" |
|
1029 |
||
4221 | 1030 |
char == $; ifTrue:[ |
1031 |
currentParam := (currentParam + 1) min: 8. |
|
1032 |
parameters at:currentParam put:(WriteStream on:''). |
|
1033 |
state := #gotXTERMCSI2. |
|
1034 |
^ #waitForNextChar |
|
1035 |
]. |
|
4269 | 1036 |
|
4221 | 1037 |
char isDigit ifTrue: [ |
1038 |
self addToParameter:char. |
|
1039 |
^ #waitForNextChar |
|
1040 |
]. |
|
2192 | 1041 |
^ #unknown |
920 | 1042 |
! ! |
1043 |
||
930 | 1044 |
!VT100TerminalView methodsFor:'queries'! |
1045 |
||
2202 | 1046 |
getParameter:para withDefault:default |
1047 |
||
1048 |
|parameter| |
|
1049 |
||
1050 |
parameter := (parameters at:para). |
|
1051 |
^ ((parameter isNil or:[parameter = 0]) ifTrue:[default] ifFalse:[parameter]). |
|
1052 |
! |
|
1053 |
||
930 | 1054 |
terminalType |
1420 | 1055 |
"returns a string describing this terminal (usually, this is |
1056 |
passed down to the shell as TERM environment variable). |
|
1057 |
Here, 'vt100' is returned." |
|
1058 |
||
1355 | 1059 |
^ 'vt100' |
930 | 1060 |
|
1061 |
"Created: / 10.6.1998 / 16:22:39 / cg" |
|
1355 | 1062 |
"Modified: / 5.5.1999 / 11:22:40 / cg" |
930 | 1063 |
! ! |
1064 |
||
920 | 1065 |
!VT100TerminalView class methodsFor:'documentation'! |
1066 |
||
1067 |
version |
|
4293 | 1068 |
^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.53 2013-07-23 14:25:04 cg Exp $' |
4286 | 1069 |
! |
1070 |
||
1071 |
version_CVS |
|
4293 | 1072 |
^ '$Header: /cvs/stx/stx/libwidg2/VT100TerminalView.st,v 1.53 2013-07-23 14:25:04 cg Exp $' |
920 | 1073 |
! ! |
4221 | 1074 |