author | Claus Gittinger <cg@exept.de> |
Fri, 08 May 1998 12:29:18 +0200 | |
changeset 3425 | f7faef75f0d8 |
parent 3423 | b4a43b4f098b |
child 3436 | 1a80952e6619 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
159 | 3 |
All Rights Reserved |
1 | 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 |
||
783 | 13 |
nil subclass:#Object |
14 |
instanceVariableNames:'' |
|
15 |
classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal |
|
16 |
UserInterruptSignal RecursionInterruptSignal |
|
17 |
ExceptionInterruptSignal SubscriptOutOfBoundsSignal |
|
3101
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
18 |
IndexNotFoundSignal NonIntegerIndexSignal NotFoundSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
19 |
KeyNotFoundSignal ElementOutOfBoundsSignal UserNotificationSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
20 |
InformationSignal WarningSignal PrimitiveFailureSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
21 |
DeepCopyErrorSignal AbortSignal ErrorRecursion Dependencies |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
22 |
InfoPrinting ActivityNotificationSignal InternalErrorSignal |
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
23 |
NonWeakDependencies SynchronizationSemaphores ObjectAttributes |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
24 |
OSSignalInterruptSignal' |
783 | 25 |
poolDictionaries:'' |
26 |
category:'Kernel-Objects' |
|
1 | 27 |
! |
28 |
||
1788 | 29 |
!Object class methodsFor:'documentation'! |
71 | 30 |
|
88 | 31 |
copyright |
32 |
" |
|
33 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
159 | 34 |
All Rights Reserved |
88 | 35 |
|
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
44 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
45 |
dependencies |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
46 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
47 |
ST/X dependencies are slightly modified from ST-80's |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
48 |
(we think they are better ;-). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
49 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
50 |
One problem occuring very often in ST-80 is that some object |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
51 |
cannot be garbage collected because some dependency is present, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
52 |
having the object as a dependent of some other object. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
53 |
In ST-80, this association remains alive (because a Dictionary |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
54 |
is used to hold dependents) - even if no other references exist to |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
55 |
to dependent or the dependee. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
56 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
57 |
This means, that in ST-80, a #release is mandatory in order to |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
58 |
prevent memory leaks. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
59 |
We think, that this is a bad solution, since after all, exactly that |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
60 |
kind of work should be performed by a garbage collector - you should not |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
61 |
need to care about dependencies. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
62 |
From a philosophical point of view, why should some object depend on |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
63 |
something that the programmer considers a dead object ? |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
64 |
(well - worse than that: it seems that some ST-80 code even depends on |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
65 |
that behavior) |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
66 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
67 |
In order to limit the trouble, ST-80 reimplemented the way dependents |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
68 |
are stored in the model class - this one keeps the dependents locally, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
69 |
so these dependents go away, once the model is reclaimed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
70 |
That may make things even more confusing: with models, no #release is |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
71 |
needed, with general objects it is mandatory. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
72 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
73 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
74 |
In ST/X, dependencies are implemented using a WeakDictionary; this means, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
75 |
that once the dependee dies, the dependency association is removed automatically, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
76 |
and the dependent can be reclaimed by the garbage collector, if no other |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
77 |
references exist to the dependent. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
78 |
In order to (at least) provide a mechanism for the old behavior |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
79 |
(in case your application heavily depends on the ST-80 mechanism), complementary |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
80 |
protocol to add nonWeak dependencies is provided |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
81 |
(see #addNonWeakDependent / #removeNonWeakDependent). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
82 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
83 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
84 |
Caveat: |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
85 |
since interests are implemented using InterestConverter (which are simply |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
86 |
forwarding messages), these must use the nonWeak mechanism (as done in ST-80 |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
87 |
automatically). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
88 |
The reason is that there are usually no direct references to the converters, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
89 |
and those would be reclaimed if stored in a weakDictionary. |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
90 |
This means, that those interests MUST be removed with #retractInterest |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
91 |
(which is bug-compatible to ST-80). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
92 |
We rewrite things to provide a more convenient mechanism in the future ... |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
93 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
94 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
95 |
I like to hear comments on the above - do you think its better ? |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
96 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
97 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
98 |
|
71 | 99 |
documentation |
100 |
" |
|
1294 | 101 |
Object is the superclass of most other classes. |
102 |
(except for nil-subclasses, which inherit nothing, |
|
103 |
to catch any message into their #doesNotUnderstand: method) |
|
104 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
105 |
Protocol which is common to every object is defined here. |
71 | 106 |
Also some utility stuff (like notify) and error handling is implemented here. |
107 |
||
108 |
Object has no instance variables (and may not get any added). One reason is, that |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
109 |
UndefinedObject and SmallInteger are also inheriting from Object - these two cannot |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
110 |
have instance variables (due to their implementation). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
111 |
The other reason is that the runtime system (VM) knows about the layout of some built-in |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
112 |
classes (think of Class, Method, Block and also Integer or Float). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
113 |
If you were allowed to add instance variables to Object, the VM had to be recompiled |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
114 |
(and also rewritten in some places). |
71 | 115 |
|
1294 | 116 |
[Class variables:] |
71 | 117 |
|
2647 | 118 |
ErrorSignal <Signal> Signal raised for error/error: messages |
119 |
also, parent of all other signals. |
|
120 |
||
121 |
HaltSignal <Signal> Signal raised for halt/halt: messages |
|
122 |
||
123 |
MessageNotUnderstoodSignal Signals raised for various error conditions |
|
124 |
UserInterruptSignal |
|
125 |
RecursionInterruptSignal |
|
126 |
ExceptionInterruptSignal |
|
127 |
SubscriptOutOfBoundsSignal |
|
128 |
NonIntegerIndexSignal |
|
129 |
NotFoundSignal |
|
130 |
KeyNotFoundSignal |
|
131 |
ElementOutOfBoundsSignal |
|
132 |
InformationSignal |
|
133 |
WarningSignal |
|
134 |
DeepCopyErrorSignal |
|
135 |
InternalErrorSignal |
|
136 |
||
137 |
AbortSignal <Signal> Signal raised by debugger, to abort a computation |
|
138 |
BUT, the debugger will only raise it if it is handled. |
|
139 |
By handling the abortSignal, you can control where the |
|
140 |
debuggers abort-function resumes execution in case of |
|
141 |
an error. |
|
142 |
||
143 |
ErrorRecursion <Boolean> controls behavior when recursive errors occur (i.e. |
|
144 |
an error while handling an error). |
|
145 |
||
146 |
Dependencies <WeakDependencyDictionary> |
|
147 |
keeps track of object dependencies. |
|
148 |
||
149 |
InfoPrinting <Boolean> controls weather informational messages |
|
150 |
are printed. |
|
151 |
||
152 |
ActivityNotificationSignal <QuerySignal> |
|
153 |
raised on #activityNotification: |
|
154 |
||
155 |
NonWeakDependencies <Dictionary> keeps track of object dependencies. |
|
156 |
Dependents stay alive. |
|
157 |
||
158 |
SynchronizationSemaphores <WeakIdentityDictionary> |
|
159 |
Semaphores for per-object-monitor. |
|
2295 | 160 |
|
1294 | 161 |
|
162 |
[author:] |
|
2647 | 163 |
Claus Gittinger |
1294 | 164 |
|
71 | 165 |
" |
166 |
! ! |
|
1 | 167 |
|
1788 | 168 |
!Object class methodsFor:'initialization'! |
1 | 169 |
|
170 |
initialize |
|
171 |
"called only once - initialize signals" |
|
172 |
||
173 |
ErrorSignal isNil ifTrue:[ |
|
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
174 |
"/ have a chicken & egg problem here; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
175 |
"/ signal wants object to be initialized, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
176 |
"/ Object needs the genericSignal from Signal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
177 |
"/ So, make certain that on exists here. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
178 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
179 |
Signal initGenericSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
180 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
181 |
ErrorSignal := Signal genericSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
182 |
ErrorSignal nameClass:self message:#errorSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
183 |
ErrorSignal notifierString:'error encountered'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
184 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
185 |
HaltSignal := ErrorSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
186 |
HaltSignal nameClass:self message:#haltSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
187 |
HaltSignal notifierString:'halt encountered'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
188 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
189 |
MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
190 |
MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
191 |
MessageNotUnderstoodSignal notifierString:'message not understood'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
192 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
193 |
PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
194 |
PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
195 |
PrimitiveFailureSignal notifierString:'primitive failed'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
196 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
197 |
InternalErrorSignal := ErrorSignal newSignalMayProceed:false. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
198 |
InternalErrorSignal nameClass:self message:#internalError. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
199 |
InternalErrorSignal notifierString:'VM internal error: '. |
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
200 |
|
362 | 201 |
"/ UserInterruptSignal := ErrorSignal newSignalMayProceed:true. |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
202 |
UserInterruptSignal := (Signal new) mayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
203 |
UserInterruptSignal nameClass:self message:#userInterruptSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
204 |
UserInterruptSignal notifierString:'user Interrupt'. |
159 | 205 |
|
362 | 206 |
"/ RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false. |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
207 |
RecursionInterruptSignal := (Signal new) mayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
208 |
RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
209 |
RecursionInterruptSignal notifierString:'recursion limit reached'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
210 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
211 |
ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
212 |
ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
213 |
ExceptionInterruptSignal notifierString:'exception Interrupt'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
214 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
215 |
NotFoundSignal := ErrorSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
216 |
NotFoundSignal nameClass:self message:#notFoundSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
217 |
NotFoundSignal notifierString:'no such element'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
218 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
219 |
IndexNotFoundSignal := NotFoundSignal newSignalMayProceed:false. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
220 |
IndexNotFoundSignal nameClass:self message:#indexNotFoundSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
221 |
IndexNotFoundSignal notifierString:'bad index: '. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
222 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
223 |
SubscriptOutOfBoundsSignal := IndexNotFoundSignal newSignalMayProceed:false. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
224 |
SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
225 |
SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
226 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
227 |
ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
228 |
ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
229 |
ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
230 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
231 |
KeyNotFoundSignal := NotFoundSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
232 |
KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
233 |
KeyNotFoundSignal notifierString:'no such key: '. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
234 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
235 |
NonIntegerIndexSignal := IndexNotFoundSignal newSignalMayProceed:false. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
236 |
NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
237 |
NonIntegerIndexSignal notifierString:'index must be integer'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
238 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
239 |
UserNotificationSignal := QuerySignal new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
240 |
UserNotificationSignal nameClass:self message:#userNotificationSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
241 |
UserNotificationSignal notifierString:'user notifiaction wanted'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
242 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
243 |
InformationSignal := UserNotificationSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
244 |
InformationSignal nameClass:self message:#informationSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
245 |
InformationSignal notifierString:'information'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
246 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
247 |
WarningSignal := UserNotificationSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
248 |
WarningSignal nameClass:self message:#warnungSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
249 |
WarningSignal notifierString:'warning'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
250 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
251 |
ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
252 |
ActivityNotificationSignal nameClass:self message:#activityNotificationSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
253 |
ActivityNotificationSignal notifierString:'activity'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
254 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
255 |
DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
256 |
DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
257 |
DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
258 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
259 |
" |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
260 |
AbortSignal is not a child of ErrorSignal - |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
261 |
this would complicate abort from within a signal handler |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
262 |
" |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
263 |
AbortSignal := Signal genericSignal newSignalMayProceed:true. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
264 |
AbortSignal nameClass:self message:#abortSignal. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
265 |
AbortSignal notifierString:'unhandled abort signal'. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
266 |
|
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
267 |
" |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
268 |
OSSignalInterruptSignal is not a child of ErrorSignal - |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
269 |
it requires explicit catching. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
270 |
If unhandled, a debugger is entered. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
271 |
" |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
272 |
OSSignalInterruptSignal := Signal genericSignal newSignalMayProceed:true. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
273 |
OSSignalInterruptSignal nameClass:self message:#osSignalInterruptSignal. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
274 |
OSSignalInterruptSignal notifierString:'OS signal interrupt'. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
275 |
|
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
276 |
ObjectAttributes isNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
277 |
ObjectAttributes := WeakIdentityDictionary new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
278 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
279 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
280 |
Dependencies isNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
281 |
Dependencies := WeakDependencyDictionary new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
282 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
283 |
NonWeakDependencies isNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
284 |
NonWeakDependencies := IdentityDictionary new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
285 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
286 |
SynchronizationSemaphores isNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
287 |
SynchronizationSemaphores := WeakIdentityDictionary new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
288 |
]. |
356 | 289 |
]. |
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
290 |
|
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
291 |
"/ initialize InfoPrinting to the VM's infoPrint setting |
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
292 |
"/ (which can be turned off via a command line argument) |
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
293 |
InfoPrinting := ObjectMemory infoPrinting. |
1 | 294 |
|
295 |
"Object initialize" |
|
812
00db9c0646fe
notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents:
783
diff
changeset
|
296 |
|
3101
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
297 |
"Modified: / 28.1.1997 / 19:38:58 / stefan" |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
298 |
"Modified: / 22.1.1998 / 21:23:40 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
299 |
"Modified: / 3.2.1998 / 18:55:09 / cg" |
1 | 300 |
! ! |
301 |
||
3175
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
302 |
!Object class methodsFor:'ST80 compatibility'! |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
303 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
304 |
rootError |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
305 |
"return the signal used for error/error: - handling. |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
306 |
Same as errorSignal for ST80 compatibility." |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
307 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
308 |
^ ErrorSignal |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
309 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
310 |
"Created: / 15.1.1998 / 23:47:05 / stefan" |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
311 |
! ! |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
312 |
|
1788 | 313 |
!Object class methodsFor:'Signal constants'! |
1 | 314 |
|
783 | 315 |
abortSignal |
316 |
"return the signal used to abort user actions. This signal is only |
|
2689 | 317 |
raised if caught (by the debugger), and will lead way out of the |
783 | 318 |
currently active doIt/printIt or inspectIt. (also some others use |
319 |
this for a save abort)" |
|
320 |
||
321 |
^ AbortSignal |
|
579
2d26193415b5
allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
322 |
! |
2d26193415b5
allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
323 |
|
782 | 324 |
activityNotificationSignal |
325 |
"return the signal used for activity notifications. |
|
326 |
A handler for this signal gets all #activityNotification: sends" |
|
327 |
||
328 |
^ ActivityNotificationSignal |
|
329 |
! |
|
330 |
||
159 | 331 |
deepCopyErrorSignal |
332 |
"return the signal raised when a deepcopy is asked for |
|
333 |
an object which cannot do this (for example, BlockClosures |
|
334 |
or Contexts)." |
|
335 |
||
336 |
^ DeepCopyErrorSignal |
|
337 |
! |
|
338 |
||
783 | 339 |
elementOutOfBoundsSignal |
340 |
"return the signal used for element error reporting |
|
341 |
(this signal is used for example when a value not in 0..255 is to |
|
342 |
be put into a bytearray)" |
|
343 |
||
344 |
^ ElementOutOfBoundsSignal |
|
345 |
! |
|
346 |
||
347 |
errorSignal |
|
348 |
"return the signal used for error/error: - handling" |
|
349 |
||
350 |
^ ErrorSignal |
|
351 |
! |
|
352 |
||
353 |
exceptionInterruptSignal |
|
354 |
"return the signal used for exception (display errors) error handling" |
|
355 |
||
356 |
^ ExceptionInterruptSignal |
|
357 |
! |
|
358 |
||
359 |
haltSignal |
|
360 |
"return the signal used for halt/halt: - handling" |
|
361 |
||
362 |
^ HaltSignal |
|
363 |
! |
|
364 |
||
3101
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
365 |
indexNotFoundSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
366 |
"return the signal used for bad index error reporting. |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
367 |
This is also the parentSignal of the nonIntegerIndex- and |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
368 |
subscriptOutOfBoundsSignal" |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
369 |
|
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
370 |
^ IndexNotFoundSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
371 |
|
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
372 |
"Created: / 8.11.1997 / 19:15:48 / cg" |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
373 |
! |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
374 |
|
783 | 375 |
informationSignal |
376 |
"return the signal used for informations. |
|
377 |
A handler for this signal gets all #information: sends" |
|
378 |
||
379 |
^ InformationSignal |
|
380 |
! |
|
381 |
||
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
382 |
internalErrorSignal |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
383 |
"return the signal used to report internal (VM-) errors." |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
384 |
|
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
385 |
^ InternalErrorSignal |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
386 |
! |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
387 |
|
783 | 388 |
keyNotFoundSignal |
389 |
"return the signal used for no such key error reporting" |
|
390 |
||
391 |
^ KeyNotFoundSignal |
|
392 |
! |
|
393 |
||
394 |
messageNotUnderstoodSignal |
|
395 |
"return the signal used for doesNotUnderstand: - error handling" |
|
396 |
||
397 |
^ MessageNotUnderstoodSignal |
|
398 |
! |
|
399 |
||
400 |
nonIntegerIndexSignal |
|
401 |
"return the signal used for bad subscript error reporting" |
|
402 |
||
403 |
^ NonIntegerIndexSignal |
|
404 |
! |
|
405 |
||
406 |
notFoundSignal |
|
407 |
"return the signal used for no element found error reporting" |
|
408 |
||
409 |
^ NotFoundSignal |
|
410 |
! |
|
411 |
||
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
412 |
osSignalInterruptSignal |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
413 |
"return the signal used for OS-signal error reporting; |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
414 |
This is only raised if handled - otherwise, a debugger is entered." |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
415 |
|
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
416 |
^ OSSignalInterruptFoundSignal |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
417 |
! |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
418 |
|
783 | 419 |
primitiveFailureSignal |
420 |
"return the signal used for primitiveFailed - error handling" |
|
421 |
||
422 |
^ PrimitiveFailureSignal |
|
423 |
! |
|
424 |
||
425 |
privateMethodSignal |
|
426 |
"return the signal used for privateMethod - error handling" |
|
427 |
||
428 |
^ MessageNotUnderstoodSignal |
|
429 |
! |
|
430 |
||
431 |
recursionInterruptSignal |
|
432 |
"return the signal used for recursion overflow error handling" |
|
433 |
||
434 |
^ RecursionInterruptSignal |
|
435 |
! |
|
436 |
||
437 |
subscriptOutOfBoundsSignal |
|
438 |
"return the signal used for subscript error reporting. |
|
439 |
(this signal is used for example when an array is accessed with an |
|
440 |
index less than 1 or greater than the array size)" |
|
441 |
||
442 |
^ SubscriptOutOfBoundsSignal |
|
443 |
! |
|
444 |
||
445 |
userInterruptSignal |
|
446 |
"return the signal used for ^C interrupts handling" |
|
447 |
||
448 |
^ UserInterruptSignal |
|
449 |
! |
|
450 |
||
451 |
userNotificationSignal |
|
452 |
"the parent signal used with information and warnings. |
|
453 |
Handling this allows handling of both information- and warning notifications." |
|
454 |
||
455 |
^ UserNotificationSignal |
|
456 |
! |
|
457 |
||
458 |
warningSignal |
|
459 |
"return the signal used for warnings. |
|
460 |
A handler for this signal gets all #warn: sends" |
|
461 |
||
462 |
^ WarningSignal |
|
1 | 463 |
! ! |
464 |
||
1788 | 465 |
!Object class methodsFor:'info messages'! |
356 | 466 |
|
783 | 467 |
infoPrinting |
468 |
"return the flag which controls information messages." |
|
469 |
||
470 |
^ InfoPrinting |
|
471 |
! |
|
472 |
||
356 | 473 |
infoPrinting:aBoolean |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
474 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
475 |
|
356 | 476 |
"turn on/off printing of information messages. |
477 |
If the argument, aBoolean is false, infoPrint will not output |
|
478 |
messages. The default is true." |
|
479 |
||
480 |
InfoPrinting := aBoolean |
|
481 |
! ! |
|
482 |
||
1788 | 483 |
!Object class methodsFor:'queries'! |
3 | 484 |
|
485 |
isBuiltInClass |
|
49 | 486 |
"return true, if this class is known by the run-time-system, |
487 |
i.e. you cannot add/remove instance variables without recompiling |
|
1266 | 488 |
the VM. |
489 |
Here, true is returned for myself, false for subclasses." |
|
3 | 490 |
|
491 |
^ self == Object |
|
1266 | 492 |
|
493 |
"Modified: 23.4.1996 / 16:00:07 / cg" |
|
3 | 494 |
! ! |
495 |
||
1 | 496 |
!Object methodsFor:'accessing'! |
497 |
||
498 |
at:index |
|
499 |
"return the indexed instance variable with index, anInteger; |
|
500 |
this method can be redefined in subclasses." |
|
501 |
||
502 |
^ self basicAt:index |
|
503 |
! |
|
504 |
||
783 | 505 |
at:index put:anObject |
506 |
"store the 2nd arg, anObject as indexed instvar with index, anInteger. |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
507 |
this method can be redefined in subclasses. Returns anObject (sigh)" |
783 | 508 |
|
509 |
^ self basicAt:index put:anObject |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
510 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
511 |
"Modified: 19.4.1996 / 11:13:29 / cg" |
783 | 512 |
! |
513 |
||
1 | 514 |
basicAt:index |
515 |
"return the indexed instance variable with index, anInteger. |
|
516 |
Trigger an error if the receiver has no indexed instance variables. |
|
2148 | 517 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
1 | 518 |
|
519 |
%{ /* NOCONTEXT */ |
|
520 |
||
329 | 521 |
REGISTER int nbytes, indx; |
1 | 522 |
OBJ myClass; |
329 | 523 |
REGISTER char *pFirst; |
1 | 524 |
unsigned char *cp; |
525 |
unsigned short *sp; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
526 |
short *ssp; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
527 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
528 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
529 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
530 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
531 |
#endif |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
532 |
unsigned int32 *lp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
533 |
int32 *slp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
534 |
unsigned int32 ul; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
535 |
int32 l; |
1 | 536 |
OBJ *op; |
329 | 537 |
REGISTER int n; |
1 | 538 |
|
539 |
/* |
|
56 | 540 |
* notice the missing test for self being a nonNilObject - |
1 | 541 |
* this can be done since basicAt: is defined both in UndefinedObject |
542 |
* and SmallInteger |
|
543 |
*/ |
|
253 | 544 |
if (__isSmallInteger(index)) { |
2647 | 545 |
myClass = __qClass(self); |
546 |
indx = __intVal(index) - 1; |
|
547 |
n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
|
548 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */); |
|
549 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
550 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
|
551 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
552 |
switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
553 |
case __MASKSMALLINT(POINTERARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
554 |
case __MASKSMALLINT(WKPOINTERARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
555 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
556 |
* pointers |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
557 |
*/ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
558 |
if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
559 |
op = (OBJ *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
560 |
RETURN ( *op ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
561 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
562 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
563 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
564 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
565 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
566 |
* (unsigned) bytes |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
567 |
*/ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
568 |
if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
569 |
cp = (unsigned char *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
570 |
RETURN ( __MKSMALLINT(*cp & 0xFF) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
571 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
572 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
573 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
574 |
case __MASKSMALLINT(FLOATARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
575 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
576 |
* native floats |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
577 |
*/ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
578 |
if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
579 |
float *fp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
580 |
OBJ v; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
581 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
582 |
fp = (float *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
583 |
__qMKSFLOAT(v, *fp); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
584 |
RETURN (v); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
585 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
586 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
587 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
588 |
case __MASKSMALLINT(DOUBLEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
589 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
590 |
* native doubles |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
591 |
*/ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
592 |
if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
593 |
double *dp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
594 |
OBJ v; |
1 | 595 |
|
56 | 596 |
#ifdef NEED_DOUBLE_ALIGN |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
597 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
598 |
* care for filler |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
599 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
600 |
pFirst += sizeof(FILLTYPE); |
56 | 601 |
#endif |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
602 |
dp = (double *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
603 |
__qMKFLOAT(v, *dp); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
604 |
RETURN (v); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
605 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
606 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
607 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
608 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
609 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
610 |
* unsigned 16bit ints |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
611 |
*/ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
612 |
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
613 |
sp = (unsigned short *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
614 |
RETURN ( __MKSMALLINT(*sp & 0xFFFF) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
615 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
616 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
617 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
618 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
619 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
620 |
* signed 16bit ints |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
621 |
*/ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
622 |
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
623 |
ssp = (short *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
624 |
RETURN ( __MKSMALLINT(*ssp) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
625 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
626 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
627 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
628 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
629 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
630 |
* unsigned native 32bit ints |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
631 |
*/ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
632 |
if ((indx >= 0) && (indx < (nbytes / sizeof(int32)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
633 |
lp = (unsigned int32 *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
634 |
ul = *lp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
635 |
if (ul <= _MAX_INT) |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
636 |
RETURN ( __MKSMALLINT(ul) ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
637 |
RETURN ( __MKULARGEINT(ul) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
638 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
639 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
640 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
641 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
642 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
643 |
* signed native 32bit ints |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
644 |
*/ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
645 |
if ((indx >= 0) && (indx < (nbytes / sizeof(int32)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
646 |
slp = (int32 *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
647 |
l = *slp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
648 |
if ((l >= _MIN_INT) && (l <= _MAX_INT)) |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
649 |
RETURN ( __MKSMALLINT(l) ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
650 |
RETURN ( __MKLARGEINT(l) ); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
651 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
652 |
break; |
2647 | 653 |
} |
1 | 654 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
655 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
656 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
657 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
658 |
%}. |
10 | 659 |
index isInteger ifFalse:[ |
2647 | 660 |
^ self indexNotInteger |
1 | 661 |
]. |
159 | 662 |
^ self subscriptBoundsError:index |
1 | 663 |
! |
664 |
||
665 |
basicAt:index put:anObject |
|
666 |
"store the 2nd arg, anObject as indexed instvar with index, anInteger. |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
667 |
Returns anObject (sigh). |
1 | 668 |
Trigger an error if the receiver has no indexed instance variables. |
2148 | 669 |
|
670 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
|
1 | 671 |
|
672 |
%{ /* NOCONTEXT */ |
|
673 |
||
674 |
register int nbytes, indx; |
|
675 |
OBJ myClass; |
|
676 |
register char *pFirst; |
|
677 |
char *cp; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
678 |
unsigned short *sp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
679 |
short *ssp; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
680 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
681 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
682 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
683 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
684 |
#endif |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
685 |
unsigned int32 *lp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
686 |
int32 *slp; |
1 | 687 |
OBJ *op; |
329 | 688 |
/* int nInstBytes, ninstvars, flags; */ |
689 |
REGISTER int n; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
690 |
unsigned int u; |
1 | 691 |
int val; |
692 |
||
56 | 693 |
/* notice the missing test for self being a nonNilObject - |
77 | 694 |
this can be done since basicAt: is defined both in UndefinedObject |
1 | 695 |
and SmallInteger */ |
696 |
||
253 | 697 |
if (__isSmallInteger(index)) { |
2647 | 698 |
indx = __intVal(index) - 1; |
699 |
myClass = __qClass(self); |
|
700 |
n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
|
701 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */); |
|
702 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
703 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
|
704 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
705 |
switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
706 |
case __MASKSMALLINT(POINTERARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
707 |
case __MASKSMALLINT(WKPOINTERARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
708 |
if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
709 |
op = (OBJ *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
710 |
*op = anObject; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
711 |
__STORE(self, anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
712 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
713 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
714 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
715 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
716 |
case __MASKSMALLINT(BYTEARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
717 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
718 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
719 |
if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
720 |
if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
721 |
cp = pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
722 |
*cp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
723 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
724 |
} |
2647 | 725 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
726 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
727 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
728 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
729 |
case __MASKSMALLINT(FLOATARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
730 |
if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
731 |
float *fp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
732 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
733 |
fp = (float *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
734 |
if (__isFloatLike(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
735 |
*fp = (float)(__floatVal(anObject)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
736 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
737 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
738 |
if (__isSmallInteger(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
739 |
*fp = (float) __intVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
740 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
741 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
742 |
if (__isShortFloat(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
743 |
*fp = __shortFloatVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
744 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
745 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
746 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
747 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
748 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
749 |
case __MASKSMALLINT(DOUBLEARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
750 |
if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
751 |
double *dp; |
13 | 752 |
|
56 | 753 |
#ifdef NEED_DOUBLE_ALIGN |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
754 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
755 |
* care for filler |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
756 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
757 |
pFirst += sizeof(FILLTYPE); |
56 | 758 |
#endif |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
759 |
dp = (double *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
760 |
if (__isFloatLike(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
761 |
*dp = __floatVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
762 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
763 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
764 |
if (__isSmallInteger(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
765 |
*dp = (double) __intVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
766 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
767 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
768 |
if (__isShortFloat(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
769 |
*dp = (double)__shortFloatVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
770 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
771 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
772 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
773 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
774 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
775 |
case __MASKSMALLINT(WORDARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
776 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
777 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
778 |
if ((val >= 0) && (val <= 0xFFFF)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
779 |
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
780 |
sp = (unsigned short *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
781 |
*sp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
782 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
783 |
} |
2647 | 784 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
785 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
786 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
787 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
788 |
case __MASKSMALLINT(SWORDARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
789 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
790 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
791 |
if ((val >= -32768) && (val < 32768)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
792 |
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
793 |
ssp = (short *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
794 |
*ssp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
795 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
796 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
797 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
798 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
799 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
800 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
801 |
case __MASKSMALLINT(SLONGARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
802 |
if ((indx >= 0) && (indx < (nbytes / sizeof(int32)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
803 |
slp = (int32 *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
804 |
if (__isSmallInteger(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
805 |
*slp = __intVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
806 |
RETURN ( anObject ); |
2647 | 807 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
808 |
n = __signedLongIntVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
809 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
810 |
* zero means failure for an int larger than 4 bytes |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
811 |
* (would be a smallInteger) |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
812 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
813 |
if (n) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
814 |
*slp = n; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
815 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
816 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
817 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
818 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
819 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
820 |
case __MASKSMALLINT(LONGARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
821 |
if ((indx >= 0) && (indx < (nbytes / sizeof(int32)))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
822 |
lp = (unsigned int32 *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
823 |
if (anObject == __MKSMALLINT(0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
824 |
*lp = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
825 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
826 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
827 |
u = __longIntVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
828 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
829 |
* zero means failure for an int larger than 4 bytes |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
830 |
* (would be a smallInteger) |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
831 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
832 |
if (u) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
833 |
*lp = u; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
834 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
835 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
836 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
837 |
break; |
2647 | 838 |
} |
1 | 839 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
840 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
841 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
842 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
843 |
%}. |
10 | 844 |
index isInteger ifFalse:[ |
2647 | 845 |
" |
846 |
the index should be an integer number |
|
847 |
" |
|
848 |
^ self indexNotInteger |
|
1 | 849 |
]. |
850 |
(index between:1 and:self size) ifFalse:[ |
|
2647 | 851 |
" |
852 |
the index is less than 1 or greater than the size of the |
|
853 |
receiver collection |
|
854 |
" |
|
855 |
^ self subscriptBoundsError:index |
|
1 | 856 |
]. |
643 | 857 |
(self class isFloatsOrDoubles) ifTrue:[ |
2647 | 858 |
anObject isNumber ifTrue:[ |
859 |
^ self basicAt:index put:(anObject asFloat) |
|
860 |
] |
|
13 | 861 |
]. |
10 | 862 |
anObject isInteger ifFalse:[ |
2647 | 863 |
" |
864 |
the object to put into the receiver collection |
|
865 |
should be an integer number |
|
866 |
" |
|
867 |
^ self elementNotInteger |
|
2 | 868 |
]. |
159 | 869 |
" |
213 | 870 |
the object to put into the receiver collection |
362 | 871 |
is not an instance of the expected element class, |
872 |
or the value is not within the elements valid range. |
|
159 | 873 |
" |
2 | 874 |
^ self elementBoundsError |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
875 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
876 |
"Modified: 19.4.1996 / 11:14:10 / cg" |
1 | 877 |
! |
878 |
||
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
879 |
byteAt:index |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
880 |
"return the byte at index. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
881 |
This is only allowed for non-pointer indexed objects |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
882 |
(i.e. byteArrays, wordArrays, floatArrays etc.). |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
883 |
The receivers indexed instvars are treated as an uninterpreted |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
884 |
collection of bytes. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
885 |
Only useful with binary storage." |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
886 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
887 |
%{ /* NOCONTEXT */ |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
888 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
889 |
REGISTER int indx; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
890 |
int nIndex; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
891 |
REGISTER OBJ slf; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
892 |
REGISTER OBJ cls; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
893 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
894 |
if (__isSmallInteger(index)) { |
2647 | 895 |
slf = self; |
896 |
if (__isNonNilObject(slf)) { |
|
897 |
cls = __qClass(slf); |
|
898 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
899 |
switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
900 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
901 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
902 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
903 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
904 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
905 |
case __MASKSMALLINT(FLOATARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
906 |
case __MASKSMALLINT(DOUBLEARRAY): |
2647 | 907 |
indx = __intVal(index) - 1; |
908 |
indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
909 |
nIndex = __byteArraySize(slf); |
|
910 |
if ((unsigned)indx < (unsigned)nIndex) { |
|
911 |
RETURN ( __MKSMALLINT(__ByteArrayInstPtr(slf)->ba_element[indx]) ); |
|
912 |
} |
|
913 |
break; |
|
914 |
} |
|
915 |
} |
|
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
916 |
} |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
917 |
%}. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
918 |
"/ index not integer or index out of range |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
919 |
"/ or non-byte indexable receiver |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
920 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
921 |
^ self primitiveFailed |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
922 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
923 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
924 |
Point new byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
925 |
(ByteArray with:1 with:2) byteAt:2 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
926 |
(WordArray with:1) byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
927 |
(FloatArray with:1.0) byteAt:2 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
928 |
'hello' byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
929 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
930 |
! |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
931 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
932 |
byteAt:index put:byteValue |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
933 |
"set the byte at index. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
934 |
This is only allowed for non-pointer indexed objects |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
935 |
(i.e. byteArrays, wordArrays, floatArrays etc.). |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
936 |
The receivers indexed instvars are treated as an uninterpreted |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
937 |
collection of bytes. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
938 |
Only useful with binary storage." |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
939 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
940 |
%{ /* NOCONTEXT */ |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
941 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
942 |
REGISTER int indx; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
943 |
int val, nIndex; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
944 |
REGISTER OBJ slf; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
945 |
REGISTER OBJ cls; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
946 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
947 |
if (__bothSmallInteger(index, byteValue)) { |
2647 | 948 |
val = __intVal(byteValue); |
949 |
if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) { |
|
950 |
slf = self; |
|
951 |
if (__isNonNilObject(slf)) { |
|
952 |
cls = __qClass(slf); |
|
953 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
954 |
switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
955 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
956 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
957 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
958 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
959 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
960 |
case __MASKSMALLINT(FLOATARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
961 |
case __MASKSMALLINT(DOUBLEARRAY): |
2647 | 962 |
indx = __intVal(index) - 1; |
963 |
indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
964 |
nIndex = __byteArraySize(slf); |
|
965 |
if ((unsigned)indx < (unsigned)nIndex) { |
|
966 |
__ByteArrayInstPtr(slf)->ba_element[indx] = val; |
|
967 |
RETURN ( byteValue ); |
|
968 |
} |
|
969 |
break; |
|
970 |
} |
|
971 |
} |
|
972 |
} |
|
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
973 |
} |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
974 |
%}. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
975 |
"/ index not integer or index out of range |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
976 |
"/ or non-byte indexable receiver |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
977 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
978 |
^ self primitiveFailed |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
979 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
980 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
981 |
(ByteArray with:1 with:2) byteAt:2 put:3; yourself |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
982 |
'hello' copy byteAt:1 put:105; yourself |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
983 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
984 |
! |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
985 |
|
1 | 986 |
instVarAt:index |
987 |
"return a non-indexed instance variable; |
|
13 | 988 |
peeking into an object this way is not very object oriented |
989 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 990 |
|
991 |
%{ /* NOCONTEXT */ |
|
992 |
||
993 |
OBJ myClass; |
|
994 |
int idx, ninstvars; |
|
995 |
||
253 | 996 |
if (__isSmallInteger(index)) { |
329 | 997 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
998 |
idx = __intVal(index) - 1; |
357 | 999 |
/* |
1000 |
* do not allow return of non-object fields. |
|
1001 |
* if subclass did not make privisions for that, |
|
1002 |
* we wont do so here ... |
|
1003 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1004 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 1005 |
if (idx == 0) { |
1006 |
RETURN ( nil ) |
|
1007 |
} |
|
1008 |
} |
|
1133 | 1009 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
159 | 1010 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 1011 |
RETURN ( __InstPtr(self)->i_instvars[idx] ); |
159 | 1012 |
} |
1 | 1013 |
} |
1014 |
%} |
|
1015 |
. |
|
1016 |
index isInteger ifFalse:[ |
|
159 | 1017 |
^ self indexNotInteger |
1 | 1018 |
]. |
159 | 1019 |
^ self subscriptBoundsError:index |
1 | 1020 |
! |
1021 |
||
1022 |
instVarAt:index put:value |
|
1023 |
"change a non-indexed instance variable; |
|
13 | 1024 |
peeking into an object this way is not very object oriented |
1025 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 1026 |
|
1027 |
%{ /* NOCONTEXT */ |
|
1028 |
||
1029 |
OBJ myClass; |
|
1030 |
int idx, ninstvars; |
|
1031 |
||
253 | 1032 |
if (__isSmallInteger(index)) { |
329 | 1033 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
1034 |
idx = __intVal(index) - 1; |
1133 | 1035 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
357 | 1036 |
/* |
1037 |
* do not allow setting of non-object fields. |
|
1038 |
* if subclass did not make privisions for that, |
|
1039 |
* we wont do so here ... |
|
1040 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1041 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 1042 |
if (idx == 0) { |
1043 |
RETURN ( nil ) |
|
1044 |
} |
|
1045 |
} |
|
159 | 1046 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 1047 |
__InstPtr(self)->i_instvars[idx] = value; |
159 | 1048 |
__STORE(self, value); |
1049 |
RETURN ( value ); |
|
1050 |
} |
|
1 | 1051 |
} |
1052 |
%} |
|
1053 |
. |
|
1054 |
index isInteger ifFalse:[ |
|
159 | 1055 |
^ self indexNotInteger |
1 | 1056 |
]. |
159 | 1057 |
^ self subscriptBoundsError:index |
359 | 1058 |
! |
1059 |
||
1060 |
instVarNamed:name |
|
1061 |
"return a non-indexed instance variables value by name; |
|
1062 |
peeking into an object this way is not very object oriented |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1063 |
- use with care if at all (provided for inspectors and memory usage monitor). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1064 |
Notice, this access is very slow (because the classes instVar-description has to be |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1065 |
parsed ad runtime)" |
359 | 1066 |
|
1067 |
^ self instVarAt:(self class instVarOffsetOf:name) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1068 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1069 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1070 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1071 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1072 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1073 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1074 |
p instVarNamed:'x' |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1075 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1076 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1077 |
"Modified: 19.4.1996 / 11:12:39 / cg" |
359 | 1078 |
! |
1079 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1080 |
instVarNamed:name ifAbsent:exceptionBlock |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1081 |
"return a non-indexed instance variables value by name, |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1082 |
or the value of exceptionBlock, if there is no such instance variable. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1083 |
peeking into an object this way is not very object oriented |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1084 |
- use with care if at all (provided for inspectors and memory usage monitor). |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1085 |
Notice, this access is very slow (because the classes instVar-description has to be |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1086 |
parsed ad runtime)" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1087 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1088 |
|idx| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1089 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1090 |
idx := self class instVarOffsetOf:name. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1091 |
idx isNil ifTrue:[^ exceptionBlock value]. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1092 |
^ self instVarAt:idx |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1093 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1094 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1095 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1096 |
|p| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1097 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1098 |
p := Point x:10 y:20. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1099 |
p instVarNamed:'x' |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1100 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1101 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1102 |
"Created: 6.7.1996 / 23:02:49 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1103 |
"Modified: 6.7.1996 / 23:03:41 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1104 |
! |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1105 |
|
359 | 1106 |
instVarNamed:name put:value |
1107 |
"set a non-indexed instance variable by name; |
|
1108 |
peeking into an object this way is not very object oriented |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1109 |
- if at all, use with care (provided for protocol completeness). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1110 |
Notice, this access is very slow (because the classes instVar-description has to be |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1111 |
parsed ad runtime)" |
359 | 1112 |
|
1113 |
^ self instVarAt:(self class instVarOffsetOf:name) put:value |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1114 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1115 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1116 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1117 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1118 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1119 |
p instVarNamed:'x' put:30. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1120 |
p |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1121 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1122 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1123 |
"Modified: 19.4.1996 / 11:12:49 / cg" |
1 | 1124 |
! ! |
1125 |
||
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1126 |
!Object methodsFor:'attributes access'! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1127 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1128 |
objectAttributeAt:key |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1129 |
"return the attribute for a given key or nil if not found" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1130 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1131 |
| attrs | |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1132 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1133 |
attrs := self objectAttributes. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1134 |
(attrs notNil and:[attrs size > 0]) ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1135 |
^ attrs at:key ifAbsent:[] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1136 |
]. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1137 |
^ nil |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1138 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1139 |
"Created: / 22.1.1998 / 21:29:17 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1140 |
"Modified: / 3.2.1998 / 18:55:55 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1141 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1142 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1143 |
objectAttributeAt:key put:anObject |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1144 |
"store the attribute anObject referenced by key into the receiver" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1145 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1146 |
|wasBlocked| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1147 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1148 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1149 |
"/ is possibly accessed from multiple threads ... |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1150 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1151 |
wasBlocked := OperatingSystem blockInterrupts. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1152 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1153 |
| attrs | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1154 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1155 |
attrs := self objectAttributes. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1156 |
(attrs isNil or:[attrs size == 0]) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1157 |
attrs := WeakIdentityDictionary new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1158 |
attrs at:key put:anObject. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1159 |
self objectAttributes:attrs. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1160 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1161 |
attrs at:key put:anObject. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1162 |
]. |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1163 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1164 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1165 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1166 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1167 |
] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1168 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1169 |
"Attaching additional attributes (slots) to an arbitrary object: |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1170 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1171 |
|p| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1172 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1173 |
p := Point new. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1174 |
p objectAttributeAt:#color put:#green. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1175 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1176 |
p objectAttributeAt:#color |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1177 |
" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1178 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1179 |
"Created: / 22.1.1998 / 21:29:25 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1180 |
"Modified: / 3.2.1998 / 18:57:58 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1181 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1182 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1183 |
objectAttributes |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1184 |
"return a Collection of attributes - nil if there is none. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1185 |
The default implementation here uses a global WeakDictionary to store |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1186 |
attributes |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1187 |
This may be too slow for high frequency slot access, |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1188 |
therefore, some classes may redefine this for better performance. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1189 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1190 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1191 |
^ ObjectAttributes at:self ifAbsent:[#()] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1192 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1193 |
"Created: / 22.1.1998 / 21:29:30 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1194 |
"Modified: / 3.2.1998 / 18:58:31 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1195 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1196 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1197 |
objectAttributes:aCollection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1198 |
"set the collection of attributes. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1199 |
The default implementation here uses a global Dictionary to store |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1200 |
attributes which may be too slow for high frequency change&update. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1201 |
Therefore, some classes may redefine this for better performance." |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1202 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1203 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1204 |
"/ is possibly accessed from multiple threads. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1205 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1206 |
(OperatingSystem blockInterrupts) ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1207 |
"/ the common case - already blocked |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1208 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1209 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1210 |
ObjectAttributes removeKey:self ifAbsent:[] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1211 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1212 |
ObjectAttributes at:self put:aCollection |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1213 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1214 |
^ self |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1215 |
]. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1216 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1217 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1218 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1219 |
ObjectAttributes removeKey:self ifAbsent:[] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1220 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1221 |
ObjectAttributes at:self put:aCollection |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1222 |
]. |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1223 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1224 |
OperatingSystem unblockInterrupts |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1225 |
] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1226 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1227 |
"Created: / 22.1.1998 / 21:29:35 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1228 |
"Modified: / 3.2.1998 / 18:58:10 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1229 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1230 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1231 |
removeObjectAttribute:anObject |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1232 |
"make the argument, anObject be no attribute of the receiver" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1233 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1234 |
|wasBlocked| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1235 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1236 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1237 |
"/ is possibly accessed from multiple threads. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1238 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1239 |
wasBlocked := OperatingSystem blockInterrupts. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1240 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1241 |
|attrs n a| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1242 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1243 |
attrs := self objectAttributes. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1244 |
attrs notNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1245 |
attrs remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1246 |
attrs size == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1247 |
self objectAttributes:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1248 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1249 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1250 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1251 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1252 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1253 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1254 |
] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1255 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1256 |
"Created: / 22.1.1998 / 21:29:39 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1257 |
"Modified: / 3.2.1998 / 18:58:13 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1258 |
! ! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1259 |
|
783 | 1260 |
!Object methodsFor:'binary storage'! |
1261 |
||
1262 |
hasSpecialBinaryRepresentation |
|
1263 |
"return true, if the receiver has a special binary representation; |
|
1264 |
default here is false, but can be redefined in class which provide |
|
1265 |
their own storeBinary/readBinary methods. |
|
1266 |
||
1267 |
Normal user classes should not use this, it is meant as a hook for |
|
1268 |
special classes such as True, False, UndefinedObject or SmallInteger. |
|
1269 |
||
1270 |
If your instances should be stored in a special way, see |
|
1271 |
#representBinaryOn: and #readBinaryContentsFromdata:manager:." |
|
1272 |
||
1273 |
^ false |
|
1 | 1274 |
! |
1275 |
||
783 | 1276 |
readBinaryContentsFrom:stream manager:manager |
1277 |
"reconstruct the receivers instance variables by reading a binary |
|
1278 |
binary representation from stream. |
|
1279 |
This is a general implementation, walking over instances |
|
1280 |
and loading each recursively using manager. |
|
1281 |
Redefined by some classes to read a more compact representations |
|
1282 |
(see String, SmallInteger etc). |
|
1283 |
||
1284 |
Notice, that the object is already recreated as an empty corps |
|
1285 |
with instance variables all nil and bit-instances (bytes, words etc.) |
|
1286 |
already read and restored. |
|
1287 |
||
1288 |
Also notice: this method is not called for if a private representation |
|
1289 |
has been stored (see representBinaryOn:). |
|
1290 |
In that case, #readBinaryContentsFromData:manager: is called, which |
|
1291 |
has to be reimplemented in the objects class." |
|
1292 |
||
1293 |
|size "{ Class: SmallInteger }" |
|
1294 |
instvarArray| |
|
1295 |
||
1296 |
stream next == 1 ifTrue:[ |
|
1297 |
"/ |
|
1298 |
"/ special representation ... |
|
1299 |
"/ |
|
1300 |
instvarArray := Array new:(size := stream nextNumber:3). |
|
1301 |
1 to:size do:[:i | |
|
1302 |
instvarArray basicAt:i put:(manager nextObject) |
|
1303 |
]. |
|
1304 |
self readBinaryContentsFromData:instvarArray manager:manager. |
|
1305 |
^ self |
|
1306 |
]. |
|
1307 |
||
1308 |
"/ |
|
1309 |
"/ standard representation |
|
1310 |
"/ |
|
1311 |
size := self basicSize. |
|
1312 |
size ~~ 0 ifTrue:[ |
|
1313 |
self class isPointers ifTrue:[ |
|
1314 |
1 to:size do:[:i | |
|
1315 |
self basicAt:i put:(manager nextObject) |
|
1316 |
] |
|
1317 |
] |
|
1318 |
]. |
|
1319 |
size := self class instSize. |
|
1320 |
1 to:size do:[:i | |
|
1321 |
self instVarAt:i put:(manager nextObject) |
|
1322 |
]. |
|
1323 |
! |
|
1324 |
||
1325 |
readBinaryContentsFromData:instvarArray manager:manager |
|
1326 |
"reconstruct the receivers instance variables by filling instance |
|
1327 |
variables with values from instvarArray. This array contains the instvars |
|
1328 |
as specified in #representBinaryOn: when the object was stored. |
|
1329 |
It is the receivers responsibility to set its instance variables in the |
|
1330 |
same order from that array." |
|
1331 |
||
1332 |
^ self subclassResponsibility |
|
1333 |
||
1334 |
"typical implementation (see also comment in #representBinaryOn:) |
|
1335 |
(for an object with foo, bar and baz as instance variables, |
|
1336 |
which did not store baz and wants baz to be reinitialized to |
|
1337 |
some constant string) |
|
1338 |
||
1339 |
foo := instvarArray at:1. |
|
1340 |
bar := instvarArray at:2. |
|
1341 |
baz := 'aConstant'. |
|
1342 |
" |
|
1343 |
! |
|
1344 |
||
1345 |
representBinaryOn:manager |
|
1346 |
"this method is called by the storage manager to ask objects |
|
1347 |
if they wish to provide their own binary representation. |
|
1348 |
||
1349 |
If they want to do so, they should return an array containing all |
|
1350 |
instance variables (named & indexed pointer) to be stored. |
|
1351 |
If not redefined, this method returns nil which means that all |
|
1352 |
instance variables are to be stored. |
|
1353 |
||
1354 |
It should be redefined in objects which do not want all instance variables |
|
1355 |
to be stored (for example: objects which keep references to a view etc.). |
|
1356 |
||
1357 |
If this is redefined returning non-nil, the corresponding class needs |
|
1358 |
a redefined instance method named #readBinaryContentsFromData:manager: |
|
1359 |
which has to fill the receivers named (and optionally indexed pointer) |
|
1360 |
instance variables with corresponding values from a data array." |
|
1361 |
||
1362 |
^ nil |
|
1363 |
||
1364 |
"typical implementation: |
|
1365 |
(see also comment in #readBinaryContentsFromData:manager:) |
|
1366 |
for an object with foo, bar and baz as instance variables, |
|
1367 |
which does not want to store baz: |
|
1368 |
||
1369 |
representBinaryOn:manager |
|
1370 |
|data| |
|
1371 |
||
1372 |
data := Array new:2. |
|
1373 |
data at:1 put:foo. |
|
1374 |
data at:2 put:bar. |
|
1375 |
^ data |
|
1376 |
" |
|
159 | 1377 |
! |
1378 |
||
783 | 1379 |
storeBinaryDefinitionBodyOn:stream manager:manager |
1380 |
"append a binary representation of the receivers body onto stream. |
|
1381 |
This is a general implementation walking over instances storing |
|
1382 |
each recursively as an ID using manager. |
|
1383 |
Can be redefined in subclasses." |
|
1384 |
||
3078 | 1385 |
|basicSize "{ Class: SmallInteger }" |
1386 |
instSize "{ Class: SmallInteger }" |
|
1387 |
specialSize "{ Class: SmallInteger }" |
|
783 | 1388 |
myClass specialRep pointers| |
1389 |
||
1390 |
myClass := self class. |
|
1391 |
instSize := myClass instSize. |
|
1392 |
||
1393 |
(pointers := myClass isPointers) ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1394 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1395 |
"/ inst size not needed - if you uncomment the line below, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1396 |
"/ also uncomment the corresponding line in |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1397 |
"/ Object>>binaryDefinitionFrom:manager: |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1398 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1399 |
"/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1400 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1401 |
myClass isVariable ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1402 |
stream nextNumber:3 put:(basicSize := self basicSize) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1403 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1404 |
basicSize := 0 |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1405 |
]. |
783 | 1406 |
] ifFalse: [ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1407 |
stream nextNumber:4 put:(basicSize := self basicSize). |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1408 |
myClass isBytes ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1409 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1410 |
stream nextPut:(self basicAt:i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1411 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1412 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1413 |
myClass isWords ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1414 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1415 |
stream nextNumber:2 put:(self basicAt: i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1416 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1417 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1418 |
myClass isLongs ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1419 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1420 |
stream nextNumber:4 put:(self basicAt: i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1421 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1422 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1423 |
myClass isFloats ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1424 |
"could do it in one big write on machines which use IEEE floats ..." |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1425 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1426 |
Float storeBinaryIEEESingle:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1427 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1428 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1429 |
myClass isDoubles ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1430 |
"could do it in one big write on machines which use IEEE doubles ..." |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1431 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1432 |
Float storeBinaryIEEEDouble:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1433 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1434 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1435 |
"/ should never be reached ... |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1436 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1437 |
manager putIdOf:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1438 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1439 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1440 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1441 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1442 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1443 |
]. |
783 | 1444 |
]. |
1445 |
||
1446 |
(pointers or:[instSize ~~ 0]) ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1447 |
specialRep := self representBinaryOn:manager. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1448 |
specialRep notNil ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1449 |
specialSize := specialRep basicSize. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1450 |
stream nextPut:1. "/ means: private representation follows |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1451 |
stream nextNumber:3 put:specialSize. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1452 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1453 |
1 to:specialSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1454 |
manager putIdOf:(specialRep at:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1455 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1456 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1457 |
stream nextPut:0. "/ means: normal representation follows |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1458 |
"/ index pointers followed by named instanceVars |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1459 |
pointers ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1460 |
basicSize ~~ 0 ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1461 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1462 |
manager putIdOf:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1463 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1464 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1465 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1466 |
instSize ~~ 0 ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1467 |
1 to:instSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1468 |
manager putIdOf:(self instVarAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1469 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1470 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1471 |
] |
1 | 1472 |
] |
783 | 1473 |
|
3078 | 1474 |
"Modified: / 2.11.1997 / 14:43:29 / cg" |
1 | 1475 |
! |
1476 |
||
783 | 1477 |
storeBinaryDefinitionOn:stream manager:manager |
1478 |
"append a binary representation of the receiver onto stream. |
|
1260 | 1479 |
This is an internal interface for binary storage mechanism. |
783 | 1480 |
This method first stores the class, then the body, which is done |
1481 |
in a separate method to allow redefinition of the bodies format. |
|
1482 |
Can be redefined in subclasses to write more compact representations |
|
1483 |
(see String, SmallInteger etc)." |
|
1484 |
||
1485 |
manager putIdOfClass:(self class) on:stream. |
|
1486 |
self storeBinaryDefinitionBodyOn:stream manager:manager |
|
1260 | 1487 |
|
1488 |
"Modified: 23.4.1996 / 09:31:12 / cg" |
|
783 | 1489 |
! |
1490 |
||
3078 | 1491 |
storeBinaryOn:aStreamOrFilename |
1492 |
"Writes a description of the receiver onto aStreamOrFilename, in a way that allows |
|
783 | 1493 |
the object's structure to be reconstructed from the stream's contents" |
1494 |
||
3078 | 1495 |
BinaryOutputManager store:self on:aStreamOrFilename |
899 | 1496 |
|
1497 |
" |
|
1498 |
|a s1 s2| |
|
1499 |
||
1500 |
s1 := 'hello'. |
|
1501 |
s2 := 'world'. |
|
1502 |
a := Array new:5. |
|
1503 |
a at:1 put:s1. |
|
1504 |
a at:2 put:s2. |
|
1505 |
a at:3 put:s1. |
|
1506 |
a at:4 put:s2. |
|
1507 |
a storeBinaryOn:'test.boss' |
|
1508 |
" |
|
1509 |
||
1510 |
" |
|
1511 |
(BinaryObjectStorage onOld:'test.boss' asFilename readStream) |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1512 |
next |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1513 |
inspect |
899 | 1514 |
" |
3078 | 1515 |
|
1516 |
"Modified: / 1.11.1997 / 21:16:24 / cg" |
|
783 | 1517 |
! |
1518 |
||
1519 |
storeBinaryOn:stream manager:manager |
|
1520 |
"append a binary representation of the receiver onto stream." |
|
1521 |
||
1522 |
manager putIdOf:self on:stream |
|
1 | 1523 |
! ! |
1524 |
||
1826 | 1525 |
!Object methodsFor:'change & update'! |
1 | 1526 |
|
783 | 1527 |
broadcast:aSelectorSymbol |
1528 |
"send a message with selector aSelectorSymbol to all my dependents" |
|
1529 |
||
1530 |
self dependentsDo:[:dependent | |
|
1531 |
dependent perform:aSelectorSymbol |
|
1532 |
] |
|
1533 |
! |
|
1534 |
||
1535 |
broadcast:aSelectorSymbol with:anArgument |
|
1536 |
"send a message with selector aSelectorSymbol with an additional |
|
1537 |
argument anArgument to all my dependents." |
|
1538 |
||
1539 |
self dependentsDo:[:dependent | |
|
1540 |
dependent perform:aSelectorSymbol with:anArgument |
|
1541 |
] |
|
1542 |
! |
|
1543 |
||
159 | 1544 |
changeRequest |
1545 |
"the receiver wants to change - check if all dependents |
|
1546 |
grant the request, and return true if so" |
|
1547 |
||
1548 |
self dependentsDo:[:dependent | |
|
1549 |
dependent updateRequest ifFalse:[^ false]. |
|
1550 |
]. |
|
1551 |
^ true |
|
1552 |
! |
|
1553 |
||
1554 |
changeRequest:aParameter |
|
1555 |
"the receiver wants to change - check if all dependents |
|
1556 |
grant the request, and return true if so" |
|
1557 |
||
1558 |
self dependentsDo:[:dependent | |
|
1559 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1560 |
]. |
|
1561 |
^ true |
|
1562 |
! |
|
1563 |
||
783 | 1564 |
changeRequest:aParameter from:anObject |
1565 |
"the receiver wants to change - check if all dependents |
|
1566 |
except anObject grant the request, and return true if so. |
|
1567 |
The argument anObject is typically going to be the one who is |
|
1568 |
about to send the change request." |
|
1569 |
||
1570 |
self dependentsDo:[:dependent | |
|
1571 |
dependent == anObject ifFalse:[ |
|
1572 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1573 |
] |
|
1574 |
]. |
|
1575 |
^ true |
|
1576 |
! |
|
1577 |
||
159 | 1578 |
changeRequestFrom:anObject |
1579 |
"the receiver wants to change - check if all dependents |
|
202 | 1580 |
except anObject grant the request, and return true if so. |
1581 |
The argument anObject is typically going to be the one who is |
|
1582 |
about to send the change request." |
|
159 | 1583 |
|
1584 |
self dependentsDo:[:dependent | |
|
1585 |
dependent == anObject ifFalse:[ |
|
1586 |
(dependent updateRequest) ifFalse:[^ false]. |
|
1587 |
] |
|
1588 |
]. |
|
1589 |
^ true |
|
1590 |
! |
|
1591 |
||
1 | 1592 |
changed |
1593 |
"notify all dependents that the receiver has changed. |
|
71 | 1594 |
Each dependent gets a '#update:'-message with the original |
1595 |
receiver as argument." |
|
1 | 1596 |
|
159 | 1597 |
self changed:nil |
1 | 1598 |
! |
1599 |
||
1600 |
changed:aParameter |
|
1601 |
"notify all dependents that the receiver has changed somehow. |
|
71 | 1602 |
Each dependent gets a '#update:'-message with aParameter |
1603 |
as argument." |
|
1 | 1604 |
|
159 | 1605 |
self changed:aParameter with:nil |
1 | 1606 |
! |
1607 |
||
71 | 1608 |
changed:aParameter with:anArgument |
1 | 1609 |
"notify all dependents that the receiver has changed somehow. |
159 | 1610 |
Each dependent gets a '#update:with:from:'-message, with aParameter |
71 | 1611 |
and anArgument as arguments." |
1 | 1612 |
|
159 | 1613 |
self dependentsDo:[:dependent | |
1614 |
dependent update:aParameter with:anArgument from:self |
|
1 | 1615 |
] |
1616 |
! |
|
1617 |
||
1618 |
update:aParameter |
|
71 | 1619 |
"the message is sent to a dependent, when one of the objects |
1620 |
on whom the receiver depends, has changed. The argument aParameter |
|
1621 |
is either the changed object or the argument to the #changed: message. |
|
1622 |
||
1623 |
Default behavior here is to do nothing" |
|
1 | 1624 |
|
1625 |
^ self |
|
1626 |
! |
|
1627 |
||
1628 |
update:aParameter with:anArgument |
|
1629 |
"dependent is notified of some change - |
|
159 | 1630 |
Default is to try update:" |
1 | 1631 |
|
1632 |
^ self update:aParameter |
|
1633 |
! |
|
1634 |
||
1635 |
update:aParameter with:anArgument from:sender |
|
1636 |
"dependent is notified of some change - |
|
159 | 1637 |
Default is to try update:with:" |
1 | 1638 |
|
1639 |
^ self update:aParameter with:anArgument |
|
159 | 1640 |
! |
1641 |
||
1642 |
updateRequest |
|
1643 |
"return true, if an update request is granted. |
|
1644 |
Default here is to grant updates - may be used |
|
1645 |
to lock updates if someone is making other changes |
|
202 | 1646 |
from within an update. Or if someone has locked its |
1647 |
state and does not want others to change things. |
|
1648 |
However, these dependents must all honor the |
|
1649 |
changeRequest - ifTrue - change protocol. I.e. they |
|
1650 |
must first ask all others via changeRequest, and only do the change |
|
1651 |
it returns true. The others must decide in updateRequest and |
|
1652 |
return true if they think a change is ok." |
|
159 | 1653 |
|
1654 |
^ true |
|
1655 |
! |
|
1656 |
||
1657 |
updateRequest:aSymbol |
|
1658 |
"return true, if an update request is granted. |
|
1659 |
Default here a simple updateRequest" |
|
1660 |
||
1661 |
^ self updateRequest |
|
1 | 1662 |
! ! |
1663 |
||
783 | 1664 |
!Object methodsFor:'cleanup'! |
1665 |
||
1666 |
lowSpaceCleanup |
|
1667 |
"ignored here - redefined in some classes to |
|
1668 |
cleanup in low-memory situations" |
|
1669 |
||
1670 |
^ self |
|
1671 |
! ! |
|
1672 |
||
1673 |
!Object methodsFor:'comparing'! |
|
1674 |
||
1675 |
= anObject |
|
3044 | 1676 |
"return true, if the receiver and the arg have the same structure. |
1677 |
Notice: |
|
1678 |
This method is partially open coded (inlined) by the compiler(s) |
|
1679 |
identical objects are always considered equal. |
|
1680 |
redefining it may not work as expected." |
|
783 | 1681 |
|
1682 |
^ self == anObject |
|
1683 |
! |
|
1684 |
||
1685 |
== anObject |
|
2505 | 1686 |
"return true, if the receiver and the arg are the same object. |
1687 |
Never redefine this in any class. |
|
3044 | 1688 |
Notice: |
1689 |
This method is open coded (inlined) by the compiler(s) |
|
1690 |
- redefining it may not work as expected." |
|
783 | 1691 |
|
1692 |
%{ /* NOCONTEXT */ |
|
1693 |
||
1694 |
RETURN ( (self == anObject) ? true : false ); |
|
1695 |
%} |
|
1696 |
! |
|
1697 |
||
1698 |
hash |
|
1699 |
"return an Integer useful as a hash key for the receiver. |
|
1700 |
This hash should return same values for objects with same |
|
1701 |
contents (i.e. use this to hash on structure)" |
|
1702 |
||
1703 |
^ self identityHash |
|
1704 |
! |
|
1705 |
||
1706 |
identityHash |
|
1707 |
"return an Integer useful as a hash key for the receiver. |
|
1708 |
This hash should return same values for the same object (i.e. use |
|
1709 |
this to hash on identity of objects). |
|
1710 |
||
1711 |
We cannot use the Objects address (as other smalltalks do) since |
|
1712 |
no object-table exists and the hashval must not change when objects |
|
1713 |
are moved by the collector. Therefore we assign each object a unique |
|
1714 |
Id in the object header itself as its hashed upon. |
|
1715 |
(luckily we have 11 bits spare to do this - unluckily its only 11 bits). |
|
1716 |
Time will show, if 11 bits are enough; if not, another entry in the |
|
1717 |
object header will be needed, adding 4 bytes to every object. Alternatively, |
|
1718 |
hashed-upon objects could add an instvar containing the hash value." |
|
1719 |
||
1720 |
%{ /* NOCONTEXT */ |
|
1721 |
||
1722 |
REGISTER unsigned hash; |
|
1723 |
static unsigned nextHash = 0; |
|
1724 |
||
1725 |
if (__isNonNilObject(self)) { |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1726 |
hash = __GET_HASH(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1727 |
if (hash == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1728 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1729 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1730 |
if (++nextHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1731 |
nextHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1732 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1733 |
hash = nextHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1734 |
__SET_HASH(self, hash); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1735 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1736 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1737 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1738 |
* now, we got 11 bits for hashing; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1739 |
* make it as large as possible; since most hashers use the returned |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1740 |
* key and take it modulo some prime number, this will allow for |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1741 |
* better distribution (i.e. bigger empty spaces) in hashed collection. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1742 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1743 |
hash = __MAKE_HASH__(hash); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1744 |
RETURN ( __MKSMALLINT(hash) ); |
783 | 1745 |
} |
1746 |
%}. |
|
1747 |
^ 0 "never reached, since redefined in UndefinedObject and SmallInteger" |
|
1748 |
! |
|
1749 |
||
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1750 |
identityHashForBinaryStore |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1751 |
"hash which is usable if the object does not change its class |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1752 |
and does not #become something else, while the hash is used. |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1753 |
This is only used by the binary storage mechanism, during the |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1754 |
object writing phase." |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1755 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1756 |
%{ /* NOCONTEXT */ |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1757 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1758 |
REGISTER unsigned hash, hash1, hash2, sz; |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1759 |
OBJ o; |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1760 |
static unsigned nextHash = 0; |
2480 | 1761 |
static unsigned nextClassHash = 0; |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1762 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1763 |
if (__isNonNilObject(self)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1764 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1765 |
* my own identityHash |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1766 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1767 |
hash1 = __GET_HASH(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1768 |
if (hash1 == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1769 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1770 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1771 |
if (++nextHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1772 |
nextHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1773 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1774 |
hash1 = nextHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1775 |
__SET_HASH(self, hash1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1776 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1777 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1778 |
* my classes identityHash |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1779 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1780 |
o = __qClass(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1781 |
hash2 = __GET_HASH(o); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1782 |
if (hash2 == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1783 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1784 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1785 |
if (++nextClassHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1786 |
nextClassHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1787 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1788 |
hash2 = nextClassHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1789 |
__SET_HASH(o, hash2); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1790 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1791 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1792 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1793 |
* some bits of my size |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1794 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1795 |
sz = __qSize(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1796 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1797 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1798 |
* now, we got 11 + 11 + 8 bits for hashing; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1799 |
* make it as large as possible; since most hashers use the returned |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1800 |
* key and take it modulo some prime number, this will allow for |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1801 |
* better distribution (i.e. bigger empty spaces) in hashed collection. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1802 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1803 |
hash = (hash1 << 11) | hash2; /* 22 bits */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1804 |
hash = (hash << 8) | (sz & 0xFC); /* 30 bits */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1805 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1806 |
while ((hash & 0x20000000) == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1807 |
hash <<= 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1808 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1809 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1810 |
RETURN ( __MKSMALLINT(hash) ); |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1811 |
} |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1812 |
%}. |
2480 | 1813 |
^ nil "never reached, since UndefinedObject and SmallInteger are not hashed upon in binary storage" |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1814 |
! |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1815 |
|
783 | 1816 |
isNil |
3044 | 1817 |
"return true, if the receiver is nil. |
1818 |
Notice: |
|
1819 |
This method is open coded (inlined) by the compiler(s) |
|
1820 |
- redefining it may not work as expected." |
|
783 | 1821 |
|
1822 |
^ false |
|
1823 |
! |
|
1824 |
||
1825 |
notNil |
|
3044 | 1826 |
"return true, if the receiver is not nil. |
1827 |
Notice: |
|
1828 |
This method is open coded (inlined) by the compiler(s) |
|
1829 |
- redefining it may not work as expected." |
|
783 | 1830 |
|
1831 |
^ true |
|
1832 |
! |
|
1833 |
||
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1834 |
sameContentsAs:anObject |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1835 |
"return true, if the receiver and the arg have the same contents |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1836 |
in both the named instance vars and any indexed instVars." |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1837 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1838 |
|myClass otherClass |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1839 |
sz "{ Class: SmallInteger }" | |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1840 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1841 |
myClass := self class. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1842 |
myClass isVariable ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1843 |
sz := self basicSize. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1844 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1845 |
"compare the indexed variables" |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1846 |
1 to:sz do:[:i | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1847 |
(self basicAt:i) ~~ (anObject basicAt:i) ifTrue:[^ false]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1848 |
] |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1849 |
]. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1850 |
|
3385 | 1851 |
"compare the instance variables" |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1852 |
sz := myClass instSize. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1853 |
1 to:sz do:[:i | |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1854 |
(self instVarAt:i) ~~ (anObject instVarAt:i) ifTrue:[^ false]. |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1855 |
]. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1856 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1857 |
^ true |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1858 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1859 |
" |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1860 |
#(1 2 3 4) sameContentsAsIn:#[1 2 3 4] asArray |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1861 |
(1@2) sameContentsAsIn:(1->2) |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1862 |
" |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1863 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1864 |
"Created: / 21.4.1998 / 15:56:40 / cg" |
3385 | 1865 |
"Modified: / 21.4.1998 / 15:58:15 / cg" |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1866 |
! |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
1867 |
|
783 | 1868 |
~= anObject |
3044 | 1869 |
"return true, if the receiver and the arg do not have the same structure. |
1870 |
Notice: |
|
1871 |
This method is partially open coded (inlined) by the compiler(s) |
|
1872 |
identical objects are never considered unequal. |
|
1873 |
redefining it may not work as expected." |
|
783 | 1874 |
|
1875 |
^ (self = anObject) not |
|
1876 |
! |
|
1877 |
||
1878 |
~~ anObject |
|
2505 | 1879 |
"return true, if the receiver and the arg are not the same object. |
1880 |
Never redefine this in any class. |
|
3044 | 1881 |
Notice: |
1882 |
This method is open coded (inlined) by the compiler(s) |
|
1883 |
- redefining it may not work as expected." |
|
783 | 1884 |
|
1885 |
%{ /* NOCONTEXT */ |
|
1886 |
RETURN ( (self == anObject) ? false : true ); |
|
1887 |
%} |
|
1888 |
! ! |
|
1889 |
||
1890 |
!Object methodsFor:'converting'! |
|
1891 |
||
3007 | 1892 |
-> anObject |
1893 |
"return an association with the receiver as key and |
|
1894 |
the argument as value" |
|
1895 |
||
1896 |
^ Association key:self value:anObject |
|
1897 |
! |
|
1898 |
||
783 | 1899 |
asValue |
1900 |
"return a valueHolder for for the receiver" |
|
1901 |
||
1902 |
^ ValueHolder with:self |
|
1903 |
! ! |
|
1904 |
||
1905 |
!Object methodsFor:'copying'! |
|
1906 |
||
1907 |
copy |
|
1908 |
"return a copy of the receiver - defaults to shallowcopy here. |
|
1909 |
Notice, that copy does not copy dependents." |
|
1910 |
||
1911 |
^ self shallowCopy postCopy |
|
1912 |
! |
|
1913 |
||
1914 |
deepCopy |
|
1915 |
"return a copy of the object with all subobjects also copied. |
|
1916 |
This method DOES handle cycles/self-refs; however the receivers |
|
1917 |
class is not copied (to avoid the 'total' copy). |
|
1918 |
This deepCopy is a bit slower than the old (unsecure) one, since it |
|
1919 |
keeps track of already copied objects. If you are sure, that your |
|
1129 | 1920 |
copied object does not include duplicates (or you do not care) and |
783 | 1921 |
no cycles, you can use the old simpleDeepCopy, which avoids this overhead, |
1922 |
but may run into trouble. |
|
1923 |
Notice, that copy does not copy dependents." |
|
1924 |
||
1925 |
^ self deepCopyUsing:(IdentityDictionary new) |
|
1926 |
||
1927 |
"an example which is not handled by the old deepCopy: |
|
1928 |
||
1929 |
|a| |
|
1930 |
a := Array new:3. |
|
1931 |
a at:3 put:a. |
|
1932 |
a deepCopy inspect |
|
1933 |
" |
|
1129 | 1934 |
|
1935 |
"Modified: 27.3.1996 / 16:31:20 / stefan" |
|
783 | 1936 |
! |
1937 |
||
1938 |
deepCopyError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1939 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1940 |
|
783 | 1941 |
"raise a signal, that deepCopy is not allowed for this object" |
1942 |
||
1943 |
^ DeepCopyErrorSignal raise |
|
1944 |
! |
|
1945 |
||
1946 |
deepCopyUsing:aDictionary |
|
1947 |
"a helper for deepCopy; return a copy of the object with |
|
1948 |
all subobjects also copied. If the to-be-copied object is in the dictionary, |
|
1949 |
use the value found there. The class of the receiver is not copied. |
|
1950 |
This method DOES handle cycles/self references." |
|
1951 |
||
1952 |
|myClass aCopy |
|
1953 |
sz "{ Class: SmallInteger }" |
|
1954 |
iOrig iCopy| |
|
1955 |
||
1956 |
myClass := self class. |
|
1957 |
myClass isVariable ifTrue:[ |
|
1958 |
sz := self basicSize. |
|
1959 |
aCopy := myClass basicNew:sz. |
|
1960 |
] ifFalse:[ |
|
1961 |
sz := 0. |
|
1962 |
aCopy := myClass basicNew |
|
1963 |
]. |
|
1964 |
aCopy setHashFrom:self. |
|
1965 |
||
1966 |
aDictionary at:self put:aCopy. |
|
143 | 1967 |
|
1968 |
" |
|
783 | 1969 |
copy indexed instvars - if any |
1970 |
" |
|
1971 |
sz ~~ 0 ifTrue:[ |
|
1972 |
myClass isBits ifTrue:[ |
|
1973 |
"block-copy indexed instvars" |
|
1974 |
aCopy replaceFrom:1 to:sz with:self startingAt:1 |
|
1975 |
] ifFalse:[ |
|
1976 |
"individual deep copy the indexed variables" |
|
1977 |
1 to:sz do:[:i | |
|
1978 |
iOrig := self basicAt:i. |
|
1979 |
iOrig notNil ifTrue:[ |
|
1980 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
1981 |
iCopy := aDictionary at:iOrig |
|
1982 |
] ifFalse:[ |
|
1983 |
iCopy := iOrig deepCopyUsing:aDictionary. |
|
1984 |
]. |
|
1985 |
aCopy basicAt:i put:iCopy |
|
1986 |
] |
|
1987 |
] |
|
1988 |
] |
|
1989 |
]. |
|
1990 |
||
1991 |
" |
|
1992 |
copy the instance variables |
|
1993 |
" |
|
1994 |
sz := myClass instSize. |
|
1995 |
sz ~~ 0 ifTrue:[ |
|
1996 |
1 to:sz do:[:i | |
|
1997 |
iOrig := self instVarAt:i. |
|
1998 |
iOrig notNil ifTrue:[ |
|
1999 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
2000 |
iCopy := aDictionary at:iOrig |
|
2001 |
] ifFalse:[ |
|
2002 |
iCopy := iOrig deepCopyUsing:aDictionary. |
|
2003 |
]. |
|
2004 |
aCopy instVarAt:i put:iCopy |
|
2005 |
] |
|
2006 |
]. |
|
2007 |
]. |
|
2008 |
||
2009 |
^ aCopy |
|
2010 |
! |
|
2011 |
||
2012 |
postCopy |
|
2013 |
"this is for compatibility with ST-80 code, which uses postCopy for |
|
2014 |
cleanup after copying, while ST/X passes the original in postCopyFrom: |
|
2015 |
(see there)" |
|
2016 |
||
2017 |
^ self |
|
2018 |
! |
|
2019 |
||
2020 |
setHashFrom:anObject |
|
2021 |
"set my identity-hash key to be the same as anObjects hash key. |
|
2022 |
This is an ST/X speciality, which is NOT available in other (especially OT based) |
|
2023 |
Smalltalks, and may not be available in future ST/X versions. |
|
2024 |
DO NEVER use this for normal application code." |
|
2025 |
||
2026 |
%{ /* NOCONTEXT */ |
|
2027 |
||
2028 |
REGISTER unsigned h; |
|
2029 |
||
2030 |
if (__isNonNilObject(self) && __isNonNilObject(anObject)) { |
|
2031 |
h = __GET_HASH(anObject); |
|
2032 |
__SET_HASH(self, h); |
|
2033 |
RETURN (self); |
|
2034 |
} |
|
2647 | 2035 |
%}. |
783 | 2036 |
self primitiveFailed "neither receiver not arg may be nil or SmallInteger" |
2037 |
! |
|
2038 |
||
2039 |
shallowCopy |
|
2040 |
"return a copy of the object with shared subobjects (a shallow copy) |
|
2041 |
i.e. the copy shares referenced instvars with its original." |
|
2042 |
||
2647 | 2043 |
%{ /* NOCONTEXT */ |
2044 |
int ninsts, spc; |
|
2045 |
int sz; |
|
3066 | 2046 |
OBJ theCopy; |
2647 | 2047 |
OBJ cls; |
2048 |
int flags; |
|
2049 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2050 |
cls = __qClass(self); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2051 |
flags = __intVal(__ClassInstPtr(cls)->c_flags); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2052 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2053 |
/* |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2054 |
* bail out for special objects .. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2055 |
*/ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2056 |
if (((flags & ~ARRAYMASK) == 0) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2057 |
&& ((flags & ARRAYMASK) != WKPOINTERARRAY)) { |
2652 | 2058 |
sz = __qSize(self); |
3078 | 2059 |
__PROTECT__(self); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2060 |
__qNew(theCopy, sz); /* OBJECT ALLOCATION */ |
3078 | 2061 |
__UNPROTECT__(self); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2062 |
if (theCopy) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2063 |
cls = __qClass(self); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2064 |
spc = __qSpace(theCopy); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2065 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2066 |
theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2067 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2068 |
sz = sz - OHDR_SIZE; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2069 |
if (sz) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2070 |
char *src, *dst; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2071 |
|
3066 | 2072 |
src = (char *)(__InstPtr(self)->i_instvars); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2073 |
dst = (char *)(__InstPtr(theCopy)->i_instvars); |
2647 | 2074 |
#ifdef bcopy4 |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2075 |
{ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2076 |
/* care for odd-number of longs */ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2077 |
int nW = sz >> 2; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2078 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2079 |
if (sz & 3) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2080 |
nW++; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2081 |
} |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2082 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2083 |
bcopy4(src, dst, nW); |
2647 | 2084 |
} |
2085 |
#else |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2086 |
bcopy(src, dst, sz); |
2647 | 2087 |
#endif |
2088 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2089 |
flags &= ARRAYMASK; |
2652 | 2090 |
if (flags == POINTERARRAY) { |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2091 |
ninsts = __BYTES2OBJS__(sz); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2092 |
} else { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2093 |
ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2094 |
} |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2095 |
if (ninsts) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2096 |
do { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2097 |
OBJ el; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2098 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2099 |
el = __InstPtr(theCopy)->i_instvars[ninsts-1]; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2100 |
__STORE_SPC(theCopy, el, spc); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2101 |
} while (--ninsts); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2102 |
} |
2647 | 2103 |
} |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2104 |
RETURN (theCopy); |
2647 | 2105 |
} |
2106 |
} |
|
2107 |
%}. |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2108 |
"/ fallBack for special objects & memoryAllocation failure case |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2109 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2110 |
^ self slowShallowCopy |
783 | 2111 |
! |
2112 |
||
2113 |
shallowCopyForFinalization |
|
2114 |
"this is used to aquire a copy to be used for finalization - |
|
2115 |
(the copy will get a dispose-notification; see the documentation in the Registry class) |
|
2116 |
This method can be redefined for more efficient copying - especially for large objects." |
|
2117 |
||
2118 |
^ self shallowCopy |
|
2119 |
! |
|
2120 |
||
2121 |
simpleDeepCopy |
|
2122 |
"return a copy of the object with all subobjects also copied. |
|
2123 |
This method does NOT handle cycles - but is included to allow this |
|
2124 |
slightly faster copy in situations where it is known that |
|
2125 |
no recursive references occur (LargeIntegers for example). |
|
2126 |
NOTICE: you will run into trouble, when trying this with recursive |
|
2127 |
objects (usually recursionInterrupt or memory-alert). |
|
2128 |
This method corresponds to the 'traditional' deepCopy found in |
|
2129 |
the Blue book." |
|
2130 |
||
2131 |
|myClass aCopy |
|
2132 |
sz "{ Class: SmallInteger }" | |
|
2133 |
||
2134 |
myClass := self class. |
|
2135 |
myClass isVariable ifTrue:[ |
|
2136 |
sz := self basicSize. |
|
2137 |
aCopy := myClass basicNew:sz. |
|
2138 |
||
2139 |
"copy the indexed variables" |
|
2140 |
1 to:sz do:[:i | |
|
2141 |
aCopy basicAt:i put:((self basicAt:i) simpleDeepCopy) |
|
2142 |
] |
|
2143 |
] ifFalse:[ |
|
2144 |
aCopy := myClass basicNew |
|
2145 |
]. |
|
2146 |
||
2147 |
"copy the instance variables" |
|
2148 |
sz := myClass instSize. |
|
2149 |
1 to:sz do:[:i | |
|
2150 |
aCopy instVarAt:i put:((self instVarAt:i) simpleDeepCopy) |
|
2151 |
]. |
|
2152 |
||
2153 |
^ aCopy |
|
2154 |
||
2155 |
"a bad example (but ST/X should survive ...)" |
|
2156 |
" |
|
2157 |
|a| |
|
2158 |
a := Array new:3. |
|
2159 |
a at:3 put:a. |
|
2160 |
a simpleDeepCopy |
|
2161 |
" |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2162 |
! |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2163 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2164 |
slowShallowCopy |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2165 |
"return a copy of the object with shared subobjects (a shallow copy) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2166 |
i.e. the copy shares referenced instvars with its original. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2167 |
This method is only invoked as a fallback from #shallowCopy." |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2168 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2169 |
|myClass aCopy |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2170 |
sz "{ Class: SmallInteger }" | |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2171 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2172 |
myClass := self class. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2173 |
myClass isVariable ifTrue:[ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2174 |
sz := self basicSize. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2175 |
aCopy := myClass basicNew:sz. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2176 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2177 |
"copy the indexed variables" |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2178 |
1 to:sz do:[:i | |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2179 |
aCopy basicAt:i put:(self basicAt:i) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2180 |
] |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2181 |
] ifFalse:[ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2182 |
aCopy := myClass basicNew |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2183 |
]. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2184 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2185 |
"copy the instance variables" |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2186 |
sz := myClass instSize. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2187 |
1 to:sz do:[:i | |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2188 |
aCopy instVarAt:i put:(self instVarAt:i) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2189 |
]. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2190 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2191 |
^ aCopy |
783 | 2192 |
! ! |
2193 |
||
2194 |
!Object methodsFor:'debugging'! |
|
2195 |
||
2196 |
basicInspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2197 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2198 |
|
783 | 2199 |
"launch an inspector on the receiver. |
2200 |
this method should NOT be redefined in subclasses." |
|
2201 |
||
2202 |
Inspector isNil ifTrue:[ |
|
2647 | 2203 |
" |
2204 |
for systems without GUI |
|
2205 |
" |
|
2206 |
Transcript showCR:'no Inspector' |
|
783 | 2207 |
] ifFalse:[ |
2647 | 2208 |
Inspector openOn:self |
783 | 2209 |
] |
1417 | 2210 |
|
2211 |
"Modified: 18.5.1996 / 15:43:25 / cg" |
|
783 | 2212 |
! |
2213 |
||
2214 |
inspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2215 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2216 |
|
783 | 2217 |
"launch an inspector on the receiver. |
2218 |
this method (or better: inspectorClass) can be redefined in subclasses |
|
2219 |
to start special inspectors." |
|
2220 |
||
2221 |
|cls| |
|
2222 |
||
2223 |
cls := self inspectorClass. |
|
2224 |
cls isNil ifTrue:[ |
|
2225 |
^ self basicInspect |
|
2226 |
]. |
|
2227 |
cls openOn:self |
|
2228 |
||
2229 |
" |
|
2230 |
Object new inspect |
|
2231 |
(1 @ 2) inspect |
|
2232 |
Smalltalk inspect |
|
2233 |
#(1 2 3) asOrderedCollection inspect |
|
2234 |
(Color red) inspect |
|
2235 |
(Image fromFile:'bitmaps/garfield.gif') inspect |
|
143 | 2236 |
" |
71 | 2237 |
! |
2238 |
||
783 | 2239 |
inspectorClass |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2240 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2241 |
|
783 | 2242 |
"return the class to use for inspect. |
2243 |
Can (should) be redefined in classes for which a better inspector is available" |
|
2244 |
||
2245 |
^ Inspector |
|
2246 |
! |
|
2247 |
||
2248 |
mustBeKindOf:aClass |
|
2249 |
"for compatibility & debugging support: |
|
2250 |
check if the receiver isKindOf:aClass and raise an error if not. |
|
2251 |
Notice: |
|
2252 |
it is VERY questionable, if it makes sense to add manual |
|
2253 |
type checks to a dynamically typed language like smalltalk. |
|
2254 |
It will, at least, slow down performance, |
|
2255 |
make your code less reusable and clutter your code with stupid sends |
|
2256 |
of this selector. Also, read the comment in isKindOf:, regarding the |
|
2257 |
use of isXXX check methods. |
|
2258 |
You see: The author does not like this at all ..." |
|
2259 |
||
2260 |
(self isKindOf:aClass) ifFalse:[ |
|
2261 |
self error:'argument is not of expected type' |
|
2262 |
] |
|
2263 |
! |
|
2264 |
||
2265 |
obsoleteMethodWarning |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2266 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2267 |
|
783 | 2268 |
"in methods which are going to be obsoleted, a self send to |
2269 |
this method is used to tell programmers that a method is |
|
2270 |
used which is going to be removed in later ST/X versions. |
|
2271 |
Find all methods which will be obsolete soon by looking at senders |
|
2272 |
of this message. |
|
2273 |
Hopefully, this warning message is annoying enough for you to |
|
2274 |
change the code ... ;-)" |
|
2275 |
||
2276 |
self obsoleteMethodWarning:nil from:thisContext sender |
|
2277 |
! |
|
2278 |
||
2279 |
obsoleteMethodWarning:message |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2280 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2281 |
|
783 | 2282 |
"in methods which are going to be obsoleted, a self send to |
2283 |
this method is used to tell programmers that a method is |
|
2284 |
used which is going to be removed in later ST/X versions. |
|
2285 |
Find all methods which will be obsolete soon by looking at senders |
|
2286 |
of this message. |
|
2287 |
Hopefully, this warning message is annoying enough for you to |
|
2288 |
change the code ... ;-)" |
|
2289 |
||
2290 |
self obsoleteMethodWarning:message from:thisContext sender |
|
2291 |
! |
|
2292 |
||
2293 |
obsoleteMethodWarning:message from:aContext |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2294 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2295 |
|
783 | 2296 |
"in methods which are going to be obsoleted, a self-send to |
2297 |
this method is used to tell programmers that a method is |
|
2298 |
used which is going to be removed in later ST/X versions. |
|
2299 |
Find all methods which will be obsolete soon by looking at senders |
|
2300 |
of this message. |
|
2301 |
Hopefully, this warning message is annoying enough for you to |
|
2302 |
change the code ... ;-)" |
|
2303 |
||
2304 |
|spec| |
|
2305 |
||
2306 |
spec := aContext methodPrintString. |
|
2136 | 2307 |
('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR. |
2308 |
(' And may not be present in future ST/X versions.') errorPrintCR. |
|
2309 |
(' called from ' , aContext sender printString) errorPrintCR. |
|
783 | 2310 |
message notNil ifTrue:[ |
2647 | 2311 |
'------> ' errorPrint. message errorPrintCR |
783 | 2312 |
] |
2313 |
||
2314 |
" |
|
2315 |
Object obsoleteMethodWarning:'foo' from:thisContext sender sender |
|
2316 |
" |
|
2136 | 2317 |
|
2318 |
"Modified: 10.1.1997 / 19:08:42 / cg" |
|
783 | 2319 |
! ! |
2320 |
||
2321 |
!Object methodsFor:'dependents access'! |
|
2322 |
||
2323 |
addDependent:anObject |
|
2324 |
"make the argument, anObject be a dependent of the receiver" |
|
2325 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2326 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2327 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2328 |
"/ must do this save from interrupts, since the dependents collection |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2329 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2330 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2331 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2332 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2333 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2334 |
[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2335 |
|deps dep| |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2336 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2337 |
deps := self dependents. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2338 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2339 |
"/ to save a fair amount of memory in case of |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2340 |
"/ many dependencies, we store a single dependent in |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2341 |
"/ a WeakArray, and switch to a WeakSet if more dependents are |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2342 |
"/ added. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2343 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2344 |
(deps isNil or:[deps size == 0]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2345 |
self dependents:(WeakArray with:anObject) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2346 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2347 |
deps class == WeakArray ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2348 |
dep := deps at:1. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2349 |
dep ~~ anObject ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2350 |
(dep isNil or:[dep == 0]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2351 |
deps at:1 put:anObject |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2352 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2353 |
self dependents:(WeakIdentitySet with:dep with:anObject) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2354 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2355 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2356 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2357 |
deps add:anObject |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2358 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2359 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2360 |
] valueNowOrOnUnwindDo:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2361 |
wasBlocked ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2362 |
OperatingSystem unblockInterrupts |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2363 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2364 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2365 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2366 |
"Modified: / 27.10.1997 / 19:35:52 / cg" |
783 | 2367 |
! |
2368 |
||
3309
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2369 |
breakDependents |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2370 |
"remove all dependencies from the receiver" |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2371 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2372 |
self dependents:nil. |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2373 |
self nonWeakDependents:nil |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2374 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2375 |
"Modified: / 19.4.1996 / 10:55:36 / cg" |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2376 |
"Created: / 27.2.1998 / 11:26:11 / stefan" |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2377 |
! |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2378 |
|
783 | 2379 |
dependents |
3222 | 2380 |
"return a Collection of dependents. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2381 |
The default implementation here uses a global WeakDictionary to store |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2382 |
dependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2383 |
This may be too slow for high frequency change&update, |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2384 |
therefore, some classes (Model) redefine this for better performance. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2385 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
783 | 2386 |
|
3222 | 2387 |
|deps| |
2388 |
||
2389 |
(deps := Dependencies at:self ifAbsent:nil) isNil ifTrue:[ |
|
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2390 |
^ #(). |
3222 | 2391 |
]. |
2392 |
^ deps |
|
2393 |
||
2394 |
"Modified: / 26.1.1998 / 11:18:15 / cg" |
|
783 | 2395 |
! |
2396 |
||
2397 |
dependents:aCollection |
|
2398 |
"set the collection of dependents. |
|
2399 |
The default implementation here uses a global Dictionary to store |
|
2400 |
dependents which may be too slow for high frequency change&update. |
|
2401 |
Therefore, some classes (Model) redefine this for better performance." |
|
2402 |
||
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2403 |
"/ must do this save from interrupts, since the dependents collection |
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2404 |
"/ is possibly accessed from multiple threads. |
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2405 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
2336 | 2406 |
"/ faster execution (and to avoid creation of garbage blocks). |
2407 |
||
2408 |
(OperatingSystem blockInterrupts) ifTrue:[ |
|
2647 | 2409 |
"/ the common case - already blocked |
2410 |
||
2411 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
|
2412 |
Dependencies removeKey:self ifAbsent:[] |
|
2413 |
] ifFalse:[ |
|
2414 |
Dependencies at:self put:aCollection |
|
2415 |
]. |
|
2416 |
^ self |
|
2336 | 2417 |
]. |
2418 |
||
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2419 |
[ |
2647 | 2420 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
2421 |
Dependencies removeKey:self ifAbsent:[] |
|
2422 |
] ifFalse:[ |
|
2423 |
Dependencies at:self put:aCollection |
|
2424 |
]. |
|
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2425 |
] valueNowOrOnUnwindDo:[ |
2647 | 2426 |
OperatingSystem unblockInterrupts |
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2427 |
] |
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2428 |
|
2336 | 2429 |
"Modified: 30.1.1997 / 21:22:10 / cg" |
783 | 2430 |
! |
2431 |
||
2432 |
dependentsDo:aBlock |
|
2433 |
"evaluate aBlock for all of my dependents" |
|
2434 |
||
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2435 |
|deps nwDeps| |
783 | 2436 |
|
2437 |
deps := self dependents. |
|
3222 | 2438 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2439 |
deps do:[:d | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2440 |
(d notNil and:[d ~~ 0]) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2441 |
aBlock value:d |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2442 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2443 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2444 |
]. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2445 |
nwDeps := self nonWeakDependents. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2446 |
(nwDeps ~~ deps and:[nwDeps size ~~ 0]) ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2447 |
nwDeps do:aBlock |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2448 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2449 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2450 |
"Modified: / 30.1.1998 / 14:03:40 / cg" |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2451 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2452 |
|
2445 | 2453 |
myDependents |
2454 |
"same as dependents - ST-80 compatibility" |
|
2455 |
||
2456 |
^ self dependents |
|
2457 |
! |
|
2458 |
||
783 | 2459 |
release |
3309
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2460 |
"remove all references to objects that may refer to self. |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2461 |
Subclasses may redefine this method but should do a 'super release'." |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2462 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2463 |
self breakDependents |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2464 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2465 |
"Modified: / 27.2.1998 / 11:29:35 / stefan" |
783 | 2466 |
! |
2467 |
||
2468 |
removeDependent:anObject |
|
2469 |
"make the argument, anObject be independent of the receiver" |
|
2470 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2471 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2472 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2473 |
"/ must do this save from interrupts, since the dependents collection |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2474 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2475 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2476 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2477 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2478 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2479 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2480 |
|deps n d| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2481 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2482 |
deps := self dependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2483 |
deps size ~~ 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2484 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2485 |
"/ to save a fair amount of memory in case of |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2486 |
"/ many dependencies, we store a single dependent in |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2487 |
"/ a WeakArray, and switch to a WeakSet if more dependents are |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2488 |
"/ added. Here we have to do the inverse ... |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2489 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2490 |
deps class == WeakArray ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2491 |
((d := deps at:1) == anObject |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2492 |
or:[d isNil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2493 |
or:[d == 0]]) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2494 |
self dependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2495 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2496 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2497 |
deps remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2498 |
(n := deps size) == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2499 |
self dependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2500 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2501 |
n == 1 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2502 |
d := deps firstIfEmpty:nil. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2503 |
d notNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2504 |
deps := WeakArray with:d |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2505 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2506 |
deps := nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2507 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2508 |
self dependents:deps. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2509 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2510 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2511 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2512 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2513 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2514 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2515 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2516 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2517 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2518 |
|
3228
b6b893e8f898
must look for size of value returned by self dependents
Claus Gittinger <cg@exept.de>
parents:
3222
diff
changeset
|
2519 |
"Modified: / 26.1.1998 / 19:51:50 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2520 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2521 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2522 |
!Object methodsFor:'dependents access (nonWeak)'! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2523 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2524 |
addNonWeakDependent:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2525 |
"make the argument, anObject be a nonWeak dependent of the receiver. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2526 |
Be careful: this nonWeakDependency will prevent the dependent from being |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2527 |
garbage collected unless the dependency is removed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2528 |
This is a private mechanism, for directed dependencies." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2529 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2530 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2531 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2532 |
"/ must do this save from interrupts, since the dependents collection |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2533 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2534 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2535 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2536 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2537 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2538 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2539 |
|deps dep| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2540 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2541 |
deps := self nonWeakDependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2542 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2543 |
"/ to save a fair amount of memory in case of |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2544 |
"/ many dependencies, we store a single dependent in |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2545 |
"/ an Array, and switch to a Set if more dependents are |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2546 |
"/ added. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2547 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2548 |
deps size == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2549 |
self nonWeakDependents:(Array with:anObject) |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2550 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2551 |
deps class == Array ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2552 |
dep := deps at:1. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2553 |
dep ~~ anObject ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2554 |
self nonWeakDependents:(IdentitySet with:dep with:anObject) |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2555 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2556 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2557 |
deps add:anObject |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2558 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2559 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2560 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2561 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2562 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2563 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2564 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2565 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2566 |
"Created: / 19.4.1996 / 10:54:08 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2567 |
"Modified: / 30.1.1998 / 14:03:08 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2568 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2569 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2570 |
nonWeakDependents |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2571 |
"return a Collection of nonWeakDependents - empty if there is none. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2572 |
This is a private mechanism for directed dependencies." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2573 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2574 |
NonWeakDependencies isNil ifTrue:[^ #()]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2575 |
^ NonWeakDependencies at:self ifAbsent:#() |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2576 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2577 |
"Created: / 19.4.1996 / 10:55:06 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2578 |
"Modified: / 30.1.1998 / 14:06:47 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2579 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2580 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2581 |
nonWeakDependents:aCollection |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2582 |
"set the collection of nonWeak dependents. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2583 |
This is a private helper for directed dependencies." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2584 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2585 |
[ |
2647 | 2586 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
2587 |
NonWeakDependencies removeKey:self ifAbsent:[] |
|
2588 |
] ifFalse:[ |
|
2589 |
NonWeakDependencies at:self put:aCollection |
|
2590 |
] |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2591 |
] valueUninterruptably |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2592 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2593 |
"Created: 19.4.1996 / 11:07:47 / cg" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2594 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2595 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2596 |
removeNonWeakDependent:anObject |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2597 |
"remove a nonWeak dependency from the receiver to the argument, anObject. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2598 |
(i.e. make it independent of the receiver)" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2599 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2600 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2601 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2602 |
"/ must do this save from interrupts, since the dependents collection |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2603 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2604 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2605 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2606 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2607 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2608 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2609 |
|deps n| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2610 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2611 |
deps := self nonWeakDependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2612 |
deps size ~~ 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2613 |
deps class == Array ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2614 |
(deps at:1) == anObject ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2615 |
self nonWeakDependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2616 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2617 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2618 |
deps remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2619 |
(n := deps size) == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2620 |
self nonWeakDependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2621 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2622 |
n == 1 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2623 |
self nonWeakDependents:(Array with:(deps first)) |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2624 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2625 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2626 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2627 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2628 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2629 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2630 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2631 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2632 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2633 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2634 |
"Created: / 19.4.1996 / 11:44:44 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2635 |
"Modified: / 30.1.1998 / 14:04:01 / cg" |
783 | 2636 |
! ! |
2637 |
||
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2638 |
!Object methodsFor:'displaying'! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2639 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2640 |
displayOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2641 |
"ST-80 Compatibility |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2642 |
display the receiver in a graphicsContext at 0@0 |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2643 |
- this method allows for any object to be displayed in some view |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2644 |
(although the fallBack is to display its printString ...)" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2645 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2646 |
^ self displayOn:aGC x:0 y:0. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2647 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2648 |
"Created: 29.5.1996 / 16:28:58 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2649 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2650 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2651 |
displayOn:aGC at:aPoint |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2652 |
"ST-80 Compatibility |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2653 |
display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2654 |
for any object to be displayed in a ListView - for example." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2655 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2656 |
^ self displayOn:aGC x:(aPoint x) y:(aPoint y). |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2657 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2658 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2659 |
displayOn:aGC x:x y:y |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2660 |
"display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2661 |
for any object to be displayed in a ListView - for example." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2662 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2663 |
self displayOn:aGC x:x y:y opaque:false |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2664 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2665 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2666 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2667 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2668 |
displayOn:aGc x:x y:y opaque:opaque |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2669 |
"display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2670 |
for any object to be displayed in a ListView - for example. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2671 |
The fallBack here shows the receivers displayString." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2672 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2673 |
|s| |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2674 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2675 |
s := self displayString. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2676 |
opaque ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2677 |
aGc displayOpaqueString:s x:x y:y. |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2678 |
] ifFalse:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2679 |
aGc displayString:s x:x y:y. |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2680 |
]. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2681 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2682 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2683 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2684 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2685 |
displayOpaqueOn:aGC x:x y:y |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2686 |
"display the receiver in a graphicsContext - this method allows |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2687 |
for any object to be displayed in a ListView - for example." |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2688 |
|
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2689 |
self displayOn:aGC x:x y:y opaque:true |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2690 |
|
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2691 |
"Modified: / 29.5.1996 / 16:29:38 / cg" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2692 |
"Created: / 26.10.1997 / 15:01:36 / cg" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2693 |
! |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2694 |
|
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2695 |
displayString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2696 |
"return a string used when displaying the receiver in a view; |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2697 |
for example an Inspector. This is usually the same as printString, |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2698 |
but sometimes redefined for a better look." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2699 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2700 |
^ self printString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2701 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2702 |
" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2703 |
#(1 2 3) printString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2704 |
#(1 2 3) displayString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2705 |
#(1 2 3) storeString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2706 |
" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2707 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2708 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2709 |
heightOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2710 |
"return the height of the receiver, if it is to be displayed on aGC" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2711 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2712 |
^ (aGC font on:aGC device) heightOf:(self displayString) |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2713 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2714 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2715 |
widthOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2716 |
"return the width of the receiver, if it is to be displayed on aGC" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2717 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2718 |
^ (aGC font on:aGC device) widthOf:(self displayString) |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2719 |
! ! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2720 |
|
783 | 2721 |
!Object methodsFor:'error handling'! |
2722 |
||
2723 |
appropriateDebugger:aSelector |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2724 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2725 |
|
783 | 2726 |
"return an appropriate debugger to use. |
2727 |
If there is already a debugger active on the stack, and it is |
|
2728 |
the DebugView, return MiniDebugger (as a last chance) otherwise abort." |
|
2729 |
||
2730 |
|context| |
|
2731 |
||
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2732 |
"DebugView cannot run without system processes" |
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2733 |
|
1685 | 2734 |
(Processor isNil |
1684 | 2735 |
or:[Processor activeProcessIsSystemProcess]) ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2736 |
^ MiniDebugger |
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2737 |
]. |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2738 |
Smalltalk isInitialized ifFalse:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2739 |
^ MiniDebugger |
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2740 |
]. |
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2741 |
|
783 | 2742 |
context := thisContext. |
2893 | 2743 |
context := context findNextContextWithSelector:aSelector or:nil or:nil. |
783 | 2744 |
[context notNil] whileTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2745 |
((context receiver class == Debugger) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2746 |
and:[context selector == aSelector]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2747 |
"we are already in some Debugger" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2748 |
(Debugger == MiniDebugger) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2749 |
"we are already in the MiniDebugger" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2750 |
ErrorRecursion ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2751 |
Smalltalk fatalAbort:'recursive error ...' |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2752 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2753 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2754 |
MiniDebugger isNil ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2755 |
Smalltalk fatalAbort:'no debugger' |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2756 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2757 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2758 |
"ok, an error occured while in the graphical debugger; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2759 |
lets try MiniDebugger" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2760 |
^ MiniDebugger |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2761 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2762 |
context := context findNextContextWithSelector:aSelector or:nil or:nil. |
71 | 2763 |
]. |
783 | 2764 |
"not within Debugger - no problem" |
2765 |
^ Debugger |
|
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2766 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2767 |
"Modified: / 23.9.1996 / 12:14:52 / stefan" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2768 |
"Modified: / 27.10.1997 / 19:22:10 / cg" |
783 | 2769 |
! |
2770 |
||
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2771 |
cannotSendMessage:aMessage to:someReceiver |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2772 |
"this message is sent by the runtime system (VM), |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2773 |
when a message is sent to some object, whose class is not |
2231 | 2774 |
a valid behavior (see documentation in Behavior)." |
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2775 |
|
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2776 |
^ InternalErrorSignal |
2647 | 2777 |
raiseRequestWith:someReceiver |
2778 |
errorString:('bad class in send of #' , aMessage selector) |
|
2231 | 2779 |
|
2780 |
"Modified: 23.1.1997 / 00:05:39 / cg" |
|
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2781 |
! |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2782 |
|
783 | 2783 |
doesNotUnderstand:aMessage |
2784 |
"this message is sent by the runtime system (VM) when |
|
2785 |
a message is not understood by some object (i.e. there |
|
2786 |
is no method for that selector). The original message has |
|
2787 |
been packed into aMessage (i.e. the receiver, selector and |
|
2788 |
any arguments) and the original receiver is then sent the |
|
2789 |
#doesNotUnderstand: message. |
|
2790 |
Here, we raise another signal which usually enters the debugger. |
|
2791 |
You can of course redefine #doesNotUnderstand: in your classes |
|
1327 | 2792 |
to implement message delegation, |
2793 |
or handle the MessageNotUnderstoodSignal gracefully." |
|
783 | 2794 |
|
2795 |
|sel errorString cls sender| |
|
2796 |
||
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2797 |
sel := aMessage selector printString. |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2798 |
|
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2799 |
"/ Although sel should always be a symbol, |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2800 |
"/ always use printStrings in the code below. |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2801 |
"/ Non-symbol selector may happen when things go mad in a primitive, |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2802 |
"/ or a method has been called by valueWithReceiver: with a wrong arg. |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2803 |
|
783 | 2804 |
"/ handle the case of an error during early startup |
2805 |
"/ (output streams not yet initialized) |
|
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2806 |
|
783 | 2807 |
Stdout isNil ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2808 |
Smalltalk fatalAbort:'error during init: ' , sel , ' not understood'. |
783 | 2809 |
]. |
2810 |
||
2811 |
"/ |
|
2812 |
"/ extract the class that should have implemented the message. |
|
2813 |
"/ (in case of a super-send, this is not the receivers class) |
|
2814 |
"/ |
|
2815 |
sender := thisContext sender. |
|
2816 |
cls := sender searchClass. |
|
2817 |
cls isNil ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2818 |
"it was NOT a super or directed send ..." |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2819 |
cls := self class |
783 | 2820 |
]. |
2821 |
||
2822 |
cls notNil ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2823 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2824 |
"/ displayString is better than 'cls name', |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2825 |
"/ since it appends (obsolete) for outdated classes. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2826 |
"/ (this happens if you send messages to old instances |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2827 |
"/ after changing a classes definition) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2828 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2829 |
errorString := cls displayString. |
783 | 2830 |
] ifFalse:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2831 |
errorString := '(** nil-class **)' |
783 | 2832 |
]. |
2833 |
errorString := errorString , ' does not understand: ' , sel. |
|
2834 |
||
2835 |
"/ |
|
2836 |
"/ this only happens, when YOU play around with my classvars ... |
|
1327 | 2837 |
"/ (or an error occurs during very early startup, when signals are not yet set) |
783 | 2838 |
"/ |
2839 |
MessageNotUnderstoodSignal isNil ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2840 |
^ self |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2841 |
enterDebuggerWithMessage:'oops - MessageNotUnderstoodSignal is gone' |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2842 |
on:thisContext. |
783 | 2843 |
]. |
2844 |
||
2845 |
"/ |
|
2846 |
"/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger |
|
2847 |
"/ |
|
2848 |
^ MessageNotUnderstoodSignal |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2849 |
raiseRequestWith:aMessage |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2850 |
errorString:errorString |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2851 |
in:sender |
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2852 |
|
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2853 |
"Modified: 31.7.1997 / 17:04:49 / cg" |
783 | 2854 |
! |
2855 |
||
2856 |
elementBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2857 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2858 |
|
1345 | 2859 |
"report an error that badElement is out of bounds |
2860 |
(i.e. cannot be put into that collection). |
|
2861 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 2862 |
|
2863 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 2864 |
|
2865 |
"Modified: 8.5.1996 / 09:12:45 / cg" |
|
783 | 2866 |
! |
2867 |
||
2868 |
elementNotCharacter |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2869 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2870 |
|
1345 | 2871 |
"report an error that object to be stored is no Character. |
2872 |
(usually when storing into Strings). |
|
2873 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 2874 |
|
2875 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 2876 |
|
2877 |
"Modified: 8.5.1996 / 09:12:49 / cg" |
|
783 | 2878 |
! |
2879 |
||
2880 |
elementNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2881 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2882 |
|
1345 | 2883 |
"report an error that object to be stored is not Integer. |
2884 |
(in collections that store integers only). |
|
2885 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 2886 |
|
2887 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 2888 |
|
2889 |
"Modified: 8.5.1996 / 09:12:51 / cg" |
|
783 | 2890 |
! |
2891 |
||
2892 |
enterDebuggerWith:anException message:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2893 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2894 |
|
783 | 2895 |
"enter the debugger with error-message aString" |
2896 |
||
1674 | 2897 |
^ self |
2898 |
enterDebuggerWithMessage:aString |
|
2899 |
on:anException suspendedContext |
|
2900 |
! |
|
2901 |
||
2902 |
enterDebuggerWithMessage:aString on:aContext |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2903 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2904 |
|
783 | 2905 |
"enter the debugger with error-message aString. |
2906 |
The first visible context shown there is aContext |
|
2907 |
(this allows intermediate helpers to hide themselfes from what is |
|
2908 |
presented to the user)" |
|
2909 |
||
1094
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2910 |
|debugger msg| |
71 | 2911 |
|
2912 |
" |
|
783 | 2913 |
if there is no debugger, exit smalltalk |
2914 |
" |
|
2915 |
Debugger isNil ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2916 |
msg := 'error: ' , aString. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2917 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2918 |
Smalltalk isStandAloneApp ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2919 |
Dialog notNil ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2920 |
(Dialog |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2921 |
confirm:msg title:(Smalltalk commandName) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2922 |
yesLabel:'ignore' noLabel:'exit' |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2923 |
) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2924 |
^ AbortSignal raise |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2925 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2926 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2927 |
msg errorPrintCR. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2928 |
OperatingSystem exit:1 |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2929 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2930 |
msg errorPrintCR. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2931 |
Smalltalk fatalAbort:'no Debugger defined' |
783 | 2932 |
]. |
983 | 2933 |
|
783 | 2934 |
" |
2935 |
find an appropriate debugger to use |
|
71 | 2936 |
" |
783 | 2937 |
debugger := self appropriateDebugger:#'enter:withMessage:'. |
2773 | 2938 |
debugger isNil ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2939 |
^ AbortSignal raise |
2773 | 2940 |
]. |
783 | 2941 |
^ debugger enter:aContext withMessage:aString. |
1094
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2942 |
|
2773 | 2943 |
"Modified: 24.7.1997 / 10:09:20 / cg" |
783 | 2944 |
! |
2945 |
||
2946 |
error |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2947 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2948 |
|
1345 | 2949 |
"report error that an error occured. |
2950 |
The error is reported by raising the ErrorSignal exception." |
|
2951 |
||
2952 |
^ ErrorSignal raiseIn:thisContext sender |
|
2953 |
||
2954 |
"Modified: 8.5.1996 / 09:13:01 / cg" |
|
783 | 2955 |
! |
2956 |
||
2957 |
error:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2958 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2959 |
|
1345 | 2960 |
"enter debugger with error-message aString. |
2961 |
The error is reported by raising the ErrorSignal exception." |
|
783 | 2962 |
|
2963 |
^ ErrorSignal raiseRequestWith:#error: |
|
2647 | 2964 |
errorString:aString |
2965 |
in:thisContext sender |
|
1345 | 2966 |
|
2967 |
"Modified: 8.5.1996 / 09:13:04 / cg" |
|
2968 |
! |
|
2969 |
||
2970 |
error:aString in:aContext |
|
2971 |
"{ Pragma: +optSpace }" |
|
2972 |
||
2973 |
"enter debugger with error-message aString. |
|
2974 |
The error is reported by raising the ErrorSignal exception." |
|
2975 |
||
2976 |
^ ErrorSignal raiseRequestWith:#error: |
|
2647 | 2977 |
errorString:aString |
2978 |
in:aContext |
|
1345 | 2979 |
|
2980 |
"Created: 8.5.1996 / 09:07:59 / cg" |
|
2981 |
"Modified: 8.5.1996 / 09:13:06 / cg" |
|
783 | 2982 |
! |
2983 |
||
2984 |
errorKeyNotFound:aKey |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2985 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2986 |
|
1345 | 2987 |
"report an error that a key was not found in a collection. |
2988 |
The error is reported by raising the KeyNotFoundSignal exception." |
|
783 | 2989 |
|
2990 |
^ KeyNotFoundSignal raiseRequestWith:aKey in:thisContext sender |
|
1345 | 2991 |
|
2992 |
"Modified: 8.5.1996 / 09:13:08 / cg" |
|
783 | 2993 |
! |
2994 |
||
2995 |
errorNotFound |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2996 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2997 |
|
1345 | 2998 |
"report an error that no element was found in a collection. |
2999 |
The error is reported by raising the NotFoundSignal exception." |
|
783 | 3000 |
|
3001 |
^ NotFoundSignal raiseIn:thisContext sender |
|
1345 | 3002 |
|
3003 |
"Modified: 8.5.1996 / 09:13:11 / cg" |
|
783 | 3004 |
! |
3005 |
||
3006 |
halt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3007 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3008 |
|
1345 | 3009 |
"enter debugger with halt-message. |
3010 |
The error is reported by raising the HaltSignal exception." |
|
783 | 3011 |
|
3012 |
^ HaltSignal raiseIn:thisContext sender. |
|
1345 | 3013 |
|
3014 |
"Modified: 8.5.1996 / 09:12:38 / cg" |
|
783 | 3015 |
! |
3016 |
||
3017 |
halt:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3018 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3019 |
|
1345 | 3020 |
"enter debugger with halt-message. |
3021 |
The error is reported by raising the HaltSignal exception." |
|
783 | 3022 |
|
3023 |
^ HaltSignal raiseRequestWith:#halt: |
|
2647 | 3024 |
errorString:aString |
3025 |
in:thisContext sender |
|
1345 | 3026 |
|
3027 |
"Modified: 8.5.1996 / 09:13:23 / cg" |
|
783 | 3028 |
! |
3029 |
||
3030 |
implementedBySubclass |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3031 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3032 |
|
783 | 3033 |
"this is sent by ST/V code - its the same as #subclassResponsibility" |
3034 |
||
3035 |
^ self subclassResponsibility |
|
3036 |
! |
|
3037 |
||
3038 |
indexNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3039 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3040 |
|
1345 | 3041 |
"report an error that index is not an Integer. |
3042 |
(when accessing collections indexed by an integer key). |
|
3043 |
The error is reported by raising the NonIntegerIndexSignal exception." |
|
783 | 3044 |
|
3045 |
^ NonIntegerIndexSignal raiseIn:thisContext sender |
|
1345 | 3046 |
|
3047 |
"Modified: 8.5.1996 / 09:13:37 / cg" |
|
783 | 3048 |
! |
3049 |
||
3050 |
integerCheckError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3051 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3052 |
|
783 | 3053 |
"generated when a variable declared with an integer type gets a bad |
3054 |
value assigned" |
|
3055 |
||
3056 |
^ self error:'bad assign of ' , self printString , |
|
3057 |
' (' , self class name , ') to integer-typed variable' |
|
71 | 3058 |
! |
3059 |
||
2829
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3060 |
invalidCodeObject |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3061 |
"{ Pragma: +optSpace }" |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3062 |
|
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3063 |
self error:'not an executable code object' |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3064 |
|
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3065 |
"Created: 1.8.1997 / 00:16:44 / cg" |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3066 |
! |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3067 |
|
783 | 3068 |
invalidMessage |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3069 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3070 |
|
783 | 3071 |
"this is sent by ST/V code - its the same as #shouldNotImplement" |
3072 |
||
3073 |
^ self shouldNotImplement |
|
3074 |
! |
|
3075 |
||
3076 |
mustBeRectangle |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3077 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3078 |
|
783 | 3079 |
"report an argument-not-rectangle-error" |
3080 |
||
3081 |
^ self error:'argument must be a Rectangle' |
|
3082 |
! |
|
3083 |
||
3084 |
mustBeString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3085 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3086 |
|
783 | 3087 |
"report an argument-not-string-error" |
3088 |
||
3089 |
^ self error:'argument must be a String' |
|
3090 |
! |
|
3091 |
||
3092 |
notIndexed |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3093 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3094 |
|
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3095 |
"report an error that receiver has no indexed instance variables. |
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3096 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3097 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3098 |
^ SubscriptOutOfBoundsSignal |
2647 | 3099 |
raiseErrorString:'receiver has no indexed variables' |
3100 |
in:thisContext sender |
|
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3101 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3102 |
"Modified: 26.7.1996 / 16:43:13 / cg" |
783 | 3103 |
! |
3104 |
||
3105 |
primitiveFailed |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3106 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3107 |
|
1345 | 3108 |
"report an error that some primitive code failed. |
3109 |
The error is reported by raising the PrimitiveFailureSignal exception." |
|
783 | 3110 |
|
3111 |
^ PrimitiveFailureSignal raiseIn:(thisContext sender) |
|
1345 | 3112 |
|
3113 |
"Modified: 8.5.1996 / 09:14:07 / cg" |
|
783 | 3114 |
! |
3115 |
||
3116 |
shouldNotImplement |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3117 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3118 |
|
1345 | 3119 |
"report an error that this message should not be implemented" |
783 | 3120 |
|
3121 |
^ self error:'method not appropriate for this class' |
|
1345 | 3122 |
|
3123 |
"Modified: 8.5.1996 / 09:09:44 / cg" |
|
783 | 3124 |
! |
3125 |
||
3126 |
subclassResponsibility |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3127 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3128 |
|
1345 | 3129 |
"report an error that this message should have been reimplemented in a |
783 | 3130 |
subclass" |
3131 |
||
1345 | 3132 |
^ self error:'method must be reimplemented in subclass' in:thisContext sender |
3133 |
||
3134 |
"Modified: 8.5.1996 / 09:09:26 / cg" |
|
783 | 3135 |
! |
3136 |
||
3137 |
subscriptBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3138 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3139 |
|
1345 | 3140 |
"report an error that some index is out of bounds. |
3141 |
(when accessing indexable collections). |
|
3142 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 3143 |
|
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3144 |
^ SubscriptOutOfBoundsSignal |
2647 | 3145 |
raiseIn:thisContext sender |
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3146 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3147 |
"Modified: 26.7.1996 / 16:45:42 / cg" |
783 | 3148 |
! |
3149 |
||
3150 |
subscriptBoundsError:anIndex |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3151 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3152 |
|
1345 | 3153 |
"report an error that anIndex is out of bounds. |
3154 |
(when accessing indexable collections). |
|
3155 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 3156 |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
3157 |
^ SubscriptOutOfBoundsSignal |
2647 | 3158 |
raiseRequestWith:anIndex |
3159 |
errorString:('subscript (' , anIndex printString , ') out of bounds') |
|
3160 |
in:thisContext sender |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
3161 |
|
1345 | 3162 |
"Modified: 8.5.1996 / 09:14:34 / cg" |
783 | 3163 |
! |
3164 |
||
3165 |
typeCheckError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3166 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3167 |
|
783 | 3168 |
"generated when a variable declared with a type hint gets a bad |
3169 |
value assigned" |
|
3170 |
||
3171 |
^ self error:'bad assign of ' , self printString , |
|
3172 |
' (' , self class name , ') to typed variable' |
|
3173 |
! ! |
|
3174 |
||
3175 |
!Object methodsFor:'evaluation'! |
|
3176 |
||
3177 |
value |
|
1327 | 3178 |
"return the receiver itself. |
3179 |
This allows every object to be used where blocks or valueHolders |
|
3180 |
are typically used, and allows for valueHolders and blocks to be |
|
3181 |
used interchangably in some situations. |
|
3182 |
||
783 | 3183 |
Time will show, if this is a good idea or leads to sloppy programming |
3184 |
style ... (the idea was borrowed from the Self language). |
|
1327 | 3185 |
|
3186 |
WARNING: dont 'optimize' away ifXXX: blocks |
|
2647 | 3187 |
(i.e. do NOT replace |
3188 |
foo ifTrue:[var1] ifFalse:[var2] |
|
3189 |
by: |
|
3190 |
foo ifTrue:var1 ifFalse:var2 |
|
3191 |
) |
|
3192 |
- the compilers will only generate inline code for the if, |
|
3193 |
iff the argument(s) are blocks - otherwise, a true send is |
|
3194 |
generated. |
|
3195 |
This 'oprimization' will work semantically correct, |
|
3196 |
but execute SLOWER instead." |
|
783 | 3197 |
|
3198 |
^ self |
|
71 | 3199 |
|
3200 |
" |
|
1327 | 3201 |
#(1 2 3 4) indexOf:5 ifAbsent:0 |
3202 |
#(1 2 3 4) indexOf:5 ifAbsent:[0] |
|
3203 |
1 > 2 ifTrue:['yes'] ifFalse:['no'] |
|
3204 |
1 > 2 ifTrue:'yes' ifFalse:'no' |
|
783 | 3205 |
" |
3206 |
||
3207 |
"DO NOT DO THIS (its slower) |
|
3208 |
(1 > 4) ifTrue:'oops' ifFalse:'ok' |
|
3209 |
||
3210 |
USE (the compiler optimizes blocks in if/while): |
|
3211 |
(1 > 4) ifTrue:['oops'] ifFalse:['ok'] |
|
3212 |
" |
|
1327 | 3213 |
|
3214 |
"Modified: 3.5.1996 / 11:57:08 / cg" |
|
783 | 3215 |
! ! |
3216 |
||
3330
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3217 |
!Object methodsFor:'finalization'! |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3218 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3219 |
finalize |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3220 |
"subclasses may redefine this method" |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3221 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3222 |
^ self |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3223 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3224 |
"Created: / 4.3.1998 / 10:40:30 / stefan" |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3225 |
! ! |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3226 |
|
783 | 3227 |
!Object methodsFor:'initialization'! |
3228 |
||
3229 |
initialize |
|
3230 |
"just to ignore initialize to objects which do not need it" |
|
3231 |
||
3232 |
^ self |
|
3233 |
! ! |
|
3234 |
||
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3235 |
!Object methodsFor:'interest'! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3236 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3237 |
addInterest:anInterest |
1762
e7267ff590ff
Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1751
diff
changeset
|
3238 |
"install an interest forwarder. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3239 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3240 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3241 |
self addNonWeakDependent:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3242 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3243 |
"Created: 14.10.1996 / 22:27:34 / stefan" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3244 |
! |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3245 |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3246 |
expressInterestIn:aspect for:anObject sendBack:aSelector |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3247 |
"arrange for aSelector to be sent to anObject whenever the receiver |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3248 |
changes aspect." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3249 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3250 |
"/ for now, use an interestConverter, which is somewhat less efficient. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3251 |
"/ In the future, a more intelligent DependencyCollection class is planned for |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3252 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3253 |
self addInterest:(InterestConverter |
2647 | 3254 |
destination:anObject |
3255 |
selector:aSelector |
|
3256 |
aspect:aspect) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3257 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3258 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3259 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3260 |
|
1422 | 3261 |
b := [Transcript showCR:' -> the point changed']. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3262 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3263 |
p := Point new. |
1422 | 3264 |
Transcript showCR:'interest in #foo:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3265 |
p expressInterestIn:#foo for:b sendBack:#value. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3266 |
p x:1. |
1422 | 3267 |
Transcript showCR:'now changing #bar ... (expect no notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3268 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3269 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3270 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3271 |
Delay waitForSeconds:1. |
1422 | 3272 |
Transcript showCR:'now changing #foo ... (expect notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3273 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3274 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3275 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3276 |
Delay waitForSeconds:1. |
1422 | 3277 |
Transcript showCR:'no more interest in #foo:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3278 |
p retractInterestIn:#foo for:b. |
1422 | 3279 |
Transcript showCR:'now changing #foo ... (expect no notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3280 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3281 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3282 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3283 |
Delay waitForSeconds:1. |
1422 | 3284 |
Transcript showCR:'interest in #bar now:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3285 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 3286 |
Transcript showCR:'now changing #foo ... (expect no notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3287 |
p changed:#foo. |
1422 | 3288 |
Transcript showCR:'now changing #bar ... (expect notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3289 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3290 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3291 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3292 |
Delay waitForSeconds:1. |
1422 | 3293 |
Transcript showCR:'interest in #foo now:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3294 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 3295 |
Transcript showCR:'now changing #foo ... (expect notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3296 |
p changed:#foo. |
1422 | 3297 |
Transcript showCR:'now changing #bar ... (expect notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3298 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3299 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3300 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3301 |
Delay waitForSeconds:1. |
1422 | 3302 |
Transcript showCR:'no more interests:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3303 |
p retractInterestsFor:b. |
1422 | 3304 |
Transcript showCR:'now changing #foo ... (expect no notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3305 |
p changed:#foo. |
1422 | 3306 |
Transcript showCR:'now changing #bar... (expect no notification)'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3307 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3308 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3309 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3310 |
p release. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3311 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3312 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3313 |
"Created: 19.4.1996 / 10:26:22 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3314 |
"Modified: 19.4.1996 / 12:34:08 / cg" |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3315 |
"Modified: 14.10.1996 / 22:28:20 / stefan" |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3316 |
! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3317 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3318 |
interests |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3319 |
"return a Collection of interests - empty if there is none. |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3320 |
Here, we use the nonWeakDependents for interests." |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3321 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3322 |
^ self nonWeakDependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3323 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3324 |
"Created: / 14.10.1996 / 22:20:51 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3325 |
"Modified: / 30.1.1998 / 14:07:35 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3326 |
! |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3327 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3328 |
interestsFor:someOne |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3329 |
"return a collection of interests of someOne - empty if there is none." |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3330 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3331 |
|coll deps| |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3332 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3333 |
deps := self interests. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3334 |
deps size == 0 ifTrue:[^ #()]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3335 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3336 |
coll := IdentitySet new. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3337 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3338 |
deps do:[:dep | |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3339 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3340 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3341 |
coll add:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3342 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3343 |
] |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3344 |
]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3345 |
^ coll |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3346 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3347 |
"Created: / 30.1.1998 / 14:02:26 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3348 |
"Modified: / 30.1.1998 / 14:08:24 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3349 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3350 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3351 |
onChangeSend:aSelector to:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3352 |
"arrange for aSelector to be sent to anObject whenever the receiver |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3353 |
changes." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3354 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3355 |
"/ for now, use an interestConverter, which is somewhat less efficient. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3356 |
"/ In the future, a more intelligent DependencyCollection class is planned for |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3357 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3358 |
self addInterest:(InterestConverter |
2647 | 3359 |
destination:anObject |
3360 |
selector:aSelector) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3361 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3362 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3363 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3364 |
|
1422 | 3365 |
b := [Transcript showCR:'the point changed']. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3366 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3367 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3368 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3369 |
p x:1. |
1422 | 3370 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3371 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3372 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3373 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3374 |
Delay waitForSeconds:1. |
1422 | 3375 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3376 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3377 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3378 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3379 |
Delay waitForSeconds:1. |
1422 | 3380 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3381 |
p retractInterestsFor:b. |
1422 | 3382 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3383 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3384 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3385 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3386 |
Delay waitForSeconds:1. |
1422 | 3387 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3388 |
p onChangeSend:#value to:b. |
1422 | 3389 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3390 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3391 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3392 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3393 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3394 |
"Created: 19.4.1996 / 10:26:38 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3395 |
"Modified: 19.4.1996 / 12:34:26 / cg" |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3396 |
"Modified: 14.10.1996 / 22:28:27 / stefan" |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3397 |
! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3398 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3399 |
removeInterest:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3400 |
"remove an interest forwarder. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3401 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3402 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3403 |
self removeNonWeakDependent:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3404 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3405 |
"Created: 14.10.1996 / 22:21:59 / stefan" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3406 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3407 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3408 |
retractInterestIn:aspect for:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3409 |
"remove the interest of someOne in the receiver changing aspect |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3410 |
(as installed with #expressInterestIn:for:sendBack:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3411 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3412 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3413 |
"/ In the future, a more intelligent DependencyCollection class is planned for |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3414 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3415 |
"/ cannot removeDependent within the loop - the collection rehashes |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3416 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3417 |
|deps coll| |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3418 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3419 |
deps := self interests. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3420 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3421 |
coll := IdentitySet new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3422 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3423 |
deps do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3424 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3425 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3426 |
dep aspect == aspect ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3427 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3428 |
^ self |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3429 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3430 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3431 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3432 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3433 |
coll do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3434 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3435 |
]. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3436 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3437 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3438 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3439 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3440 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3441 |
|
1422 | 3442 |
b := [Transcript showCR:'the point changed']. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3443 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3444 |
p := Point new. |
1422 | 3445 |
Transcript showCR:'interest in #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3446 |
p expressInterestIn:#foo for:b sendBack:#value. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3447 |
p x:1. |
1422 | 3448 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3449 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3450 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3451 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3452 |
Delay waitForSeconds:1. |
1422 | 3453 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3454 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3455 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3456 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3457 |
Delay waitForSeconds:1. |
1422 | 3458 |
Transcript showCR:'no more interest in #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3459 |
p retractInterestIn:#foo for:b. |
1422 | 3460 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3461 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3462 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3463 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3464 |
Delay waitForSeconds:1. |
1422 | 3465 |
Transcript showCR:'interest in #bar now'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3466 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 3467 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3468 |
p changed:#foo. |
1422 | 3469 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3470 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3471 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3472 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3473 |
Delay waitForSeconds:1. |
1422 | 3474 |
Transcript showCR:'interest in #foo now'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3475 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 3476 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3477 |
p changed:#foo. |
1422 | 3478 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3479 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3480 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3481 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3482 |
Delay waitForSeconds:1. |
1422 | 3483 |
Transcript showCR:'no more interests'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3484 |
p retractInterestsFor:b. |
1422 | 3485 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3486 |
p changed:#foo. |
1422 | 3487 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3488 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3489 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3490 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3491 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3492 |
"Created: / 19.4.1996 / 10:27:11 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3493 |
"Modified: / 14.10.1996 / 22:21:19 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3494 |
"Modified: / 30.1.1998 / 14:05:34 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3495 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3496 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3497 |
retractInterestsFor:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3498 |
"remove the interest of someOne in the receiver |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3499 |
(as installed with #onChangeSend:to:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3500 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3501 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3502 |
"/ In the future, a more intelligent DependencyCollection class is planned for |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3503 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3504 |
|coll deps| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3505 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3506 |
"/ cannot removeDependent within the loop - the collection rehashes |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3507 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3508 |
deps := self interests. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3509 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3510 |
coll := IdentitySet new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3511 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3512 |
deps do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3513 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3514 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3515 |
coll add:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3516 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3517 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3518 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3519 |
coll do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3520 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3521 |
]. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3522 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3523 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3524 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3525 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3526 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3527 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3528 |
|
1422 | 3529 |
b := [Transcript showCR:'the point changed']. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3530 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3531 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3532 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3533 |
p x:1. |
1422 | 3534 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3535 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3536 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3537 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3538 |
Delay waitForSeconds:1. |
1422 | 3539 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3540 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3541 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3542 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3543 |
Delay waitForSeconds:1. |
1422 | 3544 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3545 |
p retractInterestsFor:b. |
1422 | 3546 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3547 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3548 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3549 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3550 |
Delay waitForSeconds:1. |
1422 | 3551 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3552 |
p onChangeSend:#value to:b. |
1422 | 3553 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3554 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3555 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3556 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3557 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3558 |
"Created: / 19.4.1996 / 10:23:46 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3559 |
"Modified: / 14.10.1996 / 22:21:25 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3560 |
"Modified: / 30.1.1998 / 14:04:52 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3561 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3562 |
|
783 | 3563 |
!Object methodsFor:'interrupt handling'! |
3564 |
||
3565 |
childSignalInterrupt |
|
3566 |
"death of a child process (unix process) - do nothing" |
|
3567 |
||
3568 |
^ self |
|
3569 |
! |
|
3570 |
||
3571 |
customInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3572 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3573 |
|
783 | 3574 |
"a custom interrupt" |
3575 |
||
3576 |
^ self error:'custom interrupt' |
|
3577 |
! |
|
3578 |
||
3579 |
errorInterrupt:errorID with:aParameter |
|
3580 |
"subsystem error. The arguments errorID and aParameter are the values passed |
|
3581 |
to the 'errorInterruptWithIDAndParameter(id, param)' function, |
|
3582 |
which can be called from C subsystems to raise an (asynchronous) |
|
3583 |
error exception. |
|
3584 |
||
3585 |
Currently, this is used to map XErrors to smalltalk errors, but can be |
|
3586 |
used from other C subsystems too, to upcast errors. |
|
3587 |
Especially, for subsystems which call errorHandler functions asynchronously. |
|
3588 |
IDs (currently) used: |
|
3589 |
#DisplayError ..... x-error interrupt |
|
3590 |
#XtError ..... xt-error interrupt (Xt interface is not yet published) |
|
71 | 3591 |
" |
783 | 3592 |
|
3593 |
|handler| |
|
3594 |
||
3595 |
handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil. |
|
3596 |
handler notNil ifTrue:[ |
|
3597 |
"/ |
|
3598 |
"/ handler found; let it do whatever it wants ... |
|
3599 |
"/ |
|
3600 |
handler errorInterrupt:errorID with:aParameter. |
|
3601 |
^ self |
|
3602 |
]. |
|
3603 |
||
3604 |
"/ |
|
3605 |
"/ no handler - raise errorSignal passing the errorId as parameter |
|
3606 |
"/ |
|
3607 |
^ ErrorSignal |
|
3608 |
raiseRequestWith:errorID |
|
3609 |
errorString:('Subsystem error. ErrorID = ' , errorID printString) |
|
3610 |
! |
|
3611 |
||
3612 |
exceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3613 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3614 |
|
783 | 3615 |
"exception interrupt - enter debugger" |
3616 |
||
3617 |
self error:'exception Interrupt' |
|
3618 |
! |
|
3619 |
||
3620 |
fpExceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3621 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3622 |
|
783 | 3623 |
"a floating point exception occured - this one |
3624 |
has to be handled differently since it comes asynchronous |
|
3625 |
on some machines (for example, on machines with a separate FPU |
|
3626 |
or superscalar architectures. Also, errors from within primitive code |
|
3627 |
(or library functions such as GL) are sent via the Unix-signal |
|
3628 |
mechanism this way." |
|
3629 |
||
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3630 |
|where rec| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3631 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3632 |
where := thisContext sender. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3633 |
rec := where receiver. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3634 |
rec isNumber ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3635 |
^ rec class |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3636 |
raise:#domainErrorSignal |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3637 |
receiver:rec |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3638 |
selector:where selector |
3398 | 3639 |
arguments:(where args asArray) |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3640 |
errorString:'floating point exception' |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3641 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3642 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3643 |
"/ could be in some C-library ... |
783 | 3644 |
^ Float domainErrorSignal raise |
3645 |
! |
|
3646 |
||
3647 |
internalError:msg |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3648 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3649 |
|
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
3650 |
"this is triggered, when VM hits some bad error, |
783 | 3651 |
such as corrupted class, corrupted method/selector array |
3652 |
etc. The argument string gives some more information on what happened. |
|
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
3653 |
(for example, if you set an objects class to a non-behavior, nil etc.). |
783 | 3654 |
Its not guaranteed, that the system is in a working condition once |
3655 |
this error occurred ...." |
|
3656 |
||
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
3657 |
^ InternalErrorSignal |
2647 | 3658 |
raiseRequestWith:self |
3659 |
errorString:msg |
|
783 | 3660 |
! |
3661 |
||
3662 |
ioInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3663 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3664 |
|
783 | 3665 |
"I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor). |
3666 |
If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler) |
|
3667 |
or it does not understand the ioInterrupt message. |
|
3668 |
In any case, this is a sign of some big trouble. Enter debugger." |
|
3669 |
||
3670 |
self error:'I/O Interrupt - but no handler' |
|
3671 |
! |
|
3672 |
||
3673 |
memoryInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3674 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3675 |
|
783 | 3676 |
"out-of-memory interrupt and no handler - enter debugger" |
3677 |
||
3678 |
^ self error:'almost out of memory' |
|
3679 |
! |
|
3680 |
||
3681 |
recursionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3682 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3683 |
|
783 | 3684 |
"recursion limit (actually: stack overflow) interrupt. |
3685 |
This interrupt is triggered, when a process stack grows above |
|
3686 |
its stackLimit - usually, this leads into the debugger, but |
|
2689 | 3687 |
could be caught and the stackLimit increased in the handler. |
783 | 3688 |
At the time we arrive here, the system has still some stack |
3689 |
as a reserve so we can continue to do some useful work or cleanup or |
|
3690 |
debugging for a while. |
|
3691 |
If the signal is ignored, and the stack continues to grow, there |
|
3692 |
will be a few more chances (and more interrupts) before the VM |
|
3693 |
hard-terminates the process." |
|
3694 |
||
3695 |
thisContext isRecursive ifFalse:[ |
|
3696 |
^ RecursionInterruptSignal raise |
|
3697 |
] |
|
3698 |
! |
|
3699 |
||
3700 |
schedulerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3701 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3702 |
|
783 | 3703 |
"scheduler interrupt (supposed to be sent to Processor). |
3704 |
If we arrive here, either the Processor does not understand it, |
|
3705 |
or it has been set to nil. In any case, this is a sign of some |
|
3706 |
big trouble. Enter debugger." |
|
3707 |
||
3708 |
self error:'schedulerInterrupt - but no Processor' |
|
3709 |
! |
|
3710 |
||
3711 |
signalInterrupt:signalNumber |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3712 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3713 |
|
783 | 3714 |
"unix signal occured - some signals are handled as Smalltalk Exceptions |
3715 |
(SIGPIPE), others (SIGBUS) are rather fatal ... |
|
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3716 |
In any case, IF a smalltalk-signal has been connected to the OS signal, |
783 | 3717 |
that one is raised. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3718 |
Otherwise, a dialog is shown, asking the user on how to handle the |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3719 |
signal. |
783 | 3720 |
TODO: add another argument, giving more detailed signal info (PC, VADDR, |
3721 |
exact cause etc.). This helps if segvs occur in primitive code. |
|
3722 |
Currently (temporary kludge), these are passed as global variables." |
|
3723 |
||
2773 | 3724 |
|box name here sig ignorable titles actions badContext msg pc addr |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3725 |
action title| |
783 | 3726 |
|
3727 |
" |
|
3728 |
special case - since SIGPIPE has an ST-signal associated |
|
3729 |
" |
|
3730 |
(signalNumber == 13) ifTrue:[ |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3731 |
"SIGPIPE - write on a pipe with no one to read" |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3732 |
|
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3733 |
^ PipeStream brokenPipeSignal raise. |
783 | 3734 |
]. |
3735 |
||
3736 |
"if there has been an ST-signal installed, use it ..." |
|
3737 |
||
3738 |
sig := OperatingSystem operatingSystemSignal:signalNumber. |
|
3739 |
sig notNil ifTrue:[ |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3740 |
^ sig raise |
783 | 3741 |
]. |
3742 |
||
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3743 |
"/ if handled, raise OSSignalInterruptSignal |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3744 |
|
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3745 |
OSSignalInterruptSignal isHandled ifTrue:[ |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3746 |
^ OSSignalInterruptSignal raiseWith:signalNumber |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3747 |
]. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3748 |
|
783 | 3749 |
" |
3750 |
... otherwise , bring up a box asking for what to do ... |
|
3751 |
" |
|
3752 |
name := OperatingSystem nameForSignal:signalNumber. |
|
3753 |
here := thisContext. |
|
3754 |
||
3755 |
" |
|
3756 |
the context, in which the signal occurred: |
|
3757 |
" |
|
3758 |
badContext := here sender. |
|
3759 |
||
3760 |
" |
|
3761 |
ungrab - in case it happened in a box/popupview |
|
3762 |
otherwise display stays locked |
|
3763 |
" |
|
2851
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3764 |
"/ Display notNil ifTrue:[ |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3765 |
"/ Display ungrabPointer. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3766 |
"/ Display ungrabKeyboard. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3767 |
"/ ]. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3768 |
Screen notNil ifTrue:[ |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3769 |
Screen allScreens do:[:aScreen | |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3770 |
aScreen ungrabPointer. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3771 |
aScreen ungrabKeyboard. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3772 |
] |
783 | 3773 |
]. |
3774 |
||
3775 |
" |
|
3776 |
SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue) |
|
3777 |
since the system will retry the faulty instruction, which leads to |
|
3778 |
another signal - to avoid frustration, better not offer this option. |
|
3779 |
" |
|
3780 |
ignorable := (signalNumber ~~ OperatingSystem sigBUS) |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3781 |
and:[signalNumber ~~ OperatingSystem sigILL |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3782 |
and:[signalNumber ~~ OperatingSystem sigSEGV]]. |
783 | 3783 |
|
3784 |
ignorable ifFalse:[ |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3785 |
here isRecursive ifTrue:[ |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3786 |
'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3787 |
MiniDebugger enterWithMessage:'recursive signal'. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3788 |
^ self |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3789 |
]. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3790 |
" |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3791 |
a hard signal - go into debugger immediately |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3792 |
" |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3793 |
msg := 'OS-signal: ', name. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3794 |
|
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3795 |
"/ the IRQ-PC is passed as low-hi, to avoid the need |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3796 |
"/ to allocate a LargeInteger in the VM during signal |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3797 |
"/ time. I know, this is ugly. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3798 |
|
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3799 |
InterruptPcLow notNil ifTrue:[ |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3800 |
pc := InterruptPcLow + (InterruptPcHi bitShift:(SmallInteger maxBits + 1 // 2)). |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3801 |
pc ~~ 0 ifTrue:[ |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3802 |
msg := msg , ' PC=' , (pc printStringRadix:16) |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3803 |
]. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3804 |
]. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3805 |
InterruptAddrLow notNil ifTrue:[ |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3806 |
addr := InterruptAddrLow + (InterruptAddrHi bitShift:(SmallInteger maxBits + 1 // 2)). |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3807 |
addr ~~ 0 ifTrue:[ |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3808 |
msg := msg , ' ADDR=' , (addr printStringRadix:16) |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3809 |
]. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3810 |
]. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3811 |
Debugger enter:here withMessage:msg. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3812 |
badContext return. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3813 |
^ nil. |
783 | 3814 |
]. |
3815 |
||
3816 |
OptionBox isNil ifTrue:[ |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3817 |
" |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3818 |
a system without GUI ... |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3819 |
go into minidebugger (if there is one) |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3820 |
" |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3821 |
MiniDebugger isNil ifTrue:[ |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3822 |
" |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3823 |
a system without debugging facilities |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3824 |
(i.e. a standalone system) |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3825 |
output a message and exit. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3826 |
" |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3827 |
('Object [error]: exit due to Signal ' , name , ' - and no debugger.') errorPrintCR. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3828 |
Smalltalk exit. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3829 |
]. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3830 |
MiniDebugger enterWithMessage:'Signal caught (' , name, ')'. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3831 |
^ self |
783 | 3832 |
]. |
3833 |
||
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3834 |
titles := #('dump core' 'exit ST/X'). |
783 | 3835 |
actions := Array |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3836 |
with:[Smalltalk fatalAbort] |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3837 |
with:[Smalltalk exit]. |
2773 | 3838 |
|
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3839 |
action := nil. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3840 |
title := 'OS Signal caught (' , name, ')'. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3841 |
title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3842 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3843 |
"/ if cought while in the scheduler or event dispatcher, |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3844 |
"/ a modal dialog is not possible ... |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3845 |
"/ (therefore, debug & return make no sense) |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3846 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3847 |
Processor activeProcess isSystemProcess ifFalse:[ |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3848 |
titles := #('abort' 'debug') , titles. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3849 |
actions := (Array |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3850 |
with:[action := #abort] |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3851 |
with:[action := #debug]) , actions. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3852 |
|
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3853 |
badContext canReturn ifTrue:[ |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3854 |
titles := #('return') , titles. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3855 |
actions := (Array with:[action := #return]) , actions. |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3856 |
]. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3857 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3858 |
|
783 | 3859 |
ignorable ifTrue:[ |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3860 |
titles := titles, #('ignore'). |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3861 |
actions := actions , (Array with:[action := #ignore]). |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3862 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3863 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3864 |
box := OptionBox |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3865 |
title:title |
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3866 |
numberOfOptions:actions size. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3867 |
ignorable ifTrue:[ |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3868 |
box defaultButtonIndex:(actions size) |
783 | 3869 |
]. |
3870 |
box buttonTitles:titles. |
|
3871 |
box actions:actions. |
|
2773 | 3872 |
box showAtPointer. |
3873 |
||
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3874 |
action == #return ifTrue:[ |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3875 |
badContext return |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3876 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3877 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3878 |
action == #abort ifTrue:[ |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3879 |
AbortSignal raise. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3880 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3881 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3882 |
action == #debug ifTrue:[ |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3883 |
Debugger enter:here withMessage:('Signal ', name). |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3884 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3885 |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
3886 |
"Modified: / 4.5.1998 / 20:39:16 / cg" |
783 | 3887 |
! |
3888 |
||
3889 |
spyInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3890 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3891 |
|
783 | 3892 |
"spy interrupt and no handler - enter debugger" |
3893 |
||
3894 |
self error:'spy Interrupt - but no handler' |
|
3895 |
! |
|
3896 |
||
3897 |
timerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3898 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3899 |
|
783 | 3900 |
"timer interrupt and no handler - enter debugger" |
3901 |
||
3902 |
self error:'timer Interrupt - but no handler' |
|
3903 |
! |
|
3904 |
||
3905 |
userInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3906 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3907 |
|
1792 | 3908 |
"user (^c) interrupt. |
3909 |
This is typically sent by the VM, when a ctrl-C is typed at the |
|
3910 |
controlling tty (i.e. in the xterm)." |
|
783 | 3911 |
|
3912 |
UserInterruptSignal raise |
|
1788 | 3913 |
! |
3914 |
||
3915 |
userInterruptIn:aContext |
|
3916 |
"{ Pragma: +optSpace }" |
|
3917 |
||
3918 |
"user (^c) interrupt - enter debugger, but show aContext |
|
1792 | 3919 |
as top-context. |
3920 |
This is used to hide any intermediate scheduler contexts, |
|
3921 |
in case of an interrupted process. Typically, this is sent by |
|
3922 |
the WindowGroup, when a keyboardEvent for the ctrl-C key is |
|
3923 |
processed." |
|
1788 | 3924 |
|
3925 |
UserInterruptSignal raiseIn:aContext |
|
3926 |
||
3927 |
"Created: 18.10.1996 / 20:46:04 / cg" |
|
3928 |
"Modified: 20.10.1996 / 13:06:38 / cg" |
|
71 | 3929 |
! ! |
3930 |
||
1 | 3931 |
!Object methodsFor:'message sending'! |
3932 |
||
3933 |
perform:aSelector |
|
3934 |
"send the message aSelector to the receiver" |
|
3935 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3936 |
%{ |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
3937 |
REGISTER OBJ sel = aSelector; |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3938 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
3939 |
static struct inlineCache ilc_0 = __ILCPERF0(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
3940 |
static struct inlineCache ilc_1 = __ILCPERF0(@line); |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
3941 |
static struct inlineCache ilc_2 = __ILCPERF0(@line); |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
3942 |
static struct inlineCache ilc_3 = __ILCPERF0(@line); |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
3943 |
static struct inlineCache ilc_4 = __ILCPERF0(@line); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3944 |
static OBJ last_0 = nil; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3945 |
static OBJ last_1 = nil; |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
3946 |
static OBJ last_2 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
3947 |
static OBJ last_3 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
3948 |
static OBJ last_4 = nil; |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3949 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3950 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
3951 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3952 |
if (sel == last_0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3953 |
RETURN ( (*(ilc_0.ilc_func))(self, sel, nil, &ilc_0) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3954 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3955 |
if (sel == last_1) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3956 |
RETURN ( (*(ilc_1.ilc_func))(self, sel, nil, &ilc_1) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3957 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3958 |
if (sel == last_2) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3959 |
RETURN ( (*(ilc_2.ilc_func))(self, sel, nil, &ilc_2) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3960 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3961 |
if (sel == last_3) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3962 |
RETURN ( (*(ilc_3.ilc_func))(self, sel, nil, &ilc_3) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3963 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3964 |
if (sel == last_4) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3965 |
RETURN ( (*(ilc_4.ilc_func))(self, sel, nil, &ilc_4) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3966 |
} |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
3967 |
|
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3968 |
if (flip == 0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3969 |
pIlc = &ilc_0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3970 |
flip = 1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3971 |
last_0 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3972 |
} else if (flip == 1) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3973 |
pIlc = &ilc_1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3974 |
flip = 2; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3975 |
last_1 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3976 |
} else if (flip == 2) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3977 |
pIlc = &ilc_2; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3978 |
flip = 3; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3979 |
last_2 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3980 |
} else if (flip == 3) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3981 |
pIlc = &ilc_3; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3982 |
flip = 4; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3983 |
last_3 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3984 |
} else { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3985 |
pIlc = &ilc_4; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3986 |
flip = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3987 |
last_4 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3988 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3989 |
pIlc->ilc_func = __SEND0ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3990 |
if (pIlc->ilc_poly) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3991 |
__flushPolyCache(pIlc->ilc_poly); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3992 |
pIlc->ilc_poly = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3993 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3994 |
RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc) ); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3995 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3996 |
static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3997 |
RETURN (_SEND0(self, aSelector, nil, &ilc0)); |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3998 |
} |
1 | 3999 |
%} |
4000 |
! |
|
4001 |
||
783 | 4002 |
perform:aSelector inClass:aClass withArguments:argArray |
4003 |
"send the message aSelector with all args taken from argArray |
|
4004 |
to the receiver as a super-send message. |
|
4005 |
This is actually more flexible than the normal super-send, since it allows |
|
4006 |
to execute a method in ANY superclass of the receiver (not just the |
|
4007 |
immediate superclass). |
|
4008 |
Thus, it is (theoretically) possible to do |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4009 |
'5 perform:#< inClass:Magnitude withArguments:#(6)' |
783 | 4010 |
and evaluate Magnitudes compare method even if there was one in Number. |
4011 |
This method is used by the interpreter to evaluate super sends |
|
4012 |
and could be used for very special behavior (language extension ?). |
|
4013 |
||
4014 |
WARNING: this is an ST/X feature - probably not found in other smalltalks." |
|
4015 |
||
4016 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
|
4017 |
||
4018 |
" |
|
4019 |
check, if aClass is really a superclass of the receiver |
|
4020 |
" |
|
4021 |
(self class isSubclassOf:aClass) ifFalse:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4022 |
self error:'class argument is not a superclass of the receiver'. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4023 |
^ nil |
783 | 4024 |
]. |
4025 |
%{ |
|
4026 |
REGISTER OBJ *argP; |
|
4027 |
int nargs, i; |
|
4028 |
||
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4029 |
if (__isArray(argArray)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4030 |
nargs = __arraySize(argArray); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4031 |
argP = __ArrayInstPtr(argArray)->a_element; |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4032 |
} else { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4033 |
if (__isNonNilObject(argArray)) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4034 |
static struct inlineCache ilcSize = __ILC0(@line+1); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4035 |
numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4036 |
if (!__isSmallInteger(numberOfArgs)) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4037 |
goto bad; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4038 |
nargs = __intVal(numberOfArgs); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4039 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4040 |
for (i=1; i <= nargs; i++) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4041 |
*argP++ = __AT_(argArray, __MKSMALLINT(i)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4042 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4043 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4044 |
} else { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4045 |
nargs = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4046 |
} |
783 | 4047 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4048 |
switch (nargs) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4049 |
case 0: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4050 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4051 |
static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4052 |
RETURN ( _SEND0(self, aSelector, aClass, &ilc0)); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4053 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4054 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4055 |
case 1: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4056 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4057 |
static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4058 |
RETURN ( _SEND1(self, aSelector, aClass, &ilc1, argP[0])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4059 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4060 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4061 |
case 2: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4062 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4063 |
static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4064 |
RETURN ( _SEND2(self, aSelector, aClass, &ilc2, argP[0], argP[1])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4065 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4066 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4067 |
case 3: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4068 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4069 |
static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4070 |
RETURN ( _SEND3(self, aSelector, aClass, &ilc3, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4071 |
argP[0], argP[1], argP[2])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4072 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4073 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4074 |
case 4: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4075 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4076 |
static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4077 |
RETURN ( _SEND4(self, aSelector, aClass, &ilc4, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4078 |
argP[0], argP[1], argP[2], argP[3])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4079 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4080 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4081 |
case 5: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4082 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4083 |
static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4084 |
RETURN ( _SEND5(self, aSelector, aClass, &ilc5, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4085 |
argP[0], argP[1], argP[2], argP[3], argP[4])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4086 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4087 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4088 |
case 6: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4089 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4090 |
static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4091 |
RETURN ( _SEND6(self, aSelector, aClass, &ilc6, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4092 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4093 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4094 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4095 |
case 7: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4096 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4097 |
static struct inlineCache ilc7 = __DUMMYILCSELF7(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4098 |
RETURN ( _SEND7(self, aSelector, aClass, &ilc7, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4099 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4100 |
argP[6])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4101 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4102 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4103 |
case 8: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4104 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4105 |
static struct inlineCache ilc8 = __DUMMYILCSELF8(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4106 |
RETURN ( _SEND8(self, aSelector, aClass, &ilc8, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4107 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4108 |
argP[6], argP[7])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4109 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4110 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4111 |
case 9: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4112 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4113 |
static struct inlineCache ilc9 = __DUMMYILCSELF9(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4114 |
RETURN ( _SEND9(self, aSelector, aClass, &ilc9, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4115 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4116 |
argP[6], argP[7], argP[8])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4117 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4118 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4119 |
case 10: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4120 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4121 |
static struct inlineCache ilc10 = __DUMMYILCSELF10(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4122 |
RETURN ( _SEND10(self, aSelector, aClass, &ilc10, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4123 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4124 |
argP[6], argP[7], argP[8], argP[9])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4125 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4126 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4127 |
case 11: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4128 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4129 |
static struct inlineCache ilc11 = __DUMMYILCSELF11(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4130 |
RETURN ( _SEND11(self, aSelector, aClass, &ilc11, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4131 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4132 |
argP[6], argP[7], argP[8], argP[9], argP[10])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4133 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4134 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4135 |
case 12: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4136 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4137 |
static struct inlineCache ilc12 = __DUMMYILCSELF12(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4138 |
RETURN ( _SEND12(self, aSelector, aClass, &ilc12, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4139 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4140 |
argP[6], argP[7], argP[8], argP[9], argP[10], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4141 |
argP[11])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4142 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4143 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4144 |
case 13: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4145 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4146 |
static struct inlineCache ilc13 = __DUMMYILCSELF13(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4147 |
RETURN ( _SEND13(self, aSelector, aClass, &ilc13, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4148 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4149 |
argP[6], argP[7], argP[8], argP[9], argP[10], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4150 |
argP[11], argP[12])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4151 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4152 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4153 |
case 14: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4154 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4155 |
static struct inlineCache ilc14 = __DUMMYILCSELF14(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4156 |
RETURN ( _SEND14(self, aSelector, aClass, &ilc14, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4157 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4158 |
argP[6], argP[7], argP[8], argP[9], argP[10], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4159 |
argP[11], argP[12], argP[13])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4160 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4161 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4162 |
case 15: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4163 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4164 |
static struct inlineCache ilc15 = __DUMMYILCSELF15(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4165 |
RETURN ( _SEND15(self, aSelector, aClass, &ilc15, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4166 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4167 |
argP[6], argP[7], argP[8], argP[9], argP[10], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4168 |
argP[11], argP[12], argP[13], argP[14])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4169 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4170 |
|
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4171 |
#ifdef _SEND16 |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4172 |
case 16: |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4173 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4174 |
static struct inlineCache ilc16 = __DUMMYILCSELF16(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4175 |
RETURN ( _SEND15(self, aSelector, aClass, &ilc15, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4176 |
argP[0], argP[1], argP[2], argP[3], argP[4], argP[5], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4177 |
argP[6], argP[7], argP[8], argP[9], argP[10], |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4178 |
argP[11], argP[12], argP[13], argP[14], argP[15])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4179 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4180 |
#endif |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4181 |
|
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4182 |
|
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4183 |
} |
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4184 |
bad:; |
1626 | 4185 |
%}. |
4186 |
"/ arrive here, if bad number of arguments (too many) |
|
4187 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
4188 |
||
783 | 4189 |
^ self primitiveFailed |
4190 |
! |
|
4191 |
||
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4192 |
perform:aSelector with:arg |
1 | 4193 |
"send the one-arg-message aSelector to the receiver" |
4194 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4195 |
%{ |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4196 |
REGISTER OBJ sel = aSelector; |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4197 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4198 |
static struct inlineCache ilc_0 = __ILCPERF1(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4199 |
static struct inlineCache ilc_1 = __ILCPERF1(@line); |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4200 |
static struct inlineCache ilc_2 = __ILCPERF1(@line); |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4201 |
static struct inlineCache ilc_3 = __ILCPERF1(@line); |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4202 |
static struct inlineCache ilc_4 = __ILCPERF1(@line); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4203 |
static OBJ last_0 = nil; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4204 |
static OBJ last_1 = nil; |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4205 |
static OBJ last_2 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4206 |
static OBJ last_3 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4207 |
static OBJ last_4 = nil; |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4208 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4209 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4210 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4211 |
if (sel == last_0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4212 |
RETURN ( (*(ilc_0.ilc_func))(self, sel, nil, &ilc_0, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4213 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4214 |
if (sel == last_1) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4215 |
RETURN ( (*(ilc_1.ilc_func))(self, sel, nil, &ilc_1, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4216 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4217 |
if (sel == last_2) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4218 |
RETURN ( (*(ilc_2.ilc_func))(self, sel, nil, &ilc_2, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4219 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4220 |
if (sel == last_3) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4221 |
RETURN ( (*(ilc_3.ilc_func))(self, sel, nil, &ilc_3, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4222 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4223 |
if (sel == last_4) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4224 |
RETURN ( (*(ilc_4.ilc_func))(self, sel, nil, &ilc_4, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4225 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4226 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4227 |
if (flip == 0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4228 |
pIlc = &ilc_0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4229 |
flip = 1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4230 |
last_0 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4231 |
} else if (flip == 1) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4232 |
pIlc = &ilc_1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4233 |
flip = 2; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4234 |
last_1 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4235 |
} else if (flip == 2) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4236 |
pIlc = &ilc_2; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4237 |
flip = 3; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4238 |
last_2 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4239 |
} else if (flip == 3) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4240 |
pIlc = &ilc_3; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4241 |
flip = 4; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4242 |
last_3 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4243 |
} else { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4244 |
pIlc = &ilc_4; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4245 |
flip = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4246 |
last_4 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4247 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4248 |
pIlc->ilc_func = __SEND1ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4249 |
if (pIlc->ilc_poly) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4250 |
__flushPolyCache(pIlc->ilc_poly); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4251 |
pIlc->ilc_poly = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4252 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4253 |
RETURN ( (*(pIlc->ilc_func))(self, sel, nil, pIlc, arg) ); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4254 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4255 |
static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4256 |
RETURN (_SEND1(self, aSelector, nil, &ilc1, arg)); |
1 | 4257 |
} |
4258 |
%} |
|
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4259 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4260 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4261 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4262 |
perform:aSelector with:arg1 with:arg2 |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4263 |
"send the two-arg-message aSelector to the receiver" |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4264 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4265 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4266 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4267 |
static struct inlineCache ilc_0 = __ILCPERF2(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4268 |
static struct inlineCache ilc_1 = __ILCPERF2(@line); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4269 |
static OBJ last_0 = nil; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4270 |
static OBJ last_1 = nil; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4271 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4272 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4273 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4274 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4275 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4276 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4277 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4278 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4279 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4280 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4281 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4282 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4283 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4284 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4285 |
pIlc->ilc_func = __SEND2ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4286 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4287 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4288 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4289 |
} |
2647 | 4290 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4291 |
pIlc = &ilc_1; |
2647 | 4292 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4293 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4294 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4295 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4296 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, arg1, arg2) ); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4297 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4298 |
static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4299 |
RETURN (_SEND2(self, aSelector, nil, &ilc2, arg1, arg2)); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4300 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4301 |
%} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4302 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4303 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4304 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4305 |
perform:aSelector with:arg1 with:arg2 with:arg3 |
1 | 4306 |
"send the three-arg-message aSelector to the receiver" |
4307 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4308 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4309 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4310 |
static struct inlineCache ilc_0 = __ILCPERF3(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4311 |
static struct inlineCache ilc_1 = __ILCPERF3(@line); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4312 |
static OBJ last_0 = nil; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4313 |
static OBJ last_1 = nil; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4314 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4315 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4316 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4317 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4318 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4319 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4320 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4321 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4322 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4323 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4324 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4325 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4326 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4327 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4328 |
pIlc->ilc_func = __SEND3ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4329 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4330 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4331 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4332 |
} |
2647 | 4333 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4334 |
pIlc = &ilc_1; |
2647 | 4335 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4336 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4337 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4338 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4339 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4340 |
arg1, arg2, arg3) ); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4341 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4342 |
static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4343 |
RETURN (_SEND3(self, aSelector, nil, &ilc3, arg1, arg2, arg3)); |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4344 |
} |
1 | 4345 |
%} |
2437 | 4346 |
! |
4347 |
||
4348 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 |
|
4349 |
"send the four-arg-message aSelector to the receiver" |
|
4350 |
||
4351 |
%{ |
|
4352 |
struct inlineCache *pIlc; |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4353 |
static struct inlineCache ilc_0 = __ILCPERF4(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4354 |
static struct inlineCache ilc_1 = __ILCPERF4(@line); |
2437 | 4355 |
static OBJ last_0 = nil; |
4356 |
static OBJ last_1 = nil; |
|
4357 |
static flip = 0; |
|
4358 |
||
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4359 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4360 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4361 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4362 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4363 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4364 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4365 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4366 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4367 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4368 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4369 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4370 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4371 |
pIlc->ilc_func = __SEND4ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4372 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4373 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4374 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4375 |
} |
2647 | 4376 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4377 |
pIlc = &ilc_1; |
2647 | 4378 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4379 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4380 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4381 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4382 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4383 |
arg1, arg2, arg3, arg4) ); |
2437 | 4384 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4385 |
static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4386 |
RETURN (_SEND4(self, aSelector, nil, &ilc4, |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4387 |
arg1, arg2, arg3, arg4)); |
2437 | 4388 |
} |
4389 |
%} |
|
1 | 4390 |
! |
4391 |
||
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4392 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4393 |
"send the five-arg-message aSelector to the receiver" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4394 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4395 |
%{ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4396 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4397 |
static struct inlineCache ilc_0 = __ILCPERF5(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4398 |
static struct inlineCache ilc_1 = __ILCPERF5(@line); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4399 |
static OBJ last_0 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4400 |
static OBJ last_1 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4401 |
static flip = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4402 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4403 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4404 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4405 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4406 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4407 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4408 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4409 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4410 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4411 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4412 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4413 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4414 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4415 |
pIlc->ilc_func = __SEND5ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4416 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4417 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4418 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4419 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4420 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4421 |
pIlc = &ilc_1; |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4422 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4423 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4424 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4425 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4426 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4427 |
arg1, arg2, arg3, arg4, arg5) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4428 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4429 |
static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4430 |
RETURN (_SEND5(self, aSelector, nil, &ilc5, |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4431 |
arg1, arg2, arg3, arg4, arg5)); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4432 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4433 |
%} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4434 |
! |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4435 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4436 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4437 |
"send the six-arg-message aSelector to the receiver" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4438 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4439 |
%{ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4440 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4441 |
static struct inlineCache ilc_0 = __ILCPERF6(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4442 |
static struct inlineCache ilc_1 = __ILCPERF6(@line); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4443 |
static OBJ last_0 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4444 |
static OBJ last_1 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4445 |
static flip = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4446 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4447 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4448 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4449 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4450 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4451 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4452 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4453 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4454 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4455 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4456 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4457 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4458 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4459 |
pIlc->ilc_func = __SEND6ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4460 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4461 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4462 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4463 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4464 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4465 |
pIlc = &ilc_1; |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4466 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4467 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4468 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4469 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4470 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4471 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4472 |
arg1, arg2, arg3, arg4, arg5, arg6) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4473 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4474 |
static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4475 |
RETURN (_SEND6(self, aSelector, nil, &ilc6, |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4476 |
arg1, arg2, arg3, arg4, arg5, arg6)); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4477 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4478 |
%} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4479 |
! |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4480 |
|
1 | 4481 |
perform:aSelector withArguments:argArray |
4482 |
"send the message aSelector with all args taken from argArray |
|
44 | 4483 |
to the receiver." |
1 | 4484 |
|
77 | 4485 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
1 | 4486 |
|
4487 |
%{ |
|
4488 |
REGISTER OBJ *argP; |
|
4489 |
int nargs, i; |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4490 |
static struct inlineCache ilcSize = __ILC0(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4491 |
static OBJ last0 = nil; static struct inlineCache ilc0 = __ILCPERF0(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4492 |
static OBJ last1 = nil; static struct inlineCache ilc1 = __ILCPERF1(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4493 |
static OBJ last2 = nil; static struct inlineCache ilc2 = __ILCPERF2(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4494 |
static OBJ last3 = nil; static struct inlineCache ilc3 = __ILCPERF3(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4495 |
static OBJ last4 = nil; static struct inlineCache ilc4 = __ILCPERF4(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4496 |
static OBJ last5 = nil; static struct inlineCache ilc5 = __ILCPERF5(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4497 |
static OBJ last6 = nil; static struct inlineCache ilc6 = __ILCPERF6(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4498 |
static OBJ last7 = nil; static struct inlineCache ilc7 = __ILCPERF7(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4499 |
static OBJ last8 = nil; static struct inlineCache ilc8 = __ILCPERF8(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4500 |
static OBJ last9 = nil; static struct inlineCache ilc9 = __ILCPERF9(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4501 |
static OBJ last10 = nil; static struct inlineCache ilc10 = __ILCPERF10(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4502 |
static OBJ last11 = nil; static struct inlineCache ilc11 = __ILCPERF11(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4503 |
static OBJ last12 = nil; static struct inlineCache ilc12 = __ILCPERF12(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4504 |
static OBJ last13 = nil; static struct inlineCache ilc13 = __ILCPERF13(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4505 |
static OBJ last14 = nil; static struct inlineCache ilc14 = __ILCPERF14(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4506 |
static OBJ last15 = nil; static struct inlineCache ilc15 = __ILCPERF15(@line); |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4507 |
OBJ l; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4508 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4509 |
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */ |
71 | 4510 |
/* |
93 | 4511 |
* must set lineno in sender by hand here ... (because of NOCONTEXT) |
71 | 4512 |
*/ |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4513 |
if ((l = __ILC_LNO_AS_OBJ(__pilc)) != __MKSMALLINT(0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4514 |
_ContextInstPtr(__thisContext)->c_lineno = l; |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4515 |
} |
71 | 4516 |
#endif |
1 | 4517 |
|
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4518 |
if (__isArray(argArray)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4519 |
nargs = __arraySize(argArray); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4520 |
argP = __ArrayInstPtr(argArray)->a_element; |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4521 |
} else { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4522 |
if (__isNonNilObject(argArray)) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4523 |
numberOfArgs = (*ilcSize.ilc_func)(argArray, @symbol(size), nil, &ilcSize); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4524 |
if (!__isSmallInteger(numberOfArgs)) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4525 |
goto bad; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4526 |
nargs = __intVal(numberOfArgs); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4527 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4528 |
for (i=1; i <= nargs; i++) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4529 |
*argP++ = __AT_(argArray, __MKSMALLINT(i)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4530 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4531 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4532 |
} else { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4533 |
nargs = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4534 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4535 |
} |
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4536 |
switch (nargs) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4537 |
case 0: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4538 |
if ((InterruptPending != nil) || (aSelector != last0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4539 |
ilc0.ilc_func = __SEND0ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4540 |
if (ilc0.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4541 |
__flushPolyCache(ilc0.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4542 |
ilc0.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4543 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4544 |
last0 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4545 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4546 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4547 |
ilc0.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 4548 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4549 |
RETURN ((*ilc0.ilc_func)(self, aSelector, nil, &ilc0)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4550 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4551 |
case 1: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4552 |
if ((InterruptPending != nil) || (aSelector != last1)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4553 |
ilc1.ilc_func = __SEND1ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4554 |
if (ilc1.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4555 |
__flushPolyCache(ilc1.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4556 |
ilc1.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4557 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4558 |
last1 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4559 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4560 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4561 |
ilc1.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 4562 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4563 |
RETURN ( (*ilc1.ilc_func)(self, aSelector, nil, &ilc1, argP[0])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4564 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4565 |
case 2: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4566 |
if ((InterruptPending != nil) || (aSelector != last2)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4567 |
ilc2.ilc_func = __SEND2ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4568 |
if (ilc2.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4569 |
__flushPolyCache(ilc2.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4570 |
ilc2.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4571 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4572 |
last2 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4573 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4574 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4575 |
ilc2.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4576 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4577 |
RETURN ( (*ilc2.ilc_func)(self, aSelector, nil, &ilc2, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4578 |
argP[0], argP[1])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4579 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4580 |
case 3: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4581 |
if ((InterruptPending != nil) || (aSelector != last3)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4582 |
ilc3.ilc_func = __SEND3ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4583 |
if (ilc3.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4584 |
__flushPolyCache(ilc3.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4585 |
ilc3.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4586 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4587 |
last3 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4588 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4589 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4590 |
ilc3.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4591 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4592 |
RETURN ( (*ilc3.ilc_func)(self, aSelector, nil, &ilc3, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4593 |
argP[0], argP[1], argP[2])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4594 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4595 |
case 4: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4596 |
if ((InterruptPending != nil) || (aSelector != last4)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4597 |
ilc4.ilc_func = __SEND4ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4598 |
if (ilc4.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4599 |
__flushPolyCache(ilc4.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4600 |
ilc4.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4601 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4602 |
last4 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4603 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4604 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4605 |
ilc4.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4606 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4607 |
RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4608 |
argP[0], argP[1], argP[2], argP[3])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4609 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4610 |
case 5: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4611 |
if ((InterruptPending != nil) || (aSelector != last5)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4612 |
ilc5.ilc_func = __SEND5ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4613 |
if (ilc5.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4614 |
__flushPolyCache(ilc5.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4615 |
ilc5.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4616 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4617 |
last5 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4618 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4619 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4620 |
ilc5.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4621 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4622 |
RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4623 |
argP[0], argP[1], argP[2], argP[3], argP[4])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4624 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4625 |
case 6: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4626 |
if ((InterruptPending != nil) || (aSelector != last6)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4627 |
ilc6.ilc_func = __SEND6ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4628 |
if (ilc6.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4629 |
__flushPolyCache(ilc6.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4630 |
ilc6.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4631 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4632 |
last6 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4633 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4634 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4635 |
ilc6.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4636 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4637 |
RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4638 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4639 |
argP[5])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4640 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4641 |
case 7: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4642 |
if ((InterruptPending != nil) || (aSelector != last7)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4643 |
ilc7.ilc_func = __SEND7ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4644 |
if (ilc7.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4645 |
__flushPolyCache(ilc7.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4646 |
ilc7.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4647 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4648 |
last7 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4649 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4650 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4651 |
ilc7.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4652 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4653 |
RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4654 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4655 |
argP[5], argP[6])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4656 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4657 |
case 8: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4658 |
if ((InterruptPending != nil) || (aSelector != last8)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4659 |
ilc8.ilc_func = __SEND8ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4660 |
last8 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4661 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4662 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4663 |
ilc8.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4664 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4665 |
RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4666 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4667 |
argP[5], argP[6], argP[7])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4668 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4669 |
case 9: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4670 |
if ((InterruptPending != nil) || (aSelector != last9)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4671 |
ilc9.ilc_func = __SEND9ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4672 |
last9 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4673 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4674 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4675 |
ilc9.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4676 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4677 |
RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4678 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4679 |
argP[5], argP[6], argP[7], argP[8])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4680 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4681 |
case 10: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4682 |
if ((InterruptPending != nil) || (aSelector != last10)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4683 |
ilc10.ilc_func = __SEND10ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4684 |
last10 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4685 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4686 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4687 |
ilc10.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4688 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4689 |
RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4690 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4691 |
argP[5], argP[6], argP[7], argP[8], argP[9])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4692 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4693 |
case 11: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4694 |
if ((InterruptPending != nil) || (aSelector != last11)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4695 |
ilc11.ilc_func = __SEND11ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4696 |
last11 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4697 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4698 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4699 |
ilc11.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4700 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4701 |
RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4702 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4703 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4704 |
argP[10])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4705 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4706 |
case 12: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4707 |
if ((InterruptPending != nil) || (aSelector != last12)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4708 |
ilc12.ilc_func = __SEND12ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4709 |
last12 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4710 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4711 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4712 |
ilc12.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4713 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4714 |
RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4715 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4716 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4717 |
argP[10], argP[11])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4718 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4719 |
case 13: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4720 |
if ((InterruptPending != nil) || (aSelector != last13)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4721 |
ilc13.ilc_func = __SEND13ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4722 |
last13 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4723 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4724 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4725 |
ilc13.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4726 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4727 |
RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4728 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4729 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4730 |
argP[10], argP[11], argP[12])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4731 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4732 |
case 14: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4733 |
if ((InterruptPending != nil) || (aSelector != last14)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4734 |
ilc14.ilc_func = __SEND14ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4735 |
last14 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4736 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4737 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4738 |
ilc14.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4739 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4740 |
RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4741 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4742 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4743 |
argP[10], argP[11], argP[12], argP[13])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4744 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4745 |
case 15: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4746 |
if ((InterruptPending != nil) || (aSelector != last15)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4747 |
ilc15.ilc_func = __SEND15ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4748 |
last15 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4749 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4750 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4751 |
ilc15.ilc_lineNo = __pilc->ilc_lineNo; |
77 | 4752 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4753 |
RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4754 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4755 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4756 |
argP[10], argP[11], argP[12], argP[13], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4757 |
argP[14])); |
1 | 4758 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4759 |
bad:; |
1626 | 4760 |
%}. |
4761 |
"/ arrive here, if bad number of arguments (too many) |
|
4762 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
4763 |
||
1 | 4764 |
^ self primitiveFailed |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4765 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4766 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4767 |
performMethod:aMethod |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4768 |
"invoke aMethod on the receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4769 |
The method should be a zero-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4770 |
This is a non-object-oriented entry, applying a method |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4771 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4772 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4773 |
Take care for the method to be appropriate for the |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4774 |
receiver - no checking is done by the VM." |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4775 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4776 |
^ aMethod valueWithReceiver:self arguments:#() |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4777 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4778 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4779 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4780 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4781 |
mthd := SmallInteger compiledMethodAt:#negated. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4782 |
Transcript showCR:(1 performMethod:mthd) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4783 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4784 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4785 |
"BAD USE example: |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4786 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4787 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4788 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4789 |
mthd := Point compiledMethodAt:#x. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4790 |
Transcript showCR:((1->2) performMethod:mthd) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4791 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4792 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4793 |
"Modified: 31.7.1997 / 17:41:50 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4794 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4795 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4796 |
performMethod:aMethod arguments:argumentArray |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4797 |
"invoke aMethod on the receiver, passing an argumentArray. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4798 |
The size of the argumentArray should match the number of args |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4799 |
expected by the method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4800 |
This is a non-object-oriented entry, applying a method |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4801 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4802 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4803 |
Take care for the method to be appropriate for the |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4804 |
receiver - no checking is done by the VM." |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4805 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4806 |
^ aMethod valueWithReceiver:self arguments:argumentArray |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4807 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4808 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4809 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4810 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4811 |
mthd := SmallInteger compiledMethodAt:#+. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4812 |
Transcript showCR:(1 performMethod:mthd arguments:#(2)) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4813 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4814 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4815 |
"Created: 31.7.1997 / 17:46:31 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4816 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4817 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4818 |
performMethod:aMethod with:arg |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4819 |
"invoke aMethod on the receiver, passing an argument. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4820 |
The method should be a one-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4821 |
This is a non-object-oriented entry, applying a method |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4822 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4823 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4824 |
Take care for the method to be appropriate for the |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4825 |
receiver - no checking is done by the VM." |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4826 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4827 |
^ aMethod valueWithReceiver:self arguments:(Array with:arg) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4828 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4829 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4830 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4831 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4832 |
mthd := SmallInteger compiledMethodAt:#+. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4833 |
Transcript showCR:(1 performMethod:mthd with:2) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4834 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4835 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4836 |
"Modified: 31.7.1997 / 17:42:32 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4837 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4838 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4839 |
performMethod:aMethod with:arg1 with:arg2 |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4840 |
"invoke aMethod on the receiver, passing two arguments. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4841 |
The method should be a two-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4842 |
This is a non-object-oriented entry, applying a method |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4843 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4844 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4845 |
Take care for the method to be appropriate for the |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4846 |
receiver - no checking is done by the VM." |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4847 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4848 |
^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4849 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4850 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4851 |
|mthd arr| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4852 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4853 |
arr := Array new:1. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4854 |
mthd := Array compiledMethodAt:#basicAt:put:. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4855 |
arr performMethod:mthd with:1 with:'foo'. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4856 |
Transcript showCR:arr |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4857 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4858 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4859 |
"Modified: 31.7.1997 / 17:44:54 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4860 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4861 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4862 |
performMethod:aMethod with:arg1 with:arg2 with:arg3 |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4863 |
"invoke aMethod on the receiver, passing three arguments. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4864 |
The method should be a three-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4865 |
This is a non-object-oriented entry, applying a method |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4866 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4867 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4868 |
Take care for the method to be appropriate for the |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4869 |
receiver - no checking is done by the VM." |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4870 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4871 |
^ aMethod valueWithReceiver:self arguments:(Array with:arg1 with:arg2 with:arg3) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4872 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4873 |
"Created: 31.7.1997 / 17:45:20 / cg" |
1 | 4874 |
! ! |
4875 |
||
4876 |
!Object methodsFor:'printing & storing'! |
|
4877 |
||
4878 |
className |
|
4879 |
"return the classname of the receivers class" |
|
4880 |
||
4881 |
^ self class name |
|
56 | 4882 |
|
293 | 4883 |
" |
4884 |
1 className |
|
4885 |
1 class className 'this may change ...' |
|
4886 |
$a className |
|
4887 |
$a class className 'this may change ...' |
|
4888 |
" |
|
1 | 4889 |
! |
4890 |
||
4891 |
classNameWithArticle |
|
71 | 4892 |
"return a string consisting of classname preceeded by an article. |
4893 |
(dont expect me to write national variants for this ... :-) |
|
4894 |
If you have special preferences, redefine it ..." |
|
1 | 4895 |
|
1391 | 4896 |
|classname cls| |
4897 |
||
4898 |
(cls := self class) == self ifTrue:[ |
|
2647 | 4899 |
^ 'a funny object' |
1391 | 4900 |
]. |
4901 |
classname := cls displayString. |
|
85 | 4902 |
^ classname article , ' ' , classname |
56 | 4903 |
|
293 | 4904 |
" |
4905 |
1 classNameWithArticle |
|
4906 |
(1->2) classNameWithArticle |
|
4907 |
XWorkstation basicNew classNameWithArticle |
|
4908 |
" |
|
1391 | 4909 |
|
4910 |
"Modified: 13.5.1996 / 12:16:14 / cg" |
|
1 | 4911 |
! |
4912 |
||
783 | 4913 |
errorPrint |
4914 |
"print the receiver on the standard error stream." |
|
4915 |
||
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4916 |
Stream streamErrorSignal catch:[ |
2647 | 4917 |
self printOn:Stderr |
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4918 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4919 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4920 |
"Modified: 7.3.1996 / 19:11:29 / cg" |
783 | 4921 |
! |
4922 |
||
1425 | 4923 |
errorPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4924 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4925 |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4926 |
"print the receiver followed by a cr on the standard error stream." |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4927 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4928 |
Stream streamErrorSignal catch:[ |
2647 | 4929 |
self printOn:Stderr. |
4930 |
Stderr cr |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4931 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4932 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
4933 |
"Modified: 7.3.1996 / 19:13:01 / cg" |
1425 | 4934 |
"Created: 20.5.1996 / 10:20:41 / cg" |
4935 |
! |
|
4936 |
||
4937 |
errorPrintNL |
|
4938 |
"{ Pragma: +optSpace }" |
|
4939 |
||
4940 |
"print the receiver followed by a cr on the standard error stream. |
|
4941 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
4942 |
||
4943 |
^ self errorPrintCR |
|
4944 |
||
4945 |
"Modified: 20.5.1996 / 10:24:45 / cg" |
|
4946 |
! |
|
4947 |
||
4948 |
errorPrintNewline |
|
4949 |
"{ Pragma: +optSpace }" |
|
4950 |
||
4951 |
"print the receiver followed by a cr on the standard error stream. |
|
4952 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
4953 |
||
4954 |
self errorPrintCR. |
|
4955 |
||
4956 |
"Modified: 20.5.1996 / 10:24:38 / cg" |
|
71 | 4957 |
! |
4958 |
||
356 | 4959 |
infoPrint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4960 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4961 |
|
356 | 4962 |
"print the receiver on the standard error stream. |
4963 |
This is meant for information messages which are not warnings |
|
4964 |
or fatal messages. |
|
4965 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
4966 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
4967 |
InfoPrinting == true ifTrue:[ |
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
4968 |
self errorPrint |
356 | 4969 |
] |
4970 |
! |
|
4971 |
||
1425 | 4972 |
infoPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4973 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4974 |
|
356 | 4975 |
"print the receiver followed by a cr on the standard error stream. |
4976 |
This is meant for information messages which are not warnings |
|
4977 |
or fatal messages. |
|
4978 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
4979 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
4980 |
InfoPrinting == true ifTrue:[ |
2647 | 4981 |
self errorPrintCR |
356 | 4982 |
] |
1425 | 4983 |
|
4984 |
"Created: 20.5.1996 / 10:21:28 / cg" |
|
4985 |
! |
|
4986 |
||
4987 |
infoPrintNL |
|
4988 |
"{ Pragma: +optSpace }" |
|
4989 |
||
4990 |
"print the receiver followed by a cr on the standard error stream. |
|
4991 |
This is meant for information messages which are not warnings |
|
4992 |
or fatal messages. |
|
4993 |
These messages can be turned on/off by 'Object infoPrinting:true/false'. |
|
4994 |
||
4995 |
Please use #infoPrintCR - this method exists for backward compatibility." |
|
4996 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
4997 |
^ self infoPrintCR |
1425 | 4998 |
|
4999 |
"Modified: 20.5.1996 / 10:25:07 / cg" |
|
356 | 5000 |
! |
5001 |
||
783 | 5002 |
|
1887 | 5003 |
"print the receiver on the standard output stream (which is not the Transcript)" |
783 | 5004 |
|
5005 |
self printOn:Stdout |
|
1887 | 5006 |
|
5007 |
"Modified: 4.11.1996 / 23:36:58 / cg" |
|
783 | 5008 |
! |
5009 |
||
1425 | 5010 |
printCR |
1887 | 5011 |
"print the receiver followed by a cr on the standard output stream (which is not the Transcript)" |
783 | 5012 |
|
5013 |
self printOn:Stdout. |
|
5014 |
Stdout cr |
|
1425 | 5015 |
|
5016 |
"Created: 20.5.1996 / 10:21:37 / cg" |
|
1887 | 5017 |
"Modified: 4.11.1996 / 23:37:06 / cg" |
1425 | 5018 |
! |
5019 |
||
5020 |
printNL |
|
5021 |
"print the receiver followed by a cr on the standard output stream |
|
5022 |
This exists for GNU Smalltalk compatibility - please use #printCR." |
|
5023 |
||
5024 |
^ self printCR |
|
5025 |
||
5026 |
"Modified: 20.5.1996 / 10:25:31 / cg" |
|
5027 |
! |
|
5028 |
||
5029 |
printNewline |
|
5030 |
"print the receiver followed by a cr on the standard output stream. |
|
5031 |
This exists for backward compatibility - please use #printCR." |
|
5032 |
||
5033 |
self printCR |
|
5034 |
||
5035 |
"Modified: 20.5.1996 / 10:25:46 / cg" |
|
783 | 5036 |
! |
5037 |
||
5038 |
printOn:aStream |
|
5039 |
"print the receiver on the argument-stream. |
|
5040 |
The default here is to output the receivers class name. |
|
5041 |
BUT: this method is heavily redefined for objects which |
|
5042 |
can print prettier." |
|
5043 |
||
5044 |
aStream nextPutAll:self classNameWithArticle |
|
5045 |
! |
|
5046 |
||
5047 |
printOn:aStream leftPaddedTo:size |
|
5048 |
"print the receiver on aStream, padding with spaces up to size. |
|
5049 |
padding is done on the left." |
|
5050 |
||
5051 |
self printOn:aStream leftPaddedTo:size with:(Character space) |
|
5052 |
||
5053 |
" |
|
5054 |
123 printOn:Transcript leftPaddedTo:10. Transcript cr |
|
5055 |
123 printOn:Transcript leftPaddedTo:2. Transcript cr |
|
5056 |
" |
|
71 | 5057 |
! |
5058 |
||
783 | 5059 |
printOn:aStream leftPaddedTo:size with:padCharacter |
5060 |
"print the receiver on aStream, padding with padCharacters up to size. |
|
5061 |
padding is done on the left." |
|
5062 |
||
5063 |
aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter) |
|
5064 |
||
5065 |
" |
|
5066 |
123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr |
|
5067 |
123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr |
|
5068 |
" |
|
5069 |
! |
|
5070 |
||
5071 |
printOn:aStream paddedTo:size |
|
5072 |
"print the receiver on aStream, padding with spaces up to size." |
|
5073 |
||
5074 |
self printOn:aStream paddedTo:size with:(Character space) |
|
5075 |
||
5076 |
" |
|
5077 |
123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr |
|
5078 |
" |
|
71 | 5079 |
! |
5080 |
||
783 | 5081 |
printOn:aStream paddedTo:size with:padCharacter |
5082 |
"print the receiver on aStream, padding with padCharacter up to size" |
|
5083 |
||
5084 |
aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter). |
|
5085 |
||
5086 |
" |
|
5087 |
123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr |
|
5088 |
123 printOn:Transcript paddedTo:10 with:$. . Transcript cr |
|
5089 |
" |
|
5090 |
! |
|
5091 |
||
5092 |
printOn:aStream zeroPaddedTo:size |
|
5093 |
"print the receiver on aStream, padding with zeros up to size. |
|
5094 |
Usually used with float numbers." |
|
5095 |
||
5096 |
self printOn:aStream paddedTo:size with:$0. |
|
5097 |
||
5098 |
" |
|
5099 |
123.0 printOn:Transcript zeroPaddedTo:10 |
|
5100 |
" |
|
5101 |
! |
|
5102 |
||
5103 |
printRightAdjustLen:size |
|
5104 |
"obsolete - just a name confusion. |
|
5105 |
This method will go away ..." |
|
5106 |
||
5107 |
(self printStringLeftPaddedTo:size) printOn:Stdout |
|
71 | 5108 |
! |
5109 |
||
5110 |
printString |
|
5111 |
"return a string for printing the receiver. |
|
5112 |
Since we now use printOn: as the basic print mechanism, |
|
5113 |
we have to create a stream and print into it." |
|
5114 |
||
5115 |
|s| |
|
5116 |
||
5117 |
s := WriteStream on:(String new:30). |
|
5118 |
self printOn:s. |
|
5119 |
^ s contents |
|
5120 |
! |
|
5121 |
||
783 | 5122 |
printStringLeftPaddedTo:size |
5123 |
"return my printString as a right-adjusted string of length size; |
|
5124 |
characters on the left are filled with spaces. |
|
5125 |
If the printString is longer than size, |
|
5126 |
it is returned unchanged (i.e. not truncated)" |
|
5127 |
||
5128 |
^ self printStringLeftPaddedTo:size with:(Character space) |
|
5129 |
||
5130 |
" |
|
5131 |
10 printStringLeftPaddedTo:10 |
|
5132 |
1 printStringLeftPaddedTo:10 |
|
5133 |
" |
|
5134 |
! |
|
5135 |
||
5136 |
printStringLeftPaddedTo:size ifLarger:alternative |
|
5137 |
"return my printString as a right-adjusted string of length size; |
|
5138 |
characters on the left are filled with spaces. |
|
5139 |
If the printString is larger than size, |
|
5140 |
return the result from evaluating alternative." |
|
5141 |
||
5142 |
^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative |
|
5143 |
||
5144 |
" |
|
5145 |
12 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5146 |
123 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5147 |
1234 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5148 |
" |
|
5149 |
! |
|
5150 |
||
5151 |
printStringLeftPaddedTo:size with:padCharacter |
|
5152 |
"return my printString as a right-adjusted string of length size; |
|
5153 |
characters on the left are filled with padCharacter. |
|
5154 |
If the printString is longer than size, |
|
5155 |
it is returned unchanged (i.e. not truncated)" |
|
5156 |
||
5157 |
^ (self printString) leftPaddedTo:size with:padCharacter |
|
5158 |
||
5159 |
" |
|
5160 |
123 printStringLeftPaddedTo:10 with:$. |
|
5161 |
1 printStringLeftPaddedTo:10 with:$. |
|
5162 |
(Float pi) printStringLeftPaddedTo:20 with:$* |
|
5163 |
" |
|
5164 |
! |
|
5165 |
||
5166 |
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative |
|
5167 |
"return my printString as a right-adjusted string of length size; |
|
5168 |
characters on the left are filled with padCharacter. |
|
5169 |
If the printString is larger than size, |
|
369 | 5170 |
return the result from evaluating alternative." |
5171 |
||
5172 |
|s| |
|
5173 |
||
5174 |
s := self printString. |
|
5175 |
s size > size ifTrue:[^ alternative value]. |
|
783 | 5176 |
^ s leftPaddedTo:size with:padCharacter |
369 | 5177 |
|
5178 |
" |
|
783 | 5179 |
12 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
5180 |
123 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
5181 |
1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
293 | 5182 |
" |
13 | 5183 |
! |
5184 |
||
5185 |
printStringPaddedTo:size |
|
56 | 5186 |
"return a printed representation of the receiver, |
369 | 5187 |
padded with spaces (at the right) up to size. |
293 | 5188 |
If the printString is longer than size, |
5189 |
it is returned unchanged (i.e. not truncated)" |
|
13 | 5190 |
|
5191 |
^ self printStringPaddedTo:size with:(Character space) |
|
5192 |
||
293 | 5193 |
" |
5194 |
123 printStringPaddedTo:10 |
|
5195 |
1234567890123456 printStringPaddedTo:10 |
|
5196 |
'hello' printStringPaddedTo:10 |
|
5197 |
" |
|
2 | 5198 |
! |
5199 |
||
369 | 5200 |
printStringPaddedTo:size ifLarger:alternative |
5201 |
"return a printed representation of the receiver, |
|
5202 |
padded with spaces (at the right) up to size. |
|
5203 |
If the resulting printString is too large, |
|
5204 |
return the result from evaluating alternative." |
|
5205 |
||
5206 |
^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative |
|
5207 |
||
5208 |
" |
|
5209 |
12 printStringPaddedTo:3 ifLarger:['***'] |
|
5210 |
123 printStringPaddedTo:3 ifLarger:['***'] |
|
5211 |
1234 printStringPaddedTo:3 ifLarger:['***'] |
|
5212 |
" |
|
5213 |
! |
|
5214 |
||
783 | 5215 |
printStringPaddedTo:size with:padCharacter |
5216 |
"return a printed representation of the receiver, |
|
5217 |
padded with padCharacter (at the right) up to size. |
|
5218 |
If the printString is longer than size, |
|
5219 |
it is returned unchanged (i.e. not truncated)" |
|
5220 |
||
5221 |
^ (self printString) paddedTo:size with:padCharacter |
|
5222 |
||
5223 |
" |
|
5224 |
123 printStringPaddedTo:10 with:$. |
|
5225 |
123 printStringPaddedTo:10 with:$* |
|
5226 |
123 printStringPaddedTo:3 with:$* |
|
5227 |
1234 printStringPaddedTo:3 with:$* |
|
5228 |
" |
|
5229 |
! |
|
5230 |
||
5231 |
printStringPaddedTo:size with:padCharacter ifLarger:alternative |
|
5232 |
"return a printed representation of the receiver, |
|
5233 |
padded with padCharacter (at the right) up to size. |
|
5234 |
If the resulting printString is too large, |
|
5235 |
return the result from evaluating alternative." |
|
5236 |
||
5237 |
|s| |
|
5238 |
||
5239 |
s := self printString. |
|
5240 |
s size > size ifTrue:[^ alternative value]. |
|
5241 |
^ s paddedTo:size with:padCharacter |
|
5242 |
||
5243 |
" |
|
5244 |
123 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
5245 |
12345 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
5246 |
" |
|
5247 |
! |
|
5248 |
||
5249 |
printStringRightAdjustLen:size |
|
5250 |
"obsolete - just a name confusion. |
|
5251 |
This method will go away ..." |
|
5252 |
||
5253 |
^ self printStringLeftPaddedTo:size |
|
5254 |
! |
|
5255 |
||
2 | 5256 |
printStringZeroPaddedTo:size |
71 | 5257 |
"return a printed representation of the receiver, |
369 | 5258 |
padded with zero (at the right) characters up to size. |
13 | 5259 |
Usually used with float numbers." |
2 | 5260 |
|
5261 |
^ self printStringPaddedTo:size with:$0 |
|
13 | 5262 |
|
293 | 5263 |
" |
5264 |
123.0 printStringZeroPaddedTo:10 |
|
5265 |
" |
|
2 | 5266 |
! |
5267 |
||
783 | 5268 |
store |
5269 |
"store the receiver on standard output. |
|
5270 |
this method is useless, but included for compatibility." |
|
5271 |
||
5272 |
self storeOn:Stdout |
|
71 | 5273 |
! |
5274 |
||
1425 | 5275 |
storeCR |
5276 |
"store the receiver on standard output; append a carriage return." |
|
5277 |
||
5278 |
self store. |
|
5279 |
Character cr print |
|
5280 |
||
5281 |
"Created: 20.5.1996 / 10:26:01 / cg" |
|
5282 |
"Modified: 20.5.1996 / 10:26:57 / cg" |
|
5283 |
! |
|
5284 |
||
783 | 5285 |
storeNl |
5286 |
"store the receiver on standard output; append a newline. |
|
1425 | 5287 |
This method is included for backward compatibility- use #storeCR." |
5288 |
||
5289 |
self storeCR. |
|
5290 |
||
5291 |
"Modified: 20.5.1996 / 10:26:49 / cg" |
|
460
7e058858cc3b
New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents:
446
diff
changeset
|
5292 |
! |
7e058858cc3b
New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents:
446
diff
changeset
|
5293 |
|
56 | 5294 |
storeOn:aStream |
5295 |
"store the receiver on aStream; i.e. print an expression which will |
|
293 | 5296 |
reconstruct the receiver. |
5297 |
Notice, that no self referencing or cyclic objects can be represented |
|
5298 |
in this format. |
|
5299 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 5300 |
|
5301 |
|myClass hasSemi sz "{ Class: SmallInteger }" | |
|
1 | 5302 |
|
25 | 5303 |
thisContext isRecursive ifTrue:[ |
2647 | 5304 |
('Object [error]: storeString of self referencing object.') errorPrintCR. |
5305 |
aStream nextPutAll:'#("recursive")'. |
|
5306 |
^ self |
|
25 | 5307 |
]. |
56 | 5308 |
|
1 | 5309 |
myClass := self class. |
56 | 5310 |
aStream nextPut:$(. |
5311 |
aStream nextPutAll:self class name. |
|
5312 |
||
1 | 5313 |
hasSemi := false. |
5314 |
myClass isVariable ifTrue:[ |
|
2647 | 5315 |
aStream nextPutAll:' basicNew:'. |
5316 |
self basicSize printOn:aStream |
|
1 | 5317 |
] ifFalse:[ |
2647 | 5318 |
aStream nextPutAll:' basicNew' |
1 | 5319 |
]. |
56 | 5320 |
|
1 | 5321 |
sz := myClass instSize. |
5322 |
1 to:sz do:[:i | |
|
2647 | 5323 |
aStream nextPutAll:' instVarAt:'. |
5324 |
i printOn:aStream. |
|
5325 |
aStream nextPutAll:' put:'. |
|
5326 |
(self instVarAt:i) storeOn:aStream. |
|
5327 |
aStream nextPut:$;. |
|
5328 |
hasSemi := true |
|
1 | 5329 |
]. |
5330 |
myClass isVariable ifTrue:[ |
|
2647 | 5331 |
sz := self basicSize. |
5332 |
1 to:sz do:[:i | |
|
5333 |
aStream nextPutAll:' basicAt:'. |
|
5334 |
i printOn:aStream. |
|
5335 |
aStream nextPutAll:' put:'. |
|
5336 |
(self basicAt:i) storeOn:aStream. |
|
5337 |
aStream nextPut:$;. |
|
5338 |
hasSemi := true |
|
5339 |
] |
|
1 | 5340 |
]. |
5341 |
hasSemi ifTrue:[ |
|
2647 | 5342 |
aStream nextPutAll:' yourself' |
1 | 5343 |
]. |
56 | 5344 |
aStream nextPut:$). |
293 | 5345 |
|
5346 |
" |
|
5347 |
|s| |
|
5348 |
||
5349 |
s := WriteStream on:(String new). |
|
5350 |
('hello' -> 'world') storeOn:s. |
|
5351 |
s := ReadStream on:(s contents). |
|
5352 |
(Object readFrom:s) inspect |
|
5353 |
" |
|
5354 |
" |
|
5355 |
|s| |
|
5356 |
||
5357 |
s := 'data' asFilename writeStream. |
|
5358 |
('hello' -> 'world') storeOn:s. |
|
5359 |
s close. |
|
5360 |
||
5361 |
s := 'data' asFilename readStream. |
|
5362 |
(Object readFrom:s) inspect |
|
5363 |
" |
|
5364 |
||
5365 |
"does not work example:" |
|
5366 |
" |
|
5367 |
|s a| |
|
5368 |
||
5369 |
a := Array new:2. |
|
5370 |
a at:1 put:a. |
|
5371 |
||
5372 |
s := 'data' asFilename writeStream. |
|
5373 |
a storeOn:s. |
|
5374 |
s close. |
|
5375 |
||
5376 |
s := 'data' asFilename readStream. |
|
5377 |
(Object readFrom:s) inspect |
|
5378 |
" |
|
1417 | 5379 |
|
2287 | 5380 |
"Modified: 28.1.1997 / 00:36:12 / cg" |
1 | 5381 |
! |
5382 |
||
56 | 5383 |
storeString |
293 | 5384 |
"return a string representing an expression to reconstruct the receiver. |
5385 |
Notice, that no self referencing or cyclic objects can be represented |
|
5386 |
in this format. |
|
5387 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 5388 |
|
5389 |
|s| |
|
5390 |
||
5391 |
s := WriteStream on:(String new:50). |
|
5392 |
self storeOn:s. |
|
5393 |
^ s contents |
|
783 | 5394 |
! ! |
5395 |
||
5396 |
!Object methodsFor:'queries'! |
|
5397 |
||
5398 |
basicSize |
|
5399 |
"return the number of the receivers indexed instance variables, |
|
5400 |
0 if it has none. |
|
5401 |
||
2148 | 5402 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
783 | 5403 |
|
5404 |
%{ /* NOCONTEXT */ |
|
5405 |
||
5406 |
REGISTER int nbytes; |
|
5407 |
REGISTER OBJ myClass; |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5408 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5409 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5410 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5411 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5412 |
#endif |
783 | 5413 |
|
5414 |
/* |
|
5415 |
* notice the missing test for self being a nonNilObject - |
|
5416 |
* this can be done since basicSize is defined both in UndefinedObject |
|
5417 |
* and SmallInteger |
|
5418 |
*/ |
|
5419 |
myClass = __qClass(self); |
|
5420 |
nbytes = __qSize(self) |
|
2647 | 5421 |
- OHDR_SIZE |
5422 |
- __OBJS2BYTES__(__intVal(__ClassInstPtr(myClass)->c_ninstvars)); |
|
1133 | 5423 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5424 |
switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5425 |
case __MASKSMALLINT(POINTERARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5426 |
RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) ); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5427 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5428 |
case __MASKSMALLINT(BYTEARRAY): |
2647 | 5429 |
RETURN ( __MKSMALLINT(nbytes / sizeof(char)) ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5430 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5431 |
case __MASKSMALLINT(WKPOINTERARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5432 |
RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) ); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5433 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5434 |
case __MASKSMALLINT(FLOATARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5435 |
RETURN ( __MKSMALLINT(nbytes / sizeof(float)) ); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5436 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5437 |
case __MASKSMALLINT(DOUBLEARRAY): |
783 | 5438 |
#ifdef NEED_DOUBLE_ALIGN |
2647 | 5439 |
/* |
5440 |
* care for filler |
|
5441 |
*/ |
|
5442 |
nbytes -= sizeof(FILLTYPE); |
|
783 | 5443 |
#endif |
2647 | 5444 |
RETURN ( __MKSMALLINT(nbytes / sizeof(double)) ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5445 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5446 |
case __MASKSMALLINT(WORDARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5447 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5448 |
RETURN ( __MKSMALLINT(nbytes / sizeof(short)) ); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5449 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5450 |
case __MASKSMALLINT(LONGARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5451 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5452 |
RETURN ( __MKSMALLINT(nbytes / sizeof(int32)) ); |
783 | 5453 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5454 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5455 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5456 |
|
783 | 5457 |
%}. |
5458 |
^ 0 |
|
1 | 5459 |
! |
5460 |
||
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5461 |
byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5462 |
"return the number of bytes in the receivers indexed instance variables, |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5463 |
0 if it has none. This only returns non-zero for non-pointer indexed |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5464 |
instvars i.e. byteArrays, wordArrays etc. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5465 |
Notice: for Strings the returned size may look strange. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5466 |
Only useful with binary storage." |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5467 |
|
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5468 |
%{ /* NOCONTEXT */ |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5469 |
|
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5470 |
REGISTER int indx; |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5471 |
int nIndex; |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5472 |
REGISTER OBJ slf; |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5473 |
REGISTER OBJ cls; |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5474 |
|
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5475 |
slf = self; |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5476 |
if (__isNonNilObject(slf)) { |
2647 | 5477 |
cls = __qClass(slf); |
5478 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5479 |
switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5480 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5481 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5482 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5483 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5484 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5485 |
case __MASKSMALLINT(FLOATARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5486 |
case __MASKSMALLINT(DOUBLEARRAY): |
2647 | 5487 |
nIndex = __byteArraySize(slf); |
5488 |
nIndex -= __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
|
5489 |
RETURN ( __MKSMALLINT(nIndex) ); |
|
5490 |
} |
|
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5491 |
} |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5492 |
%}. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5493 |
^ 0 |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5494 |
|
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5495 |
" |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5496 |
Point new byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5497 |
'hello' byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5498 |
(ByteArray with:1 with:2) byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5499 |
(FloatArray with:1.5) byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5500 |
" |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5501 |
! |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5502 |
|
783 | 5503 |
class |
5504 |
"return the receivers class" |
|
5505 |
||
5506 |
%{ /* NOCONTEXT */ |
|
5507 |
||
5508 |
RETURN ( __Class(self) ); |
|
5509 |
%} |
|
5510 |
! |
|
5511 |
||
5512 |
respondsTo:aSelector |
|
5513 |
"return true, if the receiver implements a method with selector equal |
|
5514 |
to aSelector; i.e. if there is a method for aSelector in either the |
|
5515 |
receivers class or one of its superclasses. |
|
5516 |
||
5517 |
Notice, that this does not imply, that such a message can be sent without |
|
5518 |
an error being raised. For example, an implementation could send |
|
5519 |
#shouldNotImplement or #subclassResponsibility." |
|
5520 |
||
5521 |
" |
|
5522 |
should we go via the cache, or search (by class) ? |
|
5523 |
The first is faster, most of the time; while the 2nd fills |
|
5524 |
the cache with useless data if this is sent in a loop over all objects. |
|
5525 |
For now, use the cache ... |
|
5526 |
" |
|
5527 |
%{ /* NOCONTEXT */ |
|
5528 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
5529 |
if (__lookup(__Class(self), aSelector) == nil) { |
783 | 5530 |
RETURN ( false ); |
5531 |
} |
|
5532 |
RETURN ( true ); |
|
5533 |
%} |
|
5534 |
. |
|
5535 |
" |
|
5536 |
^ self class canUnderstand:aSelector |
|
5537 |
" |
|
5538 |
||
5539 |
"'aString' respondsTo:#+" |
|
5540 |
"'aString' respondsTo:#," |
|
5541 |
"'aString' respondsTo:#collect:" |
|
5542 |
! |
|
5543 |
||
5544 |
respondsToArithmetic |
|
5545 |
"return true, if the receiver responds to arithmetic messages. |
|
5546 |
false is returned here - the method is redefined in ArithmeticValue." |
|
5547 |
||
5548 |
^ false |
|
5549 |
! |
|
5550 |
||
5551 |
size |
|
5552 |
"return the number of the receivers indexed instance variables; |
|
5553 |
this method may be redefined in subclasses" |
|
5554 |
||
5555 |
^ self basicSize |
|
5556 |
! |
|
5557 |
||
5558 |
species |
|
5559 |
"return a class which is similar to (or the same as) the receivers class. |
|
5560 |
This is used to create an appropriate object when creating derived |
|
5561 |
copies in the collection classes (sometimes redefined)." |
|
5562 |
||
5563 |
^ self class |
|
5564 |
! |
|
5565 |
||
5566 |
yourself |
|
5567 |
"return the receiver - used for cascades to return self at the end" |
|
5568 |
||
5569 |
^ self |
|
5570 |
! ! |
|
5571 |
||
5572 |
!Object methodsFor:'secure message sending'! |
|
5573 |
||
5574 |
askFor:aSelector |
|
5575 |
"try to send the receiver the message, aSelector. |
|
5576 |
If it does not understand it, return false. Otherwise |
|
5577 |
the real value returned. |
|
5578 |
Useful to send messages such as: 'isColor' to unknown |
|
5579 |
receivers." |
|
5580 |
||
5581 |
^ self perform:aSelector ifNotUnderstood:[false] |
|
5582 |
||
5583 |
" |
|
5584 |
1 askFor:#isColor |
|
5585 |
" |
|
5586 |
! |
|
5587 |
||
5588 |
perform:aSelector ifNotUnderstood:exceptionBlock |
|
5589 |
"try to send message aSelector to the receiver. |
|
5590 |
If its understood, return the methods returned value, |
|
5591 |
otherwise return the value of the exceptionBlock" |
|
5592 |
||
5593 |
|val| |
|
5594 |
||
5595 |
MessageNotUnderstoodSignal handle:[:ex | |
|
5596 |
^ exceptionBlock value |
|
5597 |
] do:[ |
|
5598 |
val := self perform:aSelector |
|
5599 |
]. |
|
5600 |
^ val |
|
5601 |
||
5602 |
" |
|
5603 |
1.2345 perform:#foo ifNotUnderstood:['sorry'] |
|
5604 |
" |
|
1 | 5605 |
! |
5606 |
||
783 | 5607 |
perform:aSelector with:argument ifNotUnderstood:exceptionBlock |
5608 |
"try to send message aSelector to the receiver. |
|
5609 |
If its understood, return the methods returned value, |
|
5610 |
otherwise return the value of the exceptionBlock" |
|
5611 |
||
5612 |
|val| |
|
5613 |
||
5614 |
MessageNotUnderstoodSignal handle:[:ex | |
|
5615 |
^ exceptionBlock value |
|
5616 |
] do:[ |
|
5617 |
val := self perform:aSelector with:argument |
|
5618 |
]. |
|
5619 |
^ val |
|
5620 |
||
5621 |
" |
|
5622 |
|unknown| |
|
5623 |
||
5624 |
unknown := 1. |
|
5625 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
5626 |
unknown := 'high there'. |
|
5627 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
5628 |
" |
|
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5629 |
! |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5630 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5631 |
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5632 |
"try to send message aSelector to the receiver. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5633 |
If its understood, return the methods returned value, |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5634 |
otherwise return the value of the exceptionBlock" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5635 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5636 |
|val| |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5637 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5638 |
MessageNotUnderstoodSignal handle:[:ex | |
2647 | 5639 |
^ exceptionBlock value |
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5640 |
] do:[ |
2647 | 5641 |
val := self perform:aSelector withArguments:argumentArray |
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5642 |
]. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5643 |
^ val |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5644 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5645 |
" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5646 |
|unknown| |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5647 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5648 |
unknown := 1. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5649 |
(unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5650 |
unknown := 'high there'. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5651 |
(unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5652 |
" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5653 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5654 |
"Modified: 27.3.1997 / 14:13:16 / cg" |
783 | 5655 |
! ! |
5656 |
||
2448 | 5657 |
!Object methodsFor:'signal constants'! |
5658 |
||
5659 |
messageNotUnderstoodSignal |
|
5660 |
^ MessageNotUnderstoodSignal |
|
5661 |
||
5662 |
"Created: 6.3.1997 / 15:46:52 / cg" |
|
5663 |
! ! |
|
5664 |
||
783 | 5665 |
!Object methodsFor:'special queries'! |
5666 |
||
5667 |
allOwners |
|
5668 |
"return a collection of all objects referencing the receiver" |
|
5669 |
||
5670 |
^ ObjectMemory whoReferences:self |
|
5671 |
! |
|
5672 |
||
5673 |
references:anObject |
|
5674 |
"return true, if the receiver refers to the argument, anObject. |
|
5675 |
- for debugging only" |
|
5676 |
||
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5677 |
%{ /* NOCONTEXT */ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5678 |
OBJ cls, flags; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5679 |
int nInsts, i; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5680 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5681 |
if (! __isNonNilObject(self)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5682 |
RETURN (false); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5683 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5684 |
|
783 | 5685 |
/* |
5686 |
* a little optimization: use the fact that all old objects |
|
5687 |
* refering to a new object are on the remSet; if I am not, |
|
5688 |
* a trivial reject is possible, if anObject is a newbee |
|
5689 |
*/ |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5690 |
if (__isNonNilObject(anObject)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5691 |
if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5692 |
int spc; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5693 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5694 |
if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5695 |
RETURN (false); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5696 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5697 |
} |
783 | 5698 |
} |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5699 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5700 |
cls = __qClass(self); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5701 |
if (cls == anObject) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5702 |
RETURN (true); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5703 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5704 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5705 |
flags = __ClassInstPtr(cls)->c_flags; |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
5706 |
if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5707 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5708 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5709 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5710 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5711 |
if (! nInsts) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5712 |
RETURN (false); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5713 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5714 |
#if defined(memsrch4) |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5715 |
if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5716 |
RETURN (true); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5717 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5718 |
#else |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5719 |
for (i=0; i<nInsts; i++) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5720 |
if (__InstPtr(self)->i_instvars[i] == anObject) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5721 |
RETURN (true); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5722 |
} |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5723 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5724 |
#endif /* memsrch4 */ |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5725 |
|
783 | 5726 |
%}. |
5727 |
||
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5728 |
"/ |myClass |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5729 |
"/ numInst "{ Class: SmallInteger }" | |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5730 |
"/ |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5731 |
"/ myClass := self class. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5732 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5733 |
"/ "check the class" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5734 |
"/ (myClass == anObject) ifTrue:[^ true]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5735 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5736 |
"/ "check the instance variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5737 |
"/ numInst := myClass instSize. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5738 |
"/ 1 to:numInst do:[:i | |
2647 | 5739 |
"/ ((self instVarAt:i) == anObject) ifTrue:[^ true] |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5740 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5741 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5742 |
"/ "check the indexed variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5743 |
"/ myClass isVariable ifTrue:[ |
2647 | 5744 |
"/ myClass isPointers ifFalse:[ |
5745 |
"/ "/ |
|
5746 |
"/ "/ we could argue about the following unconditional return: |
|
5747 |
"/ "/ it says that a non pointer array never has a reference to the |
|
5748 |
"/ "/ corresponding object - not mimicing a reference to a copy of the |
|
5749 |
"/ "/ integer. However, it avoids useless searches in huge byteArray |
|
5750 |
"/ "/ like objects when searching for owners. If in doubt, remove it. |
|
5751 |
"/ "/ A consequence of the return below is that #[1 2 3] will say that it |
|
5752 |
"/ "/ does not refer to the number 2 (think of keeping a copy instead) |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5753 |
"/ |
2647 | 5754 |
"/ ^ false. |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5755 |
"/ |
2647 | 5756 |
"/ "/ alternative: |
5757 |
"/ "/ anObject isNumber ifFalse:[^ false]. |
|
5758 |
"/ ]. |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5759 |
"/ |
2647 | 5760 |
"/ "/ |
5761 |
"/ "/ because arrays are so common, and those have a highly tuned |
|
5762 |
"/ "/ idenitytIndex method, use it |
|
5763 |
"/ "/ |
|
5764 |
"/ myClass == Array ifTrue:[ |
|
5765 |
"/ ^ (self identityIndexOf:anObject) ~~ 0 |
|
5766 |
"/ ]. |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5767 |
"/ |
2647 | 5768 |
"/ "/ |
5769 |
"/ "/ otherwise, do it the slow way |
|
5770 |
"/ "/ |
|
5771 |
"/ numInst := self basicSize. |
|
5772 |
"/ 1 to:numInst do:[:i | |
|
5773 |
"/ ((self basicAt:i) == anObject) ifTrue:[^ true] |
|
5774 |
"/ ] |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5775 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5776 |
|
783 | 5777 |
^ false |
5778 |
||
5779 |
" |
|
5780 |
|v| |
|
5781 |
||
5782 |
v := View new initialize. |
|
5783 |
v references:Display. |
|
5784 |
" |
|
5785 |
! |
|
5786 |
||
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5787 |
referencesAny:aCollection |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5788 |
"return true, if the receiver refers to any object from |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5789 |
the argument, aCollection. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5790 |
- for debugging only" |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5791 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5792 |
%{ |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5793 |
OBJ cls, flags; |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5794 |
int nInsts, inst; |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5795 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5796 |
if (! __isNonNilObject(self)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5797 |
RETURN (false); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5798 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5799 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5800 |
if (__isArray(aCollection)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5801 |
int nObjs = __arraySize(aCollection); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5802 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5803 |
if (nObjs == 0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5804 |
RETURN (false); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5805 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5806 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5807 |
/* |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5808 |
* a little optimization: use the fact that all old objects |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5809 |
* refering to a new object are on the remSet; if I am not, |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5810 |
* a trivial reject is possible, if all objects are newbees |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5811 |
*/ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5812 |
if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5813 |
int allNewBees = 1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5814 |
int i; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5815 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5816 |
for (i=0; i<nObjs; i++) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5817 |
OBJ anObject; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5818 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5819 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5820 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5821 |
if (__isNonNilObject(anObject)) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5822 |
int spc; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5823 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5824 |
if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5825 |
allNewBees = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5826 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5827 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5828 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5829 |
if (allNewBees) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5830 |
RETURN (false); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5831 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5832 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5833 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5834 |
cls = __qClass(self); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5835 |
{ |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5836 |
#if defined(memsrch4) |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5837 |
if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)cls, nObjs)) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5838 |
RETURN (true); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5839 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5840 |
#else |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5841 |
int i; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5842 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5843 |
for (i=0; i<nObjs; i++) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5844 |
OBJ anObject; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5845 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5846 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5847 |
if (cls == anObject) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5848 |
RETURN (true); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5849 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5850 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5851 |
#endif /* memsrch4 */ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5852 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5853 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5854 |
flags = __ClassInstPtr(cls)->c_flags; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5855 |
if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5856 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5857 |
} else { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5858 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5859 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5860 |
if (! nInsts) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5861 |
RETURN (false); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5862 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5863 |
for (inst=0; inst<nInsts; inst++) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5864 |
OBJ instVar = __InstPtr(self)->i_instvars[inst]; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5865 |
int i; |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5866 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5867 |
#if defined(memsrch4) |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5868 |
if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)instVar, nObjs)) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5869 |
RETURN (true); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5870 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5871 |
#else |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5872 |
for (i=0; i<nObjs; i++) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5873 |
OBJ anObject; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5874 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5875 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5876 |
if (instVar == anObject) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5877 |
RETURN (true); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5878 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5879 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5880 |
#endif /* memsrch4 */ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5881 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5882 |
RETURN (false); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5883 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5884 |
%}. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5885 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5886 |
aCollection do:[:el | |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5887 |
(self references:el) ifTrue:[^ true]. |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5888 |
]. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5889 |
^ false |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5890 |
! |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5891 |
|
783 | 5892 |
referencesDerivedInstanceOf:aClass |
5893 |
"return true, if the receiver refers to an instance of |
|
5894 |
the argument, aClass or its subclass. This method exists |
|
5895 |
to support searching for users of a class." |
|
5896 |
||
5897 |
|myClass |
|
5898 |
numInst "{ Class: SmallInteger }" | |
|
5899 |
||
5900 |
myClass := self class. |
|
5901 |
||
5902 |
"check the class" |
|
5903 |
(myClass isKindOf:aClass) ifTrue:[^ true]. |
|
5904 |
||
5905 |
"check the instance variables" |
|
5906 |
numInst := myClass instSize. |
|
5907 |
1 to:numInst do:[:i | |
|
5908 |
((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
5909 |
]. |
|
5910 |
||
5911 |
"check the indexed variables" |
|
5912 |
myClass isVariable ifTrue:[ |
|
5913 |
myClass isPointers ifFalse:[ |
|
5914 |
"no need to search in non pointer fields" |
|
5915 |
((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false]. |
|
5916 |
]. |
|
5917 |
numInst := self basicSize. |
|
5918 |
1 to:numInst do:[:i | |
|
5919 |
((self basicAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
5920 |
] |
|
5921 |
]. |
|
5922 |
^ false |
|
5923 |
||
5924 |
" |
|
5925 |
(1 @ 3.4) referencesDerivedInstanceOf:Number |
|
5926 |
(1 @ 3.4) referencesDerivedInstanceOf:Array |
|
5927 |
View new initialize referencesDerivedInstanceOf:DeviceWorkstation |
|
5928 |
" |
|
5929 |
! |
|
5930 |
||
5931 |
referencesInstanceOf:aClass |
|
5932 |
"return true, if the receiver refers to an instance of |
|
5933 |
the argument, aClass.This method exists |
|
5934 |
to support searching for users of a class." |
|
5935 |
||
5936 |
|myClass |
|
5937 |
numInst "{ Class: SmallInteger }" | |
|
5938 |
||
5939 |
myClass := self class. |
|
5940 |
||
5941 |
"check the class" |
|
5942 |
(myClass isMemberOf:aClass) ifTrue:[^ true]. |
|
5943 |
||
5944 |
"check the instance variables" |
|
5945 |
numInst := myClass instSize. |
|
5946 |
1 to:numInst do:[:i | |
|
5947 |
((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
5948 |
]. |
|
5949 |
||
5950 |
"check the indexed variables" |
|
5951 |
myClass isVariable ifTrue:[ |
|
5952 |
myClass isPointers ifFalse:[ |
|
5953 |
"no need to search in non-pointer indexed fields" |
|
5954 |
myClass isLongs ifTrue:[ |
|
5955 |
(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false]. |
|
5956 |
] ifFalse:[ |
|
5957 |
myClass isFloatsOrDoubles ifTrue:[^ aClass == Float]. |
|
5958 |
^ aClass == SmallInteger |
|
5959 |
] |
|
5960 |
]. |
|
5961 |
numInst := self basicSize. |
|
5962 |
1 to:numInst do:[:i | |
|
5963 |
((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
5964 |
] |
|
5965 |
]. |
|
5966 |
^ false |
|
5967 |
||
5968 |
" |
|
5969 |
(1 @ 3.4) referencesInstanceOf:Float |
|
5970 |
(1 @ 3.4) referencesInstanceOf:Fraction |
|
5971 |
View new initialize referencesInstanceOf:(Display class) |
|
5972 |
" |
|
1 | 5973 |
! ! |
783 | 5974 |
|
2295 | 5975 |
!Object methodsFor:'synchronized evaluation'! |
5976 |
||
5977 |
freeSynchronizationSemaphore |
|
5978 |
"free synchronizationSemaphore. May be used, to save memory when |
|
5979 |
an object is no longer used synchronized." |
|
5980 |
||
2342 | 5981 |
|sema| |
2295 | 5982 |
|
5983 |
sema := self synchronizationSemaphore. |
|
5984 |
sema notNil ifTrue:[ |
|
2647 | 5985 |
sema wait. "/ get lock |
5986 |
self synchronizationSemaphore:nil. |
|
2295 | 5987 |
]. |
5988 |
||
5989 |
" |
|
5990 |
self synchronized:[]. |
|
5991 |
self synchronizationSemaphore. |
|
5992 |
self freeSynchronizationSemaphore. |
|
5993 |
" |
|
5994 |
||
5995 |
"Created: 28.1.1997 / 19:31:20 / stefan" |
|
5996 |
"Modified: 28.1.1997 / 19:47:55 / stefan" |
|
5997 |
! |
|
5998 |
||
5999 |
synchronizationSemaphore |
|
6000 |
"return the synchronization semaphore for myself. |
|
6001 |
subclasses may redefine" |
|
6002 |
||
6003 |
^ SynchronizationSemaphores at:self ifAbsent:[]. |
|
6004 |
||
6005 |
" |
|
6006 |
self synchronizationSemaphore |
|
6007 |
" |
|
6008 |
||
6009 |
"Modified: 28.1.1997 / 19:47:09 / stefan" |
|
6010 |
! |
|
6011 |
||
6012 |
synchronizationSemaphore:aSemaphore |
|
6013 |
"set the synchronisationSemaphore for myself. |
|
6014 |
subclasses may redefine this method" |
|
6015 |
||
6016 |
aSemaphore isNil ifTrue:[ |
|
2647 | 6017 |
"/ remove Semaphore |
6018 |
SynchronizationSemaphores removeKey:self ifAbsent:[]. |
|
2295 | 6019 |
] ifFalse:[ |
2647 | 6020 |
SynchronizationSemaphores at:self put:aSemaphore. |
2295 | 6021 |
]. |
6022 |
||
6023 |
"Modified: 28.1.1997 / 19:37:48 / stefan" |
|
6024 |
! |
|
6025 |
||
6026 |
synchronized:aBlock |
|
6027 |
"evaluate aBlock synchronized, i.e. use a monitor for this object" |
|
6028 |
||
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6029 |
|sema blocked gotSema| |
2327 | 6030 |
|
6031 |
blocked := OperatingSystem blockInterrupts. |
|
6032 |
||
6033 |
"/ the following avoids creation of an additional |
|
6034 |
"/ block in the common case |
|
2295 | 6035 |
|
6036 |
sema := self synchronizationSemaphore. |
|
6037 |
sema isNil ifTrue:[ |
|
2647 | 6038 |
"get a locked semaphore (with count = 0)" |
6039 |
sema := Semaphore new. |
|
6040 |
self synchronizationSemaphore:sema. |
|
6041 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
6042 |
^ aBlock valueNowOrOnUnwindDo:[sema signal]. |
|
2327 | 6043 |
]. |
6044 |
||
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6045 |
" |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6046 |
Poll sema (never waits). |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6047 |
Assuming that this is the common operation, this saves the creation |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6048 |
of some blocks. |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6049 |
" |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6050 |
(sema waitWithTimeout:0) notNil ifTrue:[ |
2647 | 6051 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
6052 |
^ aBlock valueNowOrOnUnwindDo:[sema signal]. |
|
2295 | 6053 |
]. |
2327 | 6054 |
|
6055 |
[ |
|
2647 | 6056 |
gotSema := sema wait. |
6057 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
6058 |
^ aBlock value. |
|
2327 | 6059 |
] valueNowOrOnUnwindDo:[ |
2647 | 6060 |
gotSema notNil ifTrue:[gotSema signal] |
2327 | 6061 |
]. |
2295 | 6062 |
|
6063 |
" |
|
6064 |
[Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork. |
|
6065 |
[Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork. |
|
6066 |
" |
|
6067 |
||
6068 |
"Created: 28.1.1997 / 17:52:56 / stefan" |
|
2327 | 6069 |
"Modified: 30.1.1997 / 13:38:54 / cg" |
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6070 |
"Modified: 20.2.1997 / 09:43:35 / stefan" |
2295 | 6071 |
! ! |
6072 |
||
783 | 6073 |
!Object methodsFor:'system primitives'! |
6074 |
||
1957 | 6075 |
asOop |
6076 |
"ST-80 compatibility: |
|
6077 |
ST-80 returns an OOP-identity based number here (I guess: its address |
|
6078 |
or index); since ST/X has no such thing, and the objects address cannot |
|
6079 |
be used (since its changing over time), we return the objects identityHash |
|
6080 |
key, which provides (at least) some identity indication. |
|
6081 |
However, notice that (in contrast to ST-80's #asOop), the identityHash |
|
6082 |
key of two non-identical objects may be the same. |
|
6083 |
You'd better not use it - especially do not misuse it." |
|
6084 |
||
6085 |
^ self identityHash |
|
6086 |
||
6087 |
"Created: 9.11.1996 / 19:09:56 / cg" |
|
6088 |
"Modified: 9.11.1996 / 19:16:04 / cg" |
|
6089 |
! |
|
6090 |
||
783 | 6091 |
become:anotherObject |
6092 |
"make all references to the receiver become references to anotherObject |
|
859 | 6093 |
and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become. |
6094 |
This can be a very dangerous operation - be warned. |
|
861 | 6095 |
In general, using #become: should be avoided if possible, since it may |
6096 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
6097 |
||
6098 |
This may also be an expensive (i.e. slow) operation, |
|
783 | 6099 |
since in the worst case, the whole memory has to be searched for |
6100 |
references to the two objects (although the primitive tries hard to |
|
6101 |
limit the search, for acceptable performance in most cases). |
|
6102 |
This method fails, if the receiver or the argument is a SmallInteger |
|
6103 |
or nil, or is a context of a living method (i.e. one that has not already |
|
6104 |
returned). |
|
859 | 6105 |
(notice that #become: is not used heavily by the system |
783 | 6106 |
- the Collection-classes have been rewritten to not use it.)" |
6107 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6108 |
if (__primBecome(self, anotherObject)) { |
783 | 6109 |
RETURN ( self ); |
859 | 6110 |
} |
6111 |
%}. |
|
783 | 6112 |
self primitiveFailed |
6113 |
! |
|
6114 |
||
6115 |
becomeNil |
|
6116 |
"make all references to the receiver become nil - effectively getting |
|
859 | 6117 |
rid of the receiver. |
6118 |
This can be a very dangerous operation - be warned. |
|
6119 |
||
6120 |
This may be an expensive (i.e. slow) operation. |
|
783 | 6121 |
The receiver may not be a SmallInteger or a context of a living method." |
6122 |
||
6123 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6124 |
if (__primBecomeNil(self)) { |
783 | 6125 |
RETURN ( nil ); |
859 | 6126 |
} |
6127 |
%}. |
|
6128 |
self primitiveFailed |
|
6129 |
! |
|
6130 |
||
6131 |
becomeSameAs:anotherObject |
|
6132 |
"make all references to the receiver become references to anotherObject |
|
861 | 6133 |
but NOT vice versa (as done in #become:). |
859 | 6134 |
This can be a very dangerous operation - be warned. |
861 | 6135 |
In general, using #become: should be avoided if possible, since it may |
6136 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
6137 |
||
6138 |
This may also be an expensive (i.e. slow) operation, |
|
859 | 6139 |
since in the worst case, the whole memory has to be searched for |
6140 |
references to the two objects (although the primitive tries hard to |
|
6141 |
limit the search, for acceptable performance in most cases). |
|
6142 |
This method fails, if the receiver or the argument is a SmallInteger |
|
6143 |
or nil, or is a context of a living method (i.e. one that has not already returned)." |
|
6144 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6145 |
if (__primBecomeSameAs(self, anotherObject)) { |
859 | 6146 |
RETURN ( self ); |
6147 |
} |
|
6148 |
%}. |
|
783 | 6149 |
self primitiveFailed |
6150 |
! |
|
6151 |
||
6152 |
changeClassTo:otherClass |
|
6153 |
"changes the class of the receiver to the argument, otherClass. |
|
6154 |
This is only allowed (possible), if the receivers class and the argument |
|
6155 |
have the same structure (i.e. number of named instance variables and |
|
6156 |
type of indexed instance variables). |
|
6157 |
If the structures do not match, or any of the original class or new class |
|
6158 |
is UndefinedObject or a Smallinteger, a primitive error is triggered." |
|
6159 |
||
6160 |
|myClass ok| |
|
6161 |
||
6162 |
"check for UndefinedObject/SmallInteger receiver or newClass" |
|
6163 |
%{ |
|
1133 | 6164 |
{ |
2647 | 6165 |
OBJ other = otherClass; |
6166 |
||
6167 |
if (__isNonNilObject(self) |
|
6168 |
&& __isNonNilObject(other) |
|
6169 |
&& (other != UndefinedObject) |
|
6170 |
&& (other != SmallInteger)) { |
|
6171 |
ok = true; |
|
6172 |
} else { |
|
6173 |
ok = false; |
|
6174 |
} |
|
783 | 6175 |
} |
6176 |
%}. |
|
6177 |
ok ifTrue:[ |
|
2647 | 6178 |
ok := false. |
6179 |
myClass := self class. |
|
6180 |
myClass flags == otherClass flags ifTrue:[ |
|
6181 |
myClass instSize == otherClass instSize ifTrue:[ |
|
6182 |
"same instance layout and types: its ok to do it" |
|
6183 |
ok := true. |
|
6184 |
] ifFalse:[ |
|
6185 |
myClass isPointers ifTrue:[ |
|
6186 |
myClass isVariable ifTrue:[ |
|
6187 |
ok := true |
|
6188 |
] |
|
6189 |
] |
|
6190 |
] |
|
6191 |
] ifFalse:[ |
|
6192 |
myClass isPointers ifTrue:[ |
|
6193 |
"if newClass is a variable class, with instSize <= my instsize, |
|
6194 |
we can do it (effectively mapping additional instvars into the |
|
6195 |
variable part) - usefulness is questionable, though" |
|
6196 |
||
6197 |
otherClass isPointers ifTrue:[ |
|
6198 |
otherClass isVariable ifTrue:[ |
|
6199 |
otherClass instSize <= (myClass instSize + self basicSize) |
|
6200 |
ifTrue:[ |
|
6201 |
ok := true |
|
6202 |
] |
|
6203 |
] ifFalse:[ |
|
6204 |
otherClass instSize == (myClass instSize + self basicSize) |
|
6205 |
ifTrue:[ |
|
6206 |
ok := true |
|
6207 |
] |
|
6208 |
] |
|
6209 |
] ifFalse:[ |
|
6210 |
"it does not make sense to convert pointers to bytes ..." |
|
6211 |
] |
|
6212 |
] ifFalse:[ |
|
6213 |
"does it make sense, to convert bits ?" |
|
6214 |
"could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..." |
|
6215 |
(myClass isBits and:[otherClass isBits]) ifTrue:[ |
|
6216 |
ok := true |
|
6217 |
] |
|
6218 |
] |
|
6219 |
] |
|
783 | 6220 |
]. |
6221 |
ok ifTrue:[ |
|
2647 | 6222 |
"now, change the receivers class ..." |
783 | 6223 |
%{ |
1133 | 6224 |
{ |
6225 |
OBJ me = self; |
|
6226 |
||
2647 | 6227 |
__qClass(me) = otherClass; |
6228 |
__STORE(me, otherClass); |
|
6229 |
RETURN (me); |
|
1133 | 6230 |
} |
783 | 6231 |
%}. |
6232 |
]. |
|
1022
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6233 |
|
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6234 |
" |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6235 |
the receiver cannot be represented as a instance of |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6236 |
the desired class. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6237 |
For example, you cannot change a bitInstance (byteArray etc.) |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6238 |
into a pointer object and vice versa. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6239 |
" |
783 | 6240 |
self primitiveFailed |
6241 |
! |
|
6242 |
||
6243 |
changeClassToThatOf:anObject |
|
6244 |
"changes the class of the receiver to that of the argument, anObject. |
|
6245 |
This is only allowed (possible), if the receivers class and the arguments |
|
6246 |
class have the same structure (i.e. number of named instance variables and |
|
6247 |
type of indexed instance variables). If the structures do not match, or any |
|
6248 |
of the objects is nil or a Smallinteger, a primitive error is triggered." |
|
6249 |
||
6250 |
self changeClassTo:(anObject class) |
|
6251 |
! ! |
|
6252 |
||
1867 | 6253 |
!Object methodsFor:'testing'! |
6254 |
||
6255 |
? defaultValue |
|
6256 |
"if the receiver is nil, return the defaultValue; |
|
6257 |
otherwise, return the receiver. |
|
6258 |
This method is only redefined in UndefinedObject - therefore, |
|
6259 |
the recevier is retuned here. |
|
6260 |
||
1958 | 6261 |
Thus, if foo and bar are simple variables or constants, |
2647 | 6262 |
foo ? bar |
1958 | 6263 |
is the same as: |
2647 | 6264 |
(foo isNil ifTrue:[bar] ifFalse:[foo]) |
1958 | 6265 |
|
6266 |
if they are message sends, the equivalent code is: |
|
2647 | 6267 |
[ |
6268 |
|t1 t2| |
|
6269 |
||
6270 |
t1 := foo. |
|
6271 |
t2 := bar. |
|
6272 |
t1 isNil ifTrue:[t2] ifFalse:[t1] |
|
6273 |
] value |
|
1958 | 6274 |
|
1867 | 6275 |
Can be used to provide defaultValues to variables, |
6276 |
as in: |
|
2647 | 6277 |
foo := arg ? #defaultValue |
2147 | 6278 |
|
2148 | 6279 |
Note: this method should never be redefined in classes other than UndefinedObject. |
1867 | 6280 |
" |
6281 |
||
6282 |
^ self |
|
6283 |
||
6284 |
" |
|
6285 |
1 ? #default |
|
6286 |
nil ? #default |
|
6287 |
" |
|
6288 |
||
6289 |
"Created: 4.11.1996 / 20:36:19 / cg" |
|
2148 | 6290 |
"Modified: 11.1.1997 / 14:56:47 / cg" |
1867 | 6291 |
! |
6292 |
||
6293 |
isArray |
|
6294 |
"return true, if the receiver is some kind of array (or weakArray etc); |
|
6295 |
false is returned here - the method is only redefined in Array." |
|
6296 |
||
6297 |
^ false |
|
6298 |
! |
|
6299 |
||
6300 |
isAssociation |
|
6301 |
"return true, if the receiver is some kind of association; |
|
6302 |
false is returned here - the method is only redefined in Association." |
|
6303 |
||
6304 |
^ false |
|
6305 |
||
6306 |
"Created: 14.5.1996 / 17:03:45 / cg" |
|
6307 |
! |
|
6308 |
||
6309 |
isBehavior |
|
6310 |
"return true, if the receiver is some kind of class (i.e. behavior); |
|
6311 |
false is returned here - the method is only redefined in Behavior." |
|
6312 |
||
6313 |
^ false |
|
6314 |
! |
|
6315 |
||
6316 |
isBlock |
|
6317 |
"return true, if the receiver is some kind of block; |
|
6318 |
false returned here - the method is only redefined in Block." |
|
6319 |
||
6320 |
^ false |
|
6321 |
! |
|
6322 |
||
6323 |
isCharacter |
|
6324 |
"return true, if the receiver is some kind of character; |
|
6325 |
false is returned here - the method is only redefined in Character." |
|
6326 |
||
6327 |
^ false |
|
6328 |
! |
|
6329 |
||
6330 |
isClass |
|
6331 |
"return true, if the receiver is some kind of class (real class, |
|
6332 |
not just behavior); |
|
6333 |
false is returned here - the method is only redefined in Class." |
|
6334 |
||
6335 |
^ false |
|
6336 |
! |
|
6337 |
||
6338 |
isCollection |
|
6339 |
"return true, if the receiver is some kind of collection; |
|
6340 |
false is returned here - the method is only redefined in Collection." |
|
6341 |
||
6342 |
^ false |
|
6343 |
! |
|
6344 |
||
6345 |
isColor |
|
6346 |
"return true, if the receiver is some kind of color; |
|
6347 |
false is returned here - the method is only redefined in Color." |
|
6348 |
||
6349 |
^ false |
|
6350 |
! |
|
6351 |
||
6352 |
isContext |
|
6353 |
"return true, if the receiver is some kind of context; |
|
6354 |
false returned here - the method is only redefined in Context." |
|
6355 |
||
6356 |
^ false |
|
6357 |
! |
|
6358 |
||
6359 |
isExternalStream |
|
6360 |
"return true, if the receiver is some kind of externalStream; |
|
6361 |
false is returned here - the method is only redefined in ExternalStream." |
|
6362 |
||
6363 |
^false |
|
6364 |
! |
|
6365 |
||
6366 |
isFileStream |
|
6367 |
"return true, if the receiver is some kind of fileStream; |
|
6368 |
false is returned here - the method is only redefined in FileStream." |
|
6369 |
||
6370 |
^false |
|
6371 |
! |
|
6372 |
||
1887 | 6373 |
isFixedPoint |
6374 |
"return true, if the receiver is some kind of fixedPoint number; |
|
6375 |
false is returned here - the method is only redefined in FixedPoint." |
|
6376 |
||
6377 |
^ false |
|
6378 |
||
6379 |
"Created: 5.11.1996 / 19:23:04 / cg" |
|
6380 |
! |
|
6381 |
||
1867 | 6382 |
isFixedSize |
6383 |
"return true if the receiver cannot grow easily |
|
6384 |
(i.e. a grow may be expensive, since it involves a become:)" |
|
6385 |
||
6386 |
^ true |
|
6387 |
! |
|
6388 |
||
6389 |
isForm |
|
6390 |
"return true, if the receiver is some kind of form; |
|
6391 |
false is returned here - the method is only redefined in Form." |
|
6392 |
||
6393 |
^ false |
|
6394 |
! |
|
6395 |
||
6396 |
isFraction |
|
6397 |
"return true, if the receiver is some kind of fraction; |
|
6398 |
false is returned here - the method is only redefined in Fraction." |
|
6399 |
||
6400 |
^ false |
|
6401 |
! |
|
6402 |
||
6403 |
isImage |
|
6404 |
"return true, if the receiver is some kind of image; |
|
6405 |
false is returned here - the method is only redefined in Image." |
|
6406 |
||
6407 |
^ false |
|
6408 |
! |
|
6409 |
||
6410 |
isImageOrForm |
|
6411 |
"return true, if the receiver is some kind of image or form; |
|
6412 |
false is returned here - the method is only redefined in Image and Form." |
|
6413 |
||
6414 |
^ false |
|
6415 |
! |
|
6416 |
||
2673
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6417 |
isImmediate |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6418 |
"return true if this object has immediate representation" |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6419 |
|
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6420 |
^ self class hasImmediateInstances |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6421 |
|
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6422 |
"Created: 3.6.1997 / 12:00:18 / cg" |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6423 |
! |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6424 |
|
1867 | 6425 |
isInteger |
6426 |
"return true, if the receiver is some kind of integer number; |
|
6427 |
false is returned here - the method is only redefined in Integer." |
|
6428 |
||
6429 |
^ false |
|
6430 |
! |
|
6431 |
||
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6432 |
isJavaClass |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6433 |
^ false |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6434 |
|
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6435 |
"Created: 26.3.1997 / 13:34:54 / cg" |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6436 |
! |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6437 |
|
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6438 |
isJavaObject |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6439 |
^ false |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6440 |
|
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6441 |
"Created: 26.3.1997 / 13:34:48 / cg" |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6442 |
! |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6443 |
|
1867 | 6444 |
isKindOf:aClass |
6445 |
"return true, if the receiver is an instance of aClass or one of its |
|
6446 |
subclasses, false otherwise. |
|
6447 |
Advice: |
|
6448 |
use of this to check objects for certain attributes/protocoll should |
|
6449 |
be avoided; it limits the reusability of your classes by limiting use |
|
6450 |
to instances of certain classes and fences you into a specific inheritance |
|
6451 |
hierarchy. |
|
6452 |
Use check-methods to check an object for a certain attributes/protocol |
|
6453 |
(such as #isXXXX, #respondsTo: or #isNumber). |
|
6454 |
||
6455 |
Using #isKindOf: is considered BAD STYLE. |
|
6456 |
||
6457 |
Advice2: |
|
6458 |
Be aware, that using an #isXXX method is usually much faster than |
|
6459 |
using #isKindOf:; because isKindOf: has to walk up all the superclass |
|
6460 |
hierarchy, comparing every class on the way. |
|
6461 |
Due to caching in the VM, a call to #isXXX is normally reached via |
|
6462 |
a single function call. |
|
6463 |
" |
|
6464 |
||
6465 |
%{ /* NOCONTEXT */ |
|
6466 |
register OBJ thisClass; |
|
6467 |
||
6468 |
thisClass = __Class(self); |
|
6469 |
while (thisClass != nil) { |
|
6470 |
if (thisClass == aClass) { |
|
6471 |
RETURN ( true ); |
|
6472 |
} |
|
6473 |
thisClass = __ClassInstPtr(thisClass)->c_superclass; |
|
6474 |
} |
|
6475 |
%} |
|
6476 |
. |
|
6477 |
"/ |
|
6478 |
"/ the above code is equivalent to: |
|
6479 |
"/ |
|
6480 |
"/ thisClass := self class. |
|
6481 |
"/ [thisClass notNil] whileTrue:[ |
|
6482 |
"/ thisClass == aClass ifTrue:[^ true]. |
|
6483 |
"/ thisClass := thisClass superclass |
|
6484 |
"/ ] |
|
6485 |
"/ |
|
6486 |
^ false |
|
6487 |
! |
|
6488 |
||
6489 |
isLayout |
|
6490 |
"return true, if the receiver is some kind of layout; |
|
6491 |
false is returned here - the method is only redefined in Layout." |
|
6492 |
||
6493 |
^ false |
|
6494 |
! |
|
6495 |
||
6496 |
isLiteral |
|
6497 |
"return true, if the receiver can be represented as a constant in ST syntax; |
|
6498 |
false is returned here - the method is redefined in some classes." |
|
6499 |
||
6500 |
^ false |
|
6501 |
! |
|
6502 |
||
6503 |
isMemberOf:aClass |
|
6504 |
"return true, if the receiver is an instance of aClass, false otherwise. |
|
6505 |
Advice: |
|
6506 |
use of this to check objects for certain attributes/protocoll should |
|
6507 |
be avoided; it limits the reusability of your classes by limiting use |
|
6508 |
to instances of a certain class. |
|
6509 |
Use check-methods to check an object for a certain attributes/protocol |
|
6510 |
(such as #isXXX, #respondsTo: or #isNumber); |
|
6511 |
||
3044 | 6512 |
Using #isMemberOf: is considered BAD STYLE. |
6513 |
Notice: |
|
6514 |
This method is open coded (inlined) by the compiler(s) |
|
6515 |
- redefining it may not work as expected." |
|
1867 | 6516 |
|
6517 |
^ (self class) == aClass |
|
6518 |
! |
|
6519 |
||
6520 |
isMeta |
|
6521 |
"return true, if the receiver is some kind of metaclass; |
|
6522 |
false is returned here - the method is only redefined in Metaclass." |
|
6523 |
||
6524 |
^ false |
|
6525 |
! |
|
6526 |
||
6527 |
isMethod |
|
6528 |
"return true, if the receiver is some kind of method; |
|
6529 |
false returned here - the method is only redefined in Method." |
|
6530 |
||
6531 |
^ false |
|
6532 |
! |
|
6533 |
||
6534 |
isNamespace |
|
6535 |
^ false |
|
6536 |
||
6537 |
"Created: 11.10.1996 / 18:08:56 / cg" |
|
6538 |
! |
|
6539 |
||
6540 |
isNumber |
|
6541 |
"return true, if the receiver is some kind of number; |
|
6542 |
false is returned here - the method is only redefined in Number." |
|
6543 |
||
6544 |
^ false |
|
6545 |
! |
|
6546 |
||
6547 |
isPoint |
|
6548 |
"return true, if the receiver is some kind of point; |
|
6549 |
false is returned here - the method is only redefined in Point." |
|
6550 |
||
6551 |
^ false |
|
6552 |
! |
|
6553 |
||
6554 |
isReal |
|
6555 |
"return true, if the receiver is some kind of real number; |
|
6556 |
false is returned here - the method is only redefined in LimitedPrecisionReal." |
|
6557 |
||
6558 |
^ false |
|
6559 |
! |
|
6560 |
||
6561 |
isRectangle |
|
6562 |
"return true, if the receiver is some kind of rectangle; |
|
6563 |
false is returned here - the method is only redefined in Rectangle." |
|
6564 |
||
6565 |
^ false |
|
6566 |
! |
|
6567 |
||
6568 |
isRemoteObject |
|
6569 |
"return true, if the receiver is some kind of remoteObject, |
|
6570 |
false if its local - the method is only redefined in RemoteObject." |
|
6571 |
||
6572 |
^ false |
|
6573 |
||
6574 |
"Created: 28.10.1996 / 15:18:45 / cg" |
|
6575 |
"Modified: 28.10.1996 / 15:20:57 / cg" |
|
6576 |
! |
|
6577 |
||
6578 |
isSequenceable |
|
6579 |
"return true, if the receiver is some kind of sequenceable collection; |
|
6580 |
false is returned here - the method is only redefined in SequenceableCollection." |
|
6581 |
||
6582 |
^ false |
|
6583 |
! |
|
6584 |
||
6585 |
isSequenceableCollection |
|
6586 |
"OBSOLETE: use isSequenceable for ST-80 compatibility. |
|
6587 |
This method is a historic leftover and will be removed soon ..." |
|
6588 |
||
6589 |
self obsoleteMethodWarning:'use #isSequenceable'. |
|
6590 |
^ false |
|
6591 |
! |
|
6592 |
||
6593 |
isSignal |
|
6594 |
"return true, if the receiver is some kind of signal; |
|
6595 |
false returned here - the method is only redefined in Signal." |
|
6596 |
||
6597 |
^ false |
|
6598 |
! |
|
6599 |
||
6600 |
isStream |
|
6601 |
"return true, if the receiver is some kind of stream; |
|
6602 |
false is returned here - the method is only redefined in Stream." |
|
6603 |
||
6604 |
^ false |
|
6605 |
! |
|
6606 |
||
6607 |
isString |
|
6608 |
"return true, if the receiver is some kind of string; |
|
6609 |
false is returned here - the method is only redefined in String." |
|
6610 |
||
6611 |
^ false |
|
6612 |
! |
|
6613 |
||
6614 |
isSymbol |
|
6615 |
"return true, if the receiver is some kind of symbol; |
|
6616 |
false is returned here - the method is only redefined in Symbol." |
|
6617 |
||
6618 |
^ false |
|
6619 |
! |
|
6620 |
||
6621 |
isText |
|
6622 |
"return true, if the receiver is some kind of text object; |
|
6623 |
false is returned here - the method is only redefined in Text." |
|
6624 |
||
6625 |
^ false |
|
6626 |
||
6627 |
"Created: 12.5.1996 / 10:56:50 / cg" |
|
6628 |
! |
|
6629 |
||
6630 |
isVariable |
|
6631 |
"return true if the receiver has indexed instance variables, |
|
6632 |
false otherwise." |
|
6633 |
||
6634 |
^ self class isVariable |
|
6635 |
! |
|
6636 |
||
2704 | 6637 |
isVariableBinding |
6638 |
^ false |
|
6639 |
||
6640 |
"Created: 19.6.1997 / 17:38:44 / cg" |
|
6641 |
! |
|
6642 |
||
1867 | 6643 |
isView |
6644 |
"return true, if the receiver is some kind of view; |
|
6645 |
false is returned here - the method is only redefined in View." |
|
6646 |
||
6647 |
^ false |
|
6648 |
! ! |
|
6649 |
||
783 | 6650 |
!Object methodsFor:'user interaction & notifications'! |
6651 |
||
6652 |
activityNotification:aString |
|
6653 |
"this can be sent from deeply nested methods, which are going to perform |
|
6654 |
some long-time activity. |
|
6655 |
If there is a handler for the ActivityNotificationSignal signal, that one is raised, |
|
6656 |
passing the argument. The handler should show this message whereever it likes, |
|
6657 |
and proceed. If there is no handler, this is simply ignored. |
|
6658 |
||
6659 |
This is very useful to pass busy messages up to some higher level (typically a view) |
|
6660 |
which likes to display that message in its label or a busy-box. |
|
6661 |
It could also be put into some logfile or printed on the standard output/error." |
|
6662 |
||
6663 |
ActivityNotificationSignal isHandled ifTrue:[ |
|
861 | 6664 |
^ ActivityNotificationSignal raiseRequestWith:self errorString:aString |
783 | 6665 |
]. |
6666 |
||
6667 |
" |
|
6668 |
nil activityNotification:'hello there' |
|
6669 |
self activityNotification:'hello there' |
|
6670 |
" |
|
6671 |
||
6672 |
" |
|
6673 |
ActivityNotificationSignal handle:[:ex | |
|
861 | 6674 |
ex errorString printNL. |
6675 |
ex proceed. |
|
783 | 6676 |
] do:[ |
861 | 6677 |
'hello' printNL. |
6678 |
self activityNotification:'doing some long time computation'. |
|
6679 |
'world' printNL. |
|
783 | 6680 |
] |
6681 |
" |
|
6682 |
||
6683 |
"Modified: 16.12.1995 / 18:23:42 / cg" |
|
6684 |
! |
|
6685 |
||
6686 |
confirm:aString |
|
6687 |
"launch a confirmer, which allows user to enter yes or no. |
|
6688 |
return true for yes, false for no" |
|
6689 |
||
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
6690 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
6691 |
on systems without GUI, or during startup, output a message |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
6692 |
and return true (as if yes was answered) |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
6693 |
Q: should we ask user by reading Stdin ? |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
6694 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
6695 |
Smalltalk isInitialized ifFalse:[ |
2647 | 6696 |
'*** confirmation requested during initialization:' printCR. |
6697 |
aString printCR. |
|
6698 |
'*** I''ll continue, assuming <yes> ...' printCR. |
|
6699 |
^ true |
|
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
6700 |
]. |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
6701 |
|
783 | 6702 |
Dialog isNil ifTrue:[ |
2647 | 6703 |
Transcript showCR:aString. |
6704 |
Transcript showCR:'continue, assuming <yes>'. |
|
6705 |
^ true |
|
783 | 6706 |
]. |
6707 |
Dialog autoload. "in case its autoloaded" |
|
6708 |
^ Dialog confirm:aString |
|
6709 |
||
6710 |
" |
|
6711 |
nil confirm:'hello' |
|
6712 |
self confirm:'hello' |
|
6713 |
" |
|
1417 | 6714 |
|
1425 | 6715 |
"Modified: 20.5.1996 / 10:28:40 / cg" |
783 | 6716 |
! |
6717 |
||
6718 |
errorNotify:aString |
|
6719 |
"launch a Notifier, showing top stack, telling user something |
|
2150 | 6720 |
and give user a chance to enter debugger." |
6721 |
||
6722 |
^ self |
|
2647 | 6723 |
errorNotify:aString |
6724 |
from:thisContext sender |
|
2150 | 6725 |
|
6726 |
" |
|
6727 |
nil errorNotify:'hello there' |
|
6728 |
self errorNotify:'hello there' |
|
6729 |
" |
|
6730 |
||
6731 |
"Modified: 11.1.1997 / 18:39:20 / cg" |
|
6732 |
! |
|
6733 |
||
6734 |
errorNotify:aString from:aContext |
|
6735 |
"launch a Notifier, showing top stack (above aContext), |
|
6736 |
telling user something and give user a chance to enter debugger." |
|
783 | 6737 |
|
2082 | 6738 |
|info con sender action| |
783 | 6739 |
|
891 | 6740 |
Smalltalk isInitialized ifFalse:[ |
2647 | 6741 |
'errorNotification: ' print. aString printCR. |
6742 |
^ self |
|
891 | 6743 |
]. |
6744 |
||
783 | 6745 |
Dialog isNil ifTrue:[ |
2647 | 6746 |
" |
6747 |
on systems without GUI, simply show |
|
6748 |
the message on the Transcript and abort. |
|
6749 |
" |
|
6750 |
Transcript showCR:aString. |
|
6751 |
AbortSignal raise. |
|
6752 |
^ self |
|
783 | 6753 |
]. |
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
6754 |
|
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
6755 |
Processor activeProcessIsSystemProcess ifTrue:[ |
2647 | 6756 |
action := #debug. |
6757 |
sender := aContext. |
|
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
6758 |
] ifFalse:[ |
2647 | 6759 |
Dialog autoload. "in case its autoloaded" |
6760 |
||
6761 |
ErrorSignal handle:[:ex | |
|
6762 |
||
6763 |
"/ a recursive error - quickly enter debugger |
|
6764 |
"/ this happened, when I corrupted the Dialog class ... |
|
6765 |
||
2689 | 6766 |
('Object [error]: ' , ex errorString , ' caught in errorNotification') errorPrintCR. |
2647 | 6767 |
action := #debug. |
6768 |
ex return. |
|
6769 |
] do:[ |
|
6770 |
sender := aContext. |
|
6771 |
sender isNil ifTrue:[ |
|
6772 |
sender := thisContext sender. |
|
6773 |
"/ |
|
6774 |
"/ for your convenience: skip the emergencyHandler block |
|
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
6775 |
"/ sender isBlockContext ifTrue:[ |
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
6776 |
"/ sender := sender sender |
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
6777 |
"/ ]. |
2647 | 6778 |
]. |
6779 |
||
6780 |
"/ skip intermediate (signal & exception) contexts |
|
6781 |
||
6782 |
DebugView notNil ifTrue:[ |
|
6783 |
sender := DebugView interestingContextFrom:sender |
|
6784 |
]. |
|
6785 |
||
6786 |
"/ show the first 5 contexts |
|
6787 |
||
6788 |
con := sender. |
|
6789 |
info := aString , Character cr asString , Character cr asString. |
|
6790 |
1 to:5 do:[:n | |
|
6791 |
con notNil ifTrue:[ |
|
6792 |
info := info , con printString , Character cr asString. |
|
6793 |
con := con sender |
|
6794 |
] |
|
6795 |
]. |
|
6796 |
||
6797 |
action := Dialog |
|
6798 |
choose:info |
|
6799 |
label:('Exception [' , Processor activeProcess nameOrId , ']') |
|
6800 |
labels:#('proceed' 'abort' 'debug') |
|
6801 |
values:#(#proceed #abort #debug) |
|
6802 |
default:#debug. |
|
6803 |
]. |
|
2082 | 6804 |
]. |
6805 |
||
6806 |
action == #debug ifTrue:[ |
|
2647 | 6807 |
Debugger enter:sender withMessage:aString |
2082 | 6808 |
] ifFalse:[ |
2647 | 6809 |
action == #abort ifTrue:[ |
6810 |
AbortSignal raise |
|
6811 |
] |
|
783 | 6812 |
] |
6813 |
||
6814 |
" |
|
6815 |
nil errorNotify:'hello there' |
|
6816 |
self errorNotify:'hello there' |
|
6817 |
" |
|
1417 | 6818 |
|
2150 | 6819 |
"Created: 11.1.1997 / 17:53:09 / cg" |
2359
fdc5d828bb5e
add process name to exception notifyer boxes window-title
Claus Gittinger <cg@exept.de>
parents:
2342
diff
changeset
|
6820 |
"Modified: 8.2.1997 / 12:47:41 / cg" |
783 | 6821 |
! |
6822 |
||
6823 |
information:aString |
|
6824 |
"launch an InfoBox, telling user something. |
|
6825 |
These info-boxes can be suppressed by handling the |
|
6826 |
UserNotification- or InformationSignal and proceeding in the handler." |
|
6827 |
||
6828 |
InformationSignal isHandled ifTrue:[ |
|
6829 |
^ InformationSignal raiseRequestWith:self errorString:aString |
|
6830 |
]. |
|
6831 |
self notify:aString |
|
6832 |
||
6833 |
" |
|
6834 |
nil information:'hello there' |
|
6835 |
self information:'hello there' |
|
6836 |
" |
|
6837 |
||
6838 |
" |
|
6839 |
InformationSignal handle:[:ex | |
|
6840 |
'no box popped' printNL. |
|
6841 |
ex proceed. |
|
6842 |
] do:[ |
|
6843 |
'hello' printNL. |
|
6844 |
self information:'some info'. |
|
6845 |
'world' printNL. |
|
6846 |
] |
|
6847 |
" |
|
6848 |
||
6849 |
"Modified: 24.11.1995 / 22:29:49 / cg" |
|
6850 |
! |
|
6851 |
||
6852 |
notify:aString |
|
6853 |
"launch a Notifier, telling user something. |
|
6854 |
Use #information: for ignorable messages." |
|
6855 |
||
891 | 6856 |
Smalltalk isInitialized ifFalse:[ |
2647 | 6857 |
'information: ' print. aString printCR. |
6858 |
^ self |
|
891 | 6859 |
]. |
6860 |
||
783 | 6861 |
Dialog isNil ifTrue:[ |
2647 | 6862 |
" |
6863 |
on systems without GUI, simply show |
|
6864 |
the message on the Transcript. |
|
6865 |
" |
|
6866 |
Transcript showCR:aString. |
|
6867 |
^ self |
|
783 | 6868 |
]. |
6869 |
Dialog autoload. "in case its autoloaded" |
|
6870 |
Dialog information:aString |
|
6871 |
||
6872 |
" |
|
6873 |
nil notify:'hello there' |
|
6874 |
self notify:'hello there' |
|
6875 |
" |
|
1417 | 6876 |
|
1425 | 6877 |
"Modified: 20.5.1996 / 10:28:48 / cg" |
783 | 6878 |
! |
6879 |
||
6880 |
warn:aString |
|
6881 |
"launch a WarningBox, telling user something. |
|
6882 |
These warn-boxes can be suppressed by handling the |
|
6883 |
UserNotification- or WarningSignal and proceeding in the handler." |
|
6884 |
||
6885 |
WarningSignal isHandled ifTrue:[ |
|
2647 | 6886 |
^ WarningSignal raiseRequestWith:self errorString:aString |
783 | 6887 |
]. |
6888 |
||
891 | 6889 |
Smalltalk isInitialized ifFalse:[ |
2647 | 6890 |
'warning: ' print. aString printCR. |
6891 |
^ self |
|
891 | 6892 |
]. |
6893 |
||
783 | 6894 |
Dialog isNil ifTrue:[ |
2647 | 6895 |
" |
6896 |
on systems without GUI, simply show |
|
6897 |
the message on the Transcript. |
|
6898 |
" |
|
6899 |
Transcript showCR:aString. |
|
6900 |
^ self |
|
783 | 6901 |
]. |
6902 |
Dialog autoload. "in case its autoloaded" |
|
6903 |
Dialog warn:aString |
|
6904 |
||
6905 |
" |
|
6906 |
nil warn:'hello there' |
|
6907 |
self warn:'hello there' |
|
6908 |
" |
|
6909 |
||
6910 |
" |
|
6911 |
WarningSignal handle:[:ex | |
|
2647 | 6912 |
ex proceed. |
783 | 6913 |
] do:[ |
2647 | 6914 |
'hello' printNL. |
6915 |
self warn:'some info'. |
|
6916 |
'world' printNL. |
|
783 | 6917 |
] |
6918 |
" |
|
1417 | 6919 |
|
1425 | 6920 |
"Modified: 20.5.1996 / 10:28:53 / cg" |
783 | 6921 |
! ! |
6922 |
||
1788 | 6923 |
!Object class methodsFor:'documentation'! |
783 | 6924 |
|
6925 |
version |
|
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
6926 |
^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.234 1998-05-07 22:26:37 cg Exp $' |
783 | 6927 |
! ! |
6928 |
Object initialize! |