author | ps |
Thu, 30 Dec 1999 12:07:15 +0100 | |
changeset 5156 | f7d6a1e1a890 |
parent 5149 | 0da06a139105 |
child 5180 | 8b625cdc8cef |
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 |
4873 | 24 |
OSSignalInterruptSignal FinalizationLobby' |
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:[ |
|
4520
57362111e454
ErrorSignal is now the class based exception Error.
Stefan Vogel <sv@exept.de>
parents:
4499
diff
changeset
|
174 |
ErrorSignal := Error. |
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
175 |
|
4866
c2b3ca7c0e70
HaltSignal (and BreakpointSignal) is no longer a child of Error.
Claus Gittinger <cg@exept.de>
parents:
4858
diff
changeset
|
176 |
HaltSignal := Exception newSignalMayProceed:true. |
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
177 |
HaltSignal nameClass:self message:#haltSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
178 |
HaltSignal notifierString:'halt encountered'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
179 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
180 |
MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
181 |
MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
182 |
MessageNotUnderstoodSignal notifierString:'message not understood'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
183 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
184 |
PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
185 |
PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
186 |
PrimitiveFailureSignal notifierString:'primitive failed'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
187 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
188 |
InternalErrorSignal := ErrorSignal newSignalMayProceed:false. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
189 |
InternalErrorSignal nameClass:self message:#internalErrorSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
190 |
InternalErrorSignal notifierString:'VM internal error: '. |
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
191 |
|
362 | 192 |
"/ UserInterruptSignal := ErrorSignal newSignalMayProceed:true. |
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
193 |
UserInterruptSignal := (Signal new) mayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
194 |
UserInterruptSignal nameClass:self message:#userInterruptSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
195 |
UserInterruptSignal notifierString:'user Interrupt'. |
159 | 196 |
|
362 | 197 |
"/ RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false. |
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
198 |
RecursionInterruptSignal := (Signal new) mayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
199 |
RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
200 |
RecursionInterruptSignal notifierString:'recursion limit reached'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
201 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
202 |
ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
203 |
ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
204 |
ExceptionInterruptSignal notifierString:'exception Interrupt'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
205 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
206 |
NotFoundSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
207 |
NotFoundSignal nameClass:self message:#notFoundSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
208 |
NotFoundSignal notifierString:'no such element'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
209 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
210 |
IndexNotFoundSignal := NotFoundSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
211 |
IndexNotFoundSignal nameClass:self message:#indexNotFoundSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
212 |
IndexNotFoundSignal notifierString:'bad index: '. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
213 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
214 |
SubscriptOutOfBoundsSignal := IndexNotFoundSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
215 |
SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
216 |
SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
217 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
218 |
ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
219 |
ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
220 |
ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
221 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
222 |
KeyNotFoundSignal := NotFoundSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
223 |
KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
224 |
KeyNotFoundSignal notifierString:'no such key: '. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
225 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
226 |
NonIntegerIndexSignal := IndexNotFoundSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
227 |
NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
228 |
NonIntegerIndexSignal notifierString:'index must be integer'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
229 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
230 |
UserNotificationSignal := QuerySignal new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
231 |
UserNotificationSignal nameClass:self message:#userNotificationSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
232 |
UserNotificationSignal notifierString:'user notifiaction wanted'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
233 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
234 |
InformationSignal := UserNotificationSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
235 |
InformationSignal nameClass:self message:#informationSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
236 |
InformationSignal notifierString:'information'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
237 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
238 |
WarningSignal := UserNotificationSignal newSignalMayProceed:true. |
4053 | 239 |
WarningSignal nameClass:self message:#warningSignal. |
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
240 |
WarningSignal notifierString:'warning'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
241 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
242 |
ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
243 |
ActivityNotificationSignal nameClass:self message:#activityNotificationSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
244 |
ActivityNotificationSignal notifierString:'activity'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
245 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
246 |
DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
247 |
DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
248 |
DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
249 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
250 |
" |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
251 |
AbortSignal is not a child of ErrorSignal - |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
252 |
this would complicate abort from within a signal handler |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
253 |
" |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
254 |
AbortSignal := Signal genericSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
255 |
AbortSignal nameClass:self message:#abortSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
256 |
AbortSignal notifierString:'unhandled abort signal'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
257 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
258 |
" |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
259 |
OSSignalInterruptSignal is not a child of ErrorSignal - |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
260 |
it requires explicit catching. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
261 |
If unhandled, a debugger is entered. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
262 |
" |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
263 |
OSSignalInterruptSignal := Signal genericSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
264 |
OSSignalInterruptSignal nameClass:self message:#osSignalInterruptSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
265 |
OSSignalInterruptSignal notifierString:'OS signal interrupt'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
266 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
267 |
ObjectAttributes isNil ifTrue:[ |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
268 |
ObjectAttributes := WeakIdentityDictionary new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
269 |
]. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
270 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
271 |
Dependencies isNil ifTrue:[ |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
272 |
Dependencies := WeakDependencyDictionary new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
273 |
]. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
274 |
NonWeakDependencies isNil ifTrue:[ |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
275 |
NonWeakDependencies := IdentityDictionary new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
276 |
]. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
277 |
SynchronizationSemaphores isNil ifTrue:[ |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
278 |
SynchronizationSemaphores := WeakIdentityDictionary new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
279 |
]. |
356 | 280 |
]. |
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
281 |
|
4873 | 282 |
FinalizationLobby isNil ifTrue:[ |
283 |
FinalizationLobby := Registry new. |
|
284 |
]. |
|
285 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
286 |
"/ 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
|
287 |
"/ (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
|
288 |
InfoPrinting := ObjectMemory infoPrinting. |
1 | 289 |
|
290 |
"Object initialize" |
|
812
00db9c0646fe
notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents:
783
diff
changeset
|
291 |
|
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
292 |
"Modified: / 22.1.1998 / 21:23:40 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
293 |
"Modified: / 3.2.1998 / 18:55:09 / cg" |
4520
57362111e454
ErrorSignal is now the class based exception Error.
Stefan Vogel <sv@exept.de>
parents:
4499
diff
changeset
|
294 |
"Modified: / 4.8.1999 / 08:54:06 / stefan" |
1 | 295 |
! ! |
296 |
||
4873 | 297 |
!Object class methodsFor:'Compatibility - ST80'! |
3175
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
298 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
299 |
rootError |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
300 |
"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
|
301 |
Same as errorSignal for ST80 compatibility." |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
302 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
303 |
^ ErrorSignal |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
304 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
305 |
"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
|
306 |
! ! |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
307 |
|
1788 | 308 |
!Object class methodsFor:'Signal constants'! |
1 | 309 |
|
783 | 310 |
abortSignal |
311 |
"return the signal used to abort user actions. This signal is only |
|
2689 | 312 |
raised if caught (by the debugger), and will lead way out of the |
783 | 313 |
currently active doIt/printIt or inspectIt. (also some others use |
314 |
this for a save abort)" |
|
315 |
||
316 |
^ AbortSignal |
|
579
2d26193415b5
allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
317 |
! |
2d26193415b5
allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
318 |
|
782 | 319 |
activityNotificationSignal |
320 |
"return the signal used for activity notifications. |
|
321 |
A handler for this signal gets all #activityNotification: sends" |
|
322 |
||
323 |
^ ActivityNotificationSignal |
|
324 |
! |
|
325 |
||
159 | 326 |
deepCopyErrorSignal |
327 |
"return the signal raised when a deepcopy is asked for |
|
328 |
an object which cannot do this (for example, BlockClosures |
|
329 |
or Contexts)." |
|
330 |
||
331 |
^ DeepCopyErrorSignal |
|
332 |
! |
|
333 |
||
783 | 334 |
elementOutOfBoundsSignal |
335 |
"return the signal used for element error reporting |
|
336 |
(this signal is used for example when a value not in 0..255 is to |
|
337 |
be put into a bytearray)" |
|
338 |
||
339 |
^ ElementOutOfBoundsSignal |
|
340 |
! |
|
341 |
||
342 |
errorSignal |
|
343 |
"return the signal used for error/error: - handling" |
|
344 |
||
345 |
^ ErrorSignal |
|
346 |
! |
|
347 |
||
348 |
exceptionInterruptSignal |
|
349 |
"return the signal used for exception (display errors) error handling" |
|
350 |
||
351 |
^ ExceptionInterruptSignal |
|
352 |
! |
|
353 |
||
354 |
haltSignal |
|
355 |
"return the signal used for halt/halt: - handling" |
|
356 |
||
357 |
^ HaltSignal |
|
358 |
! |
|
359 |
||
3101
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
360 |
indexNotFoundSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
361 |
"return the signal used for bad index error reporting. |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
362 |
This is also the parentSignal of the nonIntegerIndex- and |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
363 |
subscriptOutOfBoundsSignal" |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
364 |
|
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 |
|
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
367 |
"Created: / 8.11.1997 / 19:15:48 / cg" |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
368 |
! |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
369 |
|
783 | 370 |
informationSignal |
371 |
"return the signal used for informations. |
|
372 |
A handler for this signal gets all #information: sends" |
|
373 |
||
374 |
^ InformationSignal |
|
375 |
! |
|
376 |
||
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
377 |
internalErrorSignal |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
378 |
"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
|
379 |
|
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
380 |
^ InternalErrorSignal |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
381 |
! |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
382 |
|
783 | 383 |
keyNotFoundSignal |
384 |
"return the signal used for no such key error reporting" |
|
385 |
||
386 |
^ KeyNotFoundSignal |
|
387 |
! |
|
388 |
||
389 |
messageNotUnderstoodSignal |
|
390 |
"return the signal used for doesNotUnderstand: - error handling" |
|
391 |
||
392 |
^ MessageNotUnderstoodSignal |
|
393 |
! |
|
394 |
||
395 |
nonIntegerIndexSignal |
|
396 |
"return the signal used for bad subscript error reporting" |
|
397 |
||
398 |
^ NonIntegerIndexSignal |
|
399 |
! |
|
400 |
||
401 |
notFoundSignal |
|
402 |
"return the signal used for no element found error reporting" |
|
403 |
||
404 |
^ NotFoundSignal |
|
405 |
! |
|
406 |
||
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
407 |
osSignalInterruptSignal |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
408 |
"return the signal used for OS-signal error reporting; |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
409 |
This is only raised if handled - otherwise, a debugger is entered." |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
410 |
|
3557
b7eb2a1cb593
oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents:
3466
diff
changeset
|
411 |
^ OSSignalInterruptSignal |
b7eb2a1cb593
oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents:
3466
diff
changeset
|
412 |
|
b7eb2a1cb593
oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents:
3466
diff
changeset
|
413 |
"Modified: / 12.6.1998 / 16:27:26 / cg" |
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
414 |
! |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
415 |
|
783 | 416 |
primitiveFailureSignal |
417 |
"return the signal used for primitiveFailed - error handling" |
|
418 |
||
419 |
^ PrimitiveFailureSignal |
|
420 |
! |
|
421 |
||
422 |
privateMethodSignal |
|
423 |
"return the signal used for privateMethod - error handling" |
|
424 |
||
425 |
^ MessageNotUnderstoodSignal |
|
426 |
! |
|
427 |
||
428 |
recursionInterruptSignal |
|
429 |
"return the signal used for recursion overflow error handling" |
|
430 |
||
431 |
^ RecursionInterruptSignal |
|
432 |
! |
|
433 |
||
434 |
subscriptOutOfBoundsSignal |
|
435 |
"return the signal used for subscript error reporting. |
|
436 |
(this signal is used for example when an array is accessed with an |
|
437 |
index less than 1 or greater than the array size)" |
|
438 |
||
439 |
^ SubscriptOutOfBoundsSignal |
|
440 |
! |
|
441 |
||
442 |
userInterruptSignal |
|
443 |
"return the signal used for ^C interrupts handling" |
|
444 |
||
445 |
^ UserInterruptSignal |
|
446 |
! |
|
447 |
||
448 |
userNotificationSignal |
|
449 |
"the parent signal used with information and warnings. |
|
450 |
Handling this allows handling of both information- and warning notifications." |
|
451 |
||
452 |
^ UserNotificationSignal |
|
453 |
! |
|
454 |
||
455 |
warningSignal |
|
456 |
"return the signal used for warnings. |
|
457 |
A handler for this signal gets all #warn: sends" |
|
458 |
||
459 |
^ WarningSignal |
|
1 | 460 |
! ! |
461 |
||
1788 | 462 |
!Object class methodsFor:'info messages'! |
356 | 463 |
|
783 | 464 |
infoPrinting |
465 |
"return the flag which controls information messages." |
|
466 |
||
467 |
^ InfoPrinting |
|
468 |
! |
|
469 |
||
356 | 470 |
infoPrinting:aBoolean |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
471 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
472 |
|
356 | 473 |
"turn on/off printing of information messages. |
474 |
If the argument, aBoolean is false, infoPrint will not output |
|
475 |
messages. The default is true." |
|
476 |
||
477 |
InfoPrinting := aBoolean |
|
478 |
! ! |
|
479 |
||
1788 | 480 |
!Object class methodsFor:'queries'! |
3 | 481 |
|
482 |
isBuiltInClass |
|
49 | 483 |
"return true, if this class is known by the run-time-system, |
484 |
i.e. you cannot add/remove instance variables without recompiling |
|
1266 | 485 |
the VM. |
486 |
Here, true is returned for myself, false for subclasses." |
|
3 | 487 |
|
488 |
^ self == Object |
|
1266 | 489 |
|
490 |
"Modified: 23.4.1996 / 16:00:07 / cg" |
|
3 | 491 |
! ! |
492 |
||
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
493 |
!Object methodsFor:'Compatibility - Squeak'! |
4587 | 494 |
|
4991 | 495 |
asString |
496 |
^ self printString |
|
497 |
! |
|
498 |
||
4587 | 499 |
clone |
500 |
^ self shallowCopy |
|
4982 | 501 |
! |
502 |
||
4991 | 503 |
currentHand |
504 |
"Return a usable HandMorph -- the one associated with the object's current environment. This method will always return a hand, even if it has to conjure one up as a last resort. If a particular hand is actually handling events at the moment (such as a remote hand or a ghost hand), it will be returned." |
|
505 |
||
506 |
| w | |
|
507 |
^ (w _ self currentWorld) activeHand ifNil: [w hands first]! |
|
508 |
||
509 |
currentWorld |
|
510 |
^ Utilities currentWorld |
|
511 |
! |
|
512 |
||
513 |
newTileMorphRepresentative |
|
514 |
^ TileMorph new setLiteral: self! |
|
515 |
||
516 |
stringForReadout |
|
517 |
^ self stringRepresentation! |
|
518 |
||
519 |
stringRepresentation |
|
520 |
"Answer a string that represents the receiver. For most objects this is simply its printString, but for strings themselves, it's themselves. 6/12/96 sw" |
|
521 |
||
522 |
^ self printString ! |
|
523 |
||
4982 | 524 |
veryDeepCopy |
525 |
||
526 |
^(self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self |
|
4587 | 527 |
! ! |
528 |
||
1 | 529 |
!Object methodsFor:'accessing'! |
530 |
||
531 |
at:index |
|
532 |
"return the indexed instance variable with index, anInteger; |
|
533 |
this method can be redefined in subclasses." |
|
534 |
||
535 |
^ self basicAt:index |
|
536 |
! |
|
537 |
||
783 | 538 |
at:index put:anObject |
539 |
"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
|
540 |
this method can be redefined in subclasses. Returns anObject (sigh)" |
783 | 541 |
|
542 |
^ self basicAt:index put:anObject |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
543 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
544 |
"Modified: 19.4.1996 / 11:13:29 / cg" |
783 | 545 |
! |
546 |
||
1 | 547 |
basicAt:index |
548 |
"return the indexed instance variable with index, anInteger. |
|
549 |
Trigger an error if the receiver has no indexed instance variables. |
|
2148 | 550 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
1 | 551 |
|
552 |
%{ /* NOCONTEXT */ |
|
553 |
||
329 | 554 |
REGISTER int nbytes, indx; |
1 | 555 |
OBJ myClass; |
329 | 556 |
REGISTER char *pFirst; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
557 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
558 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
559 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
560 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
561 |
#endif |
329 | 562 |
REGISTER int n; |
1 | 563 |
|
564 |
/* |
|
56 | 565 |
* notice the missing test for self being a nonNilObject - |
1 | 566 |
* this can be done since basicAt: is defined both in UndefinedObject |
567 |
* and SmallInteger |
|
568 |
*/ |
|
253 | 569 |
if (__isSmallInteger(index)) { |
4220 | 570 |
myClass = __qClass(self); |
571 |
indx = __intVal(index) - 1; |
|
572 |
n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
|
573 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */); |
|
574 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
575 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
|
576 |
||
577 |
switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
|
578 |
case __MASKSMALLINT(POINTERARRAY): |
|
579 |
case __MASKSMALLINT(WKPOINTERARRAY): |
|
580 |
/* |
|
581 |
* pointers |
|
582 |
*/ |
|
583 |
if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) { |
|
584 |
OBJ *op; |
|
585 |
||
586 |
op = (OBJ *)pFirst + indx; |
|
587 |
RETURN ( *op ); |
|
588 |
} |
|
589 |
break; |
|
590 |
||
591 |
case __MASKSMALLINT(BYTEARRAY): |
|
592 |
/* |
|
593 |
* (unsigned) bytes |
|
594 |
*/ |
|
595 |
if ((unsigned)indx < nbytes) { |
|
596 |
unsigned char *cp; |
|
597 |
||
598 |
cp = (unsigned char *)pFirst + indx; |
|
599 |
RETURN ( __MKSMALLINT(*cp & 0xFF) ); |
|
600 |
} |
|
601 |
break; |
|
602 |
||
603 |
case __MASKSMALLINT(FLOATARRAY): |
|
604 |
/* |
|
605 |
* native floats |
|
606 |
*/ |
|
607 |
if ((unsigned)indx < (nbytes / sizeof(float))) { |
|
608 |
float *fp; |
|
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
609 |
float f; |
4220 | 610 |
OBJ v; |
611 |
||
612 |
fp = (float *)pFirst + indx; |
|
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
613 |
f = *fp; |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
614 |
if (f == 0.0) { |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
615 |
v = __float0; |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
616 |
} else { |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
617 |
__qMKSFLOAT(v, f); |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
618 |
} |
4220 | 619 |
RETURN (v); |
620 |
} |
|
621 |
break; |
|
622 |
||
623 |
case __MASKSMALLINT(DOUBLEARRAY): |
|
624 |
/* |
|
625 |
* native doubles |
|
626 |
*/ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
627 |
#ifdef __NEED_DOUBLE_ALIGN |
4220 | 628 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
629 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
|
630 |
||
631 |
pFirst += delta; |
|
632 |
nbytes -= delta; |
|
633 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
634 |
#endif |
4220 | 635 |
if ((unsigned)indx < (nbytes / sizeof(double))) { |
636 |
double *dp; |
|
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
637 |
double d; |
4220 | 638 |
OBJ v; |
639 |
||
640 |
dp = (double *)pFirst + indx; |
|
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
641 |
d = *dp; |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
642 |
if (d == 0.0) { |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
643 |
v = __float0; |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
644 |
} else { |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
645 |
__qMKFLOAT(v, d); |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
646 |
} |
4220 | 647 |
RETURN (v); |
648 |
} |
|
649 |
break; |
|
650 |
||
651 |
case __MASKSMALLINT(WORDARRAY): |
|
652 |
/* |
|
653 |
* unsigned 16bit ints |
|
654 |
*/ |
|
655 |
/* Notice: the hard coded shifts are by purpose; |
|
656 |
* it makes us independent of the short-size of the machine |
|
657 |
*/ |
|
658 |
if ((unsigned)indx < (nbytes>>1)) { |
|
659 |
unsigned short *sp; |
|
660 |
||
661 |
sp = (unsigned short *)(pFirst + (indx<<1)); |
|
662 |
RETURN ( __MKSMALLINT(*sp & 0xFFFF) ); |
|
663 |
} |
|
664 |
break; |
|
665 |
||
666 |
case __MASKSMALLINT(SWORDARRAY): |
|
667 |
/* |
|
668 |
* signed 16bit ints |
|
669 |
*/ |
|
670 |
/* Notice: the hard coded shifts are by purpose; |
|
671 |
* it makes us independent of the short-size of the machine |
|
672 |
*/ |
|
673 |
if ((unsigned)indx < (nbytes>>1)) { |
|
674 |
short *ssp; |
|
675 |
||
676 |
ssp = (short *)(pFirst + (indx<<1)); |
|
677 |
RETURN ( __MKSMALLINT(*ssp) ); |
|
678 |
} |
|
679 |
break; |
|
680 |
||
681 |
case __MASKSMALLINT(LONGARRAY): |
|
682 |
/* |
|
683 |
* unsigned 32bit ints |
|
684 |
*/ |
|
685 |
/* Notice: the hard coded shifts are by purpose; |
|
686 |
* it makes us independent of the int-size of the machine |
|
687 |
*/ |
|
688 |
if ((unsigned)indx < (nbytes>>2)) { |
|
689 |
unsigned int32 ul; |
|
690 |
unsigned int32 *lp; |
|
691 |
||
692 |
lp = (unsigned int32 *)(pFirst + (indx<<2)); |
|
693 |
ul = *lp; |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
694 |
#ifdef alpha64 |
4220 | 695 |
{ |
696 |
unsigned INT ull = (unsigned INT)ul; |
|
697 |
RETURN ( __MKSMALLINT(ull) ); |
|
698 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
699 |
#else |
4220 | 700 |
if (ul <= _MAX_INT) { |
701 |
RETURN ( __MKSMALLINT(ul) ); |
|
702 |
} |
|
703 |
RETURN ( __MKULARGEINT(ul) ); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
704 |
#endif |
4220 | 705 |
} |
706 |
break; |
|
707 |
||
708 |
case __MASKSMALLINT(SLONGARRAY): |
|
709 |
/* |
|
710 |
* signed 32bit ints |
|
711 |
*/ |
|
712 |
/* Notice: the hard coded shifts are by purpose; |
|
713 |
* it makes us independent of the int-size of the machine |
|
714 |
*/ |
|
715 |
if ((unsigned)indx < (nbytes>>2)) { |
|
716 |
int32 *slp; |
|
717 |
int32 l; |
|
718 |
||
719 |
slp = (int32 *)(pFirst + (indx<<2)); |
|
720 |
l = *slp; |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
721 |
#ifdef alpha64 |
4220 | 722 |
{ |
723 |
INT ll = (INT)l; |
|
724 |
RETURN ( __MKSMALLINT(ll) ); |
|
725 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
726 |
#else |
4220 | 727 |
if (__ISVALIDINTEGER(l)) { |
728 |
RETURN ( __MKSMALLINT(l) ); |
|
729 |
} |
|
730 |
RETURN ( __MKLARGEINT(l) ); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
731 |
#endif |
4220 | 732 |
} |
733 |
break; |
|
734 |
||
735 |
case __MASKSMALLINT(SLONGLONGARRAY): |
|
736 |
/* |
|
737 |
* signed 64bit longlongs |
|
738 |
*/ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
739 |
#ifdef __NEED_LONGLONG_ALIGN |
4220 | 740 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
741 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
|
742 |
||
743 |
pFirst += delta; |
|
744 |
nbytes -= delta; |
|
745 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
746 |
#endif |
4220 | 747 |
/* Notice: the hard coded shifts are by purpose; |
748 |
* it makes us independent of the long/longlong-size of the machine |
|
749 |
*/ |
|
750 |
if ((unsigned)indx < (nbytes>>3)) { |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
751 |
#ifdef alpha64 |
4220 | 752 |
INT *slp, ll; |
753 |
||
754 |
slp = (INT *)(pFirst + (indx<<3)); |
|
755 |
ll = *slp; |
|
756 |
if (__ISVALIDINTEGER(ll)) { |
|
757 |
RETURN ( __MKSMALLINT(ll) ); |
|
758 |
} |
|
759 |
RETURN ( __MKLARGEINT(ll) ); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
760 |
#else |
4220 | 761 |
__int64__ *llp; |
762 |
extern OBJ __MKINT64(); |
|
763 |
||
764 |
llp = (__int64__ *)(pFirst + (indx<<3)); |
|
765 |
RETURN (__MKINT64(llp)); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
766 |
#endif |
4220 | 767 |
} |
768 |
break; |
|
769 |
||
770 |
case __MASKSMALLINT(LONGLONGARRAY): |
|
771 |
/* |
|
772 |
* unsigned 64bit longlongs |
|
773 |
*/ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
774 |
#ifdef __NEED_LONGLONG_ALIGN |
4220 | 775 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
776 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
|
777 |
||
778 |
pFirst += delta; |
|
779 |
nbytes -= delta; |
|
780 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
781 |
#endif |
4220 | 782 |
/* Notice: the hard coded shifts are by purpose; |
783 |
* it makes us independent of the long/longlong-size of the machine |
|
784 |
*/ |
|
785 |
if ((unsigned)indx < (nbytes>>3)) { |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
786 |
#ifdef alpha64 |
4220 | 787 |
unsigned INT *ulp, ul; |
788 |
||
789 |
ulp = (unsigned INT *)(pFirst + (indx<<3)); |
|
790 |
ul = *ulp; |
|
791 |
if (ul <= _MAX_INT) { |
|
792 |
RETURN ( __MKSMALLINT(ul) ); |
|
793 |
} |
|
794 |
RETURN ( __MKULARGEINT(ul) ); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
795 |
#else |
4220 | 796 |
__uint64__ *llp; |
797 |
extern OBJ __MKUINT64(); |
|
798 |
||
799 |
llp = (__uint64__ *)(pFirst + (indx<<3)); |
|
800 |
RETURN (__MKUINT64(llp)); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
801 |
#endif |
4220 | 802 |
} |
803 |
break; |
|
804 |
} |
|
1 | 805 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
806 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
807 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
808 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
809 |
%}. |
10 | 810 |
index isInteger ifFalse:[ |
4220 | 811 |
^ self indexNotInteger |
1 | 812 |
]. |
159 | 813 |
^ self subscriptBoundsError:index |
1 | 814 |
! |
815 |
||
816 |
basicAt:index put:anObject |
|
817 |
"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
|
818 |
Returns anObject (sigh). |
1 | 819 |
Trigger an error if the receiver has no indexed instance variables. |
2148 | 820 |
|
821 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
|
1 | 822 |
|
823 |
%{ /* NOCONTEXT */ |
|
824 |
||
825 |
register int nbytes, indx; |
|
826 |
OBJ myClass; |
|
827 |
register char *pFirst; |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
828 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
829 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
830 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
831 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
832 |
#endif |
329 | 833 |
/* int nInstBytes, ninstvars, flags; */ |
834 |
REGISTER int n; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
835 |
unsigned int u; |
1 | 836 |
int val; |
837 |
||
56 | 838 |
/* notice the missing test for self being a nonNilObject - |
77 | 839 |
this can be done since basicAt: is defined both in UndefinedObject |
1 | 840 |
and SmallInteger */ |
841 |
||
253 | 842 |
if (__isSmallInteger(index)) { |
2647 | 843 |
indx = __intVal(index) - 1; |
844 |
myClass = __qClass(self); |
|
845 |
n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
|
846 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */); |
|
847 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
848 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
|
849 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
850 |
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
|
851 |
case __MASKSMALLINT(POINTERARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
852 |
case __MASKSMALLINT(WKPOINTERARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
853 |
if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) { |
4103 | 854 |
OBJ *op; |
855 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
856 |
op = (OBJ *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
857 |
*op = anObject; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
858 |
__STORE(self, anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
859 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
860 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
861 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
862 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
863 |
case __MASKSMALLINT(BYTEARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
864 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
865 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
866 |
if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
867 |
if ((unsigned)indx < nbytes) { |
4103 | 868 |
char *cp; |
869 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
870 |
cp = pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
871 |
*cp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
872 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
873 |
} |
2647 | 874 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
875 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
876 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
877 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
878 |
case __MASKSMALLINT(FLOATARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
879 |
if ((unsigned)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
|
880 |
float *fp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
881 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
882 |
fp = (float *)pFirst + indx; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
883 |
if (anObject != nil) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
884 |
if (! __isSmallInteger(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
885 |
if (__qIsFloatLike(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
886 |
*fp = (float)(__floatVal(anObject)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
887 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
888 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
889 |
if (__qIsShortFloat(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
890 |
*fp = __shortFloatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
891 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
892 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
893 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
894 |
*fp = (float) __intVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
895 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
896 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
897 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
898 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
899 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
900 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
901 |
case __MASKSMALLINT(DOUBLEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
902 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
903 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
904 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
905 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
906 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
907 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
908 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
909 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
910 |
if ((unsigned)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
|
911 |
double *dp; |
13 | 912 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
913 |
dp = (double *)pFirst + indx; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
914 |
if (anObject != nil) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
915 |
if (! __isSmallInteger(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
916 |
if (__qIsFloatLike(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
917 |
*dp = __floatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
918 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
919 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
920 |
if (__qIsShortFloat(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
921 |
*dp = (double)__shortFloatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
922 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
923 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
924 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
925 |
*dp = (double) __intVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
926 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
927 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
928 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
929 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
930 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
931 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
932 |
case __MASKSMALLINT(WORDARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
933 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
934 |
val = __intVal(anObject); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
935 |
if ((unsigned)val <= 0xFFFF) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
936 |
if ((unsigned)indx < (nbytes>>1)) { |
4103 | 937 |
unsigned short *sp; |
938 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
939 |
sp = (unsigned short *)(pFirst + (indx<<1)); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
940 |
*sp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
941 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
942 |
} |
2647 | 943 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
944 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
945 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
946 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
947 |
case __MASKSMALLINT(SWORDARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
948 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
949 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
950 |
if ((val >= -32768) && (val < 32768)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
951 |
if ((unsigned)indx < (nbytes>>1)) { |
4103 | 952 |
short *ssp; |
953 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
954 |
ssp = (short *)(pFirst + (indx<<1)); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
955 |
*ssp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
956 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
957 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
958 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
959 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
960 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
961 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
962 |
case __MASKSMALLINT(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
963 |
if ((unsigned)indx < (nbytes>>2)) { |
4103 | 964 |
int32 *slp; |
965 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
966 |
slp = (int32 *)(pFirst + (indx<<2)); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
967 |
if (__isSmallInteger(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
968 |
*slp = __intVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
969 |
RETURN ( anObject ); |
2647 | 970 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
971 |
n = __signedLongIntVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
972 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
973 |
* 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
|
974 |
* (would be a smallInteger) |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
975 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
976 |
if (n) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
977 |
*slp = n; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
978 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
979 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
980 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
981 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
982 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
983 |
case __MASKSMALLINT(LONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
984 |
if ((unsigned)indx < (nbytes>>2)) { |
4103 | 985 |
unsigned int32 *lp; |
986 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
987 |
lp = (unsigned int32 *)(pFirst + (indx<<2)); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
988 |
if (anObject == __MKSMALLINT(0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
989 |
*lp = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
990 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
991 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
992 |
u = __longIntVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
993 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
994 |
* 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
|
995 |
* (would be a smallInteger) |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
996 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
997 |
if (u) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
998 |
*lp = u; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
999 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1000 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1001 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1002 |
break; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1003 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1004 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1005 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1006 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1007 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1008 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1009 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1010 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1011 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1012 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1013 |
if ((unsigned)indx < (nbytes>>3)) { |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
1014 |
__int64__ ll; |
4103 | 1015 |
__int64__ *sllp; |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
1016 |
|
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
1017 |
sllp = (__int64__ *)(pFirst + (indx<<3)); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1018 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1019 |
if (anObject == __MKSMALLINT(0)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1020 |
ll.lo = ll.hi = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1021 |
*sllp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1022 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1023 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1024 |
if (__signedLong64IntVal(anObject, &ll)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1025 |
*sllp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1026 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1027 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1028 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1029 |
break; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1030 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1031 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1032 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1033 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1034 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1035 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1036 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1037 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1038 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1039 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1040 |
if ((unsigned)indx < (nbytes>>3)) { |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
1041 |
__uint64__ ll; |
4103 | 1042 |
__uint64__ *llp; |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
1043 |
|
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
1044 |
llp = (__uint64__ *)(pFirst + (indx<<3)); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1045 |
if (anObject == __MKSMALLINT(0)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1046 |
ll.lo = ll.hi = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1047 |
*llp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1048 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1049 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1050 |
if (__unsignedLong64IntVal(anObject, &ll)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1051 |
*llp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1052 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1053 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1054 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1055 |
break; |
2647 | 1056 |
} |
1 | 1057 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1058 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1059 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1060 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1061 |
%}. |
10 | 1062 |
index isInteger ifFalse:[ |
2647 | 1063 |
" |
1064 |
the index should be an integer number |
|
1065 |
" |
|
1066 |
^ self indexNotInteger |
|
1 | 1067 |
]. |
1068 |
(index between:1 and:self size) ifFalse:[ |
|
2647 | 1069 |
" |
1070 |
the index is less than 1 or greater than the size of the |
|
1071 |
receiver collection |
|
1072 |
" |
|
1073 |
^ self subscriptBoundsError:index |
|
1 | 1074 |
]. |
643 | 1075 |
(self class isFloatsOrDoubles) ifTrue:[ |
2647 | 1076 |
anObject isNumber ifTrue:[ |
1077 |
^ self basicAt:index put:(anObject asFloat) |
|
1078 |
] |
|
13 | 1079 |
]. |
10 | 1080 |
anObject isInteger ifFalse:[ |
2647 | 1081 |
" |
1082 |
the object to put into the receiver collection |
|
1083 |
should be an integer number |
|
1084 |
" |
|
1085 |
^ self elementNotInteger |
|
2 | 1086 |
]. |
159 | 1087 |
" |
213 | 1088 |
the object to put into the receiver collection |
362 | 1089 |
is not an instance of the expected element class, |
1090 |
or the value is not within the elements valid range. |
|
159 | 1091 |
" |
2 | 1092 |
^ self elementBoundsError |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1093 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1094 |
"Modified: 19.4.1996 / 11:14:10 / cg" |
1 | 1095 |
! |
1096 |
||
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1097 |
byteAt:index |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1098 |
"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
|
1099 |
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
|
1100 |
(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
|
1101 |
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
|
1102 |
collection of bytes. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1103 |
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
|
1104 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1105 |
%{ /* NOCONTEXT */ |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1106 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1107 |
REGISTER int indx; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1108 |
int nIndex; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1109 |
REGISTER OBJ slf; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1110 |
REGISTER OBJ cls; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1111 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1112 |
if (__isSmallInteger(index)) { |
2647 | 1113 |
slf = self; |
1114 |
if (__isNonNilObject(slf)) { |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1115 |
unsigned char *pFirst; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1116 |
int nIndex; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1117 |
|
2647 | 1118 |
cls = __qClass(slf); |
1119 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1120 |
pFirst = __ByteArrayInstPtr(slf)->ba_element; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1121 |
pFirst += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1122 |
nIndex = __byteArraySize(slf); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1123 |
indx = __intVal(index) - 1; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1124 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1125 |
switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1126 |
case __MASKSMALLINT(DOUBLEARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1127 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1128 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1129 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1130 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1131 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1132 |
nIndex -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1133 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1134 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1135 |
/* fall into */ |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1136 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1137 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1138 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1139 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1140 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1141 |
case __MASKSMALLINT(FLOATARRAY): |
2647 | 1142 |
if ((unsigned)indx < (unsigned)nIndex) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1143 |
RETURN ( __MKSMALLINT( pFirst[indx]) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1144 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1145 |
break; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1146 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1147 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1148 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1149 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1150 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1151 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1152 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1153 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1154 |
nIndex -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1155 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1156 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1157 |
if ((unsigned)indx < (unsigned)nIndex) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1158 |
RETURN ( __MKSMALLINT( pFirst[indx]) ); |
2647 | 1159 |
} |
1160 |
break; |
|
1161 |
} |
|
1162 |
} |
|
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1163 |
} |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1164 |
%}. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1165 |
"/ 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
|
1166 |
"/ 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
|
1167 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1168 |
^ self primitiveFailed |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1169 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1170 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1171 |
Point new byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1172 |
(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
|
1173 |
(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
|
1174 |
(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
|
1175 |
'hello' byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1176 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1177 |
! |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1178 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1179 |
byteAt:index put:byteValue |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1180 |
"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
|
1181 |
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
|
1182 |
(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
|
1183 |
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
|
1184 |
collection of bytes. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1185 |
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
|
1186 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1187 |
%{ /* NOCONTEXT */ |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1188 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1189 |
REGISTER int indx; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1190 |
int val, nIndex; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1191 |
REGISTER OBJ slf; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1192 |
REGISTER OBJ cls; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1193 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1194 |
if (__bothSmallInteger(index, byteValue)) { |
2647 | 1195 |
val = __intVal(byteValue); |
1196 |
if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) { |
|
1197 |
slf = self; |
|
1198 |
if (__isNonNilObject(slf)) { |
|
1199 |
cls = __qClass(slf); |
|
1200 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1201 |
indx = __intVal(index) - 1; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1202 |
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
|
1203 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1204 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1205 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1206 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1207 |
case __MASKSMALLINT(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1208 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1209 |
case __MASKSMALLINT(SLONGLONGARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1210 |
case __MASKSMALLINT(FLOATARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1211 |
case __MASKSMALLINT(DOUBLEARRAY): |
2647 | 1212 |
indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
1213 |
nIndex = __byteArraySize(slf); |
|
1214 |
if ((unsigned)indx < (unsigned)nIndex) { |
|
1215 |
__ByteArrayInstPtr(slf)->ba_element[indx] = val; |
|
1216 |
RETURN ( byteValue ); |
|
1217 |
} |
|
1218 |
break; |
|
1219 |
} |
|
1220 |
} |
|
1221 |
} |
|
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1222 |
} |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1223 |
%}. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1224 |
"/ 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
|
1225 |
"/ 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
|
1226 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1227 |
^ self primitiveFailed |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1228 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1229 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1230 |
(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
|
1231 |
'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
|
1232 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1233 |
! |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1234 |
|
1 | 1235 |
instVarAt:index |
1236 |
"return a non-indexed instance variable; |
|
13 | 1237 |
peeking into an object this way is not very object oriented |
1238 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 1239 |
|
1240 |
%{ /* NOCONTEXT */ |
|
1241 |
||
1242 |
OBJ myClass; |
|
1243 |
int idx, ninstvars; |
|
1244 |
||
253 | 1245 |
if (__isSmallInteger(index)) { |
329 | 1246 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
1247 |
idx = __intVal(index) - 1; |
357 | 1248 |
/* |
4267 | 1249 |
* do not allow returning of non-object fields. |
357 | 1250 |
* if subclass did not make privisions for that, |
1251 |
* we wont do so here ... |
|
1252 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1253 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 1254 |
if (idx == 0) { |
1255 |
RETURN ( nil ) |
|
1256 |
} |
|
1257 |
} |
|
1133 | 1258 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
159 | 1259 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 1260 |
RETURN ( __InstPtr(self)->i_instvars[idx] ); |
159 | 1261 |
} |
1 | 1262 |
} |
1263 |
%} |
|
1264 |
. |
|
1265 |
index isInteger ifFalse:[ |
|
159 | 1266 |
^ self indexNotInteger |
1 | 1267 |
]. |
159 | 1268 |
^ self subscriptBoundsError:index |
1 | 1269 |
! |
1270 |
||
1271 |
instVarAt:index put:value |
|
1272 |
"change a non-indexed instance variable; |
|
13 | 1273 |
peeking into an object this way is not very object oriented |
1274 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 1275 |
|
1276 |
%{ /* NOCONTEXT */ |
|
1277 |
||
1278 |
OBJ myClass; |
|
1279 |
int idx, ninstvars; |
|
1280 |
||
253 | 1281 |
if (__isSmallInteger(index)) { |
329 | 1282 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
1283 |
idx = __intVal(index) - 1; |
1133 | 1284 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
357 | 1285 |
/* |
1286 |
* do not allow setting of non-object fields. |
|
1287 |
* if subclass did not make privisions for that, |
|
1288 |
* we wont do so here ... |
|
1289 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1290 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 1291 |
if (idx == 0) { |
1292 |
RETURN ( nil ) |
|
1293 |
} |
|
1294 |
} |
|
159 | 1295 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 1296 |
__InstPtr(self)->i_instvars[idx] = value; |
159 | 1297 |
__STORE(self, value); |
1298 |
RETURN ( value ); |
|
1299 |
} |
|
1 | 1300 |
} |
1301 |
%} |
|
1302 |
. |
|
1303 |
index isInteger ifFalse:[ |
|
159 | 1304 |
^ self indexNotInteger |
1 | 1305 |
]. |
159 | 1306 |
^ self subscriptBoundsError:index |
359 | 1307 |
! |
1308 |
||
1309 |
instVarNamed:name |
|
1310 |
"return a non-indexed instance variables value by name; |
|
1311 |
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
|
1312 |
- 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
|
1313 |
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
|
1314 |
parsed ad runtime)" |
359 | 1315 |
|
1316 |
^ 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
|
1317 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1318 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1319 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1320 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1321 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1322 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1323 |
p instVarNamed:'x' |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1324 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1325 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1326 |
"Modified: 19.4.1996 / 11:12:39 / cg" |
359 | 1327 |
! |
1328 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1329 |
instVarNamed:name ifAbsent:exceptionBlock |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1330 |
"return a non-indexed instance variables value by name, |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1331 |
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
|
1332 |
peeking into an object this way is not very object oriented |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1333 |
- 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
|
1334 |
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
|
1335 |
parsed ad runtime)" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1336 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1337 |
|idx| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1338 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1339 |
idx := self class instVarOffsetOf:name. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1340 |
idx isNil ifTrue:[^ exceptionBlock value]. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1341 |
^ self instVarAt:idx |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1342 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1343 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1344 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1345 |
|p| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1346 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1347 |
p := Point x:10 y:20. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1348 |
p instVarNamed:'x' |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1349 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1350 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1351 |
"Created: 6.7.1996 / 23:02:49 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1352 |
"Modified: 6.7.1996 / 23:03:41 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1353 |
! |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1354 |
|
359 | 1355 |
instVarNamed:name put:value |
1356 |
"set a non-indexed instance variable by name; |
|
1357 |
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
|
1358 |
- 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
|
1359 |
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
|
1360 |
parsed ad runtime)" |
359 | 1361 |
|
1362 |
^ 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
|
1363 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1364 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1365 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1366 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1367 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1368 |
p instVarNamed:'x' put:30. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1369 |
p |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1370 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1371 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1372 |
"Modified: 19.4.1996 / 11:12:49 / cg" |
1 | 1373 |
! ! |
1374 |
||
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1375 |
!Object methodsFor:'attributes access'! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1376 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1377 |
objectAttributeAt:key |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1378 |
"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
|
1379 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1380 |
| attrs | |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1381 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1382 |
attrs := self objectAttributes. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1383 |
(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
|
1384 |
^ attrs at:key ifAbsent:[] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1385 |
]. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1386 |
^ nil |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1387 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1388 |
"Created: / 22.1.1998 / 21:29:17 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1389 |
"Modified: / 3.2.1998 / 18:55:55 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1390 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1391 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1392 |
objectAttributeAt:key put:anObject |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1393 |
"store the attribute anObject referenced by key into the receiver" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1394 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1395 |
|wasBlocked| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1396 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1397 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1398 |
"/ is possibly accessed from multiple threads ... |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1399 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1400 |
wasBlocked := OperatingSystem blockInterrupts. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1401 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1402 |
| attrs | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1403 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1404 |
attrs := self objectAttributes. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1405 |
(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
|
1406 |
attrs := WeakIdentityDictionary new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1407 |
attrs at:key put:anObject. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1408 |
self objectAttributes:attrs. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1409 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1410 |
attrs at:key put:anObject. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1411 |
]. |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1412 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1413 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1414 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1415 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1416 |
] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1417 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1418 |
"Attaching additional attributes (slots) to an arbitrary object: |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1419 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1420 |
|p| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1421 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1422 |
p := Point new. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1423 |
p objectAttributeAt:#color put:#green. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1424 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1425 |
p objectAttributeAt:#color |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1426 |
" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1427 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1428 |
"Created: / 22.1.1998 / 21:29:25 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1429 |
"Modified: / 3.2.1998 / 18:57:58 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1430 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1431 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1432 |
objectAttributes |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1433 |
"return a Collection of attributes - nil if there is none. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1434 |
The default implementation here uses a global WeakDictionary to store |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1435 |
attributes |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1436 |
This may be too slow for high frequency slot access, |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1437 |
therefore, some classes may redefine this for better performance. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1438 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1439 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1440 |
^ ObjectAttributes at:self ifAbsent:[#()] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1441 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1442 |
"Created: / 22.1.1998 / 21:29:30 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1443 |
"Modified: / 3.2.1998 / 18:58:31 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1444 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1445 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1446 |
objectAttributes:aCollection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1447 |
"set the collection of attributes. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1448 |
The default implementation here uses a global Dictionary to store |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1449 |
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
|
1450 |
Therefore, some classes may redefine this for better performance." |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1451 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1452 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1453 |
"/ is possibly accessed from multiple threads. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1454 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1455 |
(OperatingSystem blockInterrupts) ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1456 |
"/ the common case - already blocked |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1457 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1458 |
(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
|
1459 |
ObjectAttributes removeKey:self ifAbsent:[] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1460 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1461 |
ObjectAttributes at:self put:aCollection |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1462 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1463 |
^ self |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1464 |
]. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1465 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1466 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1467 |
(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
|
1468 |
ObjectAttributes removeKey:self ifAbsent:[] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1469 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1470 |
ObjectAttributes at:self put:aCollection |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1471 |
]. |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1472 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1473 |
OperatingSystem unblockInterrupts |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1474 |
] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1475 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1476 |
"Created: / 22.1.1998 / 21:29:35 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1477 |
"Modified: / 3.2.1998 / 18:58:10 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1478 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1479 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1480 |
removeObjectAttribute:anObject |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1481 |
"make the argument, anObject be no attribute of the receiver" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1482 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1483 |
|wasBlocked| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1484 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1485 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1486 |
"/ is possibly accessed from multiple threads. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1487 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1488 |
wasBlocked := OperatingSystem blockInterrupts. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1489 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1490 |
|attrs n a| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1491 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1492 |
attrs := self objectAttributes. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1493 |
attrs notNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1494 |
attrs remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1495 |
attrs size == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1496 |
self objectAttributes:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1497 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1498 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1499 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1500 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1501 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1502 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1503 |
] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1504 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1505 |
"Created: / 22.1.1998 / 21:29:39 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1506 |
"Modified: / 3.2.1998 / 18:58:13 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1507 |
! ! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1508 |
|
783 | 1509 |
!Object methodsFor:'binary storage'! |
1510 |
||
1511 |
hasSpecialBinaryRepresentation |
|
1512 |
"return true, if the receiver has a special binary representation; |
|
1513 |
default here is false, but can be redefined in class which provide |
|
1514 |
their own storeBinary/readBinary methods. |
|
1515 |
||
1516 |
Normal user classes should not use this, it is meant as a hook for |
|
1517 |
special classes such as True, False, UndefinedObject or SmallInteger. |
|
1518 |
||
1519 |
If your instances should be stored in a special way, see |
|
1520 |
#representBinaryOn: and #readBinaryContentsFromdata:manager:." |
|
1521 |
||
1522 |
^ false |
|
1 | 1523 |
! |
1524 |
||
783 | 1525 |
readBinaryContentsFrom:stream manager:manager |
1526 |
"reconstruct the receivers instance variables by reading a binary |
|
1527 |
binary representation from stream. |
|
1528 |
This is a general implementation, walking over instances |
|
1529 |
and loading each recursively using manager. |
|
1530 |
Redefined by some classes to read a more compact representations |
|
1531 |
(see String, SmallInteger etc). |
|
1532 |
||
1533 |
Notice, that the object is already recreated as an empty corps |
|
1534 |
with instance variables all nil and bit-instances (bytes, words etc.) |
|
1535 |
already read and restored. |
|
1536 |
||
1537 |
Also notice: this method is not called for if a private representation |
|
1538 |
has been stored (see representBinaryOn:). |
|
1539 |
In that case, #readBinaryContentsFromData:manager: is called, which |
|
1540 |
has to be reimplemented in the objects class." |
|
1541 |
||
1542 |
|size "{ Class: SmallInteger }" |
|
1543 |
instvarArray| |
|
1544 |
||
1545 |
stream next == 1 ifTrue:[ |
|
1546 |
"/ |
|
1547 |
"/ special representation ... |
|
1548 |
"/ |
|
1549 |
instvarArray := Array new:(size := stream nextNumber:3). |
|
1550 |
1 to:size do:[:i | |
|
1551 |
instvarArray basicAt:i put:(manager nextObject) |
|
1552 |
]. |
|
1553 |
self readBinaryContentsFromData:instvarArray manager:manager. |
|
1554 |
^ self |
|
1555 |
]. |
|
1556 |
||
1557 |
"/ |
|
1558 |
"/ standard representation |
|
1559 |
"/ |
|
1560 |
size := self basicSize. |
|
1561 |
size ~~ 0 ifTrue:[ |
|
1562 |
self class isPointers ifTrue:[ |
|
1563 |
1 to:size do:[:i | |
|
1564 |
self basicAt:i put:(manager nextObject) |
|
1565 |
] |
|
1566 |
] |
|
1567 |
]. |
|
1568 |
size := self class instSize. |
|
1569 |
1 to:size do:[:i | |
|
1570 |
self instVarAt:i put:(manager nextObject) |
|
1571 |
]. |
|
1572 |
! |
|
1573 |
||
1574 |
readBinaryContentsFromData:instvarArray manager:manager |
|
1575 |
"reconstruct the receivers instance variables by filling instance |
|
1576 |
variables with values from instvarArray. This array contains the instvars |
|
1577 |
as specified in #representBinaryOn: when the object was stored. |
|
1578 |
It is the receivers responsibility to set its instance variables in the |
|
1579 |
same order from that array." |
|
1580 |
||
1581 |
^ self subclassResponsibility |
|
1582 |
||
1583 |
"typical implementation (see also comment in #representBinaryOn:) |
|
1584 |
(for an object with foo, bar and baz as instance variables, |
|
1585 |
which did not store baz and wants baz to be reinitialized to |
|
1586 |
some constant string) |
|
1587 |
||
1588 |
foo := instvarArray at:1. |
|
1589 |
bar := instvarArray at:2. |
|
1590 |
baz := 'aConstant'. |
|
1591 |
" |
|
1592 |
! |
|
1593 |
||
1594 |
representBinaryOn:manager |
|
1595 |
"this method is called by the storage manager to ask objects |
|
1596 |
if they wish to provide their own binary representation. |
|
1597 |
||
1598 |
If they want to do so, they should return an array containing all |
|
1599 |
instance variables (named & indexed pointer) to be stored. |
|
1600 |
If not redefined, this method returns nil which means that all |
|
1601 |
instance variables are to be stored. |
|
1602 |
||
1603 |
It should be redefined in objects which do not want all instance variables |
|
1604 |
to be stored (for example: objects which keep references to a view etc.). |
|
1605 |
||
1606 |
If this is redefined returning non-nil, the corresponding class needs |
|
1607 |
a redefined instance method named #readBinaryContentsFromData:manager: |
|
1608 |
which has to fill the receivers named (and optionally indexed pointer) |
|
1609 |
instance variables with corresponding values from a data array." |
|
1610 |
||
1611 |
^ nil |
|
1612 |
||
1613 |
"typical implementation: |
|
1614 |
(see also comment in #readBinaryContentsFromData:manager:) |
|
1615 |
for an object with foo, bar and baz as instance variables, |
|
1616 |
which does not want to store baz: |
|
1617 |
||
1618 |
representBinaryOn:manager |
|
1619 |
|data| |
|
1620 |
||
1621 |
data := Array new:2. |
|
1622 |
data at:1 put:foo. |
|
1623 |
data at:2 put:bar. |
|
1624 |
^ data |
|
1625 |
" |
|
159 | 1626 |
! |
1627 |
||
783 | 1628 |
storeBinaryDefinitionBodyOn:stream manager:manager |
1629 |
"append a binary representation of the receivers body onto stream. |
|
1630 |
This is a general implementation walking over instances storing |
|
1631 |
each recursively as an ID using manager. |
|
1632 |
Can be redefined in subclasses." |
|
1633 |
||
3078 | 1634 |
|basicSize "{ Class: SmallInteger }" |
1635 |
instSize "{ Class: SmallInteger }" |
|
1636 |
specialSize "{ Class: SmallInteger }" |
|
783 | 1637 |
myClass specialRep pointers| |
1638 |
||
1639 |
myClass := self class. |
|
1640 |
instSize := myClass instSize. |
|
1641 |
||
1642 |
(pointers := myClass isPointers) ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1643 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1644 |
"/ 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
|
1645 |
"/ also uncomment the corresponding line in |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1646 |
"/ Object>>binaryDefinitionFrom:manager: |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1647 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1648 |
"/ 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
|
1649 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1650 |
myClass isVariable ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1651 |
stream nextNumber:3 put:(basicSize := self basicSize) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1652 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1653 |
basicSize := 0 |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1654 |
]. |
783 | 1655 |
] ifFalse: [ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1656 |
stream nextNumber:4 put:(basicSize := self basicSize). |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1657 |
myClass isBytes ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1658 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1659 |
stream nextPut:(self basicAt:i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1660 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1661 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1662 |
myClass isWords ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1663 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1664 |
stream nextNumber:2 put:(self basicAt: i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1665 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1666 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1667 |
myClass isLongs ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1668 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1669 |
stream nextNumber:4 put:(self basicAt: i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1670 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1671 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1672 |
myClass isFloats ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1673 |
"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
|
1674 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1675 |
Float storeBinaryIEEESingle:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1676 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1677 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1678 |
myClass isDoubles ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1679 |
"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
|
1680 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1681 |
Float storeBinaryIEEEDouble:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1682 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1683 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1684 |
"/ should never be reached ... |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1685 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1686 |
manager putIdOf:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1687 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1688 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1689 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1690 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1691 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1692 |
]. |
783 | 1693 |
]. |
1694 |
||
1695 |
(pointers or:[instSize ~~ 0]) ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1696 |
specialRep := self representBinaryOn:manager. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1697 |
specialRep notNil ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1698 |
specialSize := specialRep basicSize. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1699 |
stream nextPut:1. "/ means: private representation follows |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1700 |
stream nextNumber:3 put:specialSize. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1701 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1702 |
1 to:specialSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1703 |
manager putIdOf:(specialRep at:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1704 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1705 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1706 |
stream nextPut:0. "/ means: normal representation follows |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1707 |
"/ index pointers followed by named instanceVars |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1708 |
pointers ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1709 |
basicSize ~~ 0 ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1710 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1711 |
manager putIdOf:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1712 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1713 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1714 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1715 |
instSize ~~ 0 ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1716 |
1 to:instSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1717 |
manager putIdOf:(self instVarAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1718 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1719 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1720 |
] |
1 | 1721 |
] |
783 | 1722 |
|
3078 | 1723 |
"Modified: / 2.11.1997 / 14:43:29 / cg" |
1 | 1724 |
! |
1725 |
||
783 | 1726 |
storeBinaryDefinitionOn:stream manager:manager |
1727 |
"append a binary representation of the receiver onto stream. |
|
1260 | 1728 |
This is an internal interface for binary storage mechanism. |
783 | 1729 |
This method first stores the class, then the body, which is done |
1730 |
in a separate method to allow redefinition of the bodies format. |
|
1731 |
Can be redefined in subclasses to write more compact representations |
|
1732 |
(see String, SmallInteger etc)." |
|
1733 |
||
1734 |
manager putIdOfClass:(self class) on:stream. |
|
1735 |
self storeBinaryDefinitionBodyOn:stream manager:manager |
|
1260 | 1736 |
|
1737 |
"Modified: 23.4.1996 / 09:31:12 / cg" |
|
783 | 1738 |
! |
1739 |
||
3078 | 1740 |
storeBinaryOn:aStreamOrFilename |
1741 |
"Writes a description of the receiver onto aStreamOrFilename, in a way that allows |
|
783 | 1742 |
the object's structure to be reconstructed from the stream's contents" |
1743 |
||
3078 | 1744 |
BinaryOutputManager store:self on:aStreamOrFilename |
899 | 1745 |
|
1746 |
" |
|
1747 |
|a s1 s2| |
|
1748 |
||
1749 |
s1 := 'hello'. |
|
1750 |
s2 := 'world'. |
|
1751 |
a := Array new:5. |
|
1752 |
a at:1 put:s1. |
|
1753 |
a at:2 put:s2. |
|
1754 |
a at:3 put:s1. |
|
1755 |
a at:4 put:s2. |
|
1756 |
a storeBinaryOn:'test.boss' |
|
1757 |
" |
|
1758 |
||
1759 |
" |
|
1760 |
(BinaryObjectStorage onOld:'test.boss' asFilename readStream) |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1761 |
next |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1762 |
inspect |
899 | 1763 |
" |
3078 | 1764 |
|
1765 |
"Modified: / 1.11.1997 / 21:16:24 / cg" |
|
783 | 1766 |
! |
1767 |
||
1768 |
storeBinaryOn:stream manager:manager |
|
1769 |
"append a binary representation of the receiver onto stream." |
|
1770 |
||
1771 |
manager putIdOf:self on:stream |
|
1 | 1772 |
! ! |
1773 |
||
1826 | 1774 |
!Object methodsFor:'change & update'! |
1 | 1775 |
|
783 | 1776 |
broadcast:aSelectorSymbol |
1777 |
"send a message with selector aSelectorSymbol to all my dependents" |
|
1778 |
||
1779 |
self dependentsDo:[:dependent | |
|
1780 |
dependent perform:aSelectorSymbol |
|
1781 |
] |
|
1782 |
! |
|
1783 |
||
1784 |
broadcast:aSelectorSymbol with:anArgument |
|
1785 |
"send a message with selector aSelectorSymbol with an additional |
|
1786 |
argument anArgument to all my dependents." |
|
1787 |
||
1788 |
self dependentsDo:[:dependent | |
|
1789 |
dependent perform:aSelectorSymbol with:anArgument |
|
1790 |
] |
|
1791 |
! |
|
1792 |
||
159 | 1793 |
changeRequest |
1794 |
"the receiver wants to change - check if all dependents |
|
1795 |
grant the request, and return true if so" |
|
1796 |
||
1797 |
self dependentsDo:[:dependent | |
|
1798 |
dependent updateRequest ifFalse:[^ false]. |
|
1799 |
]. |
|
1800 |
^ true |
|
1801 |
! |
|
1802 |
||
1803 |
changeRequest:aParameter |
|
1804 |
"the receiver wants to change - check if all dependents |
|
1805 |
grant the request, and return true if so" |
|
1806 |
||
1807 |
self dependentsDo:[:dependent | |
|
1808 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1809 |
]. |
|
1810 |
^ true |
|
1811 |
! |
|
1812 |
||
783 | 1813 |
changeRequest:aParameter from:anObject |
1814 |
"the receiver wants to change - check if all dependents |
|
1815 |
except anObject grant the request, and return true if so. |
|
1816 |
The argument anObject is typically going to be the one who is |
|
1817 |
about to send the change request." |
|
1818 |
||
1819 |
self dependentsDo:[:dependent | |
|
1820 |
dependent == anObject ifFalse:[ |
|
1821 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1822 |
] |
|
1823 |
]. |
|
1824 |
^ true |
|
1825 |
! |
|
1826 |
||
159 | 1827 |
changeRequestFrom:anObject |
1828 |
"the receiver wants to change - check if all dependents |
|
202 | 1829 |
except anObject grant the request, and return true if so. |
1830 |
The argument anObject is typically going to be the one who is |
|
1831 |
about to send the change request." |
|
159 | 1832 |
|
1833 |
self dependentsDo:[:dependent | |
|
1834 |
dependent == anObject ifFalse:[ |
|
1835 |
(dependent updateRequest) ifFalse:[^ false]. |
|
1836 |
] |
|
1837 |
]. |
|
1838 |
^ true |
|
1839 |
! |
|
1840 |
||
1 | 1841 |
changed |
1842 |
"notify all dependents that the receiver has changed. |
|
71 | 1843 |
Each dependent gets a '#update:'-message with the original |
1844 |
receiver as argument." |
|
1 | 1845 |
|
159 | 1846 |
self changed:nil |
1 | 1847 |
! |
1848 |
||
1849 |
changed:aParameter |
|
1850 |
"notify all dependents that the receiver has changed somehow. |
|
71 | 1851 |
Each dependent gets a '#update:'-message with aParameter |
1852 |
as argument." |
|
1 | 1853 |
|
159 | 1854 |
self changed:aParameter with:nil |
1 | 1855 |
! |
1856 |
||
71 | 1857 |
changed:aParameter with:anArgument |
1 | 1858 |
"notify all dependents that the receiver has changed somehow. |
159 | 1859 |
Each dependent gets a '#update:with:from:'-message, with aParameter |
71 | 1860 |
and anArgument as arguments." |
1 | 1861 |
|
159 | 1862 |
self dependentsDo:[:dependent | |
1863 |
dependent update:aParameter with:anArgument from:self |
|
1 | 1864 |
] |
1865 |
! |
|
1866 |
||
1867 |
update:aParameter |
|
71 | 1868 |
"the message is sent to a dependent, when one of the objects |
1869 |
on whom the receiver depends, has changed. The argument aParameter |
|
1870 |
is either the changed object or the argument to the #changed: message. |
|
1871 |
||
1872 |
Default behavior here is to do nothing" |
|
1 | 1873 |
|
1874 |
^ self |
|
1875 |
! |
|
1876 |
||
1877 |
update:aParameter with:anArgument |
|
1878 |
"dependent is notified of some change - |
|
159 | 1879 |
Default is to try update:" |
1 | 1880 |
|
1881 |
^ self update:aParameter |
|
1882 |
! |
|
1883 |
||
1884 |
update:aParameter with:anArgument from:sender |
|
1885 |
"dependent is notified of some change - |
|
159 | 1886 |
Default is to try update:with:" |
1 | 1887 |
|
1888 |
^ self update:aParameter with:anArgument |
|
159 | 1889 |
! |
1890 |
||
1891 |
updateRequest |
|
1892 |
"return true, if an update request is granted. |
|
1893 |
Default here is to grant updates - may be used |
|
1894 |
to lock updates if someone is making other changes |
|
202 | 1895 |
from within an update. Or if someone has locked its |
1896 |
state and does not want others to change things. |
|
1897 |
However, these dependents must all honor the |
|
1898 |
changeRequest - ifTrue - change protocol. I.e. they |
|
1899 |
must first ask all others via changeRequest, and only do the change |
|
1900 |
it returns true. The others must decide in updateRequest and |
|
1901 |
return true if they think a change is ok." |
|
159 | 1902 |
|
1903 |
^ true |
|
1904 |
! |
|
1905 |
||
1906 |
updateRequest:aSymbol |
|
1907 |
"return true, if an update request is granted. |
|
1908 |
Default here a simple updateRequest" |
|
1909 |
||
1910 |
^ self updateRequest |
|
1 | 1911 |
! ! |
1912 |
||
783 | 1913 |
!Object methodsFor:'cleanup'! |
1914 |
||
1915 |
lowSpaceCleanup |
|
1916 |
"ignored here - redefined in some classes to |
|
1917 |
cleanup in low-memory situations" |
|
1918 |
||
1919 |
^ self |
|
1920 |
! ! |
|
1921 |
||
1922 |
!Object methodsFor:'comparing'! |
|
1923 |
||
1924 |
= anObject |
|
3044 | 1925 |
"return true, if the receiver and the arg have the same structure. |
1926 |
Notice: |
|
1927 |
This method is partially open coded (inlined) by the compiler(s) |
|
1928 |
identical objects are always considered equal. |
|
1929 |
redefining it may not work as expected." |
|
783 | 1930 |
|
1931 |
^ self == anObject |
|
1932 |
! |
|
1933 |
||
1934 |
== anObject |
|
2505 | 1935 |
"return true, if the receiver and the arg are the same object. |
1936 |
Never redefine this in any class. |
|
3044 | 1937 |
Notice: |
1938 |
This method is open coded (inlined) by the compiler(s) |
|
1939 |
- redefining it may not work as expected." |
|
783 | 1940 |
|
1941 |
%{ /* NOCONTEXT */ |
|
1942 |
||
1943 |
RETURN ( (self == anObject) ? true : false ); |
|
1944 |
%} |
|
1945 |
! |
|
1946 |
||
1947 |
hash |
|
1948 |
"return an Integer useful as a hash key for the receiver. |
|
1949 |
This hash should return same values for objects with same |
|
1950 |
contents (i.e. use this to hash on structure)" |
|
1951 |
||
1952 |
^ self identityHash |
|
1953 |
! |
|
1954 |
||
1955 |
identityHash |
|
1956 |
"return an Integer useful as a hash key for the receiver. |
|
1957 |
This hash should return same values for the same object (i.e. use |
|
1958 |
this to hash on identity of objects). |
|
1959 |
||
1960 |
We cannot use the Objects address (as other smalltalks do) since |
|
1961 |
no object-table exists and the hashval must not change when objects |
|
1962 |
are moved by the collector. Therefore we assign each object a unique |
|
1963 |
Id in the object header itself as its hashed upon. |
|
1964 |
(luckily we have 11 bits spare to do this - unluckily its only 11 bits). |
|
1965 |
Time will show, if 11 bits are enough; if not, another entry in the |
|
1966 |
object header will be needed, adding 4 bytes to every object. Alternatively, |
|
1967 |
hashed-upon objects could add an instvar containing the hash value." |
|
1968 |
||
1969 |
%{ /* NOCONTEXT */ |
|
1970 |
||
1971 |
REGISTER unsigned hash; |
|
1972 |
static unsigned nextHash = 0; |
|
1973 |
||
1974 |
if (__isNonNilObject(self)) { |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1975 |
hash = __GET_HASH(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1976 |
if (hash == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1977 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1978 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1979 |
if (++nextHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1980 |
nextHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1981 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1982 |
hash = nextHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1983 |
__SET_HASH(self, hash); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1984 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1985 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1986 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1987 |
* now, we got 11 bits for hashing; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1988 |
* 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
|
1989 |
* 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
|
1990 |
* 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
|
1991 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1992 |
hash = __MAKE_HASH__(hash); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1993 |
RETURN ( __MKSMALLINT(hash) ); |
783 | 1994 |
} |
1995 |
%}. |
|
1996 |
^ 0 "never reached, since redefined in UndefinedObject and SmallInteger" |
|
1997 |
! |
|
1998 |
||
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1999 |
identityHashForBinaryStore |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2000 |
"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
|
2001 |
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
|
2002 |
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
|
2003 |
object writing phase." |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2004 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2005 |
%{ /* NOCONTEXT */ |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2006 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2007 |
REGISTER unsigned hash, hash1, hash2, sz; |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2008 |
OBJ o; |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2009 |
static unsigned nextHash = 0; |
2480 | 2010 |
static unsigned nextClassHash = 0; |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2011 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2012 |
if (__isNonNilObject(self)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2013 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2014 |
* my own identityHash |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2015 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2016 |
hash1 = __GET_HASH(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2017 |
if (hash1 == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2018 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2019 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2020 |
if (++nextHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2021 |
nextHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2022 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2023 |
hash1 = nextHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2024 |
__SET_HASH(self, hash1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2025 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2026 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2027 |
* my classes identityHash |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2028 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2029 |
o = __qClass(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2030 |
hash2 = __GET_HASH(o); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2031 |
if (hash2 == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2032 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2033 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2034 |
if (++nextClassHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2035 |
nextClassHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2036 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2037 |
hash2 = nextClassHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2038 |
__SET_HASH(o, hash2); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2039 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2040 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2041 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2042 |
* some bits of my size |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2043 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2044 |
sz = __qSize(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2045 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2046 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2047 |
* 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
|
2048 |
* 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
|
2049 |
* 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
|
2050 |
* 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
|
2051 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2052 |
hash = (hash1 << 11) | hash2; /* 22 bits */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2053 |
hash = (hash << 8) | (sz & 0xFC); /* 30 bits */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2054 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2055 |
while ((hash & 0x20000000) == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2056 |
hash <<= 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2057 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2058 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2059 |
RETURN ( __MKSMALLINT(hash) ); |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2060 |
} |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2061 |
%}. |
2480 | 2062 |
^ 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
|
2063 |
! |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2064 |
|
783 | 2065 |
isNil |
3044 | 2066 |
"return true, if the receiver is nil. |
2067 |
Notice: |
|
2068 |
This method is open coded (inlined) by the compiler(s) |
|
2069 |
- redefining it may not work as expected." |
|
783 | 2070 |
|
2071 |
^ false |
|
2072 |
! |
|
2073 |
||
2074 |
notNil |
|
3044 | 2075 |
"return true, if the receiver is not nil. |
2076 |
Notice: |
|
2077 |
This method is open coded (inlined) by the compiler(s) |
|
2078 |
- redefining it may not work as expected." |
|
783 | 2079 |
|
2080 |
^ true |
|
2081 |
! |
|
2082 |
||
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2083 |
sameContentsAs:anObject |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2084 |
"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
|
2085 |
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
|
2086 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2087 |
|myClass otherClass |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2088 |
sz "{ Class: SmallInteger }" | |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2089 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2090 |
myClass := self class. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2091 |
myClass isVariable ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2092 |
sz := self basicSize. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2093 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2094 |
"compare the indexed variables" |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2095 |
1 to:sz do:[:i | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2096 |
(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
|
2097 |
] |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2098 |
]. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2099 |
|
3385 | 2100 |
"compare the instance variables" |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2101 |
sz := myClass instSize. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2102 |
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
|
2103 |
(self instVarAt:i) ~~ (anObject instVarAt:i) ifTrue:[^ false]. |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2104 |
]. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2105 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2106 |
^ true |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2107 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2108 |
" |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2109 |
#(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
|
2110 |
(1@2) sameContentsAsIn:(1->2) |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2111 |
" |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2112 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2113 |
"Created: / 21.4.1998 / 15:56:40 / cg" |
3385 | 2114 |
"Modified: / 21.4.1998 / 15:58:15 / cg" |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2115 |
! |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2116 |
|
783 | 2117 |
~= anObject |
3044 | 2118 |
"return true, if the receiver and the arg do not have the same structure. |
2119 |
Notice: |
|
2120 |
This method is partially open coded (inlined) by the compiler(s) |
|
2121 |
identical objects are never considered unequal. |
|
2122 |
redefining it may not work as expected." |
|
783 | 2123 |
|
2124 |
^ (self = anObject) not |
|
2125 |
! |
|
2126 |
||
2127 |
~~ anObject |
|
2505 | 2128 |
"return true, if the receiver and the arg are not the same object. |
2129 |
Never redefine this in any class. |
|
3044 | 2130 |
Notice: |
2131 |
This method is open coded (inlined) by the compiler(s) |
|
2132 |
- redefining it may not work as expected." |
|
783 | 2133 |
|
2134 |
%{ /* NOCONTEXT */ |
|
2135 |
RETURN ( (self == anObject) ? false : true ); |
|
2136 |
%} |
|
2137 |
! ! |
|
2138 |
||
2139 |
!Object methodsFor:'converting'! |
|
2140 |
||
3007 | 2141 |
-> anObject |
2142 |
"return an association with the receiver as key and |
|
2143 |
the argument as value" |
|
2144 |
||
2145 |
^ Association key:self value:anObject |
|
2146 |
! |
|
2147 |
||
783 | 2148 |
asValue |
2149 |
"return a valueHolder for for the receiver" |
|
2150 |
||
2151 |
^ ValueHolder with:self |
|
2152 |
! ! |
|
2153 |
||
2154 |
!Object methodsFor:'copying'! |
|
2155 |
||
4731 | 2156 |
cloneFrom:anObject |
2157 |
"Helper for copy: |
|
2158 |
copy all instance variables from anObject into the receiver, |
|
2159 |
which should be of the same class as the argument." |
|
2160 |
||
2161 |
self cloneFrom:anObject performing:#yourself |
|
2162 |
||
2163 |
" |
|
2164 |
|x| |
|
2165 |
||
2166 |
x := Array new:3. |
|
2167 |
x cloneFrom:#(1 2 3). |
|
2168 |
" |
|
2169 |
! |
|
2170 |
||
2171 |
cloneFrom:anObject performing:aSymbol |
|
2172 |
"Helper for copy: |
|
2173 |
for each instance variables from anObject, send it aSymbol |
|
2174 |
and store the result into the receiver, |
|
2175 |
which should be of the same class as the argument." |
|
2176 |
||
2177 |
|myClass sz "{ Class: SmallInteger }" t | |
|
2178 |
||
2179 |
myClass := self class. |
|
2180 |
myClass isVariable ifTrue:[ |
|
2181 |
sz := self basicSize. |
|
2182 |
||
2183 |
"copy the indexed variables" |
|
2184 |
1 to:sz do:[:i | |
|
2185 |
t := anObject basicAt:i. |
|
2186 |
aSymbol ~~ #yourself ifTrue:[ |
|
4734 | 2187 |
t := t perform:aSymbol. |
2188 |
]. |
|
2189 |
self basicAt:i put:t. |
|
4731 | 2190 |
] |
2191 |
]. |
|
2192 |
||
2193 |
"copy the instance variables" |
|
2194 |
sz := myClass instSize. |
|
2195 |
1 to:sz do:[:i | |
|
2196 |
t := anObject instVarAt:i. |
|
2197 |
aSymbol ~~ #yourself ifTrue:[ |
|
4734 | 2198 |
t := t perform:aSymbol |
2199 |
]. |
|
2200 |
self instVarAt:i put:t |
|
4731 | 2201 |
]. |
2202 |
||
2203 |
^ self |
|
2204 |
||
2205 |
! |
|
2206 |
||
4693
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2207 |
cloneInstanceVariablesFrom:aPrototype |
4731 | 2208 |
"Shallow copy variables from a prototype into myself. |
2209 |
This copies instVars by name - i.e. same-named variables are |
|
2210 |
copied, others are not. |
|
2211 |
The variable slots are copied as available |
|
2212 |
(i.e. the min of both indexed sizes is used)." |
|
4693
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2213 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2214 |
|myInfo otherInfo| |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2215 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2216 |
myInfo := self class instanceVariableOffsets. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2217 |
otherInfo := aPrototype class instanceVariableOffsets. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2218 |
myInfo keysAndValuesDo:[:name :index | |varIndexAssoc| |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2219 |
varIndexAssoc := otherInfo at:name ifAbsent:[]. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2220 |
varIndexAssoc notNil ifTrue:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2221 |
self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value)) |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2222 |
] |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2223 |
]. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2224 |
self isVariable ifTrue:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2225 |
1 to:(self basicSize min:aPrototype basicSize) do:[:index | |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2226 |
self basicAt:index put:(aPrototype basicAt:index) |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2227 |
]. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2228 |
]. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2229 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2230 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2231 |
Class withoutUpdatingChangesDo:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2232 |
Point subclass:#Point3D |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2233 |
instanceVariableNames:'z' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2234 |
classVariableNames:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2235 |
poolDictionaries:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2236 |
category:'testing'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2237 |
(Point3D new cloneInstanceVariablesFrom:1@2) inspect. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2238 |
] |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2239 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2240 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2241 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2242 |
Class withoutUpdatingChangesDo:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2243 |
Point variableSubclass:#Point3D |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2244 |
instanceVariableNames:'z' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2245 |
classVariableNames:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2246 |
poolDictionaries:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2247 |
category:'testing'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2248 |
((Point3D new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2249 |
] |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2250 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2251 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2252 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2253 |
|someObject| |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2254 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2255 |
Class withoutUpdatingChangesDo:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2256 |
Object subclass:#TestClass1 |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2257 |
instanceVariableNames:'foo bar' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2258 |
classVariableNames:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2259 |
poolDictionaries:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2260 |
category:'testing'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2261 |
someObject := TestClass1 new. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2262 |
someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2263 |
Object subclass:#TestClass2 |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2264 |
instanceVariableNames:'bar foo' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2265 |
classVariableNames:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2266 |
poolDictionaries:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2267 |
category:'testing'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2268 |
(TestClass2 new cloneInstanceVariablesFrom:someObject) inspect. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2269 |
] |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2270 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2271 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2272 |
" |
4731 | 2273 |
|top b b1| |
2274 |
||
2275 |
top := StandardSystemView new. |
|
2276 |
top extent:100@100. |
|
2277 |
||
2278 |
b := Button in:top. |
|
2279 |
b label:'hello'. |
|
2280 |
||
2281 |
b1 := ArrowButton new cloneInstanceVariablesFrom:b. |
|
2282 |
||
2283 |
top open. |
|
2284 |
b1 inspect |
|
2285 |
" |
|
4693
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2286 |
! |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2287 |
|
783 | 2288 |
copy |
2289 |
"return a copy of the receiver - defaults to shallowcopy here. |
|
2290 |
Notice, that copy does not copy dependents." |
|
2291 |
||
2292 |
^ self shallowCopy postCopy |
|
2293 |
! |
|
2294 |
||
2295 |
deepCopy |
|
2296 |
"return a copy of the object with all subobjects also copied. |
|
4731 | 2297 |
This method DOES handle cycles/self-refs and preserves object identity; |
2298 |
however the receivers class is not copied (to avoid the 'total' copy). |
|
2299 |
||
783 | 2300 |
This deepCopy is a bit slower than the old (unsecure) one, since it |
2301 |
keeps track of already copied objects. If you are sure, that your |
|
1129 | 2302 |
copied object does not include duplicates (or you do not care) and |
4731 | 2303 |
no cycles are involved, you can use the old simpleDeepCopy, |
2304 |
which avoids this overhead (but may run into trouble). |
|
2305 |
Notice, that deepCopy does not copy dependents." |
|
2306 |
||
4799 | 2307 |
^ (self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self |
783 | 2308 |
|
2309 |
"an example which is not handled by the old deepCopy: |
|
2310 |
||
2311 |
|a| |
|
2312 |
a := Array new:3. |
|
2313 |
a at:3 put:a. |
|
2314 |
a deepCopy inspect |
|
2315 |
" |
|
1129 | 2316 |
|
4731 | 2317 |
" |
2318 |
|a| |
|
2319 |
a := Color black onDevice:Screen current. |
|
2320 |
a deepCopy inspect |
|
2321 |
" |
|
2322 |
||
1129 | 2323 |
"Modified: 27.3.1996 / 16:31:20 / stefan" |
783 | 2324 |
! |
2325 |
||
2326 |
deepCopyError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2327 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2328 |
|
783 | 2329 |
"raise a signal, that deepCopy is not allowed for this object" |
2330 |
||
2331 |
^ DeepCopyErrorSignal raise |
|
2332 |
! |
|
2333 |
||
2334 |
deepCopyUsing:aDictionary |
|
2335 |
"a helper for deepCopy; return a copy of the object with |
|
2336 |
all subobjects also copied. If the to-be-copied object is in the dictionary, |
|
2337 |
use the value found there. The class of the receiver is not copied. |
|
2338 |
This method DOES handle cycles/self references." |
|
2339 |
||
2340 |
|myClass aCopy |
|
2341 |
sz "{ Class: SmallInteger }" |
|
2342 |
iOrig iCopy| |
|
2343 |
||
2344 |
myClass := self class. |
|
2345 |
myClass isVariable ifTrue:[ |
|
4731 | 2346 |
sz := self basicSize. |
2347 |
aCopy := myClass basicNew:sz. |
|
783 | 2348 |
] ifFalse:[ |
4731 | 2349 |
sz := 0. |
2350 |
aCopy := myClass basicNew |
|
783 | 2351 |
]. |
2352 |
aCopy setHashFrom:self. |
|
2353 |
||
2354 |
aDictionary at:self put:aCopy. |
|
143 | 2355 |
|
2356 |
" |
|
783 | 2357 |
copy indexed instvars - if any |
2358 |
" |
|
2359 |
sz ~~ 0 ifTrue:[ |
|
4731 | 2360 |
myClass isBits ifTrue:[ |
2361 |
"block-copy indexed instvars" |
|
2362 |
aCopy replaceFrom:1 to:sz with:self startingAt:1 |
|
2363 |
] ifFalse:[ |
|
2364 |
"individual deep copy the indexed variables" |
|
2365 |
1 to:sz do:[:i | |
|
2366 |
iOrig := self basicAt:i. |
|
2367 |
iOrig notNil ifTrue:[ |
|
2368 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
2369 |
iCopy := aDictionary at:iOrig |
|
2370 |
] ifFalse:[ |
|
2371 |
iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy |
|
2372 |
]. |
|
2373 |
aCopy basicAt:i put:iCopy |
|
2374 |
] |
|
2375 |
] |
|
2376 |
] |
|
783 | 2377 |
]. |
2378 |
||
2379 |
" |
|
2380 |
copy the instance variables |
|
2381 |
" |
|
2382 |
sz := myClass instSize. |
|
4731 | 2383 |
1 to:sz do:[:i | |
2384 |
(self skipInstvarIndexInDeepCopy:i) ifFalse:[ |
|
2385 |
iOrig := self instVarAt:i. |
|
2386 |
iOrig notNil ifTrue:[ |
|
2387 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
2388 |
iCopy := aDictionary at:iOrig |
|
2389 |
] ifFalse:[ |
|
2390 |
iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy |
|
2391 |
]. |
|
2392 |
aCopy instVarAt:i put:iCopy |
|
2393 |
] |
|
2394 |
] |
|
783 | 2395 |
]. |
2396 |
^ aCopy |
|
4731 | 2397 |
|
2398 |
" |
|
2399 |
|a b c copyOfC| |
|
2400 |
||
2401 |
a := Array with:'hello' with:'world' with:nil. |
|
2402 |
b := 99 @ 999. |
|
2403 |
a at:3 put:b. |
|
2404 |
c := Array with:a with:b with:a. |
|
2405 |
||
2406 |
Transcript showCR: (c at:1) == (c at:3). |
|
2407 |
copyOfC := c deepCopy. |
|
2408 |
Transcript showCR: (copyOfC at:1) == (copyOfC at:3) |
|
2409 |
" |
|
783 | 2410 |
! |
2411 |
||
2412 |
postCopy |
|
2413 |
"this is for compatibility with ST-80 code, which uses postCopy for |
|
2414 |
cleanup after copying, while ST/X passes the original in postCopyFrom: |
|
2415 |
(see there)" |
|
2416 |
||
2417 |
^ self |
|
2418 |
! |
|
2419 |
||
4731 | 2420 |
postDeepCopy |
2421 |
"allows for cleanup after deep copying" |
|
2422 |
||
2423 |
^ self postCopy |
|
2424 |
! |
|
2425 |
||
4799 | 2426 |
postDeepCopyFrom:aSource |
2427 |
"allows for cleanup after deep copying" |
|
2428 |
||
2429 |
^ self postDeepCopy |
|
2430 |
! |
|
2431 |
||
783 | 2432 |
setHashFrom:anObject |
2433 |
"set my identity-hash key to be the same as anObjects hash key. |
|
2434 |
This is an ST/X speciality, which is NOT available in other (especially OT based) |
|
2435 |
Smalltalks, and may not be available in future ST/X versions. |
|
2436 |
DO NEVER use this for normal application code." |
|
2437 |
||
2438 |
%{ /* NOCONTEXT */ |
|
2439 |
||
2440 |
REGISTER unsigned h; |
|
2441 |
||
2442 |
if (__isNonNilObject(self) && __isNonNilObject(anObject)) { |
|
2443 |
h = __GET_HASH(anObject); |
|
2444 |
__SET_HASH(self, h); |
|
2445 |
RETURN (self); |
|
2446 |
} |
|
2647 | 2447 |
%}. |
783 | 2448 |
self primitiveFailed "neither receiver not arg may be nil or SmallInteger" |
2449 |
! |
|
2450 |
||
2451 |
shallowCopy |
|
2452 |
"return a copy of the object with shared subobjects (a shallow copy) |
|
2453 |
i.e. the copy shares referenced instvars with its original." |
|
2454 |
||
2647 | 2455 |
%{ /* NOCONTEXT */ |
2456 |
int ninsts, spc; |
|
2457 |
int sz; |
|
3066 | 2458 |
OBJ theCopy; |
2647 | 2459 |
OBJ cls; |
2460 |
int flags; |
|
2461 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2462 |
cls = __qClass(self); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2463 |
flags = __intVal(__ClassInstPtr(cls)->c_flags); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2464 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2465 |
/* |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2466 |
* bail out for special objects .. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2467 |
*/ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2468 |
if (((flags & ~ARRAYMASK) == 0) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2469 |
&& ((flags & ARRAYMASK) != WKPOINTERARRAY)) { |
2652 | 2470 |
sz = __qSize(self); |
3078 | 2471 |
__PROTECT__(self); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2472 |
__qNew(theCopy, sz); /* OBJECT ALLOCATION */ |
3078 | 2473 |
__UNPROTECT__(self); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2474 |
if (theCopy) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2475 |
cls = __qClass(self); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2476 |
spc = __qSpace(theCopy); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2477 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2478 |
theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2479 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2480 |
sz = sz - OHDR_SIZE; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2481 |
if (sz) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2482 |
char *src, *dst; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2483 |
|
3066 | 2484 |
src = (char *)(__InstPtr(self)->i_instvars); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2485 |
dst = (char *)(__InstPtr(theCopy)->i_instvars); |
2647 | 2486 |
#ifdef bcopy4 |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2487 |
{ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2488 |
/* care for odd-number of longs */ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2489 |
int nW = sz >> 2; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2490 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2491 |
if (sz & 3) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2492 |
nW++; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2493 |
} |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2494 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2495 |
bcopy4(src, dst, nW); |
2647 | 2496 |
} |
2497 |
#else |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2498 |
bcopy(src, dst, sz); |
2647 | 2499 |
#endif |
2500 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2501 |
flags &= ARRAYMASK; |
2652 | 2502 |
if (flags == POINTERARRAY) { |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2503 |
ninsts = __BYTES2OBJS__(sz); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2504 |
} else { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2505 |
ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2506 |
} |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2507 |
if (ninsts) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2508 |
do { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2509 |
OBJ el; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2510 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2511 |
el = __InstPtr(theCopy)->i_instvars[ninsts-1]; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2512 |
__STORE_SPC(theCopy, el, spc); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2513 |
} while (--ninsts); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2514 |
} |
2647 | 2515 |
} |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2516 |
RETURN (theCopy); |
2647 | 2517 |
} |
2518 |
} |
|
2519 |
%}. |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2520 |
"/ fallBack for special objects & memoryAllocation failure case |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2521 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2522 |
^ self slowShallowCopy |
783 | 2523 |
! |
2524 |
||
2525 |
shallowCopyForFinalization |
|
2526 |
"this is used to aquire a copy to be used for finalization - |
|
2527 |
(the copy will get a dispose-notification; see the documentation in the Registry class) |
|
2528 |
This method can be redefined for more efficient copying - especially for large objects." |
|
2529 |
||
4574
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
2530 |
"/ going to be obsoleted by executor |
783 | 2531 |
^ self shallowCopy |
4574
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
2532 |
|
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
2533 |
"Modified: / 5.8.1999 / 14:07:16 / cg" |
783 | 2534 |
! |
2535 |
||
2536 |
simpleDeepCopy |
|
2537 |
"return a copy of the object with all subobjects also copied. |
|
2538 |
This method does NOT handle cycles - but is included to allow this |
|
2539 |
slightly faster copy in situations where it is known that |
|
2540 |
no recursive references occur (LargeIntegers for example). |
|
2541 |
NOTICE: you will run into trouble, when trying this with recursive |
|
2542 |
objects (usually recursionInterrupt or memory-alert). |
|
2543 |
This method corresponds to the 'traditional' deepCopy found in |
|
2544 |
the Blue book." |
|
2545 |
||
4731 | 2546 |
|myClass aCopy| |
2547 |
||
2548 |
(myClass := self class) isVariable ifTrue:[ |
|
2549 |
aCopy := myClass basicNew:(self basicSize). |
|
783 | 2550 |
] ifFalse:[ |
4731 | 2551 |
aCopy := myClass basicNew |
783 | 2552 |
]. |
2553 |
||
2554 |
"copy the instance variables" |
|
4731 | 2555 |
aCopy cloneFrom:self performing:#simpleDeepCopy. |
783 | 2556 |
^ aCopy |
2557 |
||
2558 |
"a bad example (but ST/X should survive ...)" |
|
2559 |
" |
|
2560 |
|a| |
|
2561 |
a := Array new:3. |
|
2562 |
a at:3 put:a. |
|
2563 |
a simpleDeepCopy |
|
2564 |
" |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2565 |
! |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2566 |
|
4731 | 2567 |
skipInstvarIndexInDeepCopy:index |
2568 |
"a helper for deepCopy; only indices for which this method returns |
|
2569 |
false are copied in a deep copy. |
|
2570 |
The default is false here - which means that everything is copied. |
|
2571 |
Can be redefined in subclasses for partial copies" |
|
2572 |
||
2573 |
^ false |
|
2574 |
! |
|
2575 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2576 |
slowShallowCopy |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2577 |
"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
|
2578 |
i.e. the copy shares referenced instvars with its original. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2579 |
This method is only invoked as a fallback from #shallowCopy." |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2580 |
|
4731 | 2581 |
|myClass aCopy| |
2582 |
||
2583 |
(myClass := self class) isVariable ifTrue:[ |
|
2584 |
aCopy := myClass basicNew:(self basicSize). |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2585 |
] ifFalse:[ |
4731 | 2586 |
aCopy := myClass basicNew |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2587 |
]. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2588 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2589 |
"copy the instance variables" |
4731 | 2590 |
aCopy cloneFrom:self performing:#yourself. |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2591 |
^ aCopy |
783 | 2592 |
! ! |
2593 |
||
2594 |
!Object methodsFor:'debugging'! |
|
2595 |
||
2596 |
basicInspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2597 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2598 |
|
783 | 2599 |
"launch an inspector on the receiver. |
2600 |
this method should NOT be redefined in subclasses." |
|
2601 |
||
2602 |
Inspector isNil ifTrue:[ |
|
2647 | 2603 |
" |
2604 |
for systems without GUI |
|
2605 |
" |
|
2606 |
Transcript showCR:'no Inspector' |
|
783 | 2607 |
] ifFalse:[ |
2647 | 2608 |
Inspector openOn:self |
783 | 2609 |
] |
1417 | 2610 |
|
2611 |
"Modified: 18.5.1996 / 15:43:25 / cg" |
|
783 | 2612 |
! |
2613 |
||
2614 |
inspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2615 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2616 |
|
783 | 2617 |
"launch an inspector on the receiver. |
2618 |
this method (or better: inspectorClass) can be redefined in subclasses |
|
2619 |
to start special inspectors." |
|
2620 |
||
2621 |
|cls| |
|
2622 |
||
2623 |
cls := self inspectorClass. |
|
2624 |
cls isNil ifTrue:[ |
|
2625 |
^ self basicInspect |
|
2626 |
]. |
|
2627 |
cls openOn:self |
|
2628 |
||
2629 |
" |
|
2630 |
Object new inspect |
|
2631 |
(1 @ 2) inspect |
|
2632 |
Smalltalk inspect |
|
2633 |
#(1 2 3) asOrderedCollection inspect |
|
2634 |
(Color red) inspect |
|
2635 |
(Image fromFile:'bitmaps/garfield.gif') inspect |
|
143 | 2636 |
" |
71 | 2637 |
! |
2638 |
||
783 | 2639 |
inspectorClass |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2640 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2641 |
|
783 | 2642 |
"return the class to use for inspect. |
2643 |
Can (should) be redefined in classes for which a better inspector is available" |
|
2644 |
||
2645 |
^ Inspector |
|
2646 |
! |
|
2647 |
||
4600 | 2648 |
mustBeBoolean |
2649 |
"this message is sent by the VM, if a non-Boolean receiver is encountered |
|
2650 |
in an if* or while* message. |
|
2651 |
Caveat: for now, this is only sent by the interpreter; |
|
2652 |
both the JIT and the stc compiler treat it as undefined." |
|
2653 |
||
2654 |
self error:'Non boolean receiver - proceed for truth' mayProceed:true. |
|
2655 |
^ true |
|
2656 |
! |
|
2657 |
||
783 | 2658 |
mustBeKindOf:aClass |
2659 |
"for compatibility & debugging support: |
|
2660 |
check if the receiver isKindOf:aClass and raise an error if not. |
|
2661 |
Notice: |
|
2662 |
it is VERY questionable, if it makes sense to add manual |
|
2663 |
type checks to a dynamically typed language like smalltalk. |
|
2664 |
It will, at least, slow down performance, |
|
2665 |
make your code less reusable and clutter your code with stupid sends |
|
2666 |
of this selector. Also, read the comment in isKindOf:, regarding the |
|
2667 |
use of isXXX check methods. |
|
2668 |
You see: The author does not like this at all ..." |
|
2669 |
||
2670 |
(self isKindOf:aClass) ifFalse:[ |
|
2671 |
self error:'argument is not of expected type' |
|
2672 |
] |
|
2673 |
! |
|
2674 |
||
2675 |
obsoleteMethodWarning |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2676 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2677 |
|
783 | 2678 |
"in methods which are going to be obsoleted, a self send to |
2679 |
this method is used to tell programmers that a method is |
|
2680 |
used which is going to be removed in later ST/X versions. |
|
2681 |
Find all methods which will be obsolete soon by looking at senders |
|
2682 |
of this message. |
|
2683 |
Hopefully, this warning message is annoying enough for you to |
|
2684 |
change the code ... ;-)" |
|
2685 |
||
2686 |
self obsoleteMethodWarning:nil from:thisContext sender |
|
2687 |
! |
|
2688 |
||
2689 |
obsoleteMethodWarning:message |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2690 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2691 |
|
783 | 2692 |
"in methods which are going to be obsoleted, a self send to |
2693 |
this method is used to tell programmers that a method is |
|
2694 |
used which is going to be removed in later ST/X versions. |
|
2695 |
Find all methods which will be obsolete soon by looking at senders |
|
2696 |
of this message. |
|
2697 |
Hopefully, this warning message is annoying enough for you to |
|
2698 |
change the code ... ;-)" |
|
2699 |
||
2700 |
self obsoleteMethodWarning:message from:thisContext sender |
|
2701 |
! |
|
2702 |
||
2703 |
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
|
2704 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2705 |
|
783 | 2706 |
"in methods which are going to be obsoleted, a self-send to |
2707 |
this method is used to tell programmers that a method is |
|
2708 |
used which is going to be removed in later ST/X versions. |
|
2709 |
Find all methods which will be obsolete soon by looking at senders |
|
2710 |
of this message. |
|
2711 |
Hopefully, this warning message is annoying enough for you to |
|
2712 |
change the code ... ;-)" |
|
2713 |
||
2714 |
|spec| |
|
2715 |
||
2716 |
spec := aContext methodPrintString. |
|
2136 | 2717 |
('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR. |
2718 |
(' And may not be present in future ST/X versions.') errorPrintCR. |
|
2719 |
(' called from ' , aContext sender printString) errorPrintCR. |
|
783 | 2720 |
message notNil ifTrue:[ |
2647 | 2721 |
'------> ' errorPrint. message errorPrintCR |
783 | 2722 |
] |
2723 |
||
2724 |
" |
|
2725 |
Object obsoleteMethodWarning:'foo' from:thisContext sender sender |
|
2726 |
" |
|
2136 | 2727 |
|
2728 |
"Modified: 10.1.1997 / 19:08:42 / cg" |
|
783 | 2729 |
! ! |
2730 |
||
2731 |
!Object methodsFor:'dependents access'! |
|
2732 |
||
2733 |
addDependent:anObject |
|
2734 |
"make the argument, anObject be a dependent of the receiver" |
|
2735 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2736 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2737 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2738 |
"/ 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
|
2739 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2740 |
"/ 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
|
2741 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2742 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2743 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2744 |
[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2745 |
|deps dep| |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2746 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2747 |
deps := self dependents. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2748 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2749 |
"/ 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
|
2750 |
"/ many dependencies, we store a single dependent in |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2751 |
"/ 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
|
2752 |
"/ added. |
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 |
(deps isNil or:[deps size == 0]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2755 |
self dependents:(WeakArray with:anObject) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2756 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2757 |
deps class == WeakArray ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2758 |
dep := deps at:1. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2759 |
dep ~~ anObject ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2760 |
(dep isNil or:[dep == 0]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2761 |
deps at:1 put:anObject |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2762 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2763 |
self dependents:(WeakIdentitySet with:dep with:anObject) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2764 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2765 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2766 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2767 |
deps add:anObject |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2768 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2769 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2770 |
] valueNowOrOnUnwindDo:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2771 |
wasBlocked ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2772 |
OperatingSystem unblockInterrupts |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2773 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2774 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2775 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2776 |
"Modified: / 27.10.1997 / 19:35:52 / cg" |
783 | 2777 |
! |
2778 |
||
3309
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2779 |
breakDependents |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2780 |
"remove all dependencies from the receiver" |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2781 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2782 |
self dependents:nil. |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2783 |
self nonWeakDependents:nil |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2784 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2785 |
"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
|
2786 |
"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
|
2787 |
! |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2788 |
|
783 | 2789 |
dependents |
3222 | 2790 |
"return a Collection of dependents. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2791 |
The default implementation here uses a global WeakDictionary to store |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2792 |
dependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2793 |
This may be too slow for high frequency change&update, |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2794 |
therefore, some classes (Model) redefine this for better performance. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2795 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
783 | 2796 |
|
3222 | 2797 |
|deps| |
2798 |
||
2799 |
(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
|
2800 |
^ #(). |
3222 | 2801 |
]. |
2802 |
^ deps |
|
2803 |
||
2804 |
"Modified: / 26.1.1998 / 11:18:15 / cg" |
|
783 | 2805 |
! |
2806 |
||
2807 |
dependents:aCollection |
|
2808 |
"set the collection of dependents. |
|
2809 |
The default implementation here uses a global Dictionary to store |
|
2810 |
dependents which may be too slow for high frequency change&update. |
|
2811 |
Therefore, some classes (Model) redefine this for better performance." |
|
2812 |
||
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2813 |
"/ 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
|
2814 |
"/ 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
|
2815 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
2336 | 2816 |
"/ faster execution (and to avoid creation of garbage blocks). |
2817 |
||
2818 |
(OperatingSystem blockInterrupts) ifTrue:[ |
|
2647 | 2819 |
"/ the common case - already blocked |
2820 |
||
2821 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
|
2822 |
Dependencies removeKey:self ifAbsent:[] |
|
2823 |
] ifFalse:[ |
|
2824 |
Dependencies at:self put:aCollection |
|
2825 |
]. |
|
2826 |
^ self |
|
2336 | 2827 |
]. |
2828 |
||
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2829 |
[ |
2647 | 2830 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
2831 |
Dependencies removeKey:self ifAbsent:[] |
|
2832 |
] ifFalse:[ |
|
2833 |
Dependencies at:self put:aCollection |
|
2834 |
]. |
|
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2835 |
] valueNowOrOnUnwindDo:[ |
2647 | 2836 |
OperatingSystem unblockInterrupts |
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2837 |
] |
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2838 |
|
2336 | 2839 |
"Modified: 30.1.1997 / 21:22:10 / cg" |
783 | 2840 |
! |
2841 |
||
2842 |
dependentsDo:aBlock |
|
2843 |
"evaluate aBlock for all of my dependents" |
|
2844 |
||
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2845 |
|deps nwDeps| |
783 | 2846 |
|
2847 |
deps := self dependents. |
|
3222 | 2848 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2849 |
deps do:[:d | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2850 |
(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
|
2851 |
aBlock value:d |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2852 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2853 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2854 |
]. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2855 |
nwDeps := self nonWeakDependents. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2856 |
(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
|
2857 |
nwDeps do:aBlock |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2858 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2859 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2860 |
"Modified: / 30.1.1998 / 14:03:40 / cg" |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2861 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2862 |
|
2445 | 2863 |
myDependents |
2864 |
"same as dependents - ST-80 compatibility" |
|
2865 |
||
2866 |
^ self dependents |
|
2867 |
! |
|
2868 |
||
783 | 2869 |
release |
3309
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2870 |
"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
|
2871 |
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
|
2872 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2873 |
self breakDependents |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2874 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2875 |
"Modified: / 27.2.1998 / 11:29:35 / stefan" |
783 | 2876 |
! |
2877 |
||
2878 |
removeDependent:anObject |
|
2879 |
"make the argument, anObject be independent of the receiver" |
|
2880 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2881 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2882 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2883 |
"/ 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
|
2884 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2885 |
"/ 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
|
2886 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2887 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2888 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2889 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2890 |
|deps n d| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2891 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2892 |
deps := self dependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2893 |
deps size ~~ 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2894 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2895 |
"/ 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
|
2896 |
"/ 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
|
2897 |
"/ 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
|
2898 |
"/ 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
|
2899 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2900 |
deps class == WeakArray ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2901 |
((d := deps at:1) == anObject |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2902 |
or:[d isNil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2903 |
or:[d == 0]]) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2904 |
self dependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2905 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2906 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2907 |
deps remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2908 |
(n := deps size) == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2909 |
self dependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2910 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2911 |
n == 1 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2912 |
d := deps firstIfEmpty:nil. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2913 |
d notNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2914 |
deps := WeakArray with:d |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2915 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2916 |
deps := nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2917 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2918 |
self dependents:deps. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2919 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2920 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2921 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2922 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2923 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2924 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2925 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2926 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2927 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2928 |
|
3228
b6b893e8f898
must look for size of value returned by self dependents
Claus Gittinger <cg@exept.de>
parents:
3222
diff
changeset
|
2929 |
"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
|
2930 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2931 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2932 |
!Object methodsFor:'dependents access (nonWeak)'! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2933 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2934 |
addNonWeakDependent:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2935 |
"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
|
2936 |
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
|
2937 |
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
|
2938 |
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
|
2939 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2940 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2941 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2942 |
"/ 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
|
2943 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2944 |
"/ 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
|
2945 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2946 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2947 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2948 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2949 |
|deps dep| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2950 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2951 |
deps := self nonWeakDependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2952 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2953 |
"/ 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
|
2954 |
"/ 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
|
2955 |
"/ 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
|
2956 |
"/ added. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2957 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2958 |
deps size == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2959 |
self nonWeakDependents:(Array with:anObject) |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2960 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2961 |
deps class == Array ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2962 |
dep := deps at:1. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2963 |
dep ~~ anObject ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2964 |
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
|
2965 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2966 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2967 |
deps add:anObject |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2968 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2969 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2970 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2971 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2972 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2973 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2974 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2975 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2976 |
"Created: / 19.4.1996 / 10:54:08 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2977 |
"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
|
2978 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2979 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2980 |
nonWeakDependents |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2981 |
"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
|
2982 |
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
|
2983 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2984 |
NonWeakDependencies isNil ifTrue:[^ #()]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2985 |
^ NonWeakDependencies at:self ifAbsent:#() |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2986 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2987 |
"Created: / 19.4.1996 / 10:55:06 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2988 |
"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
|
2989 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2990 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2991 |
nonWeakDependents:aCollection |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2992 |
"set the collection of nonWeak dependents. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2993 |
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
|
2994 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2995 |
[ |
2647 | 2996 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
2997 |
NonWeakDependencies removeKey:self ifAbsent:[] |
|
2998 |
] ifFalse:[ |
|
2999 |
NonWeakDependencies at:self put:aCollection |
|
3000 |
] |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3001 |
] valueUninterruptably |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3002 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3003 |
"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
|
3004 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3005 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3006 |
removeNonWeakDependent:anObject |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3007 |
"remove a nonWeak dependency from the receiver to the argument, anObject. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3008 |
(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
|
3009 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3010 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3011 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3012 |
"/ 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
|
3013 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3014 |
"/ 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
|
3015 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3016 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3017 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3018 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3019 |
|deps n| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3020 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3021 |
deps := self nonWeakDependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3022 |
deps size ~~ 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3023 |
deps class == Array ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3024 |
(deps at:1) == anObject ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3025 |
self nonWeakDependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3026 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3027 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3028 |
deps remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3029 |
(n := deps size) == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3030 |
self nonWeakDependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3031 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3032 |
n == 1 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3033 |
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
|
3034 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3035 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3036 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3037 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3038 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3039 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3040 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3041 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3042 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3043 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3044 |
"Created: / 19.4.1996 / 11:44:44 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3045 |
"Modified: / 30.1.1998 / 14:04:01 / cg" |
783 | 3046 |
! ! |
3047 |
||
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3048 |
!Object methodsFor:'displaying'! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3049 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3050 |
displayOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3051 |
"ST-80 Compatibility |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3052 |
display the receiver in a graphicsContext at 0@0 |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3053 |
- this method allows for any object to be displayed in some view |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3054 |
(although the fallBack is to display its printString ...)" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3055 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3056 |
^ self displayOn:aGC x:0 y:0. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3057 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3058 |
"Created: 29.5.1996 / 16:28:58 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3059 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3060 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3061 |
displayOn:aGC at:aPoint |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3062 |
"ST-80 Compatibility |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3063 |
display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3064 |
for any object to be displayed in a ListView - for example." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3065 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3066 |
^ self displayOn:aGC x:(aPoint x) y:(aPoint y). |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3067 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3068 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3069 |
displayOn:aGC x:x y:y |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3070 |
"display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3071 |
for any object to be displayed in a ListView - for example." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3072 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3073 |
self displayOn:aGC x:x y:y opaque:false |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3074 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3075 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3076 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3077 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3078 |
displayOn:aGc x:x y:y opaque:opaque |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3079 |
"display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3080 |
for any object to be displayed in a ListView - for example. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3081 |
The fallBack here shows the receivers displayString." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3082 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3083 |
|s| |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3084 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3085 |
s := self displayString. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3086 |
opaque ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3087 |
aGc displayOpaqueString:s x:x y:y. |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3088 |
] ifFalse:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3089 |
aGc displayString:s x:x y:y. |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3090 |
]. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3091 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3092 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3093 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3094 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3095 |
displayOpaqueOn:aGC x:x y:y |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3096 |
"display the receiver in a graphicsContext - this method allows |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3097 |
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
|
3098 |
|
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3099 |
self displayOn:aGC x:x y:y opaque:true |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3100 |
|
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3101 |
"Modified: / 29.5.1996 / 16:29:38 / cg" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3102 |
"Created: / 26.10.1997 / 15:01:36 / cg" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3103 |
! |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3104 |
|
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3105 |
displayString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3106 |
"return a string used when displaying the receiver in a view; |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3107 |
for example an Inspector. This is usually the same as printString, |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3108 |
but sometimes redefined for a better look." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3109 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3110 |
^ self printString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3111 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3112 |
" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3113 |
#(1 2 3) printString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3114 |
#(1 2 3) displayString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3115 |
#(1 2 3) storeString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3116 |
" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3117 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3118 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3119 |
heightOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3120 |
"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
|
3121 |
|
4603 | 3122 |
^ (aGC font onDevice:aGC device) heightOf:(self displayString) |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3123 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3124 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3125 |
widthOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3126 |
"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
|
3127 |
|
4603 | 3128 |
^ (aGC font onDevice:aGC device) widthOf:(self displayString) |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3129 |
! ! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3130 |
|
4808 | 3131 |
!Object methodsFor:'encoding & decoding'! |
3132 |
||
3133 |
decodeAsLiteralArray |
|
3134 |
^ self |
|
3135 |
! |
|
3136 |
||
3137 |
fromLiteralArrayEncoding:aSpecArray |
|
3138 |
"read my attributes from aSpecArray |
|
3139 |
" |
|
3140 |
|sel val |
|
3141 |
stop "{ Class:SmallInteger }" | |
|
3142 |
||
3143 |
stop := aSpecArray size. |
|
3144 |
||
3145 |
2 to:stop by:2 do:[:i| |
|
3146 |
sel := aSpecArray at:i. |
|
3147 |
val := aSpecArray at:i + 1. |
|
3148 |
||
3149 |
(self respondsTo:sel) ifTrue:[ |
|
3150 |
self perform:sel with:(val decodeAsLiteralArray) |
|
3151 |
] ifFalse:[ |
|
3152 |
Transcript show:self class name; show:': unhandled literalArrayEncoding attribute: '. |
|
3153 |
Transcript showCR:sel. |
|
3154 |
] |
|
3155 |
] |
|
3156 |
||
3157 |
||
3158 |
! |
|
3159 |
||
3160 |
literalArrayEncoding |
|
3161 |
"generate a literalArrayEncoding array for myself. |
|
3162 |
This uses #literalArrayEncodingSlotOrder which defines the slots and |
|
3163 |
order and #skippedInLiteralEncoding which defines slots to skip. |
|
3164 |
For most subclasses, there is no need to redefine those." |
|
3165 |
||
3166 |
|names encoding cls skipped| |
|
3167 |
||
3168 |
self isLiteral ifTrue:[ |
|
3169 |
^ self |
|
3170 |
]. |
|
3171 |
||
3172 |
skipped := self skippedInLiteralEncoding. |
|
3173 |
cls := self class. |
|
3174 |
names := cls allInstVarNames. |
|
3175 |
encoding := OrderedCollection with:(cls name). |
|
3176 |
||
3177 |
(self literalArrayEncodingSlotOrder) do:[:instSlot | |
|
3178 |
|value nm| |
|
3179 |
||
3180 |
nm := names at:instSlot. |
|
3181 |
||
3182 |
(skipped includes:nm) ifFalse:[ |
|
3183 |
(value := self instVarAt:instSlot) notNil ifTrue:[ |
|
3184 |
encoding add:(nm , ':') asSymbol. |
|
3185 |
encoding add:value literalArrayEncoding |
|
3186 |
] |
|
3187 |
] |
|
3188 |
]. |
|
3189 |
^ encoding asArray |
|
3190 |
||
3191 |
||
3192 |
! |
|
3193 |
||
3194 |
literalArrayEncodingSlotOrder |
|
3195 |
"define the order in which inst-slots are saved when generating |
|
3196 |
a literalArrayEncoding |
|
3197 |
" |
|
3198 |
^ 1 to:self class instSize |
|
3199 |
||
3200 |
! |
|
3201 |
||
3202 |
skippedInLiteralEncoding |
|
3203 |
"return a Collection with it's elements are slots for skipping |
|
3204 |
" |
|
3205 |
^ #() |
|
3206 |
||
3207 |
! ! |
|
3208 |
||
783 | 3209 |
!Object methodsFor:'error handling'! |
3210 |
||
3211 |
appropriateDebugger:aSelector |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3212 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3213 |
|
783 | 3214 |
"return an appropriate debugger to use. |
3215 |
If there is already a debugger active on the stack, and it is |
|
3216 |
the DebugView, return MiniDebugger (as a last chance) otherwise abort." |
|
3217 |
||
3218 |
|context| |
|
3219 |
||
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
3220 |
"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
|
3221 |
|
1685 | 3222 |
(Processor isNil |
4208 | 3223 |
or:[Processor activeProcessIsSystemProcess |
3224 |
or:[Smalltalk isInitialized not]]) ifTrue:[ |
|
3225 |
^ MiniDebugger |
|
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
3226 |
]. |
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
3227 |
|
783 | 3228 |
context := thisContext. |
2893 | 3229 |
context := context findNextContextWithSelector:aSelector or:nil or:nil. |
783 | 3230 |
[context notNil] whileTrue:[ |
4208 | 3231 |
((context receiver class == Debugger) |
3232 |
and:[context selector == aSelector]) ifTrue:[ |
|
3233 |
"we are already in some Debugger" |
|
3234 |
(Debugger == MiniDebugger) ifTrue:[ |
|
3235 |
"we are already in the MiniDebugger" |
|
3236 |
ErrorRecursion ifFalse:[ |
|
3237 |
Smalltalk fatalAbort:'recursive error ...' |
|
3238 |
] |
|
3239 |
]. |
|
3240 |
MiniDebugger isNil ifTrue:[ |
|
3241 |
Smalltalk fatalAbort:'no debugger' |
|
3242 |
]. |
|
3243 |
||
3244 |
"ok, an error occured while in the graphical debugger; |
|
3245 |
lets try MiniDebugger" |
|
3246 |
^ MiniDebugger |
|
3247 |
]. |
|
3248 |
context := context findNextContextWithSelector:aSelector or:nil or:nil. |
|
71 | 3249 |
]. |
783 | 3250 |
"not within Debugger - no problem" |
3251 |
^ Debugger |
|
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
3252 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3253 |
"Modified: / 23.9.1996 / 12:14:52 / stefan" |
4208 | 3254 |
"Modified: / 19.5.1999 / 18:05:00 / cg" |
783 | 3255 |
! |
3256 |
||
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3257 |
cannotSendMessage:aMessage to:someReceiver |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3258 |
"this message is sent by the runtime system (VM), |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3259 |
when a message is sent to some object, whose class is not |
2231 | 3260 |
a valid behavior (see documentation in Behavior)." |
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3261 |
|
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3262 |
^ InternalErrorSignal |
4469
8719f53c8151
dont raise nonProceedable InternalErrorSignal proceedable.
Claus Gittinger <cg@exept.de>
parents:
4452
diff
changeset
|
3263 |
raiseWith:someReceiver |
8719f53c8151
dont raise nonProceedable InternalErrorSignal proceedable.
Claus Gittinger <cg@exept.de>
parents:
4452
diff
changeset
|
3264 |
errorString:('bad class in send of #' , aMessage selector) |
2231 | 3265 |
|
3266 |
"Modified: 23.1.1997 / 00:05:39 / cg" |
|
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3267 |
! |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3268 |
|
783 | 3269 |
doesNotUnderstand:aMessage |
3270 |
"this message is sent by the runtime system (VM) when |
|
3271 |
a message is not understood by some object (i.e. there |
|
3272 |
is no method for that selector). The original message has |
|
3273 |
been packed into aMessage (i.e. the receiver, selector and |
|
3274 |
any arguments) and the original receiver is then sent the |
|
3275 |
#doesNotUnderstand: message. |
|
3276 |
Here, we raise another signal which usually enters the debugger. |
|
3277 |
You can of course redefine #doesNotUnderstand: in your classes |
|
1327 | 3278 |
to implement message delegation, |
3279 |
or handle the MessageNotUnderstoodSignal gracefully." |
|
783 | 3280 |
|
4558 | 3281 |
<context: #return> |
3282 |
||
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3283 |
|sel selStr errorString cls sender| |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3284 |
|
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3285 |
sel := aMessage selector. |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3286 |
selStr := sel printString. |
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3287 |
|
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3288 |
"/ Although sel should always be a symbol, |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3289 |
"/ always use printStrings in the code below. |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3290 |
"/ 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
|
3291 |
"/ 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
|
3292 |
|
783 | 3293 |
"/ handle the case of an error during early startup |
3294 |
"/ (output streams not yet initialized) |
|
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3295 |
|
783 | 3296 |
Stdout isNil ifTrue:[ |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3297 |
Smalltalk fatalAbort:'error during init: ' , selStr , ' not understood'. |
783 | 3298 |
]. |
3299 |
||
3300 |
"/ |
|
3301 |
"/ extract the class that should have implemented the message. |
|
3302 |
"/ (in case of a super-send, this is not the receivers class) |
|
3303 |
"/ |
|
4558 | 3304 |
cls := thisContext sender searchClass. |
783 | 3305 |
cls isNil ifTrue:[ |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3306 |
"it was NOT a super or directed send ..." |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3307 |
cls := self class |
783 | 3308 |
]. |
3309 |
||
3310 |
cls notNil ifTrue:[ |
|
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3311 |
"/ |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3312 |
"/ displayString is better than 'cls name', |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3313 |
"/ since it appends (obsolete) for outdated classes. |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3314 |
"/ (this happens if you send messages to old instances |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3315 |
"/ after changing a classes definition) |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3316 |
"/ |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3317 |
errorString := cls displayString. |
783 | 3318 |
] ifFalse:[ |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3319 |
errorString := '(** nil-class **)' |
783 | 3320 |
]. |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3321 |
sel class ~~ Symbol ifTrue:[ |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3322 |
errorString := errorString , ' nonSymbol selector: ' , selStr , ' not understood'. |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3323 |
] ifFalse:[ |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3324 |
errorString := errorString , ' does not understand: ' , selStr. |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3325 |
]. |
783 | 3326 |
|
3327 |
"/ |
|
3328 |
"/ this only happens, when YOU play around with my classvars ... |
|
1327 | 3329 |
"/ (or an error occurs during very early startup, when signals are not yet set) |
783 | 3330 |
"/ |
3331 |
MessageNotUnderstoodSignal isNil ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3332 |
^ MiniDebugger |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3333 |
enterWithMessage:'oops - MessageNotUnderstoodSignal is gone (nil)' |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3334 |
mayProceed:true. |
783 | 3335 |
]. |
3336 |
||
3337 |
"/ |
|
3338 |
"/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger |
|
3339 |
"/ |
|
3340 |
^ MessageNotUnderstoodSignal |
|
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3341 |
raiseRequestWith:aMessage |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3342 |
errorString:errorString |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3343 |
|
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3344 |
"Modified: / 9.6.1999 / 17:46:17 / cg" |
783 | 3345 |
! |
3346 |
||
3347 |
elementBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3348 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3349 |
|
1345 | 3350 |
"report an error that badElement is out of bounds |
3351 |
(i.e. cannot be put into that collection). |
|
3352 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3353 |
|
4558 | 3354 |
^ ElementOutOfBoundsSignal raise |
1345 | 3355 |
|
3356 |
"Modified: 8.5.1996 / 09:12:45 / cg" |
|
783 | 3357 |
! |
3358 |
||
3359 |
elementNotCharacter |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3360 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3361 |
|
1345 | 3362 |
"report an error that object to be stored is no Character. |
3363 |
(usually when storing into Strings). |
|
3364 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3365 |
|
4558 | 3366 |
^ ElementOutOfBoundsSignal raise |
1345 | 3367 |
|
3368 |
"Modified: 8.5.1996 / 09:12:49 / cg" |
|
783 | 3369 |
! |
3370 |
||
3371 |
elementNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3372 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3373 |
|
1345 | 3374 |
"report an error that object to be stored is not Integer. |
3375 |
(in collections that store integers only). |
|
3376 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3377 |
|
4558 | 3378 |
^ ElementOutOfBoundsSignal raise |
1345 | 3379 |
|
3380 |
"Modified: 8.5.1996 / 09:12:51 / cg" |
|
783 | 3381 |
! |
3382 |
||
3383 |
error |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3384 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3385 |
|
4558 | 3386 |
<context: #return> |
3387 |
||
1345 | 3388 |
"report error that an error occured. |
4558 | 3389 |
The error is reported by raising the Error exception, |
3390 |
which is non-proceedable. |
|
3391 |
If no handler has been setup, a debugger is entered." |
|
3392 |
||
3393 |
Error raiseWith:#error: |
|
3394 |
||
3395 |
" |
|
3396 |
nil error |
|
4529 | 3397 |
" |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3398 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3399 |
"Modified: / 8.5.1996 / 09:13:01 / cg" |
4499
251d4c698581
Send #halt resp. #error as signal parameter in these methods.
Stefan Vogel <sv@exept.de>
parents:
4469
diff
changeset
|
3400 |
"Modified: / 2.8.1999 / 17:00:19 / stefan" |
783 | 3401 |
! |
3402 |
||
3403 |
error:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3404 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3405 |
|
4558 | 3406 |
<context: #return> |
3407 |
||
3408 |
"Raise an error with error message aString. |
|
3409 |
The error is reported by raising the Error exception, |
|
3410 |
which is non-proceedable. |
|
3411 |
If no handler has been setup, a debugger is entered." |
|
3412 |
||
3413 |
Error raiseWith:#error: errorString:aString |
|
4529 | 3414 |
|
3415 |
" |
|
3416 |
nil error:' bad bad bad' |
|
3417 |
" |
|
1345 | 3418 |
|
3419 |
"Modified: 8.5.1996 / 09:13:04 / cg" |
|
3420 |
! |
|
3421 |
||
4529 | 3422 |
error:aString mayProceed:mayProceed |
3423 |
"{ Pragma: +optSpace }" |
|
3424 |
||
1345 | 3425 |
"enter debugger with error-message aString. |
4558 | 3426 |
The error is reported by raising either the |
3427 |
non-proceedable Error exception, |
|
3428 |
or the ProceedableError exception." |
|
1345 | 3429 |
|
4529 | 3430 |
mayProceed ifTrue:[ |
4558 | 3431 |
^ ProceedableError raiseRequestWith:#error: errorString:aString |
4529 | 3432 |
]. |
3433 |
||
4558 | 3434 |
Error raiseWith:#error: errorString:aString |
4529 | 3435 |
|
3436 |
"Modified: 8.5.1996 / 09:13:04 / cg" |
|
783 | 3437 |
! |
3438 |
||
3439 |
errorKeyNotFound:aKey |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3440 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3441 |
|
1345 | 3442 |
"report an error that a key was not found in a collection. |
3443 |
The error is reported by raising the KeyNotFoundSignal exception." |
|
783 | 3444 |
|
4558 | 3445 |
^ KeyNotFoundSignal raiseRequestWith:aKey |
3446 |
||
3447 |
" |
|
3448 |
#(1 2) at:3 |
|
3449 |
" |
|
783 | 3450 |
! |
3451 |
||
3452 |
errorNotFound |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3453 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3454 |
|
1345 | 3455 |
"report an error that no element was found in a collection. |
3456 |
The error is reported by raising the NotFoundSignal exception." |
|
783 | 3457 |
|
4558 | 3458 |
^ NotFoundSignal raiseRequestWith:nil |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3459 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3460 |
"Modified: / 8.5.1996 / 09:13:11 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3461 |
"Modified: / 26.7.1999 / 10:51:50 / stefan" |
783 | 3462 |
! |
3463 |
||
3622 | 3464 |
errorSignal |
3465 |
^ self class errorSignal |
|
3466 |
||
3467 |
"Created: / 19.6.1998 / 02:32:32 / cg" |
|
3468 |
! |
|
3469 |
||
783 | 3470 |
halt |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3471 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3472 |
|
1345 | 3473 |
"enter debugger with halt-message. |
3474 |
The error is reported by raising the HaltSignal exception." |
|
783 | 3475 |
|
4558 | 3476 |
^ HaltSignal raiseRequestWith:#halt |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3477 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3478 |
"Modified: / 8.5.1996 / 09:12:38 / cg" |
4499
251d4c698581
Send #halt resp. #error as signal parameter in these methods.
Stefan Vogel <sv@exept.de>
parents:
4469
diff
changeset
|
3479 |
"Modified: / 2.8.1999 / 17:00:29 / stefan" |
783 | 3480 |
! |
3481 |
||
3482 |
halt:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3483 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3484 |
|
1345 | 3485 |
"enter debugger with halt-message. |
3486 |
The error is reported by raising the HaltSignal exception." |
|
783 | 3487 |
|
4558 | 3488 |
^ HaltSignal raiseRequestWith:#halt: errorString:aString |
1345 | 3489 |
|
3490 |
"Modified: 8.5.1996 / 09:13:23 / cg" |
|
783 | 3491 |
! |
3492 |
||
3493 |
implementedBySubclass |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3494 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3495 |
|
783 | 3496 |
"this is sent by ST/V code - its the same as #subclassResponsibility" |
3497 |
||
3498 |
^ self subclassResponsibility |
|
3499 |
! |
|
3500 |
||
3501 |
indexNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3502 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3503 |
|
1345 | 3504 |
"report an error that index is not an Integer. |
3505 |
(when accessing collections indexed by an integer key). |
|
3506 |
The error is reported by raising the NonIntegerIndexSignal exception." |
|
783 | 3507 |
|
4558 | 3508 |
^ NonIntegerIndexSignal raiseRequestWith:nil |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3509 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3510 |
"Modified: / 8.5.1996 / 09:13:37 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3511 |
"Modified: / 26.7.1999 / 10:57:43 / stefan" |
783 | 3512 |
! |
3513 |
||
3450
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3514 |
indexNotInteger:anIndex |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3515 |
"{ Pragma: +optSpace }" |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3516 |
|
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3517 |
"report an error that index is not an Integer. |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3518 |
(when accessing collections indexed by an integer key). |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3519 |
The error is reported by raising the NonIntegerIndexSignal exception." |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3520 |
|
4558 | 3521 |
^ NonIntegerIndexSignal raiseRequestWith:anIndex |
3450
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3522 |
|
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3523 |
"Created: / 16.5.1998 / 19:39:41 / cg" |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3524 |
! |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3525 |
|
783 | 3526 |
integerCheckError |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3527 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3528 |
|
783 | 3529 |
"generated when a variable declared with an integer type gets a bad |
3530 |
value assigned" |
|
3531 |
||
3532 |
^ self error:'bad assign of ' , self printString , |
|
3533 |
' (' , self class name , ') to integer-typed variable' |
|
71 | 3534 |
! |
3535 |
||
2829
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3536 |
invalidCodeObject |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3537 |
"{ Pragma: +optSpace }" |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3538 |
|
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3539 |
self error:'not an executable code object' |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3540 |
|
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3541 |
"Created: 1.8.1997 / 00:16:44 / cg" |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3542 |
! |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3543 |
|
783 | 3544 |
invalidMessage |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3545 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3546 |
|
783 | 3547 |
"this is sent by ST/V code - its the same as #shouldNotImplement" |
3548 |
||
3549 |
^ self shouldNotImplement |
|
3550 |
! |
|
3551 |
||
3552 |
mustBeRectangle |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3553 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3554 |
|
783 | 3555 |
"report an argument-not-rectangle-error" |
3556 |
||
3557 |
^ self error:'argument must be a Rectangle' |
|
3558 |
! |
|
3559 |
||
3560 |
mustBeString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3561 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3562 |
|
783 | 3563 |
"report an argument-not-string-error" |
3564 |
||
3565 |
^ self error:'argument must be a String' |
|
3566 |
! |
|
3567 |
||
3568 |
notIndexed |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3569 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3570 |
|
4558 | 3571 |
<context: #return> |
3572 |
||
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3573 |
"report an error that receiver has no indexed instance variables. |
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3574 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3575 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3576 |
^ SubscriptOutOfBoundsSignal |
4558 | 3577 |
raiseErrorString:'receiver has no indexed variables' |
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3578 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3579 |
"Modified: 26.7.1996 / 16:43:13 / cg" |
783 | 3580 |
! |
3581 |
||
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3582 |
openDebuggerOnException:ex |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3583 |
"{ Pragma: +optSpace }" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3584 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3585 |
"enter the debugger on some unhandled exception" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3586 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3587 |
|msgString debugger| |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3588 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3589 |
msgString := ex errorString. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3590 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3591 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3592 |
if there is no debugger, |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3593 |
ask for ignore or exit. Exit will terminate the applciation. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3594 |
ignore will raise an abortSignal. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3595 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3596 |
Debugger isNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3597 |
msgString := 'error: ' , msgString. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3598 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3599 |
Smalltalk isStandAloneApp ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3600 |
Dialog notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3601 |
(Dialog |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3602 |
confirm:msgString |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3603 |
title:(Smalltalk commandName) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3604 |
yesLabel:'ignore' noLabel:'exit' |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3605 |
) ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3606 |
^ AbortSignal raise |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3607 |
] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3608 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3609 |
msgString errorPrintCR. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3610 |
OperatingSystem exit:1 |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3611 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3612 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3613 |
msgString errorPrintCR. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3614 |
Smalltalk fatalAbort:'no Debugger defined' |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3615 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3616 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3617 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3618 |
find an appropriate debugger to use |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3619 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3620 |
debugger := self appropriateDebugger:(thisContext selector). |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3621 |
debugger isNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3622 |
^ AbortSignal raise |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3623 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3624 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3625 |
^ debugger |
4558 | 3626 |
enter:ex suspendedContext |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3627 |
withMessage:msgString |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3628 |
mayProceed:(ex mayProceed). |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3629 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3630 |
"Modified: 24.7.1997 / 10:09:20 / cg" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3631 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3632 |
! |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3633 |
|
783 | 3634 |
primitiveFailed |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3635 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3636 |
|
1345 | 3637 |
"report an error that some primitive code failed. |
3638 |
The error is reported by raising the PrimitiveFailureSignal exception." |
|
783 | 3639 |
|
4558 | 3640 |
^ PrimitiveFailureSignal raiseRequestWith:nil |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3641 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3642 |
"Modified: / 8.5.1996 / 09:14:07 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3643 |
"Modified: / 26.7.1999 / 10:58:08 / stefan" |
783 | 3644 |
! |
3645 |
||
3646 |
shouldNotImplement |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3647 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3648 |
|
1345 | 3649 |
"report an error that this message should not be implemented" |
783 | 3650 |
|
3651 |
^ self error:'method not appropriate for this class' |
|
1345 | 3652 |
|
3653 |
"Modified: 8.5.1996 / 09:09:44 / cg" |
|
783 | 3654 |
! |
3655 |
||
3656 |
subclassResponsibility |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3657 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3658 |
|
1345 | 3659 |
"report an error that this message should have been reimplemented in a |
783 | 3660 |
subclass" |
3661 |
||
4619 | 3662 |
^ self error:'method must be reimplemented in subclass' mayProceed:true |
1345 | 3663 |
|
3664 |
"Modified: 8.5.1996 / 09:09:26 / cg" |
|
783 | 3665 |
! |
3666 |
||
3667 |
subscriptBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3668 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3669 |
|
1345 | 3670 |
"report an error that some index is out of bounds. |
3671 |
(when accessing indexable collections). |
|
3672 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 3673 |
|
4558 | 3674 |
^ SubscriptOutOfBoundsSignal raiseRequestWith:nil |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3675 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3676 |
"Modified: / 26.7.1996 / 16:45:42 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3677 |
"Modified: / 26.7.1999 / 10:58:27 / stefan" |
783 | 3678 |
! |
3679 |
||
3680 |
subscriptBoundsError:anIndex |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3681 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3682 |
|
1345 | 3683 |
"report an error that anIndex is out of bounds. |
3684 |
(when accessing indexable collections). |
|
3685 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 3686 |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
3687 |
^ SubscriptOutOfBoundsSignal |
4558 | 3688 |
raiseRequestWith:anIndex |
3689 |
errorString:('subscript (' , anIndex printString , ') out of bounds') |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
3690 |
|
1345 | 3691 |
"Modified: 8.5.1996 / 09:14:34 / cg" |
783 | 3692 |
! |
3693 |
||
3694 |
typeCheckError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3695 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3696 |
|
783 | 3697 |
"generated when a variable declared with a type hint gets a bad |
3698 |
value assigned" |
|
3699 |
||
3700 |
^ self error:'bad assign of ' , self printString , |
|
3701 |
' (' , self class name , ') to typed variable' |
|
3702 |
! ! |
|
3703 |
||
3704 |
!Object methodsFor:'evaluation'! |
|
3705 |
||
3706 |
value |
|
1327 | 3707 |
"return the receiver itself. |
3708 |
This allows every object to be used where blocks or valueHolders |
|
3709 |
are typically used, and allows for valueHolders and blocks to be |
|
3710 |
used interchangably in some situations. |
|
3711 |
||
783 | 3712 |
Time will show, if this is a good idea or leads to sloppy programming |
3713 |
style ... (the idea was borrowed from the Self language). |
|
1327 | 3714 |
|
3715 |
WARNING: dont 'optimize' away ifXXX: blocks |
|
2647 | 3716 |
(i.e. do NOT replace |
3717 |
foo ifTrue:[var1] ifFalse:[var2] |
|
3718 |
by: |
|
3719 |
foo ifTrue:var1 ifFalse:var2 |
|
3720 |
) |
|
3721 |
- the compilers will only generate inline code for the if, |
|
3722 |
iff the argument(s) are blocks - otherwise, a true send is |
|
3723 |
generated. |
|
3724 |
This 'oprimization' will work semantically correct, |
|
3725 |
but execute SLOWER instead." |
|
783 | 3726 |
|
3727 |
^ self |
|
71 | 3728 |
|
3729 |
" |
|
1327 | 3730 |
#(1 2 3 4) indexOf:5 ifAbsent:0 |
3731 |
#(1 2 3 4) indexOf:5 ifAbsent:[0] |
|
3732 |
1 > 2 ifTrue:['yes'] ifFalse:['no'] |
|
3733 |
1 > 2 ifTrue:'yes' ifFalse:'no' |
|
783 | 3734 |
" |
3735 |
||
3736 |
"DO NOT DO THIS (its slower) |
|
3737 |
(1 > 4) ifTrue:'oops' ifFalse:'ok' |
|
3738 |
||
3739 |
USE (the compiler optimizes blocks in if/while): |
|
3740 |
(1 > 4) ifTrue:['oops'] ifFalse:['ok'] |
|
3741 |
" |
|
1327 | 3742 |
|
3743 |
"Modified: 3.5.1996 / 11:57:08 / cg" |
|
783 | 3744 |
! ! |
3745 |
||
3330
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3746 |
!Object methodsFor:'finalization'! |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3747 |
|
4257
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3748 |
disposed |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3749 |
"this is invoked for objects which have been registered |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3750 |
in a Registry, when the original object dies. |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3751 |
Subclasses may redefine this method" |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3752 |
|
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3753 |
^ self |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3754 |
|
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3755 |
"Created: / 4.3.1998 / 10:40:30 / stefan" |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3756 |
! |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3757 |
|
4574
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3758 |
executor |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3759 |
"for VW & Squeak compatibility. |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3760 |
Return the object which does the finalization for me." |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3761 |
|
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3762 |
^ self shallowCopyForFinalization |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3763 |
|
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3764 |
"Created: / 5.8.1999 / 14:06:19 / cg" |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3765 |
! |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3766 |
|
3330
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3767 |
finalize |
4257
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3768 |
"For ST80 compatibility; ST/X uses #disposed when registered |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3769 |
objects are finalized. This may change." |
3330
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3770 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3771 |
^ self |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3772 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3773 |
"Created: / 4.3.1998 / 10:40:30 / stefan" |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3774 |
! ! |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3775 |
|
783 | 3776 |
!Object methodsFor:'initialization'! |
3777 |
||
3778 |
initialize |
|
3779 |
"just to ignore initialize to objects which do not need it" |
|
3780 |
||
3781 |
^ self |
|
3782 |
! ! |
|
3783 |
||
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3784 |
!Object methodsFor:'interest'! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3785 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3786 |
addInterest:anInterest |
1762
e7267ff590ff
Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1751
diff
changeset
|
3787 |
"install an interest forwarder. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3788 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3789 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3790 |
self addNonWeakDependent:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3791 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3792 |
"Created: 14.10.1996 / 22:27:34 / stefan" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3793 |
! |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3794 |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3795 |
expressInterestIn:aspect for:anObject sendBack:aSelector |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3796 |
"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
|
3797 |
changes aspect." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3798 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3799 |
"/ 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
|
3800 |
"/ 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
|
3801 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3802 |
self addInterest:(InterestConverter |
2647 | 3803 |
destination:anObject |
3804 |
selector:aSelector |
|
3805 |
aspect:aspect) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3806 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3807 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3808 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3809 |
|
1422 | 3810 |
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
|
3811 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3812 |
p := Point new. |
1422 | 3813 |
Transcript showCR:'interest in #foo:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3814 |
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
|
3815 |
p x:1. |
1422 | 3816 |
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
|
3817 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3818 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3819 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3820 |
Delay waitForSeconds:1. |
1422 | 3821 |
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
|
3822 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3823 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3824 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3825 |
Delay waitForSeconds:1. |
1422 | 3826 |
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
|
3827 |
p retractInterestIn:#foo for:b. |
1422 | 3828 |
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
|
3829 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3830 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3831 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3832 |
Delay waitForSeconds:1. |
1422 | 3833 |
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
|
3834 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 3835 |
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
|
3836 |
p changed:#foo. |
1422 | 3837 |
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
|
3838 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3839 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3840 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3841 |
Delay waitForSeconds:1. |
1422 | 3842 |
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
|
3843 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 3844 |
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
|
3845 |
p changed:#foo. |
1422 | 3846 |
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
|
3847 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3848 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3849 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3850 |
Delay waitForSeconds:1. |
1422 | 3851 |
Transcript showCR:'no more interests:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3852 |
p retractInterestsFor:b. |
1422 | 3853 |
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
|
3854 |
p changed:#foo. |
1422 | 3855 |
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
|
3856 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3857 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3858 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3859 |
p release. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3860 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3861 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3862 |
"Created: 19.4.1996 / 10:26:22 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3863 |
"Modified: 19.4.1996 / 12:34:08 / cg" |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3864 |
"Modified: 14.10.1996 / 22:28:20 / stefan" |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3865 |
! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3866 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3867 |
interests |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3868 |
"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
|
3869 |
Here, we use the nonWeakDependents for interests." |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3870 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3871 |
^ self nonWeakDependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3872 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3873 |
"Created: / 14.10.1996 / 22:20:51 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3874 |
"Modified: / 30.1.1998 / 14:07:35 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3875 |
! |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3876 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3877 |
interestsFor:someOne |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3878 |
"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
|
3879 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3880 |
|coll deps| |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3881 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3882 |
deps := self interests. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3883 |
deps size == 0 ifTrue:[^ #()]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3884 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3885 |
coll := IdentitySet new. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3886 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3887 |
deps do:[:dep | |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3888 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3889 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3890 |
coll add:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3891 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3892 |
] |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3893 |
]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3894 |
^ coll |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3895 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3896 |
"Created: / 30.1.1998 / 14:02:26 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3897 |
"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
|
3898 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3899 |
|
3960 | 3900 |
onChangeEvaluate:aBlock |
3901 |
"arrange for aBlock to be evaluated whenever the receiver changes." |
|
3902 |
||
3903 |
^ self onChangeSend:#value to:aBlock |
|
3904 |
||
3905 |
"Created: / 29.1.1999 / 16:01:22 / cg" |
|
3906 |
! |
|
3907 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3908 |
onChangeSend:aSelector to:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3909 |
"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
|
3910 |
changes." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3911 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3912 |
"/ 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
|
3913 |
"/ 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
|
3914 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3915 |
self addInterest:(InterestConverter |
2647 | 3916 |
destination:anObject |
3917 |
selector:aSelector) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3918 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3919 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3920 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3921 |
|
1422 | 3922 |
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
|
3923 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3924 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3925 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3926 |
p x:1. |
1422 | 3927 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3928 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3929 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3930 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3931 |
Delay waitForSeconds:1. |
1422 | 3932 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3933 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3934 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3935 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3936 |
Delay waitForSeconds:1. |
1422 | 3937 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3938 |
p retractInterestsFor:b. |
1422 | 3939 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3940 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3941 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3942 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3943 |
Delay waitForSeconds:1. |
1422 | 3944 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3945 |
p onChangeSend:#value to:b. |
1422 | 3946 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3947 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3948 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3949 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3950 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3951 |
"Created: 19.4.1996 / 10:26:38 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3952 |
"Modified: 19.4.1996 / 12:34:26 / cg" |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3953 |
"Modified: 14.10.1996 / 22:28:27 / stefan" |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3954 |
! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3955 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3956 |
removeInterest:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3957 |
"remove an interest forwarder. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3958 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3959 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3960 |
self removeNonWeakDependent:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3961 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3962 |
"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
|
3963 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3964 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3965 |
retractInterestIn:aspect for:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3966 |
"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
|
3967 |
(as installed with #expressInterestIn:for:sendBack:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3968 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3969 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3970 |
"/ 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
|
3971 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3972 |
"/ cannot removeDependent within the loop - the collection rehashes |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3973 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3974 |
|deps coll| |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3975 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3976 |
deps := self interests. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3977 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3978 |
coll := IdentitySet new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3979 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3980 |
deps do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3981 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3982 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3983 |
dep aspect == aspect ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3984 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3985 |
^ self |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3986 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3987 |
] |
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 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3990 |
coll do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3991 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3992 |
]. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3993 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3994 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3995 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3996 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3997 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3998 |
|
1422 | 3999 |
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
|
4000 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4001 |
p := Point new. |
1422 | 4002 |
Transcript showCR:'interest in #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4003 |
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
|
4004 |
p x:1. |
1422 | 4005 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4006 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4007 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4008 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4009 |
Delay waitForSeconds:1. |
1422 | 4010 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4011 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4012 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4013 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4014 |
Delay waitForSeconds:1. |
1422 | 4015 |
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
|
4016 |
p retractInterestIn:#foo for:b. |
1422 | 4017 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4018 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4019 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4020 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4021 |
Delay waitForSeconds:1. |
1422 | 4022 |
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
|
4023 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 4024 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4025 |
p changed:#foo. |
1422 | 4026 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4027 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4028 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4029 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4030 |
Delay waitForSeconds:1. |
1422 | 4031 |
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
|
4032 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 4033 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4034 |
p changed:#foo. |
1422 | 4035 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4036 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4037 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4038 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4039 |
Delay waitForSeconds:1. |
1422 | 4040 |
Transcript showCR:'no more interests'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4041 |
p retractInterestsFor:b. |
1422 | 4042 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4043 |
p changed:#foo. |
1422 | 4044 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4045 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4046 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4047 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4048 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4049 |
"Created: / 19.4.1996 / 10:27:11 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4050 |
"Modified: / 14.10.1996 / 22:21:19 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4051 |
"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
|
4052 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4053 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4054 |
retractInterestsFor:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4055 |
"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
|
4056 |
(as installed with #onChangeSend:to:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4057 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4058 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4059 |
"/ 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
|
4060 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4061 |
|coll deps| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4062 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4063 |
"/ 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
|
4064 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
4065 |
deps := self interests. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4066 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4067 |
coll := IdentitySet new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4068 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4069 |
deps do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4070 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4071 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4072 |
coll add:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4073 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4074 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4075 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4076 |
coll do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4077 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4078 |
]. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4079 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4080 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4081 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4082 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4083 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4084 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4085 |
|
1422 | 4086 |
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
|
4087 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4088 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4089 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4090 |
p x:1. |
1422 | 4091 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4092 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4093 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4094 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4095 |
Delay waitForSeconds:1. |
1422 | 4096 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4097 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4098 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4099 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4100 |
Delay waitForSeconds:1. |
1422 | 4101 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4102 |
p retractInterestsFor:b. |
1422 | 4103 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4104 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4105 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4106 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4107 |
Delay waitForSeconds:1. |
1422 | 4108 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4109 |
p onChangeSend:#value to:b. |
1422 | 4110 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4111 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4112 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4113 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4114 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4115 |
"Created: / 19.4.1996 / 10:23:46 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4116 |
"Modified: / 14.10.1996 / 22:21:25 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4117 |
"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
|
4118 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4119 |
|
783 | 4120 |
!Object methodsFor:'interrupt handling'! |
4121 |
||
4122 |
childSignalInterrupt |
|
4123 |
"death of a child process (unix process) - do nothing" |
|
4124 |
||
4125 |
^ self |
|
4126 |
! |
|
4127 |
||
4128 |
customInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4129 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4130 |
|
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4131 |
"a custom interrupt - but no handler has defined" |
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4132 |
|
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4133 |
self error:'custom interrupt' mayProceed:true |
783 | 4134 |
! |
4135 |
||
4136 |
errorInterrupt:errorID with:aParameter |
|
4137 |
"subsystem error. The arguments errorID and aParameter are the values passed |
|
4138 |
to the 'errorInterruptWithIDAndParameter(id, param)' function, |
|
4139 |
which can be called from C subsystems to raise an (asynchronous) |
|
4140 |
error exception. |
|
4141 |
||
4142 |
Currently, this is used to map XErrors to smalltalk errors, but can be |
|
4143 |
used from other C subsystems too, to upcast errors. |
|
4144 |
Especially, for subsystems which call errorHandler functions asynchronously. |
|
4145 |
IDs (currently) used: |
|
4146 |
#DisplayError ..... x-error interrupt |
|
4147 |
#XtError ..... xt-error interrupt (Xt interface is not yet published) |
|
71 | 4148 |
" |
783 | 4149 |
|
4150 |
|handler| |
|
4151 |
||
4152 |
handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil. |
|
4153 |
handler notNil ifTrue:[ |
|
4154 |
"/ |
|
4155 |
"/ handler found; let it do whatever it wants ... |
|
4156 |
"/ |
|
4157 |
handler errorInterrupt:errorID with:aParameter. |
|
4158 |
^ self |
|
4159 |
]. |
|
4160 |
||
4161 |
"/ |
|
4162 |
"/ no handler - raise errorSignal passing the errorId as parameter |
|
4163 |
"/ |
|
4164 |
^ ErrorSignal |
|
4165 |
raiseRequestWith:errorID |
|
4166 |
errorString:('Subsystem error. ErrorID = ' , errorID printString) |
|
4167 |
! |
|
4168 |
||
4169 |
exceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4170 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4171 |
|
783 | 4172 |
"exception interrupt - enter debugger" |
4173 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4174 |
self error:'exception Interrupt' mayProceed:true |
783 | 4175 |
! |
4176 |
||
4177 |
fpExceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4178 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4179 |
|
783 | 4180 |
"a floating point exception occured - this one |
4181 |
has to be handled differently since it comes asynchronous |
|
4182 |
on some machines (for example, on machines with a separate FPU |
|
4183 |
or superscalar architectures. Also, errors from within primitive code |
|
4184 |
(or library functions such as GL) are sent via the Unix-signal |
|
4185 |
mechanism this way." |
|
4186 |
||
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4187 |
|where rec| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4188 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4189 |
where := thisContext sender. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4190 |
rec := where receiver. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4191 |
rec isNumber ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4192 |
^ rec class |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4193 |
raise:#domainErrorSignal |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4194 |
receiver:rec |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4195 |
selector:where selector |
3398 | 4196 |
arguments:(where args asArray) |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4197 |
errorString:'floating point exception' |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4198 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4199 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4200 |
"/ could be in some C-library ... |
783 | 4201 |
^ Float domainErrorSignal raise |
4202 |
! |
|
4203 |
||
4204 |
internalError:msg |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4205 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4206 |
|
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
4207 |
"this is triggered, when VM hits some bad error, |
783 | 4208 |
such as corrupted class, corrupted method/selector array |
4209 |
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
|
4210 |
(for example, if you set an objects class to a non-behavior, nil etc.). |
783 | 4211 |
Its not guaranteed, that the system is in a working condition once |
4212 |
this error occurred ...." |
|
4213 |
||
4558 | 4214 |
InternalErrorSignal raiseWith:self errorString:msg |
783 | 4215 |
! |
4216 |
||
4217 |
ioInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4218 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4219 |
|
783 | 4220 |
"I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor). |
4221 |
If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler) |
|
4222 |
or it does not understand the ioInterrupt message. |
|
4223 |
In any case, this is a sign of some big trouble. Enter debugger." |
|
4224 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4225 |
self error:'I/O Interrupt - but no handler' mayProceed:true |
783 | 4226 |
! |
4227 |
||
4228 |
memoryInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4229 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4230 |
|
783 | 4231 |
"out-of-memory interrupt and no handler - enter debugger" |
4232 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4233 |
self error:'almost out of memory' mayProceed:true |
783 | 4234 |
! |
4235 |
||
4236 |
recursionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4237 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4238 |
|
783 | 4239 |
"recursion limit (actually: stack overflow) interrupt. |
4240 |
This interrupt is triggered, when a process stack grows above |
|
4241 |
its stackLimit - usually, this leads into the debugger, but |
|
2689 | 4242 |
could be caught and the stackLimit increased in the handler. |
783 | 4243 |
At the time we arrive here, the system has still some stack |
4244 |
as a reserve so we can continue to do some useful work or cleanup or |
|
4245 |
debugging for a while. |
|
4246 |
If the signal is ignored, and the stack continues to grow, there |
|
4247 |
will be a few more chances (and more interrupts) before the VM |
|
4248 |
hard-terminates the process." |
|
4249 |
||
4250 |
thisContext isRecursive ifFalse:[ |
|
4884 | 4251 |
"/ Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[ |
4252 |
"/ "/ mhmh - it hit me, but I am not responsible ... |
|
4253 |
"/ 'Stray recursionInterrupt ...' infoPrintCR. |
|
4254 |
"/ ^ self |
|
4255 |
"/ ]. |
|
4815
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4256 |
thisContext sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4257 |
thisContext sender sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4258 |
thisContext sender sender sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4259 |
thisContext sender sender sender sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4260 |
thisContext sender sender sender sender sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4261 |
^ RecursionInterruptSignal raise |
783 | 4262 |
] |
4815
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4263 |
|
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4264 |
"Modified: / 25.9.1999 / 18:28:11 / cg" |
783 | 4265 |
! |
4266 |
||
4267 |
schedulerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4268 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4269 |
|
783 | 4270 |
"scheduler interrupt (supposed to be sent to Processor). |
4271 |
If we arrive here, either the Processor does not understand it, |
|
4272 |
or it has been set to nil. In any case, this is a sign of some |
|
4273 |
big trouble. Enter debugger." |
|
4274 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4275 |
self error:'schedulerInterrupt - but no Processor' mayProceed:true |
783 | 4276 |
! |
4277 |
||
4278 |
signalInterrupt:signalNumber |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4279 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4280 |
|
783 | 4281 |
"unix signal occured - some signals are handled as Smalltalk Exceptions |
4282 |
(SIGPIPE), others (SIGBUS) are rather fatal ... |
|
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4283 |
In any case, IF a smalltalk-signal has been connected to the OS signal, |
783 | 4284 |
that one is raised. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4285 |
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
|
4286 |
signal. |
783 | 4287 |
TODO: add another argument, giving more detailed signal info (PC, VADDR, |
4288 |
exact cause etc.). This helps if segvs occur in primitive code. |
|
4289 |
Currently (temporary kludge), these are passed as global variables." |
|
4290 |
||
2773 | 4291 |
|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
|
4292 |
action title| |
783 | 4293 |
|
4294 |
" |
|
4295 |
special case - since SIGPIPE has an ST-signal associated |
|
4296 |
" |
|
4297 |
(signalNumber == 13) ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4298 |
"SIGPIPE - write on a pipe with no one to read" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4299 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4300 |
^ PipeStream brokenPipeSignal raise. |
783 | 4301 |
]. |
4302 |
||
4303 |
"if there has been an ST-signal installed, use it ..." |
|
4304 |
||
4305 |
sig := OperatingSystem operatingSystemSignal:signalNumber. |
|
4306 |
sig notNil ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4307 |
^ sig raise |
783 | 4308 |
]. |
4309 |
||
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4310 |
"/ if handled, raise OSSignalInterruptSignal |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4311 |
|
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4312 |
OSSignalInterruptSignal isHandled ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4313 |
^ OSSignalInterruptSignal raiseWith:signalNumber |
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4314 |
]. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4315 |
|
783 | 4316 |
" |
4317 |
... otherwise , bring up a box asking for what to do ... |
|
4318 |
" |
|
4319 |
name := OperatingSystem nameForSignal:signalNumber. |
|
4320 |
here := thisContext. |
|
4321 |
||
4322 |
" |
|
4323 |
the context, in which the signal occurred: |
|
4324 |
" |
|
4325 |
badContext := here sender. |
|
4326 |
||
4327 |
" |
|
4328 |
ungrab - in case it happened in a box/popupview |
|
4329 |
otherwise display stays locked |
|
4330 |
" |
|
2851
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4331 |
"/ Display notNil ifTrue:[ |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4332 |
"/ Display ungrabPointer. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4333 |
"/ Display ungrabKeyboard. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4334 |
"/ ]. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4335 |
Screen notNil ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4336 |
Screen allScreens do:[:aScreen | |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4337 |
aScreen ungrabPointer. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4338 |
aScreen ungrabKeyboard. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4339 |
] |
783 | 4340 |
]. |
4341 |
||
4342 |
" |
|
4343 |
SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue) |
|
4344 |
since the system will retry the faulty instruction, which leads to |
|
4345 |
another signal - to avoid frustration, better not offer this option. |
|
4346 |
" |
|
4347 |
ignorable := (signalNumber ~~ OperatingSystem sigBUS) |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4348 |
and:[signalNumber ~~ OperatingSystem sigILL |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4349 |
and:[signalNumber ~~ OperatingSystem sigSEGV]]. |
783 | 4350 |
|
4351 |
ignorable ifFalse:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4352 |
here isRecursive ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4353 |
'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR. |
4537 | 4354 |
MiniDebugger |
4355 |
enterWithMessage:'recursive signal' |
|
4356 |
mayProceed:true. |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4357 |
^ self |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4358 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4359 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4360 |
a hard signal - go into debugger immediately |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4361 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4362 |
msg := 'OS-signal: ', name. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4363 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4364 |
"/ the IRQ-PC is passed as low-hi, to avoid the need |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4365 |
"/ to allocate a LargeInteger in the VM during signal |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4366 |
"/ time. I know, this is ugly. |
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
4367 |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4368 |
InterruptPcLow notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4369 |
pc := InterruptPcLow + (InterruptPcHi bitShift:(SmallInteger maxBits + 1 // 2)). |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4370 |
pc ~~ 0 ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4371 |
msg := msg , ' PC=' , (pc printStringRadix:16) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4372 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4373 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4374 |
InterruptAddrLow notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4375 |
addr := InterruptAddrLow + (InterruptAddrHi bitShift:(SmallInteger maxBits + 1 // 2)). |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4376 |
addr ~~ 0 ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4377 |
msg := msg , ' ADDR=' , (addr printStringRadix:16) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4378 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4379 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4380 |
Debugger enter:here withMessage:msg mayProceed:true. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4381 |
badContext return. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4382 |
^ nil. |
783 | 4383 |
]. |
4384 |
||
4385 |
OptionBox isNil ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4386 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4387 |
a system without GUI ... |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4388 |
go into minidebugger (if there is one) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4389 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4390 |
MiniDebugger isNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4391 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4392 |
a system without debugging facilities |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4393 |
(i.e. a standalone system) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4394 |
output a message and exit. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4395 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4396 |
('Object [error]: exit due to Signal ' , name , ' - and no debugger.') errorPrintCR. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4397 |
Smalltalk exit. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4398 |
]. |
4537 | 4399 |
MiniDebugger |
4400 |
enterWithMessage:'Signal caught (' , name, ')' |
|
4401 |
mayProceed:true. |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4402 |
^ self |
783 | 4403 |
]. |
4404 |
||
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4405 |
titles := #('dump core' 'exit ST/X'). |
783 | 4406 |
actions := Array |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4407 |
with:[Smalltalk fatalAbort] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4408 |
with:[Smalltalk exit]. |
2773 | 4409 |
|
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4410 |
action := nil. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4411 |
title := 'OS Signal caught (' , name, ')'. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4412 |
title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4413 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4414 |
"/ if cought while in the scheduler or event dispatcher, |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4415 |
"/ a modal dialog is not possible ... |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4416 |
"/ (therefore, debug & return make no sense) |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4417 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4418 |
Processor activeProcess isSystemProcess ifFalse:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4419 |
titles := #('abort' 'debug') , titles. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4420 |
actions := (Array |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4421 |
with:[action := #abort] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4422 |
with:[action := #debug]) , actions. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4423 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4424 |
badContext canReturn ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4425 |
titles := #('return') , titles. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4426 |
actions := (Array with:[action := #return]) , actions. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4427 |
]. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4428 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4429 |
|
783 | 4430 |
ignorable ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4431 |
titles := titles, #('ignore'). |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4432 |
actions := actions , (Array with:[action := #ignore]). |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4433 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4434 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4435 |
box := OptionBox |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4436 |
title:title |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4437 |
numberOfOptions:actions size. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4438 |
ignorable ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4439 |
box defaultButtonIndex:(actions size) |
783 | 4440 |
]. |
4441 |
box buttonTitles:titles. |
|
4442 |
box actions:actions. |
|
2773 | 4443 |
box showAtPointer. |
4444 |
||
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4445 |
action == #return ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4446 |
badContext return |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4447 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4448 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4449 |
action == #abort ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4450 |
AbortSignal raise. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4451 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4452 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4453 |
action == #debug ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4454 |
Debugger enter:here withMessage:('Signal ', name) mayProceed:true. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4455 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4456 |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
4457 |
"Modified: / 4.5.1998 / 20:39:16 / cg" |
783 | 4458 |
! |
4459 |
||
4460 |
spyInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4461 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4462 |
|
783 | 4463 |
"spy interrupt and no handler - enter debugger" |
4464 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4465 |
self error:'spy Interrupt - but no handler' mayProceed:true |
783 | 4466 |
! |
4467 |
||
4468 |
timerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4469 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4470 |
|
783 | 4471 |
"timer interrupt and no handler - enter debugger" |
4472 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4473 |
self error:'timer Interrupt - but no handler' mayProceed:true |
783 | 4474 |
! |
4475 |
||
4476 |
userInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4477 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4478 |
|
1792 | 4479 |
"user (^c) interrupt. |
4480 |
This is typically sent by the VM, when a ctrl-C is typed at the |
|
4481 |
controlling tty (i.e. in the xterm)." |
|
783 | 4482 |
|
4483 |
UserInterruptSignal raise |
|
1788 | 4484 |
! |
4485 |
||
4486 |
userInterruptIn:aContext |
|
4487 |
"{ Pragma: +optSpace }" |
|
4488 |
||
4489 |
"user (^c) interrupt - enter debugger, but show aContext |
|
1792 | 4490 |
as top-context. |
4491 |
This is used to hide any intermediate scheduler contexts, |
|
4492 |
in case of an interrupted process. Typically, this is sent by |
|
4493 |
the WindowGroup, when a keyboardEvent for the ctrl-C key is |
|
4494 |
processed." |
|
1788 | 4495 |
|
4634 | 4496 |
<context: #return> |
4497 |
||
4558 | 4498 |
UserInterruptSignal raiseRequestWith:nil errorString:nil in:aContext |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
4499 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
4500 |
"Created: / 18.10.1996 / 20:46:04 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
4501 |
"Modified: / 20.10.1996 / 13:06:38 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
4502 |
"Modified: / 26.7.1999 / 10:58:49 / stefan" |
71 | 4503 |
! ! |
4504 |
||
5149 | 4505 |
|
1 | 4506 |
!Object methodsFor:'message sending'! |
4507 |
||
4508 |
perform:aSelector |
|
4509 |
"send the message aSelector to the receiver" |
|
4510 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4511 |
%{ |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4512 |
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
|
4513 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4514 |
static struct inlineCache ilc_0 = __ILCPERF0(@line+14); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4515 |
static struct inlineCache ilc_1 = __ILCPERF0(@line+17-1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4516 |
static struct inlineCache ilc_2 = __ILCPERF0(@line+20-2); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4517 |
static struct inlineCache ilc_3 = __ILCPERF0(@line+23-3); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4518 |
static struct inlineCache ilc_4 = __ILCPERF0(@line+26-4); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4519 |
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
|
4520 |
static OBJ last_1 = nil; |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4521 |
static OBJ last_2 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4522 |
static OBJ last_3 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4523 |
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
|
4524 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4525 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4526 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4527 |
if (sel == last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4528 |
RETURN ( (*(ilc_0.ilc_func))(self, sel, nil, &ilc_0) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4529 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4530 |
if (sel == last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4531 |
RETURN ( (*(ilc_1.ilc_func))(self, sel, nil, &ilc_1) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4532 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4533 |
if (sel == last_2) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4534 |
RETURN ( (*(ilc_2.ilc_func))(self, sel, nil, &ilc_2) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4535 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4536 |
if (sel == last_3) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4537 |
RETURN ( (*(ilc_3.ilc_func))(self, sel, nil, &ilc_3) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4538 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4539 |
if (sel == last_4) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4540 |
RETURN ( (*(ilc_4.ilc_func))(self, sel, nil, &ilc_4) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4541 |
} |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4542 |
|
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4543 |
if (flip == 0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4544 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4545 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4546 |
last_0 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4547 |
} else if (flip == 1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4548 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4549 |
flip = 2; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4550 |
last_1 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4551 |
} else if (flip == 2) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4552 |
pIlc = &ilc_2; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4553 |
flip = 3; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4554 |
last_2 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4555 |
} else if (flip == 3) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4556 |
pIlc = &ilc_3; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4557 |
flip = 4; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4558 |
last_3 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4559 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4560 |
pIlc = &ilc_4; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4561 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4562 |
last_4 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4563 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4564 |
pIlc->ilc_func = __SEND0ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4565 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4566 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4567 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4568 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4569 |
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
|
4570 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4571 |
static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4572 |
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
|
4573 |
} |
1 | 4574 |
%} |
4575 |
! |
|
4576 |
||
783 | 4577 |
perform:aSelector inClass:aClass withArguments:argArray |
4578 |
"send the message aSelector with all args taken from argArray |
|
4579 |
to the receiver as a super-send message. |
|
4580 |
This is actually more flexible than the normal super-send, since it allows |
|
4581 |
to execute a method in ANY superclass of the receiver (not just the |
|
4582 |
immediate superclass). |
|
4583 |
Thus, it is (theoretically) possible to do |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4584 |
'5 perform:#< inClass:Magnitude withArguments:#(6)' |
783 | 4585 |
and evaluate Magnitudes compare method even if there was one in Number. |
4586 |
This method is used by the interpreter to evaluate super sends |
|
4587 |
and could be used for very special behavior (language extension ?). |
|
4588 |
||
4589 |
WARNING: this is an ST/X feature - probably not found in other smalltalks." |
|
4590 |
||
4591 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
|
4592 |
||
4593 |
" |
|
4594 |
check, if aClass is really a superclass of the receiver |
|
4595 |
" |
|
4596 |
(self class isSubclassOf:aClass) ifFalse:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4597 |
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
|
4598 |
^ nil |
783 | 4599 |
]. |
4600 |
%{ |
|
4601 |
REGISTER OBJ *argP; |
|
4602 |
int nargs, i; |
|
4603 |
||
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4604 |
if (__isArray(argArray)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4605 |
nargs = __arraySize(argArray); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4606 |
argP = __ArrayInstPtr(argArray)->a_element; |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4607 |
} else { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4608 |
if (__isNonNilObject(argArray)) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4609 |
static struct inlineCache ilcSize = __ILC0(@line+1); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4610 |
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
|
4611 |
if (!__isSmallInteger(numberOfArgs)) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4612 |
goto bad; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4613 |
nargs = __intVal(numberOfArgs); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4614 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4615 |
for (i=1; i <= nargs; i++) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4616 |
*argP++ = __AT_(argArray, __MKSMALLINT(i)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4617 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4618 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4619 |
} else { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4620 |
nargs = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4621 |
} |
783 | 4622 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4623 |
switch (nargs) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4624 |
case 0: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4625 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4626 |
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
|
4627 |
RETURN ( _SEND0(self, aSelector, aClass, &ilc0)); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4628 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4629 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4630 |
case 1: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4631 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4632 |
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
|
4633 |
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
|
4634 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4635 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4636 |
case 2: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4637 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4638 |
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
|
4639 |
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
|
4640 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4641 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4642 |
case 3: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4643 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4644 |
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
|
4645 |
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
|
4646 |
argP[0], argP[1], argP[2])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4647 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4648 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4649 |
case 4: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4650 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4651 |
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
|
4652 |
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
|
4653 |
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
|
4654 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4655 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4656 |
case 5: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4657 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4658 |
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
|
4659 |
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
|
4660 |
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
|
4661 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4662 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4663 |
case 6: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4664 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4665 |
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
|
4666 |
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
|
4667 |
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
|
4668 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4669 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4670 |
case 7: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4671 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4672 |
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
|
4673 |
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
|
4674 |
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
|
4675 |
argP[6])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4676 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4677 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4678 |
case 8: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4679 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4680 |
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
|
4681 |
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
|
4682 |
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
|
4683 |
argP[6], argP[7])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4684 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4685 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4686 |
case 9: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4687 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4688 |
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
|
4689 |
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
|
4690 |
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
|
4691 |
argP[6], argP[7], argP[8])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4692 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4693 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4694 |
case 10: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4695 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4696 |
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
|
4697 |
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
|
4698 |
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
|
4699 |
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
|
4700 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4701 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4702 |
case 11: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4703 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4704 |
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
|
4705 |
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
|
4706 |
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
|
4707 |
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
|
4708 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4709 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4710 |
case 12: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4711 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4712 |
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
|
4713 |
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
|
4714 |
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
|
4715 |
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
|
4716 |
argP[11])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4717 |
} |
3177
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 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4721 |
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
|
4722 |
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
|
4723 |
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
|
4724 |
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
|
4725 |
argP[11], argP[12])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4726 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4727 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4728 |
case 14: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4729 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4730 |
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
|
4731 |
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
|
4732 |
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
|
4733 |
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
|
4734 |
argP[11], argP[12], argP[13])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4735 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4736 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4737 |
case 15: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4738 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4739 |
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
|
4740 |
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
|
4741 |
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
|
4742 |
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
|
4743 |
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
|
4744 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4745 |
|
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4746 |
#ifdef _SEND16 |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4747 |
case 16: |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4748 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4749 |
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
|
4750 |
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
|
4751 |
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
|
4752 |
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
|
4753 |
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
|
4754 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4755 |
#endif |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4756 |
|
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4757 |
|
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4758 |
} |
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 |
||
783 | 4764 |
^ self primitiveFailed |
4765 |
! |
|
4766 |
||
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4767 |
perform:aSelector with:arg |
1 | 4768 |
"send the one-arg-message aSelector to the receiver" |
4769 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4770 |
%{ |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4771 |
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
|
4772 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4773 |
static struct inlineCache ilc_0 = __ILCPERF1(@line+14); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4774 |
static struct inlineCache ilc_1 = __ILCPERF1(@line+14+3-1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4775 |
static struct inlineCache ilc_2 = __ILCPERF1(@line+14+6-2); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4776 |
static struct inlineCache ilc_3 = __ILCPERF1(@line+14+9-3); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4777 |
static struct inlineCache ilc_4 = __ILCPERF1(@line+14+12-4); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4778 |
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
|
4779 |
static OBJ last_1 = nil; |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4780 |
static OBJ last_2 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4781 |
static OBJ last_3 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4782 |
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
|
4783 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4784 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4785 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4786 |
if (sel == last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4787 |
RETURN ( (*(ilc_0.ilc_func))(self, sel, nil, &ilc_0, arg) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4788 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4789 |
if (sel == last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4790 |
RETURN ( (*(ilc_1.ilc_func))(self, sel, nil, &ilc_1, arg) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4791 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4792 |
if (sel == last_2) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4793 |
RETURN ( (*(ilc_2.ilc_func))(self, sel, nil, &ilc_2, arg) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4794 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4795 |
if (sel == last_3) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4796 |
RETURN ( (*(ilc_3.ilc_func))(self, sel, nil, &ilc_3, arg) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4797 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4798 |
if (sel == last_4) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4799 |
RETURN ( (*(ilc_4.ilc_func))(self, sel, nil, &ilc_4, arg) ); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4800 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4801 |
|
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4802 |
if (flip == 0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4803 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4804 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4805 |
last_0 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4806 |
} else if (flip == 1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4807 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4808 |
flip = 2; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4809 |
last_1 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4810 |
} else if (flip == 2) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4811 |
pIlc = &ilc_2; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4812 |
flip = 3; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4813 |
last_2 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4814 |
} else if (flip == 3) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4815 |
pIlc = &ilc_3; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4816 |
flip = 4; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4817 |
last_3 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4818 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4819 |
pIlc = &ilc_4; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4820 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4821 |
last_4 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4822 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4823 |
pIlc->ilc_func = __SEND1ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4824 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4825 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4826 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4827 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4828 |
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
|
4829 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4830 |
static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4831 |
RETURN (_SEND1(self, aSelector, nil, &ilc1, arg)); |
1 | 4832 |
} |
4833 |
%} |
|
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4834 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4835 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4836 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4837 |
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
|
4838 |
"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
|
4839 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4840 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4841 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4842 |
static struct inlineCache ilc_0 = __ILCPERF2(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4843 |
static struct inlineCache ilc_1 = __ILCPERF2(@line+28); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4844 |
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
|
4845 |
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
|
4846 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4847 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4848 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4849 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4850 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4851 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4852 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4853 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4854 |
last_0 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4855 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4856 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4857 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4858 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4859 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4860 |
pIlc->ilc_func = __SEND2ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4861 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4862 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4863 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4864 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4865 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4866 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4867 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4868 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4869 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4870 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4871 |
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
|
4872 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4873 |
static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4874 |
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
|
4875 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4876 |
%} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4877 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4878 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4879 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4880 |
perform:aSelector with:arg1 with:arg2 with:arg3 |
1 | 4881 |
"send the three-arg-message aSelector to the receiver" |
4882 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4883 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4884 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4885 |
static struct inlineCache ilc_0 = __ILCPERF3(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4886 |
static struct inlineCache ilc_1 = __ILCPERF3(@line+28); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4887 |
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
|
4888 |
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
|
4889 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4890 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4891 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4892 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4893 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4894 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4895 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4896 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4897 |
last_0 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4898 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4899 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4900 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4901 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4902 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4903 |
pIlc->ilc_func = __SEND3ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4904 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4905 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4906 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4907 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4908 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4909 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4910 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4911 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4912 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4913 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4914 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4915 |
arg1, arg2, arg3) ); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4916 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4917 |
static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4918 |
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
|
4919 |
} |
1 | 4920 |
%} |
2437 | 4921 |
! |
4922 |
||
4923 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 |
|
4924 |
"send the four-arg-message aSelector to the receiver" |
|
4925 |
||
4926 |
%{ |
|
4927 |
struct inlineCache *pIlc; |
|
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4928 |
static struct inlineCache ilc_0 = __ILCPERF4(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4929 |
static struct inlineCache ilc_1 = __ILCPERF4(@line+28); |
2437 | 4930 |
static OBJ last_0 = nil; |
4931 |
static OBJ last_1 = nil; |
|
4932 |
static flip = 0; |
|
4933 |
||
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4934 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4935 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4936 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4937 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4938 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4939 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4940 |
last_0 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4941 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4942 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4943 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4944 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4945 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4946 |
pIlc->ilc_func = __SEND4ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4947 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4948 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4949 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4950 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4951 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4952 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4953 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4954 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4955 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4956 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4957 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4958 |
arg1, arg2, arg3, arg4) ); |
2437 | 4959 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4960 |
static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4961 |
RETURN (_SEND4(self, aSelector, nil, &ilc4, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4962 |
arg1, arg2, arg3, arg4)); |
2437 | 4963 |
} |
4964 |
%} |
|
1 | 4965 |
! |
4966 |
||
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4967 |
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
|
4968 |
"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
|
4969 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4970 |
%{ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4971 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4972 |
static struct inlineCache ilc_0 = __ILCPERF5(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4973 |
static struct inlineCache ilc_1 = __ILCPERF5(@line+28); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4974 |
static OBJ last_0 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4975 |
static OBJ last_1 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4976 |
static flip = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4977 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4978 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4979 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4980 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4981 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4982 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4983 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4984 |
last_0 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4985 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4986 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4987 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4988 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4989 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4990 |
pIlc->ilc_func = __SEND5ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4991 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4992 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4993 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4994 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4995 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4996 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4997 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4998 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4999 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5000 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5001 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5002 |
arg1, arg2, arg3, arg4, arg5) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5003 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5004 |
static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5005 |
RETURN (_SEND5(self, aSelector, nil, &ilc5, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5006 |
arg1, arg2, arg3, arg4, arg5)); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5007 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5008 |
%} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5009 |
! |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5010 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5011 |
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
|
5012 |
"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
|
5013 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5014 |
%{ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5015 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5016 |
static struct inlineCache ilc_0 = __ILCPERF6(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5017 |
static struct inlineCache ilc_1 = __ILCPERF6(@line+28); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5018 |
static OBJ last_0 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5019 |
static OBJ last_1 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5020 |
static flip = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5021 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5022 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5023 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5024 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5025 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5026 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5027 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5028 |
last_0 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5029 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5030 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5031 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5032 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5033 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5034 |
pIlc->ilc_func = __SEND6ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5035 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5036 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5037 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5038 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5039 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5040 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5041 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5042 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5043 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5044 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5045 |
|
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5046 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5047 |
arg1, arg2, arg3, arg4, arg5, arg6) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5048 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5049 |
static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5050 |
RETURN (_SEND6(self, aSelector, nil, &ilc6, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5051 |
arg1, arg2, arg3, arg4, arg5, arg6)); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5052 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5053 |
%} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5054 |
! |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5055 |
|
1 | 5056 |
perform:aSelector withArguments:argArray |
5057 |
"send the message aSelector with all args taken from argArray |
|
44 | 5058 |
to the receiver." |
1 | 5059 |
|
77 | 5060 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
1 | 5061 |
|
5062 |
%{ |
|
5063 |
REGISTER OBJ *argP; |
|
5064 |
int nargs, i; |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5065 |
static struct inlineCache ilcSize = __ILC0(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5066 |
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
|
5067 |
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
|
5068 |
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
|
5069 |
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
|
5070 |
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
|
5071 |
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
|
5072 |
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
|
5073 |
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
|
5074 |
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
|
5075 |
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
|
5076 |
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
|
5077 |
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
|
5078 |
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
|
5079 |
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
|
5080 |
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
|
5081 |
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
|
5082 |
OBJ l; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5083 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5084 |
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */ |
71 | 5085 |
/* |
93 | 5086 |
* must set lineno in sender by hand here ... (because of NOCONTEXT) |
71 | 5087 |
*/ |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5088 |
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
|
5089 |
_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
|
5090 |
} |
71 | 5091 |
#endif |
1 | 5092 |
|
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5093 |
if (__isArray(argArray)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5094 |
nargs = __arraySize(argArray); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5095 |
argP = __ArrayInstPtr(argArray)->a_element; |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5096 |
} else { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5097 |
if (__isNonNilObject(argArray)) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5098 |
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
|
5099 |
if (!__isSmallInteger(numberOfArgs)) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5100 |
goto bad; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5101 |
nargs = __intVal(numberOfArgs); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5102 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5103 |
for (i=1; i <= nargs; i++) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5104 |
*argP++ = __AT_(argArray, __MKSMALLINT(i)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5105 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5106 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5107 |
} else { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5108 |
nargs = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5109 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5110 |
} |
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5111 |
switch (nargs) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5112 |
case 0: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5113 |
if ((InterruptPending != nil) || (aSelector != last0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5114 |
ilc0.ilc_func = __SEND0ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5115 |
if (ilc0.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5116 |
__flushPolyCache(ilc0.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5117 |
ilc0.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5118 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5119 |
last0 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5120 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5121 |
#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
|
5122 |
ilc0.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 5123 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5124 |
RETURN ((*ilc0.ilc_func)(self, aSelector, nil, &ilc0)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5125 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5126 |
case 1: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5127 |
if ((InterruptPending != nil) || (aSelector != last1)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5128 |
ilc1.ilc_func = __SEND1ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5129 |
if (ilc1.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5130 |
__flushPolyCache(ilc1.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5131 |
ilc1.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5132 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5133 |
last1 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5134 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5135 |
#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
|
5136 |
ilc1.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 5137 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5138 |
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
|
5139 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5140 |
case 2: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5141 |
if ((InterruptPending != nil) || (aSelector != last2)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5142 |
ilc2.ilc_func = __SEND2ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5143 |
if (ilc2.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5144 |
__flushPolyCache(ilc2.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5145 |
ilc2.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5146 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5147 |
last2 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5148 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5149 |
#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
|
5150 |
ilc2.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5151 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5152 |
RETURN ( (*ilc2.ilc_func)(self, aSelector, nil, &ilc2, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5153 |
argP[0], argP[1])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5154 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5155 |
case 3: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5156 |
if ((InterruptPending != nil) || (aSelector != last3)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5157 |
ilc3.ilc_func = __SEND3ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5158 |
if (ilc3.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5159 |
__flushPolyCache(ilc3.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5160 |
ilc3.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5161 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5162 |
last3 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5163 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5164 |
#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
|
5165 |
ilc3.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5166 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5167 |
RETURN ( (*ilc3.ilc_func)(self, aSelector, nil, &ilc3, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5168 |
argP[0], argP[1], argP[2])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5169 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5170 |
case 4: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5171 |
if ((InterruptPending != nil) || (aSelector != last4)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5172 |
ilc4.ilc_func = __SEND4ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5173 |
if (ilc4.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5174 |
__flushPolyCache(ilc4.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5175 |
ilc4.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5176 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5177 |
last4 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5178 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5179 |
#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
|
5180 |
ilc4.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5181 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5182 |
RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5183 |
argP[0], argP[1], argP[2], argP[3])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5184 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5185 |
case 5: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5186 |
if ((InterruptPending != nil) || (aSelector != last5)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5187 |
ilc5.ilc_func = __SEND5ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5188 |
if (ilc5.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5189 |
__flushPolyCache(ilc5.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5190 |
ilc5.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5191 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5192 |
last5 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5193 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5194 |
#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
|
5195 |
ilc5.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5196 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5197 |
RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5198 |
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
|
5199 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5200 |
case 6: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5201 |
if ((InterruptPending != nil) || (aSelector != last6)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5202 |
ilc6.ilc_func = __SEND6ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5203 |
if (ilc6.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5204 |
__flushPolyCache(ilc6.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5205 |
ilc6.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5206 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5207 |
last6 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5208 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5209 |
#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
|
5210 |
ilc6.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5211 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5212 |
RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5213 |
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
|
5214 |
argP[5])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5215 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5216 |
case 7: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5217 |
if ((InterruptPending != nil) || (aSelector != last7)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5218 |
ilc7.ilc_func = __SEND7ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5219 |
if (ilc7.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5220 |
__flushPolyCache(ilc7.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5221 |
ilc7.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5222 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5223 |
last7 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5224 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5225 |
#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
|
5226 |
ilc7.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5227 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5228 |
RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5229 |
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
|
5230 |
argP[5], argP[6])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5231 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5232 |
case 8: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5233 |
if ((InterruptPending != nil) || (aSelector != last8)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5234 |
ilc8.ilc_func = __SEND8ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5235 |
last8 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5236 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5237 |
#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
|
5238 |
ilc8.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5239 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5240 |
RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5241 |
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
|
5242 |
argP[5], argP[6], argP[7])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5243 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5244 |
case 9: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5245 |
if ((InterruptPending != nil) || (aSelector != last9)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5246 |
ilc9.ilc_func = __SEND9ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5247 |
last9 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5248 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5249 |
#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
|
5250 |
ilc9.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5251 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5252 |
RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5253 |
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
|
5254 |
argP[5], argP[6], argP[7], argP[8])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5255 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5256 |
case 10: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5257 |
if ((InterruptPending != nil) || (aSelector != last10)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5258 |
ilc10.ilc_func = __SEND10ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5259 |
last10 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5260 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5261 |
#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
|
5262 |
ilc10.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5263 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5264 |
RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5265 |
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
|
5266 |
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
|
5267 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5268 |
case 11: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5269 |
if ((InterruptPending != nil) || (aSelector != last11)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5270 |
ilc11.ilc_func = __SEND11ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5271 |
last11 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5272 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5273 |
#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
|
5274 |
ilc11.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5275 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5276 |
RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5277 |
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
|
5278 |
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
|
5279 |
argP[10])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5280 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5281 |
case 12: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5282 |
if ((InterruptPending != nil) || (aSelector != last12)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5283 |
ilc12.ilc_func = __SEND12ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5284 |
last12 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5285 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5286 |
#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
|
5287 |
ilc12.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5288 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5289 |
RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5290 |
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
|
5291 |
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
|
5292 |
argP[10], argP[11])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5293 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5294 |
case 13: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5295 |
if ((InterruptPending != nil) || (aSelector != last13)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5296 |
ilc13.ilc_func = __SEND13ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5297 |
last13 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5298 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5299 |
#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
|
5300 |
ilc13.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5301 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5302 |
RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5303 |
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
|
5304 |
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
|
5305 |
argP[10], argP[11], argP[12])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5306 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5307 |
case 14: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5308 |
if ((InterruptPending != nil) || (aSelector != last14)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5309 |
ilc14.ilc_func = __SEND14ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5310 |
last14 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5311 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5312 |
#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
|
5313 |
ilc14.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5314 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5315 |
RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5316 |
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
|
5317 |
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
|
5318 |
argP[10], argP[11], argP[12], argP[13])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5319 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5320 |
case 15: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5321 |
if ((InterruptPending != nil) || (aSelector != last15)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5322 |
ilc15.ilc_func = __SEND15ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5323 |
last15 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5324 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5325 |
#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
|
5326 |
ilc15.ilc_lineNo = __pilc->ilc_lineNo; |
77 | 5327 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5328 |
RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5329 |
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
|
5330 |
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
|
5331 |
argP[10], argP[11], argP[12], argP[13], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5332 |
argP[14])); |
1 | 5333 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5334 |
bad:; |
1626 | 5335 |
%}. |
5336 |
"/ arrive here, if bad number of arguments (too many) |
|
5337 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
5338 |
||
1 | 5339 |
^ self primitiveFailed |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5340 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5341 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5342 |
performMethod:aMethod |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5343 |
"invoke aMethod on the receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5344 |
The method should be a zero-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5345 |
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
|
5346 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5347 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5348 |
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
|
5349 |
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
|
5350 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5351 |
^ aMethod valueWithReceiver:self arguments:#() |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5352 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5353 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5354 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5355 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5356 |
mthd := SmallInteger compiledMethodAt:#negated. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5357 |
Transcript showCR:(1 performMethod:mthd) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5358 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5359 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5360 |
"BAD USE example: |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5361 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5362 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5363 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5364 |
mthd := Point compiledMethodAt:#x. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5365 |
Transcript showCR:((1->2) performMethod:mthd) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5366 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5367 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5368 |
"Modified: 31.7.1997 / 17:41:50 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5369 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5370 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5371 |
performMethod:aMethod arguments:argumentArray |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5372 |
"invoke aMethod on the receiver, passing an argumentArray. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5373 |
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
|
5374 |
expected by the method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5375 |
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
|
5376 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5377 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5378 |
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
|
5379 |
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
|
5380 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5381 |
^ aMethod valueWithReceiver:self arguments:argumentArray |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5382 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5383 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5384 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5385 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5386 |
mthd := SmallInteger compiledMethodAt:#+. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5387 |
Transcript showCR:(1 performMethod:mthd arguments:#(2)) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5388 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5389 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5390 |
"Created: 31.7.1997 / 17:46:31 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5391 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5392 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5393 |
performMethod:aMethod with:arg |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5394 |
"invoke aMethod on the receiver, passing an argument. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5395 |
The method should be a one-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5396 |
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
|
5397 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5398 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5399 |
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
|
5400 |
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
|
5401 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5402 |
^ aMethod valueWithReceiver:self arguments:(Array with:arg) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5403 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5404 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5405 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5406 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5407 |
mthd := SmallInteger compiledMethodAt:#+. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5408 |
Transcript showCR:(1 performMethod:mthd with:2) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5409 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5410 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5411 |
"Modified: 31.7.1997 / 17:42:32 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5412 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5413 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5414 |
performMethod:aMethod with:arg1 with:arg2 |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5415 |
"invoke aMethod on the receiver, passing two arguments. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5416 |
The method should be a two-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5417 |
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
|
5418 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5419 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5420 |
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
|
5421 |
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
|
5422 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5423 |
^ 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
|
5424 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5425 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5426 |
|mthd arr| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5427 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5428 |
arr := Array new:1. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5429 |
mthd := Array compiledMethodAt:#basicAt:put:. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5430 |
arr performMethod:mthd with:1 with:'foo'. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5431 |
Transcript showCR:arr |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5432 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5433 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5434 |
"Modified: 31.7.1997 / 17:44:54 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5435 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5436 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5437 |
performMethod:aMethod with:arg1 with:arg2 with:arg3 |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5438 |
"invoke aMethod on the receiver, passing three arguments. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5439 |
The method should be a three-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5440 |
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
|
5441 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5442 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5443 |
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
|
5444 |
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
|
5445 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5446 |
^ 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
|
5447 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5448 |
"Created: 31.7.1997 / 17:45:20 / cg" |
1 | 5449 |
! ! |
5450 |
||
5451 |
!Object methodsFor:'printing & storing'! |
|
5452 |
||
5453 |
className |
|
5454 |
"return the classname of the receivers class" |
|
5455 |
||
5456 |
^ self class name |
|
56 | 5457 |
|
293 | 5458 |
" |
5459 |
1 className |
|
5460 |
1 class className 'this may change ...' |
|
5461 |
$a className |
|
5462 |
$a class className 'this may change ...' |
|
5463 |
" |
|
1 | 5464 |
! |
5465 |
||
5466 |
classNameWithArticle |
|
71 | 5467 |
"return a string consisting of classname preceeded by an article. |
5468 |
(dont expect me to write national variants for this ... :-) |
|
5469 |
If you have special preferences, redefine it ..." |
|
1 | 5470 |
|
1391 | 5471 |
|classname cls| |
5472 |
||
5473 |
(cls := self class) == self ifTrue:[ |
|
2647 | 5474 |
^ 'a funny object' |
1391 | 5475 |
]. |
5476 |
classname := cls displayString. |
|
85 | 5477 |
^ classname article , ' ' , classname |
56 | 5478 |
|
293 | 5479 |
" |
5480 |
1 classNameWithArticle |
|
5481 |
(1->2) classNameWithArticle |
|
5482 |
XWorkstation basicNew classNameWithArticle |
|
5483 |
" |
|
1391 | 5484 |
|
5485 |
"Modified: 13.5.1996 / 12:16:14 / cg" |
|
1 | 5486 |
! |
5487 |
||
783 | 5488 |
errorPrint |
5489 |
"print the receiver on the standard error stream." |
|
5490 |
||
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5491 |
Stream streamErrorSignal catch:[ |
2647 | 5492 |
self printOn:Stderr |
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5493 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5494 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5495 |
"Modified: 7.3.1996 / 19:11:29 / cg" |
783 | 5496 |
! |
5497 |
||
1425 | 5498 |
errorPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5499 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5500 |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5501 |
"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
|
5502 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5503 |
Stream streamErrorSignal catch:[ |
2647 | 5504 |
self printOn:Stderr. |
5505 |
Stderr cr |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5506 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5507 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5508 |
"Modified: 7.3.1996 / 19:13:01 / cg" |
1425 | 5509 |
"Created: 20.5.1996 / 10:20:41 / cg" |
5510 |
! |
|
5511 |
||
5512 |
errorPrintNL |
|
5513 |
"{ Pragma: +optSpace }" |
|
5514 |
||
5515 |
"print the receiver followed by a cr on the standard error stream. |
|
5516 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
5517 |
||
5518 |
^ self errorPrintCR |
|
5519 |
||
5520 |
"Modified: 20.5.1996 / 10:24:45 / cg" |
|
5521 |
! |
|
5522 |
||
5523 |
errorPrintNewline |
|
5524 |
"{ Pragma: +optSpace }" |
|
5525 |
||
5526 |
"print the receiver followed by a cr on the standard error stream. |
|
5527 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
5528 |
||
5529 |
self errorPrintCR. |
|
5530 |
||
5531 |
"Modified: 20.5.1996 / 10:24:38 / cg" |
|
71 | 5532 |
! |
5533 |
||
356 | 5534 |
infoPrint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5535 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5536 |
|
356 | 5537 |
"print the receiver on the standard error stream. |
5538 |
This is meant for information messages which are not warnings |
|
5539 |
or fatal messages. |
|
5540 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
5541 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5542 |
InfoPrinting == true ifTrue:[ |
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5543 |
self errorPrint |
356 | 5544 |
] |
5545 |
! |
|
5546 |
||
1425 | 5547 |
infoPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5548 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5549 |
|
356 | 5550 |
"print the receiver followed by a cr on the standard error stream. |
5551 |
This is meant for information messages which are not warnings |
|
5552 |
or fatal messages. |
|
5553 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
5554 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5555 |
InfoPrinting == true ifTrue:[ |
2647 | 5556 |
self errorPrintCR |
356 | 5557 |
] |
1425 | 5558 |
|
5559 |
"Created: 20.5.1996 / 10:21:28 / cg" |
|
5560 |
! |
|
5561 |
||
5562 |
infoPrintNL |
|
5563 |
"{ Pragma: +optSpace }" |
|
5564 |
||
5565 |
"print the receiver followed by a cr on the standard error stream. |
|
5566 |
This is meant for information messages which are not warnings |
|
5567 |
or fatal messages. |
|
5568 |
These messages can be turned on/off by 'Object infoPrinting:true/false'. |
|
5569 |
||
5570 |
Please use #infoPrintCR - this method exists for backward compatibility." |
|
5571 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5572 |
^ self infoPrintCR |
1425 | 5573 |
|
5574 |
"Modified: 20.5.1996 / 10:25:07 / cg" |
|
356 | 5575 |
! |
5576 |
||
783 | 5577 |
|
1887 | 5578 |
"print the receiver on the standard output stream (which is not the Transcript)" |
783 | 5579 |
|
5580 |
self printOn:Stdout |
|
1887 | 5581 |
|
5582 |
"Modified: 4.11.1996 / 23:36:58 / cg" |
|
783 | 5583 |
! |
5584 |
||
1425 | 5585 |
printCR |
1887 | 5586 |
"print the receiver followed by a cr on the standard output stream (which is not the Transcript)" |
783 | 5587 |
|
5588 |
self printOn:Stdout. |
|
5589 |
Stdout cr |
|
1425 | 5590 |
|
5591 |
"Created: 20.5.1996 / 10:21:37 / cg" |
|
1887 | 5592 |
"Modified: 4.11.1996 / 23:37:06 / cg" |
1425 | 5593 |
! |
5594 |
||
5595 |
printNL |
|
5596 |
"print the receiver followed by a cr on the standard output stream |
|
5597 |
This exists for GNU Smalltalk compatibility - please use #printCR." |
|
5598 |
||
5599 |
^ self printCR |
|
5600 |
||
5601 |
"Modified: 20.5.1996 / 10:25:31 / cg" |
|
5602 |
! |
|
5603 |
||
5604 |
printNewline |
|
5605 |
"print the receiver followed by a cr on the standard output stream. |
|
5606 |
This exists for backward compatibility - please use #printCR." |
|
5607 |
||
5608 |
self printCR |
|
5609 |
||
5610 |
"Modified: 20.5.1996 / 10:25:46 / cg" |
|
783 | 5611 |
! |
5612 |
||
5613 |
printOn:aStream |
|
4392 | 5614 |
"append a user printed representation of the receiver to aStream. |
5615 |
The format is suitable for a human - not meant to be read back. |
|
5616 |
||
783 | 5617 |
The default here is to output the receivers class name. |
5618 |
BUT: this method is heavily redefined for objects which |
|
5619 |
can print prettier." |
|
5620 |
||
5621 |
aStream nextPutAll:self classNameWithArticle |
|
5622 |
! |
|
5623 |
||
5624 |
printOn:aStream leftPaddedTo:size |
|
5625 |
"print the receiver on aStream, padding with spaces up to size. |
|
5626 |
padding is done on the left." |
|
5627 |
||
5628 |
self printOn:aStream leftPaddedTo:size with:(Character space) |
|
5629 |
||
5630 |
" |
|
5631 |
123 printOn:Transcript leftPaddedTo:10. Transcript cr |
|
5632 |
123 printOn:Transcript leftPaddedTo:2. Transcript cr |
|
5633 |
" |
|
71 | 5634 |
! |
5635 |
||
783 | 5636 |
printOn:aStream leftPaddedTo:size with:padCharacter |
5637 |
"print the receiver on aStream, padding with padCharacters up to size. |
|
5638 |
padding is done on the left." |
|
5639 |
||
5640 |
aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter) |
|
5641 |
||
5642 |
" |
|
5643 |
123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr |
|
5644 |
123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr |
|
5645 |
" |
|
5646 |
! |
|
5647 |
||
5648 |
printOn:aStream paddedTo:size |
|
5649 |
"print the receiver on aStream, padding with spaces up to size." |
|
5650 |
||
5651 |
self printOn:aStream paddedTo:size with:(Character space) |
|
5652 |
||
5653 |
" |
|
5654 |
123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr |
|
5655 |
" |
|
71 | 5656 |
! |
5657 |
||
783 | 5658 |
printOn:aStream paddedTo:size with:padCharacter |
5659 |
"print the receiver on aStream, padding with padCharacter up to size" |
|
5660 |
||
5661 |
aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter). |
|
5662 |
||
5663 |
" |
|
5664 |
123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr |
|
5665 |
123 printOn:Transcript paddedTo:10 with:$. . Transcript cr |
|
5666 |
" |
|
5667 |
! |
|
5668 |
||
5669 |
printOn:aStream zeroPaddedTo:size |
|
5670 |
"print the receiver on aStream, padding with zeros up to size. |
|
5671 |
Usually used with float numbers." |
|
5672 |
||
5673 |
self printOn:aStream paddedTo:size with:$0. |
|
5674 |
||
5675 |
" |
|
5676 |
123.0 printOn:Transcript zeroPaddedTo:10 |
|
5677 |
" |
|
5678 |
! |
|
5679 |
||
5680 |
printRightAdjustLen:size |
|
5681 |
"obsolete - just a name confusion. |
|
5682 |
This method will go away ..." |
|
5683 |
||
5684 |
(self printStringLeftPaddedTo:size) printOn:Stdout |
|
71 | 5685 |
! |
5686 |
||
5687 |
printString |
|
5688 |
"return a string for printing the receiver. |
|
5689 |
Since we now use printOn: as the basic print mechanism, |
|
5690 |
we have to create a stream and print into it." |
|
5691 |
||
5692 |
|s| |
|
5693 |
||
5694 |
s := WriteStream on:(String new:30). |
|
5695 |
self printOn:s. |
|
5696 |
^ s contents |
|
5697 |
! |
|
5698 |
||
783 | 5699 |
printStringLeftPaddedTo:size |
5700 |
"return my printString as a right-adjusted string of length size; |
|
5701 |
characters on the left are filled with spaces. |
|
5702 |
If the printString is longer than size, |
|
5703 |
it is returned unchanged (i.e. not truncated)" |
|
5704 |
||
5705 |
^ self printStringLeftPaddedTo:size with:(Character space) |
|
5706 |
||
5707 |
" |
|
5708 |
10 printStringLeftPaddedTo:10 |
|
5709 |
1 printStringLeftPaddedTo:10 |
|
5710 |
" |
|
5711 |
! |
|
5712 |
||
5713 |
printStringLeftPaddedTo:size ifLarger:alternative |
|
5714 |
"return my printString as a right-adjusted string of length size; |
|
5715 |
characters on the left are filled with spaces. |
|
5716 |
If the printString is larger than size, |
|
5717 |
return the result from evaluating alternative." |
|
5718 |
||
5719 |
^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative |
|
5720 |
||
5721 |
" |
|
5722 |
12 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5723 |
123 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5724 |
1234 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5725 |
" |
|
5726 |
! |
|
5727 |
||
5728 |
printStringLeftPaddedTo:size with:padCharacter |
|
5729 |
"return my printString as a right-adjusted string of length size; |
|
5730 |
characters on the left are filled with padCharacter. |
|
5731 |
If the printString is longer than size, |
|
5732 |
it is returned unchanged (i.e. not truncated)" |
|
5733 |
||
5734 |
^ (self printString) leftPaddedTo:size with:padCharacter |
|
5735 |
||
5736 |
" |
|
5737 |
123 printStringLeftPaddedTo:10 with:$. |
|
5738 |
1 printStringLeftPaddedTo:10 with:$. |
|
5739 |
(Float pi) printStringLeftPaddedTo:20 with:$* |
|
5740 |
" |
|
5741 |
! |
|
5742 |
||
5743 |
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative |
|
5744 |
"return my printString as a right-adjusted string of length size; |
|
5745 |
characters on the left are filled with padCharacter. |
|
5746 |
If the printString is larger than size, |
|
369 | 5747 |
return the result from evaluating alternative." |
5748 |
||
5749 |
|s| |
|
5750 |
||
5751 |
s := self printString. |
|
5752 |
s size > size ifTrue:[^ alternative value]. |
|
783 | 5753 |
^ s leftPaddedTo:size with:padCharacter |
369 | 5754 |
|
5755 |
" |
|
783 | 5756 |
12 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
5757 |
123 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
5758 |
1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
293 | 5759 |
" |
13 | 5760 |
! |
5761 |
||
5762 |
printStringPaddedTo:size |
|
56 | 5763 |
"return a printed representation of the receiver, |
369 | 5764 |
padded with spaces (at the right) up to size. |
293 | 5765 |
If the printString is longer than size, |
5766 |
it is returned unchanged (i.e. not truncated)" |
|
13 | 5767 |
|
5768 |
^ self printStringPaddedTo:size with:(Character space) |
|
5769 |
||
293 | 5770 |
" |
5771 |
123 printStringPaddedTo:10 |
|
5772 |
1234567890123456 printStringPaddedTo:10 |
|
5773 |
'hello' printStringPaddedTo:10 |
|
5774 |
" |
|
2 | 5775 |
! |
5776 |
||
369 | 5777 |
printStringPaddedTo:size ifLarger:alternative |
5778 |
"return a printed representation of the receiver, |
|
5779 |
padded with spaces (at the right) up to size. |
|
5780 |
If the resulting printString is too large, |
|
5781 |
return the result from evaluating alternative." |
|
5782 |
||
5783 |
^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative |
|
5784 |
||
5785 |
" |
|
5786 |
12 printStringPaddedTo:3 ifLarger:['***'] |
|
5787 |
123 printStringPaddedTo:3 ifLarger:['***'] |
|
5788 |
1234 printStringPaddedTo:3 ifLarger:['***'] |
|
5789 |
" |
|
5790 |
! |
|
5791 |
||
783 | 5792 |
printStringPaddedTo:size with:padCharacter |
5793 |
"return a printed representation of the receiver, |
|
5794 |
padded with padCharacter (at the right) up to size. |
|
5795 |
If the printString is longer than size, |
|
5796 |
it is returned unchanged (i.e. not truncated)" |
|
5797 |
||
5798 |
^ (self printString) paddedTo:size with:padCharacter |
|
5799 |
||
5800 |
" |
|
5801 |
123 printStringPaddedTo:10 with:$. |
|
5802 |
123 printStringPaddedTo:10 with:$* |
|
5803 |
123 printStringPaddedTo:3 with:$* |
|
5804 |
1234 printStringPaddedTo:3 with:$* |
|
5805 |
" |
|
5806 |
! |
|
5807 |
||
5808 |
printStringPaddedTo:size with:padCharacter ifLarger:alternative |
|
5809 |
"return a printed representation of the receiver, |
|
5810 |
padded with padCharacter (at the right) up to size. |
|
5811 |
If the resulting printString is too large, |
|
5812 |
return the result from evaluating alternative." |
|
5813 |
||
5814 |
|s| |
|
5815 |
||
5816 |
s := self printString. |
|
5817 |
s size > size ifTrue:[^ alternative value]. |
|
5818 |
^ s paddedTo:size with:padCharacter |
|
5819 |
||
5820 |
" |
|
5821 |
123 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
5822 |
12345 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
5823 |
" |
|
5824 |
! |
|
5825 |
||
5826 |
printStringRightAdjustLen:size |
|
5827 |
"obsolete - just a name confusion. |
|
5828 |
This method will go away ..." |
|
5829 |
||
5830 |
^ self printStringLeftPaddedTo:size |
|
5831 |
! |
|
5832 |
||
2 | 5833 |
printStringZeroPaddedTo:size |
71 | 5834 |
"return a printed representation of the receiver, |
369 | 5835 |
padded with zero (at the right) characters up to size. |
13 | 5836 |
Usually used with float numbers." |
2 | 5837 |
|
5838 |
^ self printStringPaddedTo:size with:$0 |
|
13 | 5839 |
|
293 | 5840 |
" |
5841 |
123.0 printStringZeroPaddedTo:10 |
|
5842 |
" |
|
2 | 5843 |
! |
5844 |
||
783 | 5845 |
store |
5846 |
"store the receiver on standard output. |
|
5847 |
this method is useless, but included for compatibility." |
|
5848 |
||
5849 |
self storeOn:Stdout |
|
71 | 5850 |
! |
5851 |
||
1425 | 5852 |
storeCR |
5853 |
"store the receiver on standard output; append a carriage return." |
|
5854 |
||
5855 |
self store. |
|
5856 |
Character cr print |
|
5857 |
||
5858 |
"Created: 20.5.1996 / 10:26:01 / cg" |
|
5859 |
"Modified: 20.5.1996 / 10:26:57 / cg" |
|
5860 |
! |
|
5861 |
||
783 | 5862 |
storeNl |
5863 |
"store the receiver on standard output; append a newline. |
|
1425 | 5864 |
This method is included for backward compatibility- use #storeCR." |
5865 |
||
5866 |
self storeCR. |
|
5867 |
||
5868 |
"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
|
5869 |
! |
7e058858cc3b
New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents:
446
diff
changeset
|
5870 |
|
56 | 5871 |
storeOn:aStream |
5872 |
"store the receiver on aStream; i.e. print an expression which will |
|
293 | 5873 |
reconstruct the receiver. |
5874 |
Notice, that no self referencing or cyclic objects can be represented |
|
5875 |
in this format. |
|
5876 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 5877 |
|
5878 |
|myClass hasSemi sz "{ Class: SmallInteger }" | |
|
1 | 5879 |
|
25 | 5880 |
thisContext isRecursive ifTrue:[ |
2647 | 5881 |
('Object [error]: storeString of self referencing object.') errorPrintCR. |
5882 |
aStream nextPutAll:'#("recursive")'. |
|
5883 |
^ self |
|
25 | 5884 |
]. |
56 | 5885 |
|
1 | 5886 |
myClass := self class. |
56 | 5887 |
aStream nextPut:$(. |
5888 |
aStream nextPutAll:self class name. |
|
5889 |
||
1 | 5890 |
hasSemi := false. |
5891 |
myClass isVariable ifTrue:[ |
|
2647 | 5892 |
aStream nextPutAll:' basicNew:'. |
5893 |
self basicSize printOn:aStream |
|
1 | 5894 |
] ifFalse:[ |
2647 | 5895 |
aStream nextPutAll:' basicNew' |
1 | 5896 |
]. |
56 | 5897 |
|
1 | 5898 |
sz := myClass instSize. |
5899 |
1 to:sz do:[:i | |
|
2647 | 5900 |
aStream nextPutAll:' instVarAt:'. |
5901 |
i printOn:aStream. |
|
5902 |
aStream nextPutAll:' put:'. |
|
5903 |
(self instVarAt:i) storeOn:aStream. |
|
5904 |
aStream nextPut:$;. |
|
5905 |
hasSemi := true |
|
1 | 5906 |
]. |
5907 |
myClass isVariable ifTrue:[ |
|
2647 | 5908 |
sz := self basicSize. |
5909 |
1 to:sz do:[:i | |
|
5910 |
aStream nextPutAll:' basicAt:'. |
|
5911 |
i printOn:aStream. |
|
5912 |
aStream nextPutAll:' put:'. |
|
5913 |
(self basicAt:i) storeOn:aStream. |
|
5914 |
aStream nextPut:$;. |
|
5915 |
hasSemi := true |
|
5916 |
] |
|
1 | 5917 |
]. |
5918 |
hasSemi ifTrue:[ |
|
2647 | 5919 |
aStream nextPutAll:' yourself' |
1 | 5920 |
]. |
56 | 5921 |
aStream nextPut:$). |
293 | 5922 |
|
5923 |
" |
|
5924 |
|s| |
|
5925 |
||
5926 |
s := WriteStream on:(String new). |
|
5927 |
('hello' -> 'world') storeOn:s. |
|
5928 |
s := ReadStream on:(s contents). |
|
5929 |
(Object readFrom:s) inspect |
|
5930 |
" |
|
5931 |
" |
|
5932 |
|s| |
|
5933 |
||
5934 |
s := 'data' asFilename writeStream. |
|
5935 |
('hello' -> 'world') storeOn:s. |
|
5936 |
s close. |
|
5937 |
||
5938 |
s := 'data' asFilename readStream. |
|
5939 |
(Object readFrom:s) inspect |
|
5940 |
" |
|
5941 |
||
5942 |
"does not work example:" |
|
5943 |
" |
|
5944 |
|s a| |
|
5945 |
||
5946 |
a := Array new:2. |
|
5947 |
a at:1 put:a. |
|
5948 |
||
5949 |
s := 'data' asFilename writeStream. |
|
5950 |
a storeOn:s. |
|
5951 |
s close. |
|
5952 |
||
5953 |
s := 'data' asFilename readStream. |
|
5954 |
(Object readFrom:s) inspect |
|
5955 |
" |
|
1417 | 5956 |
|
2287 | 5957 |
"Modified: 28.1.1997 / 00:36:12 / cg" |
1 | 5958 |
! |
5959 |
||
56 | 5960 |
storeString |
293 | 5961 |
"return a string representing an expression to reconstruct the receiver. |
5962 |
Notice, that no self referencing or cyclic objects can be represented |
|
5963 |
in this format. |
|
5964 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 5965 |
|
5966 |
|s| |
|
5967 |
||
5968 |
s := WriteStream on:(String new:50). |
|
5969 |
self storeOn:s. |
|
5970 |
^ s contents |
|
783 | 5971 |
! ! |
5972 |
||
5973 |
!Object methodsFor:'queries'! |
|
5974 |
||
5975 |
basicSize |
|
5976 |
"return the number of the receivers indexed instance variables, |
|
5977 |
0 if it has none. |
|
5978 |
||
2148 | 5979 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
783 | 5980 |
|
5981 |
%{ /* NOCONTEXT */ |
|
5982 |
||
5983 |
REGISTER int nbytes; |
|
5984 |
REGISTER OBJ myClass; |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5985 |
int nInstBytes; |
783 | 5986 |
|
5987 |
/* |
|
5988 |
* notice the missing test for self being a nonNilObject - |
|
5989 |
* this can be done since basicSize is defined both in UndefinedObject |
|
5990 |
* and SmallInteger |
|
5991 |
*/ |
|
5992 |
myClass = __qClass(self); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5993 |
nbytes = __qSize(self); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5994 |
nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) ); |
1133 | 5995 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5996 |
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
|
5997 |
case __MASKSMALLINT(POINTERARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5998 |
case __MASKSMALLINT(WKPOINTERARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5999 |
nbytes -= nInstBytes; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
6000 |
RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) ); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
6001 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
6002 |
case __MASKSMALLINT(BYTEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6003 |
nbytes -= nInstBytes; |
2647 | 6004 |
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
|
6005 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
6006 |
case __MASKSMALLINT(FLOATARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6007 |
nbytes -= nInstBytes; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
6008 |
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
|
6009 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
6010 |
case __MASKSMALLINT(DOUBLEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6011 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6012 |
nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1); |
783 | 6013 |
#endif |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6014 |
nbytes -= nInstBytes; |
2647 | 6015 |
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
|
6016 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
6017 |
case __MASKSMALLINT(WORDARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
6018 |
case __MASKSMALLINT(SWORDARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6019 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6020 |
RETURN ( __MKSMALLINT(nbytes>>1) ); /* notice the hardcoded 2 here - not sizeof(short) */ |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
6021 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
6022 |
case __MASKSMALLINT(LONGARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
6023 |
case __MASKSMALLINT(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6024 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6025 |
RETURN ( __MKSMALLINT(nbytes>>2) ); /* notice the hardcoded 4 here - not sizeof(int) */ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6026 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6027 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6028 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6029 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6030 |
nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6031 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6032 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6033 |
RETURN ( __MKSMALLINT(nbytes>>3) ); /* notice the hardcoded 8 here - not sizeof(long long) */ |
783 | 6034 |
} |
6035 |
%}. |
|
6036 |
^ 0 |
|
1 | 6037 |
! |
6038 |
||
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6039 |
byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6040 |
"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
|
6041 |
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
|
6042 |
instvars i.e. byteArrays, wordArrays etc. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6043 |
Notice: for Strings the returned size may look strange. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6044 |
Only useful with binary storage." |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6045 |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6046 |
|myClass| |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6047 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6048 |
myClass := self class. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6049 |
myClass isVariable ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6050 |
myClass isPointers ifFalse:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6051 |
myClass isBytes ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6052 |
^ self basicSize. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6053 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6054 |
myClass isWords ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6055 |
^ self basicSize * 2. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6056 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6057 |
myClass isSignedWords ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6058 |
^ self basicSize * 2. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6059 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6060 |
myClass isLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6061 |
^ self basicSize * 4. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6062 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6063 |
myClass isSignedLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6064 |
^ self basicSize * 4. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6065 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6066 |
myClass isLongLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6067 |
^ self basicSize * 8. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6068 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6069 |
myClass isSignedLongLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6070 |
^ self basicSize * 8. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6071 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6072 |
myClass isFloats ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6073 |
^ self basicSize * %{ __MKSMALLINT(sizeof(float)) %}. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6074 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6075 |
myClass isDoubles ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6076 |
^ self basicSize * %{ __MKSMALLINT(sizeof(double)) %}. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6077 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6078 |
self halt:'oops'. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6079 |
] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6080 |
]. |
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6081 |
^ 0 |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6082 |
|
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6083 |
" |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6084 |
Point new byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6085 |
'hello' byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6086 |
(ByteArray with:1 with:2) byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6087 |
(FloatArray with:1.5) byteSize |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6088 |
(DoubleArray with:1.5) byteSize |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6089 |
(WordArray with:1 with:2) byteSize |
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6090 |
" |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6091 |
! |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6092 |
|
783 | 6093 |
class |
6094 |
"return the receivers class" |
|
6095 |
||
6096 |
%{ /* NOCONTEXT */ |
|
6097 |
||
6098 |
RETURN ( __Class(self) ); |
|
6099 |
%} |
|
6100 |
! |
|
6101 |
||
6102 |
respondsTo:aSelector |
|
6103 |
"return true, if the receiver implements a method with selector equal |
|
6104 |
to aSelector; i.e. if there is a method for aSelector in either the |
|
6105 |
receivers class or one of its superclasses. |
|
6106 |
||
6107 |
Notice, that this does not imply, that such a message can be sent without |
|
6108 |
an error being raised. For example, an implementation could send |
|
6109 |
#shouldNotImplement or #subclassResponsibility." |
|
6110 |
||
6111 |
" |
|
6112 |
should we go via the cache, or search (by class) ? |
|
6113 |
The first is faster, most of the time; while the 2nd fills |
|
6114 |
the cache with useless data if this is sent in a loop over all objects. |
|
6115 |
For now, use the cache ... |
|
6116 |
" |
|
6117 |
%{ /* NOCONTEXT */ |
|
6118 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
6119 |
if (__lookup(__Class(self), aSelector) == nil) { |
783 | 6120 |
RETURN ( false ); |
6121 |
} |
|
6122 |
RETURN ( true ); |
|
6123 |
%} |
|
6124 |
. |
|
6125 |
" |
|
6126 |
^ self class canUnderstand:aSelector |
|
6127 |
" |
|
6128 |
||
6129 |
"'aString' respondsTo:#+" |
|
6130 |
"'aString' respondsTo:#," |
|
6131 |
"'aString' respondsTo:#collect:" |
|
6132 |
! |
|
6133 |
||
6134 |
respondsToArithmetic |
|
6135 |
"return true, if the receiver responds to arithmetic messages. |
|
6136 |
false is returned here - the method is redefined in ArithmeticValue." |
|
6137 |
||
6138 |
^ false |
|
6139 |
! |
|
6140 |
||
6141 |
size |
|
6142 |
"return the number of the receivers indexed instance variables; |
|
6143 |
this method may be redefined in subclasses" |
|
6144 |
||
6145 |
^ self basicSize |
|
6146 |
! |
|
6147 |
||
6148 |
species |
|
6149 |
"return a class which is similar to (or the same as) the receivers class. |
|
6150 |
This is used to create an appropriate object when creating derived |
|
6151 |
copies in the collection classes (sometimes redefined)." |
|
6152 |
||
6153 |
^ self class |
|
6154 |
! |
|
6155 |
||
6156 |
yourself |
|
6157 |
"return the receiver - used for cascades to return self at the end" |
|
6158 |
||
6159 |
^ self |
|
6160 |
! ! |
|
6161 |
||
6162 |
!Object methodsFor:'secure message sending'! |
|
6163 |
||
6164 |
askFor:aSelector |
|
6165 |
"try to send the receiver the message, aSelector. |
|
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6166 |
If it does not understand it, return false. |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6167 |
Otherwise the real value returned. |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6168 |
Useful to send messages such as: #isColor to unknown |
783 | 6169 |
receivers." |
6170 |
||
6171 |
^ self perform:aSelector ifNotUnderstood:[false] |
|
6172 |
||
6173 |
" |
|
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6174 |
1 askFor:#isColor |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6175 |
Color red askFor:#isColor |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6176 |
|
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6177 |
1 askFor:#isFoo |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6178 |
Color red askFor:#isFoo |
783 | 6179 |
" |
6180 |
! |
|
6181 |
||
6182 |
perform:aSelector ifNotUnderstood:exceptionBlock |
|
6183 |
"try to send message aSelector to the receiver. |
|
6184 |
If its understood, return the methods returned value, |
|
6185 |
otherwise return the value of the exceptionBlock" |
|
6186 |
||
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6187 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6188 |
|
783 | 6189 |
MessageNotUnderstoodSignal handle:[:ex | |
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6190 |
"/ reject, if the bad message is not the one |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6191 |
"/ we have sent originally |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6192 |
ex parameter selector == aSelector ifFalse:[ |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6193 |
ex reject |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6194 |
] |
783 | 6195 |
] do:[ |
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6196 |
val := self perform:aSelector. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6197 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6198 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6199 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6200 |
^ exceptionBlock value |
783 | 6201 |
]. |
6202 |
^ val |
|
6203 |
||
6204 |
" |
|
6205 |
1.2345 perform:#foo ifNotUnderstood:['sorry'] |
|
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6206 |
1.2345 perform:#sqrt ifNotUnderstood:['sorry'] |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6207 |
12345 perform:#sqrt ifNotUnderstood:['sorry'] |
783 | 6208 |
" |
1 | 6209 |
! |
6210 |
||
783 | 6211 |
perform:aSelector with:argument ifNotUnderstood:exceptionBlock |
6212 |
"try to send message aSelector to the receiver. |
|
6213 |
If its understood, return the methods returned value, |
|
6214 |
otherwise return the value of the exceptionBlock" |
|
6215 |
||
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6216 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6217 |
|
783 | 6218 |
MessageNotUnderstoodSignal handle:[:ex | |
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6219 |
"/ reject, if the bad message is not the one |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6220 |
"/ we have sent originally |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6221 |
ex parameter selector == aSelector ifFalse:[ |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6222 |
ex reject |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6223 |
] |
783 | 6224 |
] do:[ |
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6225 |
val := self perform:aSelector with:argument. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6226 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6227 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6228 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6229 |
^ exceptionBlock value |
783 | 6230 |
]. |
6231 |
^ val |
|
6232 |
||
6233 |
" |
|
6234 |
|unknown| |
|
6235 |
||
6236 |
unknown := 1. |
|
6237 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
6238 |
unknown := 'high there'. |
|
6239 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
6240 |
" |
|
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6241 |
! |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6242 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6243 |
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6244 |
"try to send message aSelector to the receiver. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6245 |
If its understood, return the methods returned value, |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6246 |
otherwise return the value of the exceptionBlock" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6247 |
|
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6248 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6249 |
|
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6250 |
MessageNotUnderstoodSignal handle:[:ex | |
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6251 |
"/ reject, if the bad message is not the one |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6252 |
"/ we have sent originally |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6253 |
ex parameter selector == aSelector ifFalse:[ |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6254 |
ex reject |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6255 |
] |
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6256 |
] do:[ |
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6257 |
val := self perform:aSelector withArguments:argumentArray. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6258 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6259 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6260 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6261 |
^ exceptionBlock value |
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6262 |
]. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6263 |
^ val |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6264 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6265 |
" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6266 |
|unknown| |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6267 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6268 |
unknown := 1. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6269 |
(unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6270 |
unknown := 'high there'. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6271 |
(unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6272 |
" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6273 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6274 |
"Modified: 27.3.1997 / 14:13:16 / cg" |
783 | 6275 |
! ! |
6276 |
||
2448 | 6277 |
!Object methodsFor:'signal constants'! |
6278 |
||
6279 |
messageNotUnderstoodSignal |
|
6280 |
^ MessageNotUnderstoodSignal |
|
6281 |
||
6282 |
"Created: 6.3.1997 / 15:46:52 / cg" |
|
6283 |
! ! |
|
6284 |
||
783 | 6285 |
!Object methodsFor:'special queries'! |
6286 |
||
6287 |
allOwners |
|
6288 |
"return a collection of all objects referencing the receiver" |
|
6289 |
||
6290 |
^ ObjectMemory whoReferences:self |
|
6291 |
! |
|
6292 |
||
6293 |
references:anObject |
|
6294 |
"return true, if the receiver refers to the argument, anObject. |
|
6295 |
- for debugging only" |
|
6296 |
||
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6297 |
%{ /* NOCONTEXT */ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6298 |
OBJ cls, flags; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6299 |
int nInsts, i; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6300 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6301 |
if (! __isNonNilObject(self)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6302 |
RETURN (false); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6303 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6304 |
|
783 | 6305 |
/* |
6306 |
* a little optimization: use the fact that all old objects |
|
6307 |
* refering to a new object are on the remSet; if I am not, |
|
6308 |
* a trivial reject is possible, if anObject is a newbee |
|
6309 |
*/ |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6310 |
if (__isNonNilObject(anObject)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6311 |
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
|
6312 |
int spc; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6313 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6314 |
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
|
6315 |
RETURN (false); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6316 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6317 |
} |
783 | 6318 |
} |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6319 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6320 |
cls = __qClass(self); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6321 |
if (cls == anObject) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6322 |
RETURN (true); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6323 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6324 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6325 |
flags = __ClassInstPtr(cls)->c_flags; |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
6326 |
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
|
6327 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6328 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6329 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6330 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6331 |
if (! nInsts) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6332 |
RETURN (false); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6333 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6334 |
#if defined(memsrch4) |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6335 |
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
|
6336 |
RETURN (true); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6337 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6338 |
#else |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6339 |
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
|
6340 |
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
|
6341 |
RETURN (true); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6342 |
} |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6343 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6344 |
#endif /* memsrch4 */ |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6345 |
|
783 | 6346 |
%}. |
6347 |
||
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6348 |
"/ |myClass |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6349 |
"/ numInst "{ Class: SmallInteger }" | |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6350 |
"/ |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6351 |
"/ myClass := self class. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6352 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6353 |
"/ "check the class" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6354 |
"/ (myClass == anObject) ifTrue:[^ true]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6355 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6356 |
"/ "check the instance variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6357 |
"/ numInst := myClass instSize. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6358 |
"/ 1 to:numInst do:[:i | |
2647 | 6359 |
"/ ((self instVarAt:i) == anObject) ifTrue:[^ true] |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6360 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6361 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6362 |
"/ "check the indexed variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6363 |
"/ myClass isVariable ifTrue:[ |
2647 | 6364 |
"/ myClass isPointers ifFalse:[ |
6365 |
"/ "/ |
|
6366 |
"/ "/ we could argue about the following unconditional return: |
|
6367 |
"/ "/ it says that a non pointer array never has a reference to the |
|
6368 |
"/ "/ corresponding object - not mimicing a reference to a copy of the |
|
6369 |
"/ "/ integer. However, it avoids useless searches in huge byteArray |
|
6370 |
"/ "/ like objects when searching for owners. If in doubt, remove it. |
|
6371 |
"/ "/ A consequence of the return below is that #[1 2 3] will say that it |
|
6372 |
"/ "/ 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
|
6373 |
"/ |
2647 | 6374 |
"/ ^ false. |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6375 |
"/ |
2647 | 6376 |
"/ "/ alternative: |
6377 |
"/ "/ anObject isNumber ifFalse:[^ false]. |
|
6378 |
"/ ]. |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6379 |
"/ |
2647 | 6380 |
"/ "/ |
6381 |
"/ "/ because arrays are so common, and those have a highly tuned |
|
6382 |
"/ "/ idenitytIndex method, use it |
|
6383 |
"/ "/ |
|
6384 |
"/ myClass == Array ifTrue:[ |
|
6385 |
"/ ^ (self identityIndexOf:anObject) ~~ 0 |
|
6386 |
"/ ]. |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6387 |
"/ |
2647 | 6388 |
"/ "/ |
6389 |
"/ "/ otherwise, do it the slow way |
|
6390 |
"/ "/ |
|
6391 |
"/ numInst := self basicSize. |
|
6392 |
"/ 1 to:numInst do:[:i | |
|
6393 |
"/ ((self basicAt:i) == anObject) ifTrue:[^ true] |
|
6394 |
"/ ] |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6395 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6396 |
|
783 | 6397 |
^ false |
6398 |
||
6399 |
" |
|
6400 |
|v| |
|
6401 |
||
6402 |
v := View new initialize. |
|
6403 |
v references:Display. |
|
6404 |
" |
|
6405 |
! |
|
6406 |
||
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6407 |
referencesAny:aCollection |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6408 |
"return true, if the receiver refers to any object from |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6409 |
the argument, aCollection. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6410 |
- for debugging only" |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6411 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6412 |
%{ |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6413 |
OBJ cls, flags; |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6414 |
int nInsts, inst; |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6415 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6416 |
if (! __isNonNilObject(self)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6417 |
RETURN (false); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6418 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6419 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6420 |
if (__isArray(aCollection)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6421 |
int nObjs = __arraySize(aCollection); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6422 |
char *minAddr = 0, *maxAddr = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6423 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6424 |
if (nObjs == 0) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6425 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6426 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6427 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6428 |
/* |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6429 |
* a little optimization: use the fact that all old objects |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6430 |
* refering to a new object are on the remSet; if I am not, |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6431 |
* a trivial reject is possible, if all objects are newbees. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6432 |
* as a side effect, gather min/max addresses |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6433 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6434 |
if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6435 |
int allNewBees = 1; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6436 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6437 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6438 |
minAddr = (char *)(__ArrayInstPtr(aCollection)->a_element[0]); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6439 |
maxAddr = minAddr; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6440 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6441 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6442 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6443 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6444 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6445 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6446 |
if (__isNonNilObject(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6447 |
int spc; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6448 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6449 |
if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6450 |
allNewBees = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6451 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6452 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6453 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6454 |
if ((char *)anObject < minAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6455 |
minAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6456 |
} else if ((char *)anObject > maxAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6457 |
maxAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6458 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6459 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6460 |
if (allNewBees) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6461 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6462 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6463 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6464 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6465 |
/* |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6466 |
* fetch min/max in searchList (if not already done) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6467 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6468 |
if (minAddr == 0) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6469 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6470 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6471 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6472 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6473 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6474 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6475 |
if ((char *)anObject < minAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6476 |
minAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6477 |
} else if ((char *)anObject > maxAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6478 |
maxAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6479 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6480 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6481 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6482 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6483 |
cls = __qClass(self); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6484 |
if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) { |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6485 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6486 |
if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)cls, nObjs)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6487 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6488 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6489 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6490 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6491 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6492 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6493 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6494 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6495 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6496 |
if (cls == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6497 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6498 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6499 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6500 |
#endif /* memsrch4 */ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6501 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6502 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6503 |
flags = __ClassInstPtr(cls)->c_flags; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6504 |
if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6505 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6506 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6507 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6508 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6509 |
if (! nInsts) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6510 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6511 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6512 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6513 |
if (nObjs == 1) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6514 |
/* better reverse the loop */ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6515 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6516 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6517 |
anObject = __ArrayInstPtr(aCollection)->a_element[0]; |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6518 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6519 |
if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6520 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6521 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6522 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6523 |
for (inst=0; inst<nInsts; inst++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6524 |
if ((__InstPtr(self)->i_instvars[inst]) == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6525 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6526 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6527 |
} |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6528 |
#endif |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6529 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6530 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6531 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6532 |
for (inst=0; inst<nInsts; inst++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6533 |
OBJ instVar = __InstPtr(self)->i_instvars[inst]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6534 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6535 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6536 |
if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) { |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6537 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6538 |
if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)instVar, nObjs)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6539 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6540 |
} |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6541 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6542 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6543 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6544 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6545 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6546 |
if (instVar == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6547 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6548 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6549 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6550 |
#endif /* memsrch4 */ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6551 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6552 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6553 |
RETURN (false); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6554 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6555 |
%}. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6556 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6557 |
aCollection do:[:el | |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6558 |
(self references:el) ifTrue:[^ true]. |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6559 |
]. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6560 |
^ false |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6561 |
! |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6562 |
|
783 | 6563 |
referencesDerivedInstanceOf:aClass |
6564 |
"return true, if the receiver refers to an instance of |
|
6565 |
the argument, aClass or its subclass. This method exists |
|
6566 |
to support searching for users of a class." |
|
6567 |
||
6568 |
|myClass |
|
6569 |
numInst "{ Class: SmallInteger }" | |
|
6570 |
||
6571 |
myClass := self class. |
|
6572 |
||
6573 |
"check the class" |
|
6574 |
(myClass isKindOf:aClass) ifTrue:[^ true]. |
|
6575 |
||
6576 |
"check the instance variables" |
|
6577 |
numInst := myClass instSize. |
|
6578 |
1 to:numInst do:[:i | |
|
6579 |
((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
6580 |
]. |
|
6581 |
||
6582 |
"check the indexed variables" |
|
6583 |
myClass isVariable ifTrue:[ |
|
6584 |
myClass isPointers ifFalse:[ |
|
6585 |
"no need to search in non pointer fields" |
|
6586 |
((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false]. |
|
6587 |
]. |
|
6588 |
numInst := self basicSize. |
|
6589 |
1 to:numInst do:[:i | |
|
6590 |
((self basicAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
6591 |
] |
|
6592 |
]. |
|
6593 |
^ false |
|
6594 |
||
6595 |
" |
|
6596 |
(1 @ 3.4) referencesDerivedInstanceOf:Number |
|
6597 |
(1 @ 3.4) referencesDerivedInstanceOf:Array |
|
6598 |
View new initialize referencesDerivedInstanceOf:DeviceWorkstation |
|
6599 |
" |
|
6600 |
! |
|
6601 |
||
6602 |
referencesInstanceOf:aClass |
|
6603 |
"return true, if the receiver refers to an instance of |
|
6604 |
the argument, aClass.This method exists |
|
6605 |
to support searching for users of a class." |
|
6606 |
||
6607 |
|myClass |
|
6608 |
numInst "{ Class: SmallInteger }" | |
|
6609 |
||
6610 |
myClass := self class. |
|
6611 |
||
6612 |
"check the class" |
|
6613 |
(myClass isMemberOf:aClass) ifTrue:[^ true]. |
|
6614 |
||
6615 |
"check the instance variables" |
|
6616 |
numInst := myClass instSize. |
|
6617 |
1 to:numInst do:[:i | |
|
6618 |
((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
6619 |
]. |
|
6620 |
||
6621 |
"check the indexed variables" |
|
6622 |
myClass isVariable ifTrue:[ |
|
6623 |
myClass isPointers ifFalse:[ |
|
6624 |
"no need to search in non-pointer indexed fields" |
|
6625 |
myClass isLongs ifTrue:[ |
|
6626 |
(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false]. |
|
6627 |
] ifFalse:[ |
|
6628 |
myClass isFloatsOrDoubles ifTrue:[^ aClass == Float]. |
|
6629 |
^ aClass == SmallInteger |
|
6630 |
] |
|
6631 |
]. |
|
6632 |
numInst := self basicSize. |
|
6633 |
1 to:numInst do:[:i | |
|
6634 |
((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
6635 |
] |
|
6636 |
]. |
|
6637 |
^ false |
|
6638 |
||
6639 |
" |
|
6640 |
(1 @ 3.4) referencesInstanceOf:Float |
|
6641 |
(1 @ 3.4) referencesInstanceOf:Fraction |
|
6642 |
View new initialize referencesInstanceOf:(Display class) |
|
6643 |
" |
|
1 | 6644 |
! ! |
783 | 6645 |
|
2295 | 6646 |
!Object methodsFor:'synchronized evaluation'! |
6647 |
||
6648 |
freeSynchronizationSemaphore |
|
6649 |
"free synchronizationSemaphore. May be used, to save memory when |
|
6650 |
an object is no longer used synchronized." |
|
6651 |
||
2342 | 6652 |
|sema| |
2295 | 6653 |
|
6654 |
sema := self synchronizationSemaphore. |
|
6655 |
sema notNil ifTrue:[ |
|
2647 | 6656 |
sema wait. "/ get lock |
6657 |
self synchronizationSemaphore:nil. |
|
2295 | 6658 |
]. |
6659 |
||
6660 |
" |
|
6661 |
self synchronized:[]. |
|
6662 |
self synchronizationSemaphore. |
|
6663 |
self freeSynchronizationSemaphore. |
|
6664 |
" |
|
6665 |
||
6666 |
"Created: 28.1.1997 / 19:31:20 / stefan" |
|
6667 |
"Modified: 28.1.1997 / 19:47:55 / stefan" |
|
6668 |
! |
|
6669 |
||
6670 |
synchronizationSemaphore |
|
6671 |
"return the synchronization semaphore for myself. |
|
6672 |
subclasses may redefine" |
|
6673 |
||
6674 |
^ SynchronizationSemaphores at:self ifAbsent:[]. |
|
6675 |
||
6676 |
" |
|
6677 |
self synchronizationSemaphore |
|
6678 |
" |
|
6679 |
||
6680 |
"Modified: 28.1.1997 / 19:47:09 / stefan" |
|
6681 |
! |
|
6682 |
||
6683 |
synchronizationSemaphore:aSemaphore |
|
6684 |
"set the synchronisationSemaphore for myself. |
|
6685 |
subclasses may redefine this method" |
|
6686 |
||
6687 |
aSemaphore isNil ifTrue:[ |
|
2647 | 6688 |
"/ remove Semaphore |
6689 |
SynchronizationSemaphores removeKey:self ifAbsent:[]. |
|
2295 | 6690 |
] ifFalse:[ |
2647 | 6691 |
SynchronizationSemaphores at:self put:aSemaphore. |
2295 | 6692 |
]. |
6693 |
||
6694 |
"Modified: 28.1.1997 / 19:37:48 / stefan" |
|
6695 |
! |
|
6696 |
||
6697 |
synchronized:aBlock |
|
6698 |
"evaluate aBlock synchronized, i.e. use a monitor for this object" |
|
6699 |
||
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6700 |
|sema blocked gotSema| |
2327 | 6701 |
|
6702 |
blocked := OperatingSystem blockInterrupts. |
|
6703 |
||
6704 |
"/ the following avoids creation of an additional |
|
6705 |
"/ block in the common case |
|
2295 | 6706 |
|
6707 |
sema := self synchronizationSemaphore. |
|
6708 |
sema isNil ifTrue:[ |
|
2647 | 6709 |
"get a locked semaphore (with count = 0)" |
6710 |
sema := Semaphore new. |
|
6711 |
self synchronizationSemaphore:sema. |
|
6712 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
6713 |
^ aBlock valueNowOrOnUnwindDo:[sema signal]. |
|
2327 | 6714 |
]. |
6715 |
||
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6716 |
" |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6717 |
Poll sema (never waits). |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6718 |
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
|
6719 |
of some blocks. |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6720 |
" |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6721 |
(sema waitWithTimeout:0) notNil ifTrue:[ |
2647 | 6722 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
6723 |
^ aBlock valueNowOrOnUnwindDo:[sema signal]. |
|
2295 | 6724 |
]. |
2327 | 6725 |
|
6726 |
[ |
|
2647 | 6727 |
gotSema := sema wait. |
6728 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
6729 |
^ aBlock value. |
|
2327 | 6730 |
] valueNowOrOnUnwindDo:[ |
2647 | 6731 |
gotSema notNil ifTrue:[gotSema signal] |
2327 | 6732 |
]. |
2295 | 6733 |
|
6734 |
" |
|
6735 |
[Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork. |
|
6736 |
[Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork. |
|
6737 |
" |
|
6738 |
||
6739 |
"Created: 28.1.1997 / 17:52:56 / stefan" |
|
2327 | 6740 |
"Modified: 30.1.1997 / 13:38:54 / cg" |
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6741 |
"Modified: 20.2.1997 / 09:43:35 / stefan" |
2295 | 6742 |
! ! |
6743 |
||
783 | 6744 |
!Object methodsFor:'system primitives'! |
6745 |
||
1957 | 6746 |
asOop |
6747 |
"ST-80 compatibility: |
|
6748 |
ST-80 returns an OOP-identity based number here (I guess: its address |
|
6749 |
or index); since ST/X has no such thing, and the objects address cannot |
|
6750 |
be used (since its changing over time), we return the objects identityHash |
|
6751 |
key, which provides (at least) some identity indication. |
|
6752 |
However, notice that (in contrast to ST-80's #asOop), the identityHash |
|
6753 |
key of two non-identical objects may be the same. |
|
6754 |
You'd better not use it - especially do not misuse it." |
|
6755 |
||
6756 |
^ self identityHash |
|
6757 |
||
6758 |
"Created: 9.11.1996 / 19:09:56 / cg" |
|
6759 |
"Modified: 9.11.1996 / 19:16:04 / cg" |
|
6760 |
! |
|
6761 |
||
783 | 6762 |
become:anotherObject |
6763 |
"make all references to the receiver become references to anotherObject |
|
859 | 6764 |
and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become. |
6765 |
This can be a very dangerous operation - be warned. |
|
861 | 6766 |
In general, using #become: should be avoided if possible, since it may |
6767 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
6768 |
||
6769 |
This may also be an expensive (i.e. slow) operation, |
|
783 | 6770 |
since in the worst case, the whole memory has to be searched for |
6771 |
references to the two objects (although the primitive tries hard to |
|
6772 |
limit the search, for acceptable performance in most cases). |
|
6773 |
This method fails, if the receiver or the argument is a SmallInteger |
|
6774 |
or nil, or is a context of a living method (i.e. one that has not already |
|
6775 |
returned). |
|
859 | 6776 |
(notice that #become: is not used heavily by the system |
783 | 6777 |
- the Collection-classes have been rewritten to not use it.)" |
6778 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6779 |
if (__primBecome(self, anotherObject)) { |
783 | 6780 |
RETURN ( self ); |
859 | 6781 |
} |
6782 |
%}. |
|
783 | 6783 |
self primitiveFailed |
6784 |
! |
|
6785 |
||
6786 |
becomeNil |
|
6787 |
"make all references to the receiver become nil - effectively getting |
|
859 | 6788 |
rid of the receiver. |
6789 |
This can be a very dangerous operation - be warned. |
|
6790 |
||
6791 |
This may be an expensive (i.e. slow) operation. |
|
783 | 6792 |
The receiver may not be a SmallInteger or a context of a living method." |
6793 |
||
6794 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6795 |
if (__primBecomeNil(self)) { |
783 | 6796 |
RETURN ( nil ); |
859 | 6797 |
} |
6798 |
%}. |
|
6799 |
self primitiveFailed |
|
6800 |
! |
|
6801 |
||
6802 |
becomeSameAs:anotherObject |
|
6803 |
"make all references to the receiver become references to anotherObject |
|
861 | 6804 |
but NOT vice versa (as done in #become:). |
859 | 6805 |
This can be a very dangerous operation - be warned. |
861 | 6806 |
In general, using #become: should be avoided if possible, since it may |
6807 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
6808 |
||
6809 |
This may also be an expensive (i.e. slow) operation, |
|
859 | 6810 |
since in the worst case, the whole memory has to be searched for |
6811 |
references to the two objects (although the primitive tries hard to |
|
6812 |
limit the search, for acceptable performance in most cases). |
|
6813 |
This method fails, if the receiver or the argument is a SmallInteger |
|
6814 |
or nil, or is a context of a living method (i.e. one that has not already returned)." |
|
6815 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6816 |
if (__primBecomeSameAs(self, anotherObject)) { |
859 | 6817 |
RETURN ( self ); |
6818 |
} |
|
6819 |
%}. |
|
783 | 6820 |
self primitiveFailed |
6821 |
! |
|
6822 |
||
6823 |
changeClassTo:otherClass |
|
6824 |
"changes the class of the receiver to the argument, otherClass. |
|
6825 |
This is only allowed (possible), if the receivers class and the argument |
|
6826 |
have the same structure (i.e. number of named instance variables and |
|
6827 |
type of indexed instance variables). |
|
6828 |
If the structures do not match, or any of the original class or new class |
|
6829 |
is UndefinedObject or a Smallinteger, a primitive error is triggered." |
|
6830 |
||
6831 |
|myClass ok| |
|
6832 |
||
6833 |
"check for UndefinedObject/SmallInteger receiver or newClass" |
|
6834 |
%{ |
|
1133 | 6835 |
{ |
4363
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6836 |
OBJ other = otherClass; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6837 |
|
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6838 |
if (__isNonNilObject(self) |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6839 |
&& __isNonNilObject(other) |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6840 |
&& (other != UndefinedObject) |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6841 |
&& (other != SmallInteger)) { |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6842 |
ok = true; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6843 |
} else { |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6844 |
ok = false; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6845 |
} |
783 | 6846 |
} |
6847 |
%}. |
|
6848 |
ok ifTrue:[ |
|
4363
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6849 |
ok := false. |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6850 |
myClass := self class. |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6851 |
myClass flags == otherClass flags ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6852 |
myClass instSize == otherClass instSize ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6853 |
"same instance layout and types: its ok to do it" |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6854 |
ok := true. |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6855 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6856 |
myClass isPointers ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6857 |
myClass isVariable ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6858 |
ok := true |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6859 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6860 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6861 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6862 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6863 |
myClass isPointers ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6864 |
"if newClass is a variable class, with instSize <= my instsize, |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6865 |
we can do it (effectively mapping additional instvars into the |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6866 |
variable part) - usefulness is questionable, though" |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6867 |
|
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6868 |
otherClass isPointers ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6869 |
otherClass isVariable ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6870 |
otherClass instSize <= (myClass instSize + self basicSize) |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6871 |
ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6872 |
ok := true |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6873 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6874 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6875 |
otherClass instSize == (myClass instSize + self basicSize) |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6876 |
ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6877 |
ok := true |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6878 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6879 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6880 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6881 |
"it does not make sense to convert pointers to bytes ..." |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6882 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6883 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6884 |
"does it make sense, to convert bits ?" |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6885 |
"could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..." |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6886 |
(myClass isBitsExtended and:[otherClass isBitsExtended]) ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6887 |
ok := true |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6888 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6889 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6890 |
] |
783 | 6891 |
]. |
6892 |
ok ifTrue:[ |
|
4363
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6893 |
"now, change the receivers class ..." |
783 | 6894 |
%{ |
4363
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6895 |
{ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6896 |
OBJ me = self; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6897 |
|
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6898 |
__qClass(me) = otherClass; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6899 |
__STORE(me, otherClass); |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6900 |
RETURN (me); |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6901 |
} |
783 | 6902 |
%}. |
6903 |
]. |
|
1022
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6904 |
|
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6905 |
" |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6906 |
the receiver cannot be represented as a instance of |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6907 |
the desired class. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6908 |
For example, you cannot change a bitInstance (byteArray etc.) |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6909 |
into a pointer object and vice versa. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6910 |
" |
783 | 6911 |
self primitiveFailed |
6912 |
! |
|
6913 |
||
6914 |
changeClassToThatOf:anObject |
|
6915 |
"changes the class of the receiver to that of the argument, anObject. |
|
6916 |
This is only allowed (possible), if the receivers class and the arguments |
|
6917 |
class have the same structure (i.e. number of named instance variables and |
|
6918 |
type of indexed instance variables). If the structures do not match, or any |
|
6919 |
of the objects is nil or a Smallinteger, a primitive error is triggered." |
|
6920 |
||
6921 |
self changeClassTo:(anObject class) |
|
6922 |
! ! |
|
6923 |
||
1867 | 6924 |
!Object methodsFor:'testing'! |
6925 |
||
6926 |
? defaultValue |
|
3465 | 6927 |
"a syntactic shugar-piece: |
6928 |
if the receiver is nil, return the defaultValue; |
|
1867 | 6929 |
otherwise, return the receiver. |
6930 |
This method is only redefined in UndefinedObject - therefore, |
|
6931 |
the recevier is retuned here. |
|
6932 |
||
1958 | 6933 |
Thus, if foo and bar are simple variables or constants, |
4360 | 6934 |
foo ? bar |
1958 | 6935 |
is the same as: |
4360 | 6936 |
(foo isNil ifTrue:[bar] ifFalse:[foo]) |
1958 | 6937 |
|
6938 |
if they are message sends, the equivalent code is: |
|
4360 | 6939 |
[ |
6940 |
|t1 t2| |
|
6941 |
||
6942 |
t1 := foo. |
|
6943 |
t2 := bar. |
|
6944 |
t1 isNil ifTrue:[t2] ifFalse:[t1] |
|
6945 |
] value |
|
1958 | 6946 |
|
1867 | 6947 |
Can be used to provide defaultValues to variables, |
6948 |
as in: |
|
4360 | 6949 |
foo := arg ? #defaultValue |
2147 | 6950 |
|
2148 | 6951 |
Note: this method should never be redefined in classes other than UndefinedObject. |
4360 | 6952 |
Notice: |
6953 |
This method is open coded (inlined) by the compiler(s) |
|
6954 |
- redefining it may not work as expected." |
|
1867 | 6955 |
|
6956 |
^ self |
|
6957 |
||
6958 |
" |
|
6959 |
1 ? #default |
|
6960 |
nil ? #default |
|
6961 |
" |
|
6962 |
||
3465 | 6963 |
"Created: / 4.11.1996 / 20:36:19 / cg" |
6964 |
"Modified: / 19.5.1998 / 17:39:56 / cg" |
|
1867 | 6965 |
! |
6966 |
||
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6967 |
?? defaultValue |
3465 | 6968 |
"a syntactic shugar-piece: |
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6969 |
much like ?, but sends #value to the argument if required. |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6970 |
(i.e. its the same as #ifNil:) |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6971 |
If the receiver is nil, return the defaultValues value; |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6972 |
otherwise, return the receiver. |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6973 |
This method is only redefined in UndefinedObject - therefore, |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6974 |
the recevier is retuned here. |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6975 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6976 |
Thus, if foo and bar are simple variables or constants, |
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6977 |
foo ?? bar |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6978 |
is the same as: |
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6979 |
(foo isNil ifTrue:[bar value] ifFalse:[foo]) |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6980 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6981 |
if they are message sends, the equivalent code is: |
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6982 |
[ |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6983 |
|t t2| |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6984 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6985 |
t := foo. |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6986 |
t isNil ifTrue:[bar value] ifFalse:[t] |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6987 |
] value |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6988 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6989 |
Can be used to provide defaultValues to variables, |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6990 |
as in: |
4360 | 6991 |
foo := arg ?? [ self computeDefault ] |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6992 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6993 |
Note: this method should never be redefined in classes other than UndefinedObject. |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6994 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6995 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6996 |
^ self |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6997 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6998 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6999 |
1 ?? #default |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
7000 |
nil ?? #default |
4360 | 7001 |
1 ?? [ self halt. 1 + 2 ] |
7002 |
nil ?? [ self halt. 1 + 2 ] |
|
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
7003 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
7004 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
7005 |
"Created: / 4.11.1996 / 20:36:19 / cg" |
3466 | 7006 |
"Modified: / 19.5.1998 / 17:42:56 / cg" |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
7007 |
! |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
7008 |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7009 |
ifNil:aBlockOrValue |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7010 |
"return myself, or the result from evaluating the argument, if I am nil. |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7011 |
This is much like #?, but sends #value to the argument in case of a nil |
4360 | 7012 |
receiver. |
7013 |
Notice: |
|
7014 |
This method is open coded (inlined) by the compiler(s) |
|
7015 |
- redefining it may not work as expected." |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7016 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7017 |
^ self |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7018 |
! |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7019 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7020 |
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7021 |
"return the value of the first arg, if I am nil, |
4360 | 7022 |
the result from evaluating the 2nd argument, if I am not nil. |
7023 |
Notice: |
|
7024 |
This method is open coded (inlined) by the compiler(s) |
|
7025 |
- redefining it may not work as expected." |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7026 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7027 |
^ notNilBlockOrValue value |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7028 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7029 |
! |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7030 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7031 |
ifNotNil:aBlockOrValue |
4360 | 7032 |
"return myself if nil, or the result from evaluating the argument, |
7033 |
if I am not nil. |
|
7034 |
Notice: |
|
7035 |
This method is open coded (inlined) by the compiler(s) |
|
7036 |
- redefining it may not work as expected." |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7037 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7038 |
^ aBlockOrValue value |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7039 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7040 |
! |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7041 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7042 |
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7043 |
"return the value of the 2nd arg, if I am nil, |
4360 | 7044 |
the result from evaluating the 1st argument, if I am not nil. |
7045 |
Notice: |
|
7046 |
This method is open coded (inlined) by the compiler(s) |
|
7047 |
- redefining it may not work as expected." |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7048 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7049 |
^ notNilBlockOrValue value |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7050 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7051 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7052 |
! |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7053 |
|
1867 | 7054 |
isArray |
7055 |
"return true, if the receiver is some kind of array (or weakArray etc); |
|
7056 |
false is returned here - the method is only redefined in Array." |
|
7057 |
||
7058 |
^ false |
|
7059 |
! |
|
7060 |
||
7061 |
isAssociation |
|
7062 |
"return true, if the receiver is some kind of association; |
|
7063 |
false is returned here - the method is only redefined in Association." |
|
7064 |
||
7065 |
^ false |
|
7066 |
||
7067 |
"Created: 14.5.1996 / 17:03:45 / cg" |
|
7068 |
! |
|
7069 |
||
7070 |
isBehavior |
|
7071 |
"return true, if the receiver is some kind of class (i.e. behavior); |
|
7072 |
false is returned here - the method is only redefined in Behavior." |
|
7073 |
||
7074 |
^ false |
|
7075 |
! |
|
7076 |
||
7077 |
isBlock |
|
7078 |
"return true, if the receiver is some kind of block; |
|
7079 |
false returned here - the method is only redefined in Block." |
|
7080 |
||
7081 |
^ false |
|
7082 |
! |
|
7083 |
||
7084 |
isCharacter |
|
7085 |
"return true, if the receiver is some kind of character; |
|
7086 |
false is returned here - the method is only redefined in Character." |
|
7087 |
||
7088 |
^ false |
|
7089 |
! |
|
7090 |
||
7091 |
isClass |
|
7092 |
"return true, if the receiver is some kind of class (real class, |
|
7093 |
not just behavior); |
|
7094 |
false is returned here - the method is only redefined in Class." |
|
7095 |
||
7096 |
^ false |
|
7097 |
! |
|
7098 |
||
7099 |
isCollection |
|
7100 |
"return true, if the receiver is some kind of collection; |
|
7101 |
false is returned here - the method is only redefined in Collection." |
|
7102 |
||
7103 |
^ false |
|
7104 |
! |
|
7105 |
||
7106 |
isColor |
|
7107 |
"return true, if the receiver is some kind of color; |
|
7108 |
false is returned here - the method is only redefined in Color." |
|
7109 |
||
7110 |
^ false |
|
7111 |
! |
|
7112 |
||
7113 |
isContext |
|
7114 |
"return true, if the receiver is some kind of context; |
|
7115 |
false returned here - the method is only redefined in Context." |
|
7116 |
||
7117 |
^ false |
|
7118 |
! |
|
7119 |
||
7120 |
isExternalStream |
|
7121 |
"return true, if the receiver is some kind of externalStream; |
|
7122 |
false is returned here - the method is only redefined in ExternalStream." |
|
7123 |
||
7124 |
^false |
|
7125 |
! |
|
7126 |
||
7127 |
isFileStream |
|
7128 |
"return true, if the receiver is some kind of fileStream; |
|
7129 |
false is returned here - the method is only redefined in FileStream." |
|
7130 |
||
7131 |
^false |
|
7132 |
! |
|
7133 |
||
1887 | 7134 |
isFixedPoint |
7135 |
"return true, if the receiver is some kind of fixedPoint number; |
|
7136 |
false is returned here - the method is only redefined in FixedPoint." |
|
7137 |
||
7138 |
^ false |
|
7139 |
||
7140 |
"Created: 5.11.1996 / 19:23:04 / cg" |
|
7141 |
! |
|
7142 |
||
1867 | 7143 |
isFixedSize |
7144 |
"return true if the receiver cannot grow easily |
|
7145 |
(i.e. a grow may be expensive, since it involves a become:)" |
|
7146 |
||
7147 |
^ true |
|
7148 |
! |
|
7149 |
||
7150 |
isForm |
|
7151 |
"return true, if the receiver is some kind of form; |
|
7152 |
false is returned here - the method is only redefined in Form." |
|
7153 |
||
7154 |
^ false |
|
7155 |
! |
|
7156 |
||
7157 |
isFraction |
|
7158 |
"return true, if the receiver is some kind of fraction; |
|
7159 |
false is returned here - the method is only redefined in Fraction." |
|
7160 |
||
7161 |
^ false |
|
7162 |
! |
|
7163 |
||
7164 |
isImage |
|
7165 |
"return true, if the receiver is some kind of image; |
|
7166 |
false is returned here - the method is only redefined in Image." |
|
7167 |
||
7168 |
^ false |
|
7169 |
! |
|
7170 |
||
7171 |
isImageOrForm |
|
7172 |
"return true, if the receiver is some kind of image or form; |
|
7173 |
false is returned here - the method is only redefined in Image and Form." |
|
7174 |
||
7175 |
^ false |
|
7176 |
! |
|
7177 |
||
2673
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7178 |
isImmediate |
4666 | 7179 |
"return true if I am an immediate object |
7180 |
i.e. I am represented in the pointer itself and |
|
7181 |
no real object header/storage is used me. |
|
7182 |
(currently, only SmallIntegers and nil return true)" |
|
2673
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7183 |
|
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7184 |
^ self class hasImmediateInstances |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7185 |
|
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7186 |
"Created: 3.6.1997 / 12:00:18 / cg" |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7187 |
! |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7188 |
|
1867 | 7189 |
isInteger |
7190 |
"return true, if the receiver is some kind of integer number; |
|
7191 |
false is returned here - the method is only redefined in Integer." |
|
7192 |
||
7193 |
^ false |
|
7194 |
! |
|
7195 |
||
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7196 |
isJavaClass |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7197 |
"return true, if this is a javaClass. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7198 |
false is returned here - the method is only redefined in JavaClass." |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7199 |
|
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7200 |
^ false |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7201 |
|
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7202 |
"Created: / 26.3.1997 / 13:34:54 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7203 |
"Modified: / 8.5.1998 / 21:25:21 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7204 |
! |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7205 |
|
5149 | 7206 |
isJavaClassRef |
7207 |
"return true, if this is a JavaClassRef. |
|
7208 |
false is returned here - the method is only redefined in JavaClassRef." |
|
7209 |
||
7210 |
^ false |
|
7211 |
||
7212 |
"Modified: / 8.5.1998 / 21:25:46 / cg" |
|
7213 |
"Created: / 24.12.1999 / 01:46:28 / cg" |
|
7214 |
! |
|
7215 |
||
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7216 |
isJavaContext |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7217 |
"return true, if this is a javaContext. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7218 |
false is returned here - the method is only redefined in JavaContext." |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7219 |
|
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7220 |
^ false |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7221 |
|
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7222 |
"Created: / 8.5.1998 / 21:24:27 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7223 |
"Modified: / 8.5.1998 / 21:25:35 / cg" |
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7224 |
! |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7225 |
|
4816 | 7226 |
isJavaMethod |
7227 |
"return true, if this is a JavaMethod. |
|
7228 |
false is returned here - the method is only redefined in JavaMethod." |
|
7229 |
||
7230 |
^ false |
|
7231 |
||
7232 |
"Modified: / 8.5.1998 / 21:25:46 / cg" |
|
7233 |
"Created: / 25.9.1999 / 23:26:12 / cg" |
|
7234 |
! |
|
7235 |
||
5129 | 7236 |
isJavaMethodRef |
7237 |
"return true, if this is a JavaMethodRef. |
|
7238 |
false is returned here - the method is only redefined in JavaMethodRef." |
|
7239 |
||
7240 |
^ false |
|
7241 |
||
7242 |
"Modified: / 8.5.1998 / 21:25:46 / cg" |
|
7243 |
"Created: / 23.12.1999 / 19:44:51 / cg" |
|
7244 |
! |
|
7245 |
||
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7246 |
isJavaObject |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7247 |
"return true, if this is a javaObject. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7248 |
false is returned here - the method is only redefined in JavaObject." |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7249 |
|
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7250 |
^ false |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7251 |
|
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7252 |
"Created: / 26.3.1997 / 13:34:48 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7253 |
"Modified: / 8.5.1998 / 21:25:46 / cg" |
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7254 |
! |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7255 |
|
1867 | 7256 |
isKindOf:aClass |
7257 |
"return true, if the receiver is an instance of aClass or one of its |
|
7258 |
subclasses, false otherwise. |
|
7259 |
Advice: |
|
7260 |
use of this to check objects for certain attributes/protocoll should |
|
7261 |
be avoided; it limits the reusability of your classes by limiting use |
|
7262 |
to instances of certain classes and fences you into a specific inheritance |
|
7263 |
hierarchy. |
|
7264 |
Use check-methods to check an object for a certain attributes/protocol |
|
7265 |
(such as #isXXXX, #respondsTo: or #isNumber). |
|
7266 |
||
7267 |
Using #isKindOf: is considered BAD STYLE. |
|
7268 |
||
7269 |
Advice2: |
|
7270 |
Be aware, that using an #isXXX method is usually much faster than |
|
7271 |
using #isKindOf:; because isKindOf: has to walk up all the superclass |
|
7272 |
hierarchy, comparing every class on the way. |
|
7273 |
Due to caching in the VM, a call to #isXXX is normally reached via |
|
7274 |
a single function call. |
|
7275 |
" |
|
7276 |
||
7277 |
%{ /* NOCONTEXT */ |
|
7278 |
register OBJ thisClass; |
|
7279 |
||
7280 |
thisClass = __Class(self); |
|
7281 |
while (thisClass != nil) { |
|
7282 |
if (thisClass == aClass) { |
|
7283 |
RETURN ( true ); |
|
7284 |
} |
|
7285 |
thisClass = __ClassInstPtr(thisClass)->c_superclass; |
|
7286 |
} |
|
7287 |
%} |
|
7288 |
. |
|
7289 |
"/ |
|
7290 |
"/ the above code is equivalent to: |
|
7291 |
"/ |
|
7292 |
"/ thisClass := self class. |
|
7293 |
"/ [thisClass notNil] whileTrue:[ |
|
7294 |
"/ thisClass == aClass ifTrue:[^ true]. |
|
7295 |
"/ thisClass := thisClass superclass |
|
7296 |
"/ ] |
|
7297 |
"/ |
|
7298 |
^ false |
|
7299 |
! |
|
7300 |
||
7301 |
isLayout |
|
7302 |
"return true, if the receiver is some kind of layout; |
|
7303 |
false is returned here - the method is only redefined in Layout." |
|
7304 |
||
7305 |
^ false |
|
7306 |
! |
|
7307 |
||
7308 |
isLiteral |
|
4666 | 7309 |
"return true, if the receiver can be represented as a literal constant in ST syntax; |
1867 | 7310 |
false is returned here - the method is redefined in some classes." |
7311 |
||
7312 |
^ false |
|
7313 |
! |
|
7314 |
||
7315 |
isMemberOf:aClass |
|
7316 |
"return true, if the receiver is an instance of aClass, false otherwise. |
|
7317 |
Advice: |
|
7318 |
use of this to check objects for certain attributes/protocoll should |
|
7319 |
be avoided; it limits the reusability of your classes by limiting use |
|
7320 |
to instances of a certain class. |
|
7321 |
Use check-methods to check an object for a certain attributes/protocol |
|
7322 |
(such as #isXXX, #respondsTo: or #isNumber); |
|
7323 |
||
3044 | 7324 |
Using #isMemberOf: is considered BAD STYLE. |
7325 |
Notice: |
|
7326 |
This method is open coded (inlined) by the compiler(s) |
|
7327 |
- redefining it may not work as expected." |
|
1867 | 7328 |
|
7329 |
^ (self class) == aClass |
|
7330 |
! |
|
7331 |
||
7332 |
isMeta |
|
7333 |
"return true, if the receiver is some kind of metaclass; |
|
7334 |
false is returned here - the method is only redefined in Metaclass." |
|
7335 |
||
7336 |
^ false |
|
7337 |
! |
|
7338 |
||
7339 |
isMethod |
|
7340 |
"return true, if the receiver is some kind of method; |
|
7341 |
false returned here - the method is only redefined in Method." |
|
7342 |
||
7343 |
^ false |
|
7344 |
! |
|
7345 |
||
4992 | 7346 |
isMorph |
7347 |
"return true, if the receiver is some kind of morph; |
|
7348 |
false is returned here - the method is only redefined in Morph." |
|
7349 |
||
7350 |
^ false |
|
7351 |
! |
|
7352 |
||
1867 | 7353 |
isNamespace |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7354 |
"return true, if this is a nameSpace. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7355 |
false is returned here - the method is only redefined in Namespace." |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7356 |
|
1867 | 7357 |
^ false |
7358 |
||
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7359 |
"Created: / 11.10.1996 / 18:08:56 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7360 |
"Modified: / 8.5.1998 / 21:26:05 / cg" |
1867 | 7361 |
! |
7362 |
||
7363 |
isNumber |
|
7364 |
"return true, if the receiver is some kind of number; |
|
7365 |
false is returned here - the method is only redefined in Number." |
|
7366 |
||
7367 |
^ false |
|
7368 |
! |
|
7369 |
||
7370 |
isPoint |
|
7371 |
"return true, if the receiver is some kind of point; |
|
7372 |
false is returned here - the method is only redefined in Point." |
|
7373 |
||
7374 |
^ false |
|
7375 |
! |
|
7376 |
||
7377 |
isReal |
|
7378 |
"return true, if the receiver is some kind of real number; |
|
7379 |
false is returned here - the method is only redefined in LimitedPrecisionReal." |
|
7380 |
||
7381 |
^ false |
|
7382 |
! |
|
7383 |
||
7384 |
isRectangle |
|
7385 |
"return true, if the receiver is some kind of rectangle; |
|
7386 |
false is returned here - the method is only redefined in Rectangle." |
|
7387 |
||
7388 |
^ false |
|
7389 |
! |
|
7390 |
||
7391 |
isRemoteObject |
|
7392 |
"return true, if the receiver is some kind of remoteObject, |
|
7393 |
false if its local - the method is only redefined in RemoteObject." |
|
7394 |
||
7395 |
^ false |
|
7396 |
||
7397 |
"Created: 28.10.1996 / 15:18:45 / cg" |
|
7398 |
"Modified: 28.10.1996 / 15:20:57 / cg" |
|
7399 |
! |
|
7400 |
||
7401 |
isSequenceable |
|
7402 |
"return true, if the receiver is some kind of sequenceable collection; |
|
7403 |
false is returned here - the method is only redefined in SequenceableCollection." |
|
7404 |
||
7405 |
^ false |
|
7406 |
! |
|
7407 |
||
7408 |
isSequenceableCollection |
|
7409 |
"OBSOLETE: use isSequenceable for ST-80 compatibility. |
|
4007 | 7410 |
This method is a historic leftover and will be removed soon ... |
7411 |
(although its name is much better than #isSequenceable - sigh)" |
|
1867 | 7412 |
|
7413 |
self obsoleteMethodWarning:'use #isSequenceable'. |
|
7414 |
^ false |
|
7415 |
! |
|
7416 |
||
7417 |
isSignal |
|
7418 |
"return true, if the receiver is some kind of signal; |
|
7419 |
false returned here - the method is only redefined in Signal." |
|
7420 |
||
7421 |
^ false |
|
7422 |
! |
|
7423 |
||
7424 |
isStream |
|
7425 |
"return true, if the receiver is some kind of stream; |
|
7426 |
false is returned here - the method is only redefined in Stream." |
|
7427 |
||
7428 |
^ false |
|
7429 |
! |
|
7430 |
||
7431 |
isString |
|
7432 |
"return true, if the receiver is some kind of string; |
|
4683 | 7433 |
false is returned here - the method is only redefined in CharacterArray." |
1867 | 7434 |
|
7435 |
^ false |
|
7436 |
! |
|
7437 |
||
4007 | 7438 |
isStringCollection |
7439 |
"return true, if the receiver is some kind of stringCollection; |
|
7440 |
false is returned here - the method is only redefined in StringCollection." |
|
7441 |
||
7442 |
^ false |
|
7443 |
! |
|
7444 |
||
1867 | 7445 |
isSymbol |
7446 |
"return true, if the receiver is some kind of symbol; |
|
7447 |
false is returned here - the method is only redefined in Symbol." |
|
7448 |
||
7449 |
^ false |
|
7450 |
! |
|
7451 |
||
7452 |
isText |
|
7453 |
"return true, if the receiver is some kind of text object; |
|
7454 |
false is returned here - the method is only redefined in Text." |
|
7455 |
||
7456 |
^ false |
|
7457 |
||
7458 |
"Created: 12.5.1996 / 10:56:50 / cg" |
|
7459 |
! |
|
7460 |
||
4009 | 7461 |
isValueModel |
7462 |
"return true, if the receiver is some kind of valueModel; |
|
7463 |
false is returned here - the method is only redefined in ValueModel." |
|
7464 |
||
7465 |
^ false |
|
7466 |
||
7467 |
! |
|
7468 |
||
1867 | 7469 |
isVariable |
7470 |
"return true if the receiver has indexed instance variables, |
|
7471 |
false otherwise." |
|
7472 |
||
7473 |
^ self class isVariable |
|
7474 |
! |
|
7475 |
||
2704 | 7476 |
isVariableBinding |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7477 |
"return true, if this is a binding for a variable. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7478 |
false is returned here - the method is only redefined in Binding." |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7479 |
|
2704 | 7480 |
^ false |
7481 |
||
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7482 |
"Created: / 19.6.1997 / 17:38:44 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7483 |
"Modified: / 8.5.1998 / 21:26:55 / cg" |
2704 | 7484 |
! |
7485 |
||
1867 | 7486 |
isView |
7487 |
"return true, if the receiver is some kind of view; |
|
7488 |
false is returned here - the method is only redefined in View." |
|
7489 |
||
7490 |
^ false |
|
7491 |
! ! |
|
7492 |
||
4664 | 7493 |
!Object methodsFor:'tracing'! |
7494 |
||
4682 | 7495 |
traceInto:aRequestor level:level from:referrer |
4664 | 7496 |
"double dispatch into tracer, passing my type implicitely in the selector" |
7497 |
||
4682 | 7498 |
^ aRequestor traceObject:self level:level from:referrer |
4664 | 7499 |
|
7500 |
"Created: / 2.9.1999 / 09:05:17 / stefan" |
|
7501 |
! ! |
|
7502 |
||
783 | 7503 |
!Object methodsFor:'user interaction & notifications'! |
7504 |
||
7505 |
activityNotification:aString |
|
7506 |
"this can be sent from deeply nested methods, which are going to perform |
|
7507 |
some long-time activity. |
|
7508 |
If there is a handler for the ActivityNotificationSignal signal, that one is raised, |
|
7509 |
passing the argument. The handler should show this message whereever it likes, |
|
7510 |
and proceed. If there is no handler, this is simply ignored. |
|
7511 |
||
7512 |
This is very useful to pass busy messages up to some higher level (typically a view) |
|
7513 |
which likes to display that message in its label or a busy-box. |
|
7514 |
It could also be put into some logfile or printed on the standard output/error." |
|
7515 |
||
7516 |
ActivityNotificationSignal isHandled ifTrue:[ |
|
861 | 7517 |
^ ActivityNotificationSignal raiseRequestWith:self errorString:aString |
783 | 7518 |
]. |
7519 |
||
7520 |
" |
|
7521 |
nil activityNotification:'hello there' |
|
7522 |
self activityNotification:'hello there' |
|
7523 |
" |
|
7524 |
||
7525 |
" |
|
7526 |
ActivityNotificationSignal handle:[:ex | |
|
861 | 7527 |
ex errorString printNL. |
7528 |
ex proceed. |
|
783 | 7529 |
] do:[ |
861 | 7530 |
'hello' printNL. |
7531 |
self activityNotification:'doing some long time computation'. |
|
7532 |
'world' printNL. |
|
783 | 7533 |
] |
7534 |
" |
|
7535 |
||
7536 |
"Modified: 16.12.1995 / 18:23:42 / cg" |
|
7537 |
! |
|
7538 |
||
7539 |
confirm:aString |
|
7540 |
"launch a confirmer, which allows user to enter yes or no. |
|
5084 | 7541 |
return true for yes, false for no. |
7542 |
If no GUI is present (headless applications), true is returned." |
|
783 | 7543 |
|
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7544 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7545 |
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
|
7546 |
and return true (as if yes was answered) |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7547 |
Q: should we ask user by reading Stdin ? |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7548 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7549 |
Smalltalk isInitialized ifFalse:[ |
5082
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7550 |
'*** confirmation requested during initialization:' errorPrintCR. |
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7551 |
aString errorPrintCR. |
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7552 |
'*** I''ll continue, assuming <yes> ...' errorPrintCR. |
5081
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7553 |
^ true |
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7554 |
]. |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7555 |
|
5081
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7556 |
(Dialog isNil |
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7557 |
or:[Screen isNil |
5082
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7558 |
or:[Screen current isNil]]) ifTrue:[ |
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7559 |
'confirm: ' infoPrint. |
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7560 |
aString infoPrintCR. |
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7561 |
'continue, assuming <yes>' infoPrintCR. |
5081
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7562 |
^ true |
783 | 7563 |
]. |
5082
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7564 |
|
783 | 7565 |
Dialog autoload. "in case its autoloaded" |
7566 |
^ Dialog confirm:aString |
|
7567 |
||
7568 |
" |
|
7569 |
nil confirm:'hello' |
|
7570 |
self confirm:'hello' |
|
7571 |
" |
|
1417 | 7572 |
|
1425 | 7573 |
"Modified: 20.5.1996 / 10:28:40 / cg" |
783 | 7574 |
! |
7575 |
||
5084 | 7576 |
confirmWithCancel:aString |
7577 |
"launch a confirmer, which allows user to enter yes, no or cancel. |
|
7578 |
return true for yes, false for no, nil for cancel. |
|
7579 |
If no GUI is present (headless applications), nil is returned." |
|
7580 |
||
7581 |
" |
|
7582 |
on systems without GUI, or during startup, output a message |
|
7583 |
and return true (as if yes was answered) |
|
7584 |
Q: should we ask user by reading Stdin ? |
|
7585 |
" |
|
7586 |
Smalltalk isInitialized ifFalse:[ |
|
7587 |
'*** confirmation requested during initialization:' errorPrintCR. |
|
7588 |
aString errorPrintCR. |
|
7589 |
'*** I''ll continue, assuming <cancel> ...' errorPrintCR. |
|
7590 |
^ nil |
|
7591 |
]. |
|
7592 |
||
7593 |
(Dialog isNil |
|
7594 |
or:[Screen isNil |
|
7595 |
or:[Screen current isNil]]) ifTrue:[ |
|
7596 |
'confirm: ' infoPrint. |
|
7597 |
aString infoPrintCR. |
|
7598 |
'continue, assuming <cancel>' infoPrintCR. |
|
7599 |
^ nil |
|
7600 |
]. |
|
7601 |
||
7602 |
Dialog autoload. "in case its autoloaded" |
|
7603 |
^ Dialog confirmWithCancel:aString |
|
7604 |
||
7605 |
" |
|
7606 |
nil confirmWithCancel:'hello' |
|
7607 |
self confirmWithCancel:'hello' |
|
7608 |
" |
|
7609 |
||
7610 |
"Modified: 20.5.1996 / 10:28:40 / cg" |
|
7611 |
! |
|
7612 |
||
783 | 7613 |
errorNotify:aString |
7614 |
"launch a Notifier, showing top stack, telling user something |
|
2150 | 7615 |
and give user a chance to enter debugger." |
7616 |
||
7617 |
^ self |
|
2647 | 7618 |
errorNotify:aString |
7619 |
from:thisContext sender |
|
2150 | 7620 |
|
7621 |
" |
|
7622 |
nil errorNotify:'hello there' |
|
7623 |
self errorNotify:'hello there' |
|
7624 |
" |
|
7625 |
||
7626 |
"Modified: 11.1.1997 / 18:39:20 / cg" |
|
7627 |
! |
|
7628 |
||
7629 |
errorNotify:aString from:aContext |
|
7630 |
"launch a Notifier, showing top stack (above aContext), |
|
7631 |
telling user something and give user a chance to enter debugger." |
|
783 | 7632 |
|
3766
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7633 |
^ self errorNotify:aString from:aContext allowDebug:true |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7634 |
|
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7635 |
"Modified: / 17.8.1998 / 10:09:27 / cg" |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7636 |
! |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7637 |
|
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7638 |
errorNotify:aString from:aContext allowDebug:allowDebug |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7639 |
"launch a Notifier, showing top stack (above aContext), |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7640 |
telling user something and optionally give the user a chance to enter debugger." |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7641 |
|
2082 | 7642 |
|info con sender action| |
783 | 7643 |
|
891 | 7644 |
Smalltalk isInitialized ifFalse:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7645 |
'errorNotification: ' print. aString printCR. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7646 |
^ self |
891 | 7647 |
]. |
5055
6d02262273a5
care for nil Display in #errorNotify:
Claus Gittinger <cg@exept.de>
parents:
4992
diff
changeset
|
7648 |
(Dialog isNil |
6d02262273a5
care for nil Display in #errorNotify:
Claus Gittinger <cg@exept.de>
parents:
4992
diff
changeset
|
7649 |
or:[Screen isNil |
6d02262273a5
care for nil Display in #errorNotify:
Claus Gittinger <cg@exept.de>
parents:
4992
diff
changeset
|
7650 |
or:[Screen current isNil]]) ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7651 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7652 |
on systems without GUI, simply show |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7653 |
the message on the Transcript and abort. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7654 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7655 |
Transcript showCR:aString. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7656 |
AbortSignal raise. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7657 |
^ self |
783 | 7658 |
]. |
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7659 |
|
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7660 |
Processor activeProcessIsSystemProcess ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7661 |
action := #debug. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7662 |
sender := aContext. |
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7663 |
] ifFalse:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7664 |
Dialog autoload. "in case its autoloaded" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7665 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7666 |
ErrorSignal handle:[:ex | |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7667 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7668 |
"/ a recursive error - quickly enter debugger |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7669 |
"/ this happened, when I corrupted the Dialog class ... |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7670 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7671 |
('Object [error]: ' , ex errorString , ' caught in errorNotification') errorPrintCR. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7672 |
action := #debug. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7673 |
ex return. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7674 |
] do:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7675 |
sender := aContext. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7676 |
sender isNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7677 |
sender := thisContext sender. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7678 |
"/ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7679 |
"/ 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
|
7680 |
"/ sender isBlockContext ifTrue:[ |
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7681 |
"/ sender := sender sender |
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7682 |
"/ ]. |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7683 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7684 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7685 |
"/ skip intermediate (signal & exception) contexts |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7686 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7687 |
DebugView notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7688 |
sender := DebugView interestingContextFrom:sender |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7689 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7690 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7691 |
"/ show the first 5 contexts |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7692 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7693 |
con := sender. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7694 |
info := aString , Character cr asString , Character cr asString. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7695 |
1 to:5 do:[:n | |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7696 |
con notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7697 |
info := info , con printString , Character cr asString. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7698 |
con := con sender |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7699 |
] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7700 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7701 |
|
5062 | 7702 |
(allowDebug and:[Debugger notNil]) ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7703 |
action := Dialog |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7704 |
choose:info |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7705 |
label:('Exception [' , Processor activeProcess nameOrId , ']') |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7706 |
labels:#('proceed' 'abort' 'debug') |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7707 |
values:#(#proceed #abort #debug) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7708 |
default:#debug. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7709 |
] ifFalse:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7710 |
action := Dialog |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7711 |
choose:info |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7712 |
label:('Exception [' , Processor activeProcess nameOrId , ']') |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7713 |
labels:#('proceed' 'abort') |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7714 |
values:#(#proceed #abort) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7715 |
default:#abort. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7716 |
] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7717 |
]. |
2082 | 7718 |
]. |
7719 |
||
7720 |
action == #debug ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7721 |
Debugger enter:sender withMessage:aString mayProceed:true |
2082 | 7722 |
] ifFalse:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7723 |
action == #abort ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7724 |
AbortSignal raise |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7725 |
] |
783 | 7726 |
] |
7727 |
||
7728 |
" |
|
7729 |
nil errorNotify:'hello there' |
|
7730 |
self errorNotify:'hello there' |
|
7731 |
" |
|
1417 | 7732 |
|
3766
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7733 |
"Modified: / 8.2.1997 / 12:47:41 / cg" |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7734 |
"Created: / 17.8.1998 / 10:09:26 / cg" |
783 | 7735 |
! |
7736 |
||
7737 |
information:aString |
|
7738 |
"launch an InfoBox, telling user something. |
|
7739 |
These info-boxes can be suppressed by handling the |
|
7740 |
UserNotification- or InformationSignal and proceeding in the handler." |
|
7741 |
||
7742 |
InformationSignal isHandled ifTrue:[ |
|
7743 |
^ InformationSignal raiseRequestWith:self errorString:aString |
|
7744 |
]. |
|
7745 |
self notify:aString |
|
7746 |
||
7747 |
" |
|
7748 |
nil information:'hello there' |
|
7749 |
self information:'hello there' |
|
7750 |
" |
|
7751 |
||
7752 |
" |
|
7753 |
InformationSignal handle:[:ex | |
|
7754 |
'no box popped' printNL. |
|
7755 |
ex proceed. |
|
7756 |
] do:[ |
|
7757 |
'hello' printNL. |
|
7758 |
self information:'some info'. |
|
7759 |
'world' printNL. |
|
7760 |
] |
|
7761 |
" |
|
7762 |
||
7763 |
"Modified: 24.11.1995 / 22:29:49 / cg" |
|
7764 |
! |
|
7765 |
||
5084 | 7766 |
notify:aString |
7767 |
"launch a Notifier, telling user something. |
|
7768 |
Use #information: for ignorable messages." |
|
7769 |
||
7770 |
Smalltalk isInitialized ifFalse:[ |
|
7771 |
'information: ' print. aString printCR. |
|
7772 |
^ self |
|
7773 |
]. |
|
7774 |
||
7775 |
(Smalltalk isInitialized not |
|
7776 |
or:[Dialog isNil |
|
7777 |
or:[Screen isNil |
|
7778 |
or:[Screen current isNil]]]) ifTrue:[ |
|
7779 |
" |
|
7780 |
on systems without GUI, simply show |
|
7781 |
the message on the Transcript and abort. |
|
7782 |
" |
|
7783 |
Transcript show:'notification: '; showCR:aString. |
|
7784 |
^ self |
|
7785 |
]. |
|
7786 |
||
7787 |
Dialog autoload. "in case its autoloaded" |
|
7788 |
Dialog information:aString |
|
7789 |
||
7790 |
" |
|
7791 |
nil notify:'hello there' |
|
7792 |
self notify:'hello there' |
|
7793 |
" |
|
7794 |
||
7795 |
"Modified: 20.5.1996 / 10:28:48 / cg" |
|
7796 |
! |
|
7797 |
||
783 | 7798 |
warn:aString |
7799 |
"launch a WarningBox, telling user something. |
|
7800 |
These warn-boxes can be suppressed by handling the |
|
7801 |
UserNotification- or WarningSignal and proceeding in the handler." |
|
7802 |
||
7803 |
WarningSignal isHandled ifTrue:[ |
|
5081
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7804 |
^ WarningSignal raiseRequestWith:self errorString:aString |
783 | 7805 |
]. |
7806 |
||
5082
211f9c06656c
oops - confirm/notify where wrong in the non-gui case
Claus Gittinger <cg@exept.de>
parents:
5081
diff
changeset
|
7807 |
(Smalltalk isInitialized not |
5083 | 7808 |
or:[Dialog isNil |
5081
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7809 |
or:[Screen isNil |
5083 | 7810 |
or:[Screen current isNil]]]) ifTrue:[ |
5081
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7811 |
" |
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7812 |
on systems without GUI, simply show |
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7813 |
the message on the Transcript and abort. |
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7814 |
" |
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7815 |
Transcript show:'warning: '; showCR:aString. |
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7816 |
^ self |
891 | 7817 |
]. |
7818 |
||
783 | 7819 |
Dialog autoload. "in case its autoloaded" |
7820 |
Dialog warn:aString |
|
7821 |
||
7822 |
" |
|
7823 |
nil warn:'hello there' |
|
7824 |
self warn:'hello there' |
|
7825 |
" |
|
7826 |
||
7827 |
" |
|
7828 |
WarningSignal handle:[:ex | |
|
5081
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7829 |
ex proceed. |
783 | 7830 |
] do:[ |
5081
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7831 |
'hello' printNL. |
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7832 |
self warn:'some info'. |
7e8bd5012897
care for warning, notify and information when no Screen is present.
Claus Gittinger <cg@exept.de>
parents:
5062
diff
changeset
|
7833 |
'world' printNL. |
783 | 7834 |
] |
7835 |
" |
|
1417 | 7836 |
|
1425 | 7837 |
"Modified: 20.5.1996 / 10:28:53 / cg" |
783 | 7838 |
! ! |
7839 |
||
1788 | 7840 |
!Object class methodsFor:'documentation'! |
783 | 7841 |
|
7842 |
version |
|
5149 | 7843 |
^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.314 1999-12-24 00:45:48 cg Exp $' |
783 | 7844 |
! ! |
7845 |
Object initialize! |