author | claus |
Wed, 24 Aug 1994 01:38:59 +0200 | |
changeset 51 | e895ac4cc7c8 |
parent 36 | 641fe12489b2 |
child 52 | e69fade0aa8e |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
0 | 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 |
" |
|
12 |
||
13 |
EditTextView subclass:#TextCollector |
|
14 |
instanceVariableNames:'entryStream lineLimit destroyAction |
|
15 |
outstandingLines outstandingLine |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
16 |
flushBlock flushPending collecting timeDelay access' |
0 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Views-Text' |
|
20 |
! |
|
21 |
||
22 |
TextCollector comment:' |
|
5 | 23 |
COPYRIGHT (c) 1989 by Claus Gittinger |
0 | 24 |
All Rights Reserved |
25 |
||
36 | 26 |
$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.8 1994-08-07 13:18:43 claus Exp $ |
15 | 27 |
'! |
28 |
||
29 |
!TextCollector class methodsFor:'documentation'! |
|
30 |
||
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
31 |
copyright |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
32 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
33 |
COPYRIGHT (c) 1989 by Claus Gittinger |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
34 |
All Rights Reserved |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
35 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
36 |
This software is furnished under a license and may be used |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
37 |
only in accordance with the terms of that license and with the |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
38 |
inclusion of the above copyright notice. This software may not |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
39 |
be provided or otherwise made available to, or used by, any |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
40 |
other person. No title to or ownership of the software is |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
41 |
hereby transferred. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
42 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
43 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
44 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
45 |
version |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
46 |
" |
36 | 47 |
$Header: /cvs/stx/stx/libwidg/Attic/TextColl.st,v 1.8 1994-08-07 13:18:43 claus Exp $ |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
48 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
49 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
50 |
|
15 | 51 |
documentation |
52 |
" |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
53 |
a view for editable text, which also understands some stream messages. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
54 |
Instances of this view can take the place of a stream and display the |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
55 |
received text. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
56 |
Its main use in the system is the Transcript, but it can also be used for |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
57 |
things like trace-windows etc. |
0 | 58 |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
59 |
If collecting is turned on, a Textcollector will not immediately display |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
60 |
entered text, but wait for some short time (timeDelay) and collect incoming |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
61 |
data - finally updating the whole chunk in one piece. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
62 |
This helps slow display devices, which would otherwise scroll a lot. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
63 |
(on fast displays this is less of a problem). |
15 | 64 |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
65 |
The total number of lines kept is controlled by lineLimit, if more lines are |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
66 |
entered at the bottom, the textcollector will forget lines at the top. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
67 |
Linelimit can also be set to nil (i.e. no limit), but you may need a lot |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
68 |
of memory then ... |
15 | 69 |
" |
70 |
! ! |
|
0 | 71 |
|
72 |
!TextCollector class methodsFor:'defaults'! |
|
73 |
||
74 |
defaultLineLimit |
|
15 | 75 |
"the number of lines remembered by default" |
76 |
||
77 |
^ 600 |
|
78 |
! |
|
79 |
||
80 |
defaultTimeDelay |
|
81 |
"the time in seconds to wait & collect by default" |
|
82 |
||
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
83 |
^ 0.3 |
0 | 84 |
! ! |
85 |
||
86 |
!TextCollector class methodsFor:'instance creation'! |
|
87 |
||
88 |
newTranscript |
|
89 |
|topView transcript f v| |
|
90 |
||
7 | 91 |
topView := StandardSystemView label:'Transcript' minExtent:(100 @ 100). |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
92 |
topView icon:(Form fromFile:'SmalltalkX.xbm'). |
0 | 93 |
|
94 |
v := ScrollableView for:self in:topView. |
|
95 |
v origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
96 |
transcript := v scrolledView. |
|
97 |
"transcript partialLines:false." |
|
98 |
||
99 |
f := transcript font. |
|
100 |
topView extent:(((f widthOf:'x') * 70) @ (f height * 10)). |
|
101 |
||
102 |
Smalltalk at:#Transcript put:transcript. |
|
103 |
||
104 |
"fancy feature: whenever Transcript is closed, reset to StdError" |
|
105 |
transcript destroyAction:[Smalltalk at:#Transcript put:Stderr]. |
|
106 |
||
22 | 107 |
topView open. |
15 | 108 |
"transcript lineLimit:1000. " "or whatever you think makes sense" |
109 |
||
0 | 110 |
^ transcript |
111 |
! ! |
|
112 |
||
113 |
!TextCollector methodsFor:'initialize / release'! |
|
114 |
||
115 |
initialize |
|
116 |
super initialize. |
|
117 |
||
118 |
outstandingLines := OrderedCollection new. |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
119 |
|
0 | 120 |
flushBlock := [self endEntry]. |
121 |
flushPending := false. |
|
15 | 122 |
collecting := true. |
123 |
timeDelay := self class defaultTimeDelay. |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
124 |
access := Semaphore forMutualExclusion. |
0 | 125 |
|
126 |
lineLimit := self class defaultLineLimit. |
|
127 |
entryStream := ActorStream new. |
|
128 |
entryStream nextPutBlock:[:something | self nextPut:something]. |
|
129 |
entryStream nextPutAllBlock:[:something | self nextPutAll:something] |
|
130 |
! |
|
131 |
||
36 | 132 |
reinitialize |
133 |
"recreate access-semaphore; image could have been save (theoretically) |
|
134 |
with the semaphore locked - int this case, we had a deadlock" |
|
135 |
||
136 |
flushPending := false. |
|
137 |
access := Semaphore forMutualExclusion. |
|
138 |
super reinitialize. |
|
139 |
! |
|
140 |
||
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
141 |
mapped |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
142 |
"view became visible - show collected lines (if any)" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
143 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
144 |
super mapped. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
145 |
self endEntry |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
146 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
147 |
|
0 | 148 |
destroy |
149 |
destroyAction notNil ifTrue:[ |
|
150 |
destroyAction value |
|
151 |
]. |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
152 |
Processor removeTimedBlock:flushBlock. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
153 |
flushBlock := nil. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
154 |
outstandingLines := OrderedCollection new. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
155 |
outstandingLine := ''. |
0 | 156 |
super destroy |
157 |
! ! |
|
158 |
||
159 |
!TextCollector methodsFor:'accessing'! |
|
160 |
||
161 |
collect:aBoolean |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
162 |
"turn on/off collecting - if on, do not output immediately |
15 | 163 |
but collect text and output en-bloque after some time delta" |
0 | 164 |
|
165 |
collecting := aBoolean |
|
166 |
! |
|
167 |
||
168 |
lineLimit:aNumber |
|
169 |
"define the number of text-lines I am supposed to hold" |
|
170 |
||
171 |
lineLimit := aNumber |
|
172 |
! |
|
173 |
||
174 |
destroyAction:aBlock |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
175 |
"define the action to be performed when I get destroyed. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
176 |
This is a special feature, to allow resetting Transcript to Stderr |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
177 |
when closed. (see TextCollectorclass>>newTranscript)" |
0 | 178 |
|
179 |
destroyAction := aBlock |
|
180 |
! |
|
181 |
||
182 |
endEntry |
|
183 |
"flush collected output" |
|
184 |
||
36 | 185 |
|nLines lines| |
0 | 186 |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
187 |
shown ifFalse:[^ self]. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
188 |
|
15 | 189 |
Processor removeTimedBlock:flushBlock. |
190 |
flushPending := false. |
|
191 |
||
36 | 192 |
outstandingLines size ~~ 0 ifTrue:[ |
193 |
access critical:[ |
|
194 |
"insert the bunch of lines - if any" |
|
195 |
lines := outstandingLines. |
|
196 |
outstandingLines := OrderedCollection new. |
|
197 |
||
198 |
nLines := lines size. |
|
199 |
(nLines ~~ 0) ifTrue:[ |
|
200 |
self insertLines:lines withCr:true. |
|
201 |
self withCursorOffDo:[ |
|
202 |
(cursorLine >= (firstLineShown + nFullLinesShown)) ifTrue:[ |
|
203 |
self scrollDown:nLines |
|
204 |
] |
|
205 |
]. |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
206 |
]. |
36 | 207 |
"and the last partial line - if any" |
208 |
outstandingLine notNil ifTrue:[ |
|
209 |
self insertStringAtCursor:outstandingLine. |
|
210 |
outstandingLine := ''. |
|
211 |
]. |
|
212 |
self checkLineLimit |
|
213 |
] |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
214 |
] |
0 | 215 |
! ! |
216 |
||
217 |
!TextCollector methodsFor:'private'! |
|
218 |
||
219 |
checkLineLimit |
|
220 |
"this method checks if the text has become too large (> lineLimit) |
|
221 |
and cuts off some lines at the top if so; it must be called whenever lines |
|
222 |
have been added to the bottom" |
|
223 |
||
224 |
|nDel| |
|
225 |
||
226 |
lineLimit notNil ifTrue:[ |
|
227 |
(cursorLine > lineLimit) ifTrue:[ |
|
228 |
nDel := list size - lineLimit. |
|
229 |
list removeFromIndex:1 toIndex:nDel. |
|
230 |
cursorLine := cursorLine - nDel. |
|
231 |
firstLineShown := firstLineShown - nDel. |
|
232 |
(firstLineShown < 1) ifTrue:[ |
|
233 |
cursorLine := cursorLine - firstLineShown + 1. |
|
234 |
firstLineShown := 1 |
|
235 |
]. |
|
236 |
self contentsChanged |
|
237 |
] |
|
238 |
] |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
239 |
! |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
240 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
241 |
installDelayedUpdate |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
242 |
"arrange for collecting input for some time, |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
243 |
and output all buffered strings at once after a while. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
244 |
This makes output to the transcript much faster on systems |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
245 |
with poor scrolling performance (i.e. dump vga cards ...)." |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
246 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
247 |
|wg p| |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
248 |
|
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
249 |
flushPending ifFalse:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
250 |
flushPending := true. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
251 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
252 |
this could run under a process, which dies in the meantime; |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
253 |
therefore, we have to interrupt the transcript process. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
254 |
" |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
255 |
wg := self windowGroup. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
256 |
wg isNil ifTrue:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
257 |
p := Processor activeProcess |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
258 |
] ifFalse:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
259 |
p := wg process |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
260 |
]. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
261 |
Processor addTimedBlock:flushBlock for:p afterSeconds:timeDelay. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
262 |
] |
0 | 263 |
! ! |
264 |
||
265 |
!TextCollector methodsFor:'stream messages'! |
|
266 |
||
267 |
lineLength |
|
268 |
^ width // (font width) |
|
269 |
! |
|
270 |
||
271 |
nextPut:something |
|
272 |
"this allows TextCollectors to be used Stream-wise" |
|
273 |
||
274 |
flushPending ifTrue:[ |
|
275 |
self endEntry |
|
276 |
]. |
|
277 |
(something isMemberOf:Character) ifTrue:[ |
|
278 |
((something == Character cr) or:[something == Character nl]) ifTrue:[ |
|
279 |
^ self cr |
|
280 |
]. |
|
281 |
self insertCharAtCursor:something |
|
282 |
] ifFalse:[ |
|
283 |
self insertStringAtCursor:(something printString). |
|
284 |
self checkLineLimit |
|
285 |
]. |
|
286 |
device synchronizeOutput |
|
287 |
! |
|
288 |
||
289 |
nextPutAll:something |
|
290 |
"this allows TextCollectors to be used Stream-wise" |
|
291 |
||
292 |
^ self nextPut:something |
|
293 |
! |
|
294 |
||
295 |
cr |
|
15 | 296 |
"output a carriage return, finishing the current line" |
297 |
||
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
298 |
|wasBlocked| |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
299 |
|
0 | 300 |
collecting ifTrue:[ |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
301 |
access critical:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
302 |
outstandingLine notNil ifTrue:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
303 |
outstandingLines add:outstandingLine. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
304 |
]. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
305 |
outstandingLine := ''. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
306 |
]. |
0 | 307 |
flushPending ifFalse:[ |
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
308 |
self installDelayedUpdate |
0 | 309 |
] |
310 |
] ifFalse:[ |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
311 |
access critical:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
312 |
self cursorReturn. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
313 |
self checkLineLimit. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
314 |
]. |
0 | 315 |
] |
316 |
! |
|
317 |
||
318 |
show:anObject |
|
319 |
"insert the argument aString at current cursor position" |
|
320 |
||
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
321 |
|aString wasBlocked| |
0 | 322 |
|
323 |
aString := anObject printString. |
|
324 |
collecting ifTrue:[ |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
325 |
access critical:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
326 |
outstandingLine notNil ifTrue:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
327 |
outstandingLine := outstandingLine , aString |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
328 |
] ifFalse:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
329 |
outstandingLine := aString |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
330 |
]. |
0 | 331 |
]. |
332 |
flushPending ifFalse:[ |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
333 |
self installDelayedUpdate |
0 | 334 |
] |
335 |
] ifFalse:[ |
|
34
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
336 |
access critical:[ |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
337 |
self nextPut:aString. |
c4b386a8cc57
critical-lock; allows show:/showCr: from multiple processes
claus
parents:
22
diff
changeset
|
338 |
]. |
0 | 339 |
] |
340 |
! |
|
341 |
||
342 |
showCr:aString |
|
343 |
"insert the argument aString followed by a newline |
|
344 |
at current cursor position" |
|
345 |
||
346 |
self show:aString. |
|
347 |
self cr |
|
348 |
! |
|
349 |
||
350 |
doesNotUnderstand:aMessage |
|
351 |
"this is funny: all message we do not understand, are passed |
|
352 |
on to the stream which will send the characters via nextPut: |
|
353 |
This way, we understand all Stream messages - great isn't it !! |
|
354 |
" |
|
15 | 355 |
^ entryStream perform:(aMessage selector) withArguments:(aMessage arguments) |
0 | 356 |
! ! |