author | Stefan Vogel <sv@exept.de> |
Thu, 28 Oct 1999 01:58:45 +0200 | |
changeset 4962 | 0023029d2522 |
parent 4884 | 988431a226b7 |
child 4982 | adfc8977cee4 |
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 |
|
495 |
clone |
|
496 |
^ self shallowCopy |
|
497 |
! ! |
|
498 |
||
1 | 499 |
!Object methodsFor:'accessing'! |
500 |
||
501 |
at:index |
|
502 |
"return the indexed instance variable with index, anInteger; |
|
503 |
this method can be redefined in subclasses." |
|
504 |
||
505 |
^ self basicAt:index |
|
506 |
! |
|
507 |
||
783 | 508 |
at:index put:anObject |
509 |
"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
|
510 |
this method can be redefined in subclasses. Returns anObject (sigh)" |
783 | 511 |
|
512 |
^ self basicAt:index put:anObject |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
513 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
514 |
"Modified: 19.4.1996 / 11:13:29 / cg" |
783 | 515 |
! |
516 |
||
1 | 517 |
basicAt:index |
518 |
"return the indexed instance variable with index, anInteger. |
|
519 |
Trigger an error if the receiver has no indexed instance variables. |
|
2148 | 520 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
1 | 521 |
|
522 |
%{ /* NOCONTEXT */ |
|
523 |
||
329 | 524 |
REGISTER int nbytes, indx; |
1 | 525 |
OBJ myClass; |
329 | 526 |
REGISTER char *pFirst; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
527 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
528 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
529 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
530 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
531 |
#endif |
329 | 532 |
REGISTER int n; |
1 | 533 |
|
534 |
/* |
|
56 | 535 |
* notice the missing test for self being a nonNilObject - |
1 | 536 |
* this can be done since basicAt: is defined both in UndefinedObject |
537 |
* and SmallInteger |
|
538 |
*/ |
|
253 | 539 |
if (__isSmallInteger(index)) { |
4220 | 540 |
myClass = __qClass(self); |
541 |
indx = __intVal(index) - 1; |
|
542 |
n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
|
543 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */); |
|
544 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
545 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
|
546 |
||
547 |
switch ((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
|
548 |
case __MASKSMALLINT(POINTERARRAY): |
|
549 |
case __MASKSMALLINT(WKPOINTERARRAY): |
|
550 |
/* |
|
551 |
* pointers |
|
552 |
*/ |
|
553 |
if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) { |
|
554 |
OBJ *op; |
|
555 |
||
556 |
op = (OBJ *)pFirst + indx; |
|
557 |
RETURN ( *op ); |
|
558 |
} |
|
559 |
break; |
|
560 |
||
561 |
case __MASKSMALLINT(BYTEARRAY): |
|
562 |
/* |
|
563 |
* (unsigned) bytes |
|
564 |
*/ |
|
565 |
if ((unsigned)indx < nbytes) { |
|
566 |
unsigned char *cp; |
|
567 |
||
568 |
cp = (unsigned char *)pFirst + indx; |
|
569 |
RETURN ( __MKSMALLINT(*cp & 0xFF) ); |
|
570 |
} |
|
571 |
break; |
|
572 |
||
573 |
case __MASKSMALLINT(FLOATARRAY): |
|
574 |
/* |
|
575 |
* native floats |
|
576 |
*/ |
|
577 |
if ((unsigned)indx < (nbytes / sizeof(float))) { |
|
578 |
float *fp; |
|
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
579 |
float f; |
4220 | 580 |
OBJ v; |
581 |
||
582 |
fp = (float *)pFirst + indx; |
|
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
583 |
f = *fp; |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
584 |
if (f == 0.0) { |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
585 |
v = __float0; |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
586 |
} else { |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
587 |
__qMKSFLOAT(v, f); |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
588 |
} |
4220 | 589 |
RETURN (v); |
590 |
} |
|
591 |
break; |
|
592 |
||
593 |
case __MASKSMALLINT(DOUBLEARRAY): |
|
594 |
/* |
|
595 |
* native doubles |
|
596 |
*/ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
597 |
#ifdef __NEED_DOUBLE_ALIGN |
4220 | 598 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
599 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
|
600 |
||
601 |
pFirst += delta; |
|
602 |
nbytes -= delta; |
|
603 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
604 |
#endif |
4220 | 605 |
if ((unsigned)indx < (nbytes / sizeof(double))) { |
606 |
double *dp; |
|
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
607 |
double d; |
4220 | 608 |
OBJ v; |
609 |
||
610 |
dp = (double *)pFirst + indx; |
|
4858
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
611 |
d = *dp; |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
612 |
if (d == 0.0) { |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
613 |
v = __float0; |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
614 |
} else { |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
615 |
__qMKFLOAT(v, d); |
8f3ed29a8fe0
quicker 0-return from float- and doubleArray
Claus Gittinger <cg@exept.de>
parents:
4818
diff
changeset
|
616 |
} |
4220 | 617 |
RETURN (v); |
618 |
} |
|
619 |
break; |
|
620 |
||
621 |
case __MASKSMALLINT(WORDARRAY): |
|
622 |
/* |
|
623 |
* unsigned 16bit ints |
|
624 |
*/ |
|
625 |
/* Notice: the hard coded shifts are by purpose; |
|
626 |
* it makes us independent of the short-size of the machine |
|
627 |
*/ |
|
628 |
if ((unsigned)indx < (nbytes>>1)) { |
|
629 |
unsigned short *sp; |
|
630 |
||
631 |
sp = (unsigned short *)(pFirst + (indx<<1)); |
|
632 |
RETURN ( __MKSMALLINT(*sp & 0xFFFF) ); |
|
633 |
} |
|
634 |
break; |
|
635 |
||
636 |
case __MASKSMALLINT(SWORDARRAY): |
|
637 |
/* |
|
638 |
* signed 16bit ints |
|
639 |
*/ |
|
640 |
/* Notice: the hard coded shifts are by purpose; |
|
641 |
* it makes us independent of the short-size of the machine |
|
642 |
*/ |
|
643 |
if ((unsigned)indx < (nbytes>>1)) { |
|
644 |
short *ssp; |
|
645 |
||
646 |
ssp = (short *)(pFirst + (indx<<1)); |
|
647 |
RETURN ( __MKSMALLINT(*ssp) ); |
|
648 |
} |
|
649 |
break; |
|
650 |
||
651 |
case __MASKSMALLINT(LONGARRAY): |
|
652 |
/* |
|
653 |
* unsigned 32bit ints |
|
654 |
*/ |
|
655 |
/* Notice: the hard coded shifts are by purpose; |
|
656 |
* it makes us independent of the int-size of the machine |
|
657 |
*/ |
|
658 |
if ((unsigned)indx < (nbytes>>2)) { |
|
659 |
unsigned int32 ul; |
|
660 |
unsigned int32 *lp; |
|
661 |
||
662 |
lp = (unsigned int32 *)(pFirst + (indx<<2)); |
|
663 |
ul = *lp; |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
664 |
#ifdef alpha64 |
4220 | 665 |
{ |
666 |
unsigned INT ull = (unsigned INT)ul; |
|
667 |
RETURN ( __MKSMALLINT(ull) ); |
|
668 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
669 |
#else |
4220 | 670 |
if (ul <= _MAX_INT) { |
671 |
RETURN ( __MKSMALLINT(ul) ); |
|
672 |
} |
|
673 |
RETURN ( __MKULARGEINT(ul) ); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
674 |
#endif |
4220 | 675 |
} |
676 |
break; |
|
677 |
||
678 |
case __MASKSMALLINT(SLONGARRAY): |
|
679 |
/* |
|
680 |
* signed 32bit ints |
|
681 |
*/ |
|
682 |
/* Notice: the hard coded shifts are by purpose; |
|
683 |
* it makes us independent of the int-size of the machine |
|
684 |
*/ |
|
685 |
if ((unsigned)indx < (nbytes>>2)) { |
|
686 |
int32 *slp; |
|
687 |
int32 l; |
|
688 |
||
689 |
slp = (int32 *)(pFirst + (indx<<2)); |
|
690 |
l = *slp; |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
691 |
#ifdef alpha64 |
4220 | 692 |
{ |
693 |
INT ll = (INT)l; |
|
694 |
RETURN ( __MKSMALLINT(ll) ); |
|
695 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
696 |
#else |
4220 | 697 |
if (__ISVALIDINTEGER(l)) { |
698 |
RETURN ( __MKSMALLINT(l) ); |
|
699 |
} |
|
700 |
RETURN ( __MKLARGEINT(l) ); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
701 |
#endif |
4220 | 702 |
} |
703 |
break; |
|
704 |
||
705 |
case __MASKSMALLINT(SLONGLONGARRAY): |
|
706 |
/* |
|
707 |
* signed 64bit longlongs |
|
708 |
*/ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
709 |
#ifdef __NEED_LONGLONG_ALIGN |
4220 | 710 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
711 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
|
712 |
||
713 |
pFirst += delta; |
|
714 |
nbytes -= delta; |
|
715 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
716 |
#endif |
4220 | 717 |
/* Notice: the hard coded shifts are by purpose; |
718 |
* it makes us independent of the long/longlong-size of the machine |
|
719 |
*/ |
|
720 |
if ((unsigned)indx < (nbytes>>3)) { |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
721 |
#ifdef alpha64 |
4220 | 722 |
INT *slp, ll; |
723 |
||
724 |
slp = (INT *)(pFirst + (indx<<3)); |
|
725 |
ll = *slp; |
|
726 |
if (__ISVALIDINTEGER(ll)) { |
|
727 |
RETURN ( __MKSMALLINT(ll) ); |
|
728 |
} |
|
729 |
RETURN ( __MKLARGEINT(ll) ); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
730 |
#else |
4220 | 731 |
__int64__ *llp; |
732 |
extern OBJ __MKINT64(); |
|
733 |
||
734 |
llp = (__int64__ *)(pFirst + (indx<<3)); |
|
735 |
RETURN (__MKINT64(llp)); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
736 |
#endif |
4220 | 737 |
} |
738 |
break; |
|
739 |
||
740 |
case __MASKSMALLINT(LONGLONGARRAY): |
|
741 |
/* |
|
742 |
* unsigned 64bit longlongs |
|
743 |
*/ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
744 |
#ifdef __NEED_LONGLONG_ALIGN |
4220 | 745 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
746 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
|
747 |
||
748 |
pFirst += delta; |
|
749 |
nbytes -= delta; |
|
750 |
} |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
751 |
#endif |
4220 | 752 |
/* Notice: the hard coded shifts are by purpose; |
753 |
* it makes us independent of the long/longlong-size of the machine |
|
754 |
*/ |
|
755 |
if ((unsigned)indx < (nbytes>>3)) { |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
756 |
#ifdef alpha64 |
4220 | 757 |
unsigned INT *ulp, ul; |
758 |
||
759 |
ulp = (unsigned INT *)(pFirst + (indx<<3)); |
|
760 |
ul = *ulp; |
|
761 |
if (ul <= _MAX_INT) { |
|
762 |
RETURN ( __MKSMALLINT(ul) ); |
|
763 |
} |
|
764 |
RETURN ( __MKULARGEINT(ul) ); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
765 |
#else |
4220 | 766 |
__uint64__ *llp; |
767 |
extern OBJ __MKUINT64(); |
|
768 |
||
769 |
llp = (__uint64__ *)(pFirst + (indx<<3)); |
|
770 |
RETURN (__MKUINT64(llp)); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
771 |
#endif |
4220 | 772 |
} |
773 |
break; |
|
774 |
} |
|
1 | 775 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
776 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
777 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
778 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
779 |
%}. |
10 | 780 |
index isInteger ifFalse:[ |
4220 | 781 |
^ self indexNotInteger |
1 | 782 |
]. |
159 | 783 |
^ self subscriptBoundsError:index |
1 | 784 |
! |
785 |
||
786 |
basicAt:index put:anObject |
|
787 |
"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
|
788 |
Returns anObject (sigh). |
1 | 789 |
Trigger an error if the receiver has no indexed instance variables. |
2148 | 790 |
|
791 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
|
1 | 792 |
|
793 |
%{ /* NOCONTEXT */ |
|
794 |
||
795 |
register int nbytes, indx; |
|
796 |
OBJ myClass; |
|
797 |
register char *pFirst; |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
798 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
799 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
800 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
801 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
802 |
#endif |
329 | 803 |
/* int nInstBytes, ninstvars, flags; */ |
804 |
REGISTER int n; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
805 |
unsigned int u; |
1 | 806 |
int val; |
807 |
||
56 | 808 |
/* notice the missing test for self being a nonNilObject - |
77 | 809 |
this can be done since basicAt: is defined both in UndefinedObject |
1 | 810 |
and SmallInteger */ |
811 |
||
253 | 812 |
if (__isSmallInteger(index)) { |
2647 | 813 |
indx = __intVal(index) - 1; |
814 |
myClass = __qClass(self); |
|
815 |
n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
|
816 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */); |
|
817 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
818 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
|
819 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
820 |
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
|
821 |
case __MASKSMALLINT(POINTERARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
822 |
case __MASKSMALLINT(WKPOINTERARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
823 |
if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) { |
4103 | 824 |
OBJ *op; |
825 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
826 |
op = (OBJ *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
827 |
*op = anObject; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
828 |
__STORE(self, anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
829 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
830 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
831 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
832 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
833 |
case __MASKSMALLINT(BYTEARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
834 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
835 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
836 |
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
|
837 |
if ((unsigned)indx < nbytes) { |
4103 | 838 |
char *cp; |
839 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
840 |
cp = pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
841 |
*cp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
842 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
843 |
} |
2647 | 844 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
845 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
846 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
847 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
848 |
case __MASKSMALLINT(FLOATARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
849 |
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
|
850 |
float *fp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
851 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
852 |
fp = (float *)pFirst + indx; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
853 |
if (anObject != nil) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
854 |
if (! __isSmallInteger(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
855 |
if (__qIsFloatLike(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
856 |
*fp = (float)(__floatVal(anObject)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
857 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
858 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
859 |
if (__qIsShortFloat(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
860 |
*fp = __shortFloatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
861 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
862 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
863 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
864 |
*fp = (float) __intVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
865 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
866 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
867 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
868 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
869 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
870 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
871 |
case __MASKSMALLINT(DOUBLEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
872 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
873 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
874 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
875 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
876 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
877 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
878 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
879 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
880 |
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
|
881 |
double *dp; |
13 | 882 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
883 |
dp = (double *)pFirst + indx; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
884 |
if (anObject != nil) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
885 |
if (! __isSmallInteger(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
886 |
if (__qIsFloatLike(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
887 |
*dp = __floatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
888 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
889 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
890 |
if (__qIsShortFloat(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
891 |
*dp = (double)__shortFloatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
892 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
893 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
894 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
895 |
*dp = (double) __intVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
896 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
897 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
898 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
899 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
900 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
901 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
902 |
case __MASKSMALLINT(WORDARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
903 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
904 |
val = __intVal(anObject); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
905 |
if ((unsigned)val <= 0xFFFF) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
906 |
if ((unsigned)indx < (nbytes>>1)) { |
4103 | 907 |
unsigned short *sp; |
908 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
909 |
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
|
910 |
*sp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
911 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
912 |
} |
2647 | 913 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
914 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
915 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
916 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
917 |
case __MASKSMALLINT(SWORDARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
918 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
919 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
920 |
if ((val >= -32768) && (val < 32768)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
921 |
if ((unsigned)indx < (nbytes>>1)) { |
4103 | 922 |
short *ssp; |
923 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
924 |
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
|
925 |
*ssp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
926 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
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(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
933 |
if ((unsigned)indx < (nbytes>>2)) { |
4103 | 934 |
int32 *slp; |
935 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
936 |
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
|
937 |
if (__isSmallInteger(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
938 |
*slp = __intVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
939 |
RETURN ( anObject ); |
2647 | 940 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
941 |
n = __signedLongIntVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
942 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
943 |
* 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
|
944 |
* (would be a smallInteger) |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
945 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
946 |
if (n) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
947 |
*slp = n; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
948 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
949 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
950 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
951 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
952 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
953 |
case __MASKSMALLINT(LONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
954 |
if ((unsigned)indx < (nbytes>>2)) { |
4103 | 955 |
unsigned int32 *lp; |
956 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
957 |
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
|
958 |
if (anObject == __MKSMALLINT(0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
959 |
*lp = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
960 |
RETURN ( anObject ); |
3159
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 |
u = __longIntVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
963 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
964 |
* 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
|
965 |
* (would be a smallInteger) |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
966 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
967 |
if (u) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
968 |
*lp = u; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
969 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
970 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
971 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
972 |
break; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
973 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
974 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
975 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
976 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
977 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
978 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
979 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
980 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
981 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
982 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
983 |
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
|
984 |
__int64__ ll; |
4103 | 985 |
__int64__ *sllp; |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
986 |
|
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
987 |
sllp = (__int64__ *)(pFirst + (indx<<3)); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
988 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
989 |
if (anObject == __MKSMALLINT(0)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
990 |
ll.lo = ll.hi = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
991 |
*sllp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
992 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
993 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
994 |
if (__signedLong64IntVal(anObject, &ll)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
995 |
*sllp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
996 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
997 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
998 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
999 |
break; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1000 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1001 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1002 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1003 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1004 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1005 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1006 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1007 |
nbytes -= delta; |
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 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1010 |
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
|
1011 |
__uint64__ ll; |
4103 | 1012 |
__uint64__ *llp; |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
1013 |
|
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
1014 |
llp = (__uint64__ *)(pFirst + (indx<<3)); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1015 |
if (anObject == __MKSMALLINT(0)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1016 |
ll.lo = ll.hi = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1017 |
*llp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1018 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1019 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1020 |
if (__unsignedLong64IntVal(anObject, &ll)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1021 |
*llp = 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 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1025 |
break; |
2647 | 1026 |
} |
1 | 1027 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1028 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1029 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1030 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1031 |
%}. |
10 | 1032 |
index isInteger ifFalse:[ |
2647 | 1033 |
" |
1034 |
the index should be an integer number |
|
1035 |
" |
|
1036 |
^ self indexNotInteger |
|
1 | 1037 |
]. |
1038 |
(index between:1 and:self size) ifFalse:[ |
|
2647 | 1039 |
" |
1040 |
the index is less than 1 or greater than the size of the |
|
1041 |
receiver collection |
|
1042 |
" |
|
1043 |
^ self subscriptBoundsError:index |
|
1 | 1044 |
]. |
643 | 1045 |
(self class isFloatsOrDoubles) ifTrue:[ |
2647 | 1046 |
anObject isNumber ifTrue:[ |
1047 |
^ self basicAt:index put:(anObject asFloat) |
|
1048 |
] |
|
13 | 1049 |
]. |
10 | 1050 |
anObject isInteger ifFalse:[ |
2647 | 1051 |
" |
1052 |
the object to put into the receiver collection |
|
1053 |
should be an integer number |
|
1054 |
" |
|
1055 |
^ self elementNotInteger |
|
2 | 1056 |
]. |
159 | 1057 |
" |
213 | 1058 |
the object to put into the receiver collection |
362 | 1059 |
is not an instance of the expected element class, |
1060 |
or the value is not within the elements valid range. |
|
159 | 1061 |
" |
2 | 1062 |
^ self elementBoundsError |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1063 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1064 |
"Modified: 19.4.1996 / 11:14:10 / cg" |
1 | 1065 |
! |
1066 |
||
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1067 |
byteAt:index |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1068 |
"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
|
1069 |
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
|
1070 |
(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
|
1071 |
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
|
1072 |
collection of bytes. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1073 |
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
|
1074 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1075 |
%{ /* NOCONTEXT */ |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1076 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1077 |
REGISTER int indx; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1078 |
int nIndex; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1079 |
REGISTER OBJ slf; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1080 |
REGISTER OBJ cls; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1081 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1082 |
if (__isSmallInteger(index)) { |
2647 | 1083 |
slf = self; |
1084 |
if (__isNonNilObject(slf)) { |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1085 |
unsigned char *pFirst; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1086 |
int nIndex; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1087 |
|
2647 | 1088 |
cls = __qClass(slf); |
1089 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1090 |
pFirst = __ByteArrayInstPtr(slf)->ba_element; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1091 |
pFirst += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1092 |
nIndex = __byteArraySize(slf); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1093 |
indx = __intVal(index) - 1; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1094 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1095 |
switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1096 |
case __MASKSMALLINT(DOUBLEARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1097 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1098 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1099 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1100 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1101 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1102 |
nIndex -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1103 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1104 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1105 |
/* fall into */ |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1106 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1107 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1108 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1109 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1110 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1111 |
case __MASKSMALLINT(FLOATARRAY): |
2647 | 1112 |
if ((unsigned)indx < (unsigned)nIndex) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1113 |
RETURN ( __MKSMALLINT( pFirst[indx]) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1114 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1115 |
break; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1116 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1117 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1118 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1119 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1120 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1121 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1122 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1123 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1124 |
nIndex -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1125 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1126 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1127 |
if ((unsigned)indx < (unsigned)nIndex) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1128 |
RETURN ( __MKSMALLINT( pFirst[indx]) ); |
2647 | 1129 |
} |
1130 |
break; |
|
1131 |
} |
|
1132 |
} |
|
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1133 |
} |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1134 |
%}. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1135 |
"/ 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
|
1136 |
"/ 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
|
1137 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1138 |
^ self primitiveFailed |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1139 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1140 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1141 |
Point new byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1142 |
(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
|
1143 |
(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
|
1144 |
(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
|
1145 |
'hello' byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1146 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1147 |
! |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1148 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1149 |
byteAt:index put:byteValue |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1150 |
"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
|
1151 |
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
|
1152 |
(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
|
1153 |
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
|
1154 |
collection of bytes. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1155 |
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
|
1156 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1157 |
%{ /* NOCONTEXT */ |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1158 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1159 |
REGISTER int indx; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1160 |
int val, nIndex; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1161 |
REGISTER OBJ slf; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1162 |
REGISTER OBJ cls; |
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 |
if (__bothSmallInteger(index, byteValue)) { |
2647 | 1165 |
val = __intVal(byteValue); |
1166 |
if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) { |
|
1167 |
slf = self; |
|
1168 |
if (__isNonNilObject(slf)) { |
|
1169 |
cls = __qClass(slf); |
|
1170 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1171 |
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
|
1172 |
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
|
1173 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1174 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1175 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1176 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1177 |
case __MASKSMALLINT(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1178 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1179 |
case __MASKSMALLINT(SLONGLONGARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1180 |
case __MASKSMALLINT(FLOATARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1181 |
case __MASKSMALLINT(DOUBLEARRAY): |
2647 | 1182 |
indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
1183 |
nIndex = __byteArraySize(slf); |
|
1184 |
if ((unsigned)indx < (unsigned)nIndex) { |
|
1185 |
__ByteArrayInstPtr(slf)->ba_element[indx] = val; |
|
1186 |
RETURN ( byteValue ); |
|
1187 |
} |
|
1188 |
break; |
|
1189 |
} |
|
1190 |
} |
|
1191 |
} |
|
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1192 |
} |
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 |
"/ 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
|
1195 |
"/ 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
|
1196 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1197 |
^ self primitiveFailed |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1198 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1199 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1200 |
(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
|
1201 |
'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
|
1202 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1203 |
! |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1204 |
|
1 | 1205 |
instVarAt:index |
1206 |
"return a non-indexed instance variable; |
|
13 | 1207 |
peeking into an object this way is not very object oriented |
1208 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 1209 |
|
1210 |
%{ /* NOCONTEXT */ |
|
1211 |
||
1212 |
OBJ myClass; |
|
1213 |
int idx, ninstvars; |
|
1214 |
||
253 | 1215 |
if (__isSmallInteger(index)) { |
329 | 1216 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
1217 |
idx = __intVal(index) - 1; |
357 | 1218 |
/* |
4267 | 1219 |
* do not allow returning of non-object fields. |
357 | 1220 |
* if subclass did not make privisions for that, |
1221 |
* we wont do so here ... |
|
1222 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1223 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 1224 |
if (idx == 0) { |
1225 |
RETURN ( nil ) |
|
1226 |
} |
|
1227 |
} |
|
1133 | 1228 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
159 | 1229 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 1230 |
RETURN ( __InstPtr(self)->i_instvars[idx] ); |
159 | 1231 |
} |
1 | 1232 |
} |
1233 |
%} |
|
1234 |
. |
|
1235 |
index isInteger ifFalse:[ |
|
159 | 1236 |
^ self indexNotInteger |
1 | 1237 |
]. |
159 | 1238 |
^ self subscriptBoundsError:index |
1 | 1239 |
! |
1240 |
||
1241 |
instVarAt:index put:value |
|
1242 |
"change a non-indexed instance variable; |
|
13 | 1243 |
peeking into an object this way is not very object oriented |
1244 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 1245 |
|
1246 |
%{ /* NOCONTEXT */ |
|
1247 |
||
1248 |
OBJ myClass; |
|
1249 |
int idx, ninstvars; |
|
1250 |
||
253 | 1251 |
if (__isSmallInteger(index)) { |
329 | 1252 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
1253 |
idx = __intVal(index) - 1; |
1133 | 1254 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
357 | 1255 |
/* |
1256 |
* do not allow setting of non-object fields. |
|
1257 |
* if subclass did not make privisions for that, |
|
1258 |
* we wont do so here ... |
|
1259 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1260 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 1261 |
if (idx == 0) { |
1262 |
RETURN ( nil ) |
|
1263 |
} |
|
1264 |
} |
|
159 | 1265 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 1266 |
__InstPtr(self)->i_instvars[idx] = value; |
159 | 1267 |
__STORE(self, value); |
1268 |
RETURN ( value ); |
|
1269 |
} |
|
1 | 1270 |
} |
1271 |
%} |
|
1272 |
. |
|
1273 |
index isInteger ifFalse:[ |
|
159 | 1274 |
^ self indexNotInteger |
1 | 1275 |
]. |
159 | 1276 |
^ self subscriptBoundsError:index |
359 | 1277 |
! |
1278 |
||
1279 |
instVarNamed:name |
|
1280 |
"return a non-indexed instance variables value by name; |
|
1281 |
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
|
1282 |
- 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
|
1283 |
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
|
1284 |
parsed ad runtime)" |
359 | 1285 |
|
1286 |
^ 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
|
1287 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1288 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1289 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1290 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1291 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1292 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1293 |
p instVarNamed:'x' |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1294 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1295 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1296 |
"Modified: 19.4.1996 / 11:12:39 / cg" |
359 | 1297 |
! |
1298 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1299 |
instVarNamed:name ifAbsent:exceptionBlock |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1300 |
"return a non-indexed instance variables value by name, |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1301 |
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
|
1302 |
peeking into an object this way is not very object oriented |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1303 |
- 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
|
1304 |
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
|
1305 |
parsed ad runtime)" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1306 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1307 |
|idx| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1308 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1309 |
idx := self class instVarOffsetOf:name. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1310 |
idx isNil ifTrue:[^ exceptionBlock value]. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1311 |
^ self instVarAt:idx |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1312 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1313 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1314 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1315 |
|p| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1316 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1317 |
p := Point x:10 y:20. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1318 |
p instVarNamed:'x' |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1319 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1320 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1321 |
"Created: 6.7.1996 / 23:02:49 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1322 |
"Modified: 6.7.1996 / 23:03:41 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1323 |
! |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1324 |
|
359 | 1325 |
instVarNamed:name put:value |
1326 |
"set a non-indexed instance variable by name; |
|
1327 |
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
|
1328 |
- 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
|
1329 |
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
|
1330 |
parsed ad runtime)" |
359 | 1331 |
|
1332 |
^ 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
|
1333 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1334 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1335 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1336 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1337 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1338 |
p instVarNamed:'x' put:30. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1339 |
p |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1340 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1341 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1342 |
"Modified: 19.4.1996 / 11:12:49 / cg" |
1 | 1343 |
! ! |
1344 |
||
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1345 |
!Object methodsFor:'attributes access'! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1346 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1347 |
objectAttributeAt:key |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1348 |
"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
|
1349 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1350 |
| attrs | |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1351 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1352 |
attrs := self objectAttributes. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1353 |
(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
|
1354 |
^ attrs at:key ifAbsent:[] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1355 |
]. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1356 |
^ nil |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1357 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1358 |
"Created: / 22.1.1998 / 21:29:17 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1359 |
"Modified: / 3.2.1998 / 18:55:55 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1360 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1361 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1362 |
objectAttributeAt:key put:anObject |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1363 |
"store the attribute anObject referenced by key into the receiver" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1364 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1365 |
|wasBlocked| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1366 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1367 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1368 |
"/ is possibly accessed from multiple threads ... |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1369 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1370 |
wasBlocked := OperatingSystem blockInterrupts. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1371 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1372 |
| attrs | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1373 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1374 |
attrs := self objectAttributes. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1375 |
(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
|
1376 |
attrs := WeakIdentityDictionary new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1377 |
attrs at:key put:anObject. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1378 |
self objectAttributes:attrs. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1379 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1380 |
attrs at:key put:anObject. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1381 |
]. |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1382 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1383 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1384 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1385 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1386 |
] |
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 |
"Attaching additional attributes (slots) to an arbitrary object: |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1389 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1390 |
|p| |
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 |
p := Point new. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1393 |
p objectAttributeAt:#color put:#green. |
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 |
p objectAttributeAt:#color |
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 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1398 |
"Created: / 22.1.1998 / 21:29:25 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1399 |
"Modified: / 3.2.1998 / 18:57:58 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1400 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1401 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1402 |
objectAttributes |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1403 |
"return a Collection of attributes - nil if there is none. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1404 |
The default implementation here uses a global WeakDictionary to store |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1405 |
attributes |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1406 |
This may be too slow for high frequency slot access, |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1407 |
therefore, some classes may redefine this for better performance. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1408 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1409 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1410 |
^ ObjectAttributes at:self ifAbsent:[#()] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1411 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1412 |
"Created: / 22.1.1998 / 21:29:30 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1413 |
"Modified: / 3.2.1998 / 18:58:31 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1414 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1415 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1416 |
objectAttributes:aCollection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1417 |
"set the collection of attributes. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1418 |
The default implementation here uses a global Dictionary to store |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1419 |
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
|
1420 |
Therefore, some classes may redefine this for better performance." |
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 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1423 |
"/ is possibly accessed from multiple threads. |
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 |
(OperatingSystem blockInterrupts) ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1426 |
"/ the common case - already blocked |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1427 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1428 |
(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
|
1429 |
ObjectAttributes removeKey:self ifAbsent:[] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1430 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1431 |
ObjectAttributes at:self put:aCollection |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1432 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1433 |
^ self |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1434 |
]. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1435 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1436 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1437 |
(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
|
1438 |
ObjectAttributes removeKey:self ifAbsent:[] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1439 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1440 |
ObjectAttributes at:self put:aCollection |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1441 |
]. |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1442 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1443 |
OperatingSystem unblockInterrupts |
3268
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 |
"Created: / 22.1.1998 / 21:29:35 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1447 |
"Modified: / 3.2.1998 / 18:58:10 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1448 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1449 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1450 |
removeObjectAttribute:anObject |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1451 |
"make the argument, anObject be no attribute of the receiver" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1452 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1453 |
|wasBlocked| |
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 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1456 |
"/ is possibly accessed from multiple threads. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1457 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1458 |
wasBlocked := OperatingSystem blockInterrupts. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1459 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1460 |
|attrs n a| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1461 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1462 |
attrs := self objectAttributes. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1463 |
attrs notNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1464 |
attrs remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1465 |
attrs size == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1466 |
self objectAttributes:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1467 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1468 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1469 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1470 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1471 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1472 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1473 |
] |
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 |
"Created: / 22.1.1998 / 21:29:39 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1476 |
"Modified: / 3.2.1998 / 18:58:13 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1477 |
! ! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1478 |
|
783 | 1479 |
!Object methodsFor:'binary storage'! |
1480 |
||
1481 |
hasSpecialBinaryRepresentation |
|
1482 |
"return true, if the receiver has a special binary representation; |
|
1483 |
default here is false, but can be redefined in class which provide |
|
1484 |
their own storeBinary/readBinary methods. |
|
1485 |
||
1486 |
Normal user classes should not use this, it is meant as a hook for |
|
1487 |
special classes such as True, False, UndefinedObject or SmallInteger. |
|
1488 |
||
1489 |
If your instances should be stored in a special way, see |
|
1490 |
#representBinaryOn: and #readBinaryContentsFromdata:manager:." |
|
1491 |
||
1492 |
^ false |
|
1 | 1493 |
! |
1494 |
||
783 | 1495 |
readBinaryContentsFrom:stream manager:manager |
1496 |
"reconstruct the receivers instance variables by reading a binary |
|
1497 |
binary representation from stream. |
|
1498 |
This is a general implementation, walking over instances |
|
1499 |
and loading each recursively using manager. |
|
1500 |
Redefined by some classes to read a more compact representations |
|
1501 |
(see String, SmallInteger etc). |
|
1502 |
||
1503 |
Notice, that the object is already recreated as an empty corps |
|
1504 |
with instance variables all nil and bit-instances (bytes, words etc.) |
|
1505 |
already read and restored. |
|
1506 |
||
1507 |
Also notice: this method is not called for if a private representation |
|
1508 |
has been stored (see representBinaryOn:). |
|
1509 |
In that case, #readBinaryContentsFromData:manager: is called, which |
|
1510 |
has to be reimplemented in the objects class." |
|
1511 |
||
1512 |
|size "{ Class: SmallInteger }" |
|
1513 |
instvarArray| |
|
1514 |
||
1515 |
stream next == 1 ifTrue:[ |
|
1516 |
"/ |
|
1517 |
"/ special representation ... |
|
1518 |
"/ |
|
1519 |
instvarArray := Array new:(size := stream nextNumber:3). |
|
1520 |
1 to:size do:[:i | |
|
1521 |
instvarArray basicAt:i put:(manager nextObject) |
|
1522 |
]. |
|
1523 |
self readBinaryContentsFromData:instvarArray manager:manager. |
|
1524 |
^ self |
|
1525 |
]. |
|
1526 |
||
1527 |
"/ |
|
1528 |
"/ standard representation |
|
1529 |
"/ |
|
1530 |
size := self basicSize. |
|
1531 |
size ~~ 0 ifTrue:[ |
|
1532 |
self class isPointers ifTrue:[ |
|
1533 |
1 to:size do:[:i | |
|
1534 |
self basicAt:i put:(manager nextObject) |
|
1535 |
] |
|
1536 |
] |
|
1537 |
]. |
|
1538 |
size := self class instSize. |
|
1539 |
1 to:size do:[:i | |
|
1540 |
self instVarAt:i put:(manager nextObject) |
|
1541 |
]. |
|
1542 |
! |
|
1543 |
||
1544 |
readBinaryContentsFromData:instvarArray manager:manager |
|
1545 |
"reconstruct the receivers instance variables by filling instance |
|
1546 |
variables with values from instvarArray. This array contains the instvars |
|
1547 |
as specified in #representBinaryOn: when the object was stored. |
|
1548 |
It is the receivers responsibility to set its instance variables in the |
|
1549 |
same order from that array." |
|
1550 |
||
1551 |
^ self subclassResponsibility |
|
1552 |
||
1553 |
"typical implementation (see also comment in #representBinaryOn:) |
|
1554 |
(for an object with foo, bar and baz as instance variables, |
|
1555 |
which did not store baz and wants baz to be reinitialized to |
|
1556 |
some constant string) |
|
1557 |
||
1558 |
foo := instvarArray at:1. |
|
1559 |
bar := instvarArray at:2. |
|
1560 |
baz := 'aConstant'. |
|
1561 |
" |
|
1562 |
! |
|
1563 |
||
1564 |
representBinaryOn:manager |
|
1565 |
"this method is called by the storage manager to ask objects |
|
1566 |
if they wish to provide their own binary representation. |
|
1567 |
||
1568 |
If they want to do so, they should return an array containing all |
|
1569 |
instance variables (named & indexed pointer) to be stored. |
|
1570 |
If not redefined, this method returns nil which means that all |
|
1571 |
instance variables are to be stored. |
|
1572 |
||
1573 |
It should be redefined in objects which do not want all instance variables |
|
1574 |
to be stored (for example: objects which keep references to a view etc.). |
|
1575 |
||
1576 |
If this is redefined returning non-nil, the corresponding class needs |
|
1577 |
a redefined instance method named #readBinaryContentsFromData:manager: |
|
1578 |
which has to fill the receivers named (and optionally indexed pointer) |
|
1579 |
instance variables with corresponding values from a data array." |
|
1580 |
||
1581 |
^ nil |
|
1582 |
||
1583 |
"typical implementation: |
|
1584 |
(see also comment in #readBinaryContentsFromData:manager:) |
|
1585 |
for an object with foo, bar and baz as instance variables, |
|
1586 |
which does not want to store baz: |
|
1587 |
||
1588 |
representBinaryOn:manager |
|
1589 |
|data| |
|
1590 |
||
1591 |
data := Array new:2. |
|
1592 |
data at:1 put:foo. |
|
1593 |
data at:2 put:bar. |
|
1594 |
^ data |
|
1595 |
" |
|
159 | 1596 |
! |
1597 |
||
783 | 1598 |
storeBinaryDefinitionBodyOn:stream manager:manager |
1599 |
"append a binary representation of the receivers body onto stream. |
|
1600 |
This is a general implementation walking over instances storing |
|
1601 |
each recursively as an ID using manager. |
|
1602 |
Can be redefined in subclasses." |
|
1603 |
||
3078 | 1604 |
|basicSize "{ Class: SmallInteger }" |
1605 |
instSize "{ Class: SmallInteger }" |
|
1606 |
specialSize "{ Class: SmallInteger }" |
|
783 | 1607 |
myClass specialRep pointers| |
1608 |
||
1609 |
myClass := self class. |
|
1610 |
instSize := myClass instSize. |
|
1611 |
||
1612 |
(pointers := myClass isPointers) ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1613 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1614 |
"/ 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
|
1615 |
"/ also uncomment the corresponding line in |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1616 |
"/ Object>>binaryDefinitionFrom:manager: |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1617 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1618 |
"/ 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
|
1619 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1620 |
myClass isVariable ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1621 |
stream nextNumber:3 put:(basicSize := self basicSize) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1622 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1623 |
basicSize := 0 |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1624 |
]. |
783 | 1625 |
] ifFalse: [ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1626 |
stream nextNumber:4 put:(basicSize := self basicSize). |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1627 |
myClass isBytes ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1628 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1629 |
stream nextPut:(self basicAt:i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1630 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1631 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1632 |
myClass isWords ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1633 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1634 |
stream nextNumber:2 put:(self basicAt: i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1635 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1636 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1637 |
myClass isLongs ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1638 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1639 |
stream nextNumber:4 put:(self basicAt: i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1640 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1641 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1642 |
myClass isFloats ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1643 |
"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
|
1644 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1645 |
Float storeBinaryIEEESingle:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1646 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1647 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1648 |
myClass isDoubles ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1649 |
"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
|
1650 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1651 |
Float storeBinaryIEEEDouble:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1652 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1653 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1654 |
"/ should never be reached ... |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1655 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1656 |
manager putIdOf:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1657 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1658 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1659 |
] |
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 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1662 |
]. |
783 | 1663 |
]. |
1664 |
||
1665 |
(pointers or:[instSize ~~ 0]) ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1666 |
specialRep := self representBinaryOn:manager. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1667 |
specialRep notNil ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1668 |
specialSize := specialRep basicSize. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1669 |
stream nextPut:1. "/ means: private representation follows |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1670 |
stream nextNumber:3 put:specialSize. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1671 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1672 |
1 to:specialSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1673 |
manager putIdOf:(specialRep at:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1674 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1675 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1676 |
stream nextPut:0. "/ means: normal representation follows |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1677 |
"/ index pointers followed by named instanceVars |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1678 |
pointers ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1679 |
basicSize ~~ 0 ifTrue:[ |
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 |
manager putIdOf:(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 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1684 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1685 |
instSize ~~ 0 ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1686 |
1 to:instSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1687 |
manager putIdOf:(self instVarAt:i) on:stream |
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 |
] |
1 | 1691 |
] |
783 | 1692 |
|
3078 | 1693 |
"Modified: / 2.11.1997 / 14:43:29 / cg" |
1 | 1694 |
! |
1695 |
||
783 | 1696 |
storeBinaryDefinitionOn:stream manager:manager |
1697 |
"append a binary representation of the receiver onto stream. |
|
1260 | 1698 |
This is an internal interface for binary storage mechanism. |
783 | 1699 |
This method first stores the class, then the body, which is done |
1700 |
in a separate method to allow redefinition of the bodies format. |
|
1701 |
Can be redefined in subclasses to write more compact representations |
|
1702 |
(see String, SmallInteger etc)." |
|
1703 |
||
1704 |
manager putIdOfClass:(self class) on:stream. |
|
1705 |
self storeBinaryDefinitionBodyOn:stream manager:manager |
|
1260 | 1706 |
|
1707 |
"Modified: 23.4.1996 / 09:31:12 / cg" |
|
783 | 1708 |
! |
1709 |
||
3078 | 1710 |
storeBinaryOn:aStreamOrFilename |
1711 |
"Writes a description of the receiver onto aStreamOrFilename, in a way that allows |
|
783 | 1712 |
the object's structure to be reconstructed from the stream's contents" |
1713 |
||
3078 | 1714 |
BinaryOutputManager store:self on:aStreamOrFilename |
899 | 1715 |
|
1716 |
" |
|
1717 |
|a s1 s2| |
|
1718 |
||
1719 |
s1 := 'hello'. |
|
1720 |
s2 := 'world'. |
|
1721 |
a := Array new:5. |
|
1722 |
a at:1 put:s1. |
|
1723 |
a at:2 put:s2. |
|
1724 |
a at:3 put:s1. |
|
1725 |
a at:4 put:s2. |
|
1726 |
a storeBinaryOn:'test.boss' |
|
1727 |
" |
|
1728 |
||
1729 |
" |
|
1730 |
(BinaryObjectStorage onOld:'test.boss' asFilename readStream) |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1731 |
next |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1732 |
inspect |
899 | 1733 |
" |
3078 | 1734 |
|
1735 |
"Modified: / 1.11.1997 / 21:16:24 / cg" |
|
783 | 1736 |
! |
1737 |
||
1738 |
storeBinaryOn:stream manager:manager |
|
1739 |
"append a binary representation of the receiver onto stream." |
|
1740 |
||
1741 |
manager putIdOf:self on:stream |
|
1 | 1742 |
! ! |
1743 |
||
1826 | 1744 |
!Object methodsFor:'change & update'! |
1 | 1745 |
|
783 | 1746 |
broadcast:aSelectorSymbol |
1747 |
"send a message with selector aSelectorSymbol to all my dependents" |
|
1748 |
||
1749 |
self dependentsDo:[:dependent | |
|
1750 |
dependent perform:aSelectorSymbol |
|
1751 |
] |
|
1752 |
! |
|
1753 |
||
1754 |
broadcast:aSelectorSymbol with:anArgument |
|
1755 |
"send a message with selector aSelectorSymbol with an additional |
|
1756 |
argument anArgument to all my dependents." |
|
1757 |
||
1758 |
self dependentsDo:[:dependent | |
|
1759 |
dependent perform:aSelectorSymbol with:anArgument |
|
1760 |
] |
|
1761 |
! |
|
1762 |
||
159 | 1763 |
changeRequest |
1764 |
"the receiver wants to change - check if all dependents |
|
1765 |
grant the request, and return true if so" |
|
1766 |
||
1767 |
self dependentsDo:[:dependent | |
|
1768 |
dependent updateRequest ifFalse:[^ false]. |
|
1769 |
]. |
|
1770 |
^ true |
|
1771 |
! |
|
1772 |
||
1773 |
changeRequest:aParameter |
|
1774 |
"the receiver wants to change - check if all dependents |
|
1775 |
grant the request, and return true if so" |
|
1776 |
||
1777 |
self dependentsDo:[:dependent | |
|
1778 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1779 |
]. |
|
1780 |
^ true |
|
1781 |
! |
|
1782 |
||
783 | 1783 |
changeRequest:aParameter from:anObject |
1784 |
"the receiver wants to change - check if all dependents |
|
1785 |
except anObject grant the request, and return true if so. |
|
1786 |
The argument anObject is typically going to be the one who is |
|
1787 |
about to send the change request." |
|
1788 |
||
1789 |
self dependentsDo:[:dependent | |
|
1790 |
dependent == anObject ifFalse:[ |
|
1791 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1792 |
] |
|
1793 |
]. |
|
1794 |
^ true |
|
1795 |
! |
|
1796 |
||
159 | 1797 |
changeRequestFrom:anObject |
1798 |
"the receiver wants to change - check if all dependents |
|
202 | 1799 |
except anObject grant the request, and return true if so. |
1800 |
The argument anObject is typically going to be the one who is |
|
1801 |
about to send the change request." |
|
159 | 1802 |
|
1803 |
self dependentsDo:[:dependent | |
|
1804 |
dependent == anObject ifFalse:[ |
|
1805 |
(dependent updateRequest) ifFalse:[^ false]. |
|
1806 |
] |
|
1807 |
]. |
|
1808 |
^ true |
|
1809 |
! |
|
1810 |
||
1 | 1811 |
changed |
1812 |
"notify all dependents that the receiver has changed. |
|
71 | 1813 |
Each dependent gets a '#update:'-message with the original |
1814 |
receiver as argument." |
|
1 | 1815 |
|
159 | 1816 |
self changed:nil |
1 | 1817 |
! |
1818 |
||
1819 |
changed:aParameter |
|
1820 |
"notify all dependents that the receiver has changed somehow. |
|
71 | 1821 |
Each dependent gets a '#update:'-message with aParameter |
1822 |
as argument." |
|
1 | 1823 |
|
159 | 1824 |
self changed:aParameter with:nil |
1 | 1825 |
! |
1826 |
||
71 | 1827 |
changed:aParameter with:anArgument |
1 | 1828 |
"notify all dependents that the receiver has changed somehow. |
159 | 1829 |
Each dependent gets a '#update:with:from:'-message, with aParameter |
71 | 1830 |
and anArgument as arguments." |
1 | 1831 |
|
159 | 1832 |
self dependentsDo:[:dependent | |
1833 |
dependent update:aParameter with:anArgument from:self |
|
1 | 1834 |
] |
1835 |
! |
|
1836 |
||
1837 |
update:aParameter |
|
71 | 1838 |
"the message is sent to a dependent, when one of the objects |
1839 |
on whom the receiver depends, has changed. The argument aParameter |
|
1840 |
is either the changed object or the argument to the #changed: message. |
|
1841 |
||
1842 |
Default behavior here is to do nothing" |
|
1 | 1843 |
|
1844 |
^ self |
|
1845 |
! |
|
1846 |
||
1847 |
update:aParameter with:anArgument |
|
1848 |
"dependent is notified of some change - |
|
159 | 1849 |
Default is to try update:" |
1 | 1850 |
|
1851 |
^ self update:aParameter |
|
1852 |
! |
|
1853 |
||
1854 |
update:aParameter with:anArgument from:sender |
|
1855 |
"dependent is notified of some change - |
|
159 | 1856 |
Default is to try update:with:" |
1 | 1857 |
|
1858 |
^ self update:aParameter with:anArgument |
|
159 | 1859 |
! |
1860 |
||
1861 |
updateRequest |
|
1862 |
"return true, if an update request is granted. |
|
1863 |
Default here is to grant updates - may be used |
|
1864 |
to lock updates if someone is making other changes |
|
202 | 1865 |
from within an update. Or if someone has locked its |
1866 |
state and does not want others to change things. |
|
1867 |
However, these dependents must all honor the |
|
1868 |
changeRequest - ifTrue - change protocol. I.e. they |
|
1869 |
must first ask all others via changeRequest, and only do the change |
|
1870 |
it returns true. The others must decide in updateRequest and |
|
1871 |
return true if they think a change is ok." |
|
159 | 1872 |
|
1873 |
^ true |
|
1874 |
! |
|
1875 |
||
1876 |
updateRequest:aSymbol |
|
1877 |
"return true, if an update request is granted. |
|
1878 |
Default here a simple updateRequest" |
|
1879 |
||
1880 |
^ self updateRequest |
|
1 | 1881 |
! ! |
1882 |
||
783 | 1883 |
!Object methodsFor:'cleanup'! |
1884 |
||
1885 |
lowSpaceCleanup |
|
1886 |
"ignored here - redefined in some classes to |
|
1887 |
cleanup in low-memory situations" |
|
1888 |
||
1889 |
^ self |
|
1890 |
! ! |
|
1891 |
||
1892 |
!Object methodsFor:'comparing'! |
|
1893 |
||
1894 |
= anObject |
|
3044 | 1895 |
"return true, if the receiver and the arg have the same structure. |
1896 |
Notice: |
|
1897 |
This method is partially open coded (inlined) by the compiler(s) |
|
1898 |
identical objects are always considered equal. |
|
1899 |
redefining it may not work as expected." |
|
783 | 1900 |
|
1901 |
^ self == anObject |
|
1902 |
! |
|
1903 |
||
1904 |
== anObject |
|
2505 | 1905 |
"return true, if the receiver and the arg are the same object. |
1906 |
Never redefine this in any class. |
|
3044 | 1907 |
Notice: |
1908 |
This method is open coded (inlined) by the compiler(s) |
|
1909 |
- redefining it may not work as expected." |
|
783 | 1910 |
|
1911 |
%{ /* NOCONTEXT */ |
|
1912 |
||
1913 |
RETURN ( (self == anObject) ? true : false ); |
|
1914 |
%} |
|
1915 |
! |
|
1916 |
||
1917 |
hash |
|
1918 |
"return an Integer useful as a hash key for the receiver. |
|
1919 |
This hash should return same values for objects with same |
|
1920 |
contents (i.e. use this to hash on structure)" |
|
1921 |
||
1922 |
^ self identityHash |
|
1923 |
! |
|
1924 |
||
1925 |
identityHash |
|
1926 |
"return an Integer useful as a hash key for the receiver. |
|
1927 |
This hash should return same values for the same object (i.e. use |
|
1928 |
this to hash on identity of objects). |
|
1929 |
||
1930 |
We cannot use the Objects address (as other smalltalks do) since |
|
1931 |
no object-table exists and the hashval must not change when objects |
|
1932 |
are moved by the collector. Therefore we assign each object a unique |
|
1933 |
Id in the object header itself as its hashed upon. |
|
1934 |
(luckily we have 11 bits spare to do this - unluckily its only 11 bits). |
|
1935 |
Time will show, if 11 bits are enough; if not, another entry in the |
|
1936 |
object header will be needed, adding 4 bytes to every object. Alternatively, |
|
1937 |
hashed-upon objects could add an instvar containing the hash value." |
|
1938 |
||
1939 |
%{ /* NOCONTEXT */ |
|
1940 |
||
1941 |
REGISTER unsigned hash; |
|
1942 |
static unsigned nextHash = 0; |
|
1943 |
||
1944 |
if (__isNonNilObject(self)) { |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1945 |
hash = __GET_HASH(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1946 |
if (hash == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1947 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1948 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1949 |
if (++nextHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1950 |
nextHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1951 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1952 |
hash = nextHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1953 |
__SET_HASH(self, hash); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1954 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1955 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1956 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1957 |
* now, we got 11 bits for hashing; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1958 |
* 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
|
1959 |
* 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
|
1960 |
* 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
|
1961 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1962 |
hash = __MAKE_HASH__(hash); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1963 |
RETURN ( __MKSMALLINT(hash) ); |
783 | 1964 |
} |
1965 |
%}. |
|
1966 |
^ 0 "never reached, since redefined in UndefinedObject and SmallInteger" |
|
1967 |
! |
|
1968 |
||
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1969 |
identityHashForBinaryStore |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1970 |
"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
|
1971 |
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
|
1972 |
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
|
1973 |
object writing phase." |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1974 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1975 |
%{ /* NOCONTEXT */ |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1976 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1977 |
REGISTER unsigned hash, hash1, hash2, sz; |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1978 |
OBJ o; |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1979 |
static unsigned nextHash = 0; |
2480 | 1980 |
static unsigned nextClassHash = 0; |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1981 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1982 |
if (__isNonNilObject(self)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1983 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1984 |
* my own identityHash |
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 |
hash1 = __GET_HASH(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1987 |
if (hash1 == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1988 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1989 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1990 |
if (++nextHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1991 |
nextHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1992 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1993 |
hash1 = nextHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1994 |
__SET_HASH(self, hash1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1995 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1996 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1997 |
* my classes identityHash |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1998 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1999 |
o = __qClass(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2000 |
hash2 = __GET_HASH(o); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2001 |
if (hash2 == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2002 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2003 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2004 |
if (++nextClassHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2005 |
nextClassHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2006 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2007 |
hash2 = nextClassHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2008 |
__SET_HASH(o, hash2); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2009 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2010 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2011 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2012 |
* some bits of my size |
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 |
sz = __qSize(self); |
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 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2017 |
* 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
|
2018 |
* 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
|
2019 |
* 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
|
2020 |
* 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
|
2021 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2022 |
hash = (hash1 << 11) | hash2; /* 22 bits */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2023 |
hash = (hash << 8) | (sz & 0xFC); /* 30 bits */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2024 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2025 |
while ((hash & 0x20000000) == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2026 |
hash <<= 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2027 |
} |
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 |
RETURN ( __MKSMALLINT(hash) ); |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2030 |
} |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2031 |
%}. |
2480 | 2032 |
^ 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
|
2033 |
! |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2034 |
|
783 | 2035 |
isNil |
3044 | 2036 |
"return true, if the receiver is nil. |
2037 |
Notice: |
|
2038 |
This method is open coded (inlined) by the compiler(s) |
|
2039 |
- redefining it may not work as expected." |
|
783 | 2040 |
|
2041 |
^ false |
|
2042 |
! |
|
2043 |
||
2044 |
notNil |
|
3044 | 2045 |
"return true, if the receiver is not nil. |
2046 |
Notice: |
|
2047 |
This method is open coded (inlined) by the compiler(s) |
|
2048 |
- redefining it may not work as expected." |
|
783 | 2049 |
|
2050 |
^ true |
|
2051 |
! |
|
2052 |
||
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2053 |
sameContentsAs:anObject |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2054 |
"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
|
2055 |
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
|
2056 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2057 |
|myClass otherClass |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2058 |
sz "{ Class: SmallInteger }" | |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2059 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2060 |
myClass := self class. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2061 |
myClass isVariable ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2062 |
sz := self basicSize. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2063 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2064 |
"compare the indexed variables" |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2065 |
1 to:sz do:[:i | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2066 |
(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
|
2067 |
] |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2068 |
]. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2069 |
|
3385 | 2070 |
"compare the instance variables" |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2071 |
sz := myClass instSize. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2072 |
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
|
2073 |
(self instVarAt:i) ~~ (anObject instVarAt:i) ifTrue:[^ false]. |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2074 |
]. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2075 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2076 |
^ true |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2077 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2078 |
" |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2079 |
#(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
|
2080 |
(1@2) sameContentsAsIn:(1->2) |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2081 |
" |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2082 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2083 |
"Created: / 21.4.1998 / 15:56:40 / cg" |
3385 | 2084 |
"Modified: / 21.4.1998 / 15:58:15 / cg" |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2085 |
! |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2086 |
|
783 | 2087 |
~= anObject |
3044 | 2088 |
"return true, if the receiver and the arg do not have the same structure. |
2089 |
Notice: |
|
2090 |
This method is partially open coded (inlined) by the compiler(s) |
|
2091 |
identical objects are never considered unequal. |
|
2092 |
redefining it may not work as expected." |
|
783 | 2093 |
|
2094 |
^ (self = anObject) not |
|
2095 |
! |
|
2096 |
||
2097 |
~~ anObject |
|
2505 | 2098 |
"return true, if the receiver and the arg are not the same object. |
2099 |
Never redefine this in any class. |
|
3044 | 2100 |
Notice: |
2101 |
This method is open coded (inlined) by the compiler(s) |
|
2102 |
- redefining it may not work as expected." |
|
783 | 2103 |
|
2104 |
%{ /* NOCONTEXT */ |
|
2105 |
RETURN ( (self == anObject) ? false : true ); |
|
2106 |
%} |
|
2107 |
! ! |
|
2108 |
||
2109 |
!Object methodsFor:'converting'! |
|
2110 |
||
3007 | 2111 |
-> anObject |
2112 |
"return an association with the receiver as key and |
|
2113 |
the argument as value" |
|
2114 |
||
2115 |
^ Association key:self value:anObject |
|
2116 |
! |
|
2117 |
||
783 | 2118 |
asValue |
2119 |
"return a valueHolder for for the receiver" |
|
2120 |
||
2121 |
^ ValueHolder with:self |
|
2122 |
! ! |
|
2123 |
||
2124 |
!Object methodsFor:'copying'! |
|
2125 |
||
4731 | 2126 |
cloneFrom:anObject |
2127 |
"Helper for copy: |
|
2128 |
copy all instance variables from anObject into the receiver, |
|
2129 |
which should be of the same class as the argument." |
|
2130 |
||
2131 |
self cloneFrom:anObject performing:#yourself |
|
2132 |
||
2133 |
" |
|
2134 |
|x| |
|
2135 |
||
2136 |
x := Array new:3. |
|
2137 |
x cloneFrom:#(1 2 3). |
|
2138 |
" |
|
2139 |
! |
|
2140 |
||
2141 |
cloneFrom:anObject performing:aSymbol |
|
2142 |
"Helper for copy: |
|
2143 |
for each instance variables from anObject, send it aSymbol |
|
2144 |
and store the result into the receiver, |
|
2145 |
which should be of the same class as the argument." |
|
2146 |
||
2147 |
|myClass sz "{ Class: SmallInteger }" t | |
|
2148 |
||
2149 |
myClass := self class. |
|
2150 |
myClass isVariable ifTrue:[ |
|
2151 |
sz := self basicSize. |
|
2152 |
||
2153 |
"copy the indexed variables" |
|
2154 |
1 to:sz do:[:i | |
|
2155 |
t := anObject basicAt:i. |
|
2156 |
aSymbol ~~ #yourself ifTrue:[ |
|
4734 | 2157 |
t := t perform:aSymbol. |
2158 |
]. |
|
2159 |
self basicAt:i put:t. |
|
4731 | 2160 |
] |
2161 |
]. |
|
2162 |
||
2163 |
"copy the instance variables" |
|
2164 |
sz := myClass instSize. |
|
2165 |
1 to:sz do:[:i | |
|
2166 |
t := anObject instVarAt:i. |
|
2167 |
aSymbol ~~ #yourself ifTrue:[ |
|
4734 | 2168 |
t := t perform:aSymbol |
2169 |
]. |
|
2170 |
self instVarAt:i put:t |
|
4731 | 2171 |
]. |
2172 |
||
2173 |
^ self |
|
2174 |
||
2175 |
! |
|
2176 |
||
4693
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2177 |
cloneInstanceVariablesFrom:aPrototype |
4731 | 2178 |
"Shallow copy variables from a prototype into myself. |
2179 |
This copies instVars by name - i.e. same-named variables are |
|
2180 |
copied, others are not. |
|
2181 |
The variable slots are copied as available |
|
2182 |
(i.e. the min of both indexed sizes is used)." |
|
4693
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2183 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2184 |
|myInfo otherInfo| |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2185 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2186 |
myInfo := self class instanceVariableOffsets. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2187 |
otherInfo := aPrototype class instanceVariableOffsets. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2188 |
myInfo keysAndValuesDo:[:name :index | |varIndexAssoc| |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2189 |
varIndexAssoc := otherInfo at:name ifAbsent:[]. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2190 |
varIndexAssoc notNil ifTrue:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2191 |
self instVarAt:index put:(aPrototype instVarAt:(varIndexAssoc value)) |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2192 |
] |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2193 |
]. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2194 |
self isVariable ifTrue:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2195 |
1 to:(self basicSize min:aPrototype basicSize) do:[:index | |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2196 |
self basicAt:index put:(aPrototype basicAt:index) |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2197 |
]. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2198 |
]. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2199 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2200 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2201 |
Class withoutUpdatingChangesDo:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2202 |
Point subclass:#Point3D |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2203 |
instanceVariableNames:'z' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2204 |
classVariableNames:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2205 |
poolDictionaries:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2206 |
category:'testing'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2207 |
(Point3D new cloneInstanceVariablesFrom:1@2) inspect. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2208 |
] |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2209 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2210 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2211 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2212 |
Class withoutUpdatingChangesDo:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2213 |
Point variableSubclass:#Point3D |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2214 |
instanceVariableNames:'z' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2215 |
classVariableNames:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2216 |
poolDictionaries:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2217 |
category:'testing'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2218 |
((Point3D new:2) cloneInstanceVariablesFrom:#(1 2 3)) inspect. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2219 |
] |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2220 |
" |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2221 |
|
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 |
|someObject| |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2224 |
|
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2225 |
Class withoutUpdatingChangesDo:[ |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2226 |
Object subclass:#TestClass1 |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2227 |
instanceVariableNames:'foo bar' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2228 |
classVariableNames:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2229 |
poolDictionaries:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2230 |
category:'testing'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2231 |
someObject := TestClass1 new. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2232 |
someObject instVarAt:1 put:'foo'; instVarAt:2 put:'bar'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2233 |
Object subclass:#TestClass2 |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2234 |
instanceVariableNames:'bar foo' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2235 |
classVariableNames:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2236 |
poolDictionaries:'' |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2237 |
category:'testing'. |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2238 |
(TestClass2 new cloneInstanceVariablesFrom:someObject) inspect. |
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 |
" |
4731 | 2243 |
|top b b1| |
2244 |
||
2245 |
top := StandardSystemView new. |
|
2246 |
top extent:100@100. |
|
2247 |
||
2248 |
b := Button in:top. |
|
2249 |
b label:'hello'. |
|
2250 |
||
2251 |
b1 := ArrowButton new cloneInstanceVariablesFrom:b. |
|
2252 |
||
2253 |
top open. |
|
2254 |
b1 inspect |
|
2255 |
" |
|
4693
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2256 |
! |
2792b6043133
New: #cloneInstanceVariablesFrom:
Stefan Vogel <sv@exept.de>
parents:
4683
diff
changeset
|
2257 |
|
783 | 2258 |
copy |
2259 |
"return a copy of the receiver - defaults to shallowcopy here. |
|
2260 |
Notice, that copy does not copy dependents." |
|
2261 |
||
2262 |
^ self shallowCopy postCopy |
|
2263 |
! |
|
2264 |
||
2265 |
deepCopy |
|
2266 |
"return a copy of the object with all subobjects also copied. |
|
4731 | 2267 |
This method DOES handle cycles/self-refs and preserves object identity; |
2268 |
however the receivers class is not copied (to avoid the 'total' copy). |
|
2269 |
||
783 | 2270 |
This deepCopy is a bit slower than the old (unsecure) one, since it |
2271 |
keeps track of already copied objects. If you are sure, that your |
|
1129 | 2272 |
copied object does not include duplicates (or you do not care) and |
4731 | 2273 |
no cycles are involved, you can use the old simpleDeepCopy, |
2274 |
which avoids this overhead (but may run into trouble). |
|
2275 |
Notice, that deepCopy does not copy dependents." |
|
2276 |
||
4799 | 2277 |
^ (self deepCopyUsing:(IdentityDictionary new)) postDeepCopyFrom:self |
783 | 2278 |
|
2279 |
"an example which is not handled by the old deepCopy: |
|
2280 |
||
2281 |
|a| |
|
2282 |
a := Array new:3. |
|
2283 |
a at:3 put:a. |
|
2284 |
a deepCopy inspect |
|
2285 |
" |
|
1129 | 2286 |
|
4731 | 2287 |
" |
2288 |
|a| |
|
2289 |
a := Color black onDevice:Screen current. |
|
2290 |
a deepCopy inspect |
|
2291 |
" |
|
2292 |
||
1129 | 2293 |
"Modified: 27.3.1996 / 16:31:20 / stefan" |
783 | 2294 |
! |
2295 |
||
2296 |
deepCopyError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2297 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2298 |
|
783 | 2299 |
"raise a signal, that deepCopy is not allowed for this object" |
2300 |
||
2301 |
^ DeepCopyErrorSignal raise |
|
2302 |
! |
|
2303 |
||
2304 |
deepCopyUsing:aDictionary |
|
2305 |
"a helper for deepCopy; return a copy of the object with |
|
2306 |
all subobjects also copied. If the to-be-copied object is in the dictionary, |
|
2307 |
use the value found there. The class of the receiver is not copied. |
|
2308 |
This method DOES handle cycles/self references." |
|
2309 |
||
2310 |
|myClass aCopy |
|
2311 |
sz "{ Class: SmallInteger }" |
|
2312 |
iOrig iCopy| |
|
2313 |
||
2314 |
myClass := self class. |
|
2315 |
myClass isVariable ifTrue:[ |
|
4731 | 2316 |
sz := self basicSize. |
2317 |
aCopy := myClass basicNew:sz. |
|
783 | 2318 |
] ifFalse:[ |
4731 | 2319 |
sz := 0. |
2320 |
aCopy := myClass basicNew |
|
783 | 2321 |
]. |
2322 |
aCopy setHashFrom:self. |
|
2323 |
||
2324 |
aDictionary at:self put:aCopy. |
|
143 | 2325 |
|
2326 |
" |
|
783 | 2327 |
copy indexed instvars - if any |
2328 |
" |
|
2329 |
sz ~~ 0 ifTrue:[ |
|
4731 | 2330 |
myClass isBits ifTrue:[ |
2331 |
"block-copy indexed instvars" |
|
2332 |
aCopy replaceFrom:1 to:sz with:self startingAt:1 |
|
2333 |
] ifFalse:[ |
|
2334 |
"individual deep copy the indexed variables" |
|
2335 |
1 to:sz do:[:i | |
|
2336 |
iOrig := self basicAt:i. |
|
2337 |
iOrig notNil ifTrue:[ |
|
2338 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
2339 |
iCopy := aDictionary at:iOrig |
|
2340 |
] ifFalse:[ |
|
2341 |
iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy |
|
2342 |
]. |
|
2343 |
aCopy basicAt:i put:iCopy |
|
2344 |
] |
|
2345 |
] |
|
2346 |
] |
|
783 | 2347 |
]. |
2348 |
||
2349 |
" |
|
2350 |
copy the instance variables |
|
2351 |
" |
|
2352 |
sz := myClass instSize. |
|
4731 | 2353 |
1 to:sz do:[:i | |
2354 |
(self skipInstvarIndexInDeepCopy:i) ifFalse:[ |
|
2355 |
iOrig := self instVarAt:i. |
|
2356 |
iOrig notNil ifTrue:[ |
|
2357 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
2358 |
iCopy := aDictionary at:iOrig |
|
2359 |
] ifFalse:[ |
|
2360 |
iCopy := (iOrig deepCopyUsing:aDictionary) postDeepCopy |
|
2361 |
]. |
|
2362 |
aCopy instVarAt:i put:iCopy |
|
2363 |
] |
|
2364 |
] |
|
783 | 2365 |
]. |
2366 |
^ aCopy |
|
4731 | 2367 |
|
2368 |
" |
|
2369 |
|a b c copyOfC| |
|
2370 |
||
2371 |
a := Array with:'hello' with:'world' with:nil. |
|
2372 |
b := 99 @ 999. |
|
2373 |
a at:3 put:b. |
|
2374 |
c := Array with:a with:b with:a. |
|
2375 |
||
2376 |
Transcript showCR: (c at:1) == (c at:3). |
|
2377 |
copyOfC := c deepCopy. |
|
2378 |
Transcript showCR: (copyOfC at:1) == (copyOfC at:3) |
|
2379 |
" |
|
783 | 2380 |
! |
2381 |
||
2382 |
postCopy |
|
2383 |
"this is for compatibility with ST-80 code, which uses postCopy for |
|
2384 |
cleanup after copying, while ST/X passes the original in postCopyFrom: |
|
2385 |
(see there)" |
|
2386 |
||
2387 |
^ self |
|
2388 |
! |
|
2389 |
||
4731 | 2390 |
postDeepCopy |
2391 |
"allows for cleanup after deep copying" |
|
2392 |
||
2393 |
^ self postCopy |
|
2394 |
! |
|
2395 |
||
4799 | 2396 |
postDeepCopyFrom:aSource |
2397 |
"allows for cleanup after deep copying" |
|
2398 |
||
2399 |
^ self postDeepCopy |
|
2400 |
! |
|
2401 |
||
783 | 2402 |
setHashFrom:anObject |
2403 |
"set my identity-hash key to be the same as anObjects hash key. |
|
2404 |
This is an ST/X speciality, which is NOT available in other (especially OT based) |
|
2405 |
Smalltalks, and may not be available in future ST/X versions. |
|
2406 |
DO NEVER use this for normal application code." |
|
2407 |
||
2408 |
%{ /* NOCONTEXT */ |
|
2409 |
||
2410 |
REGISTER unsigned h; |
|
2411 |
||
2412 |
if (__isNonNilObject(self) && __isNonNilObject(anObject)) { |
|
2413 |
h = __GET_HASH(anObject); |
|
2414 |
__SET_HASH(self, h); |
|
2415 |
RETURN (self); |
|
2416 |
} |
|
2647 | 2417 |
%}. |
783 | 2418 |
self primitiveFailed "neither receiver not arg may be nil or SmallInteger" |
2419 |
! |
|
2420 |
||
2421 |
shallowCopy |
|
2422 |
"return a copy of the object with shared subobjects (a shallow copy) |
|
2423 |
i.e. the copy shares referenced instvars with its original." |
|
2424 |
||
2647 | 2425 |
%{ /* NOCONTEXT */ |
2426 |
int ninsts, spc; |
|
2427 |
int sz; |
|
3066 | 2428 |
OBJ theCopy; |
2647 | 2429 |
OBJ cls; |
2430 |
int flags; |
|
2431 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2432 |
cls = __qClass(self); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2433 |
flags = __intVal(__ClassInstPtr(cls)->c_flags); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2434 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2435 |
/* |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2436 |
* bail out for special objects .. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2437 |
*/ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2438 |
if (((flags & ~ARRAYMASK) == 0) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2439 |
&& ((flags & ARRAYMASK) != WKPOINTERARRAY)) { |
2652 | 2440 |
sz = __qSize(self); |
3078 | 2441 |
__PROTECT__(self); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2442 |
__qNew(theCopy, sz); /* OBJECT ALLOCATION */ |
3078 | 2443 |
__UNPROTECT__(self); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2444 |
if (theCopy) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2445 |
cls = __qClass(self); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2446 |
spc = __qSpace(theCopy); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2447 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2448 |
theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2449 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2450 |
sz = sz - OHDR_SIZE; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2451 |
if (sz) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2452 |
char *src, *dst; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2453 |
|
3066 | 2454 |
src = (char *)(__InstPtr(self)->i_instvars); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2455 |
dst = (char *)(__InstPtr(theCopy)->i_instvars); |
2647 | 2456 |
#ifdef bcopy4 |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2457 |
{ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2458 |
/* care for odd-number of longs */ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2459 |
int nW = sz >> 2; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2460 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2461 |
if (sz & 3) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2462 |
nW++; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2463 |
} |
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 |
bcopy4(src, dst, nW); |
2647 | 2466 |
} |
2467 |
#else |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2468 |
bcopy(src, dst, sz); |
2647 | 2469 |
#endif |
2470 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2471 |
flags &= ARRAYMASK; |
2652 | 2472 |
if (flags == POINTERARRAY) { |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2473 |
ninsts = __BYTES2OBJS__(sz); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2474 |
} else { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2475 |
ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2476 |
} |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2477 |
if (ninsts) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2478 |
do { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2479 |
OBJ el; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2480 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2481 |
el = __InstPtr(theCopy)->i_instvars[ninsts-1]; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2482 |
__STORE_SPC(theCopy, el, spc); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2483 |
} while (--ninsts); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2484 |
} |
2647 | 2485 |
} |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2486 |
RETURN (theCopy); |
2647 | 2487 |
} |
2488 |
} |
|
2489 |
%}. |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2490 |
"/ fallBack for special objects & memoryAllocation failure case |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2491 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2492 |
^ self slowShallowCopy |
783 | 2493 |
! |
2494 |
||
2495 |
shallowCopyForFinalization |
|
2496 |
"this is used to aquire a copy to be used for finalization - |
|
2497 |
(the copy will get a dispose-notification; see the documentation in the Registry class) |
|
2498 |
This method can be redefined for more efficient copying - especially for large objects." |
|
2499 |
||
4574
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
2500 |
"/ going to be obsoleted by executor |
783 | 2501 |
^ self shallowCopy |
4574
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
2502 |
|
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
2503 |
"Modified: / 5.8.1999 / 14:07:16 / cg" |
783 | 2504 |
! |
2505 |
||
2506 |
simpleDeepCopy |
|
2507 |
"return a copy of the object with all subobjects also copied. |
|
2508 |
This method does NOT handle cycles - but is included to allow this |
|
2509 |
slightly faster copy in situations where it is known that |
|
2510 |
no recursive references occur (LargeIntegers for example). |
|
2511 |
NOTICE: you will run into trouble, when trying this with recursive |
|
2512 |
objects (usually recursionInterrupt or memory-alert). |
|
2513 |
This method corresponds to the 'traditional' deepCopy found in |
|
2514 |
the Blue book." |
|
2515 |
||
4731 | 2516 |
|myClass aCopy| |
2517 |
||
2518 |
(myClass := self class) isVariable ifTrue:[ |
|
2519 |
aCopy := myClass basicNew:(self basicSize). |
|
783 | 2520 |
] ifFalse:[ |
4731 | 2521 |
aCopy := myClass basicNew |
783 | 2522 |
]. |
2523 |
||
2524 |
"copy the instance variables" |
|
4731 | 2525 |
aCopy cloneFrom:self performing:#simpleDeepCopy. |
783 | 2526 |
^ aCopy |
2527 |
||
2528 |
"a bad example (but ST/X should survive ...)" |
|
2529 |
" |
|
2530 |
|a| |
|
2531 |
a := Array new:3. |
|
2532 |
a at:3 put:a. |
|
2533 |
a simpleDeepCopy |
|
2534 |
" |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2535 |
! |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2536 |
|
4731 | 2537 |
skipInstvarIndexInDeepCopy:index |
2538 |
"a helper for deepCopy; only indices for which this method returns |
|
2539 |
false are copied in a deep copy. |
|
2540 |
The default is false here - which means that everything is copied. |
|
2541 |
Can be redefined in subclasses for partial copies" |
|
2542 |
||
2543 |
^ false |
|
2544 |
! |
|
2545 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2546 |
slowShallowCopy |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2547 |
"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
|
2548 |
i.e. the copy shares referenced instvars with its original. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2549 |
This method is only invoked as a fallback from #shallowCopy." |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2550 |
|
4731 | 2551 |
|myClass aCopy| |
2552 |
||
2553 |
(myClass := self class) isVariable ifTrue:[ |
|
2554 |
aCopy := myClass basicNew:(self basicSize). |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2555 |
] ifFalse:[ |
4731 | 2556 |
aCopy := myClass basicNew |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2557 |
]. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2558 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2559 |
"copy the instance variables" |
4731 | 2560 |
aCopy cloneFrom:self performing:#yourself. |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2561 |
^ aCopy |
783 | 2562 |
! ! |
2563 |
||
2564 |
!Object methodsFor:'debugging'! |
|
2565 |
||
2566 |
basicInspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2567 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2568 |
|
783 | 2569 |
"launch an inspector on the receiver. |
2570 |
this method should NOT be redefined in subclasses." |
|
2571 |
||
2572 |
Inspector isNil ifTrue:[ |
|
2647 | 2573 |
" |
2574 |
for systems without GUI |
|
2575 |
" |
|
2576 |
Transcript showCR:'no Inspector' |
|
783 | 2577 |
] ifFalse:[ |
2647 | 2578 |
Inspector openOn:self |
783 | 2579 |
] |
1417 | 2580 |
|
2581 |
"Modified: 18.5.1996 / 15:43:25 / cg" |
|
783 | 2582 |
! |
2583 |
||
2584 |
inspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2585 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2586 |
|
783 | 2587 |
"launch an inspector on the receiver. |
2588 |
this method (or better: inspectorClass) can be redefined in subclasses |
|
2589 |
to start special inspectors." |
|
2590 |
||
2591 |
|cls| |
|
2592 |
||
2593 |
cls := self inspectorClass. |
|
2594 |
cls isNil ifTrue:[ |
|
2595 |
^ self basicInspect |
|
2596 |
]. |
|
2597 |
cls openOn:self |
|
2598 |
||
2599 |
" |
|
2600 |
Object new inspect |
|
2601 |
(1 @ 2) inspect |
|
2602 |
Smalltalk inspect |
|
2603 |
#(1 2 3) asOrderedCollection inspect |
|
2604 |
(Color red) inspect |
|
2605 |
(Image fromFile:'bitmaps/garfield.gif') inspect |
|
143 | 2606 |
" |
71 | 2607 |
! |
2608 |
||
783 | 2609 |
inspectorClass |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2610 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2611 |
|
783 | 2612 |
"return the class to use for inspect. |
2613 |
Can (should) be redefined in classes for which a better inspector is available" |
|
2614 |
||
2615 |
^ Inspector |
|
2616 |
! |
|
2617 |
||
4600 | 2618 |
mustBeBoolean |
2619 |
"this message is sent by the VM, if a non-Boolean receiver is encountered |
|
2620 |
in an if* or while* message. |
|
2621 |
Caveat: for now, this is only sent by the interpreter; |
|
2622 |
both the JIT and the stc compiler treat it as undefined." |
|
2623 |
||
2624 |
self error:'Non boolean receiver - proceed for truth' mayProceed:true. |
|
2625 |
^ true |
|
2626 |
! |
|
2627 |
||
783 | 2628 |
mustBeKindOf:aClass |
2629 |
"for compatibility & debugging support: |
|
2630 |
check if the receiver isKindOf:aClass and raise an error if not. |
|
2631 |
Notice: |
|
2632 |
it is VERY questionable, if it makes sense to add manual |
|
2633 |
type checks to a dynamically typed language like smalltalk. |
|
2634 |
It will, at least, slow down performance, |
|
2635 |
make your code less reusable and clutter your code with stupid sends |
|
2636 |
of this selector. Also, read the comment in isKindOf:, regarding the |
|
2637 |
use of isXXX check methods. |
|
2638 |
You see: The author does not like this at all ..." |
|
2639 |
||
2640 |
(self isKindOf:aClass) ifFalse:[ |
|
2641 |
self error:'argument is not of expected type' |
|
2642 |
] |
|
2643 |
! |
|
2644 |
||
2645 |
obsoleteMethodWarning |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2646 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2647 |
|
783 | 2648 |
"in methods which are going to be obsoleted, a self send to |
2649 |
this method is used to tell programmers that a method is |
|
2650 |
used which is going to be removed in later ST/X versions. |
|
2651 |
Find all methods which will be obsolete soon by looking at senders |
|
2652 |
of this message. |
|
2653 |
Hopefully, this warning message is annoying enough for you to |
|
2654 |
change the code ... ;-)" |
|
2655 |
||
2656 |
self obsoleteMethodWarning:nil from:thisContext sender |
|
2657 |
! |
|
2658 |
||
2659 |
obsoleteMethodWarning:message |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2660 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2661 |
|
783 | 2662 |
"in methods which are going to be obsoleted, a self send to |
2663 |
this method is used to tell programmers that a method is |
|
2664 |
used which is going to be removed in later ST/X versions. |
|
2665 |
Find all methods which will be obsolete soon by looking at senders |
|
2666 |
of this message. |
|
2667 |
Hopefully, this warning message is annoying enough for you to |
|
2668 |
change the code ... ;-)" |
|
2669 |
||
2670 |
self obsoleteMethodWarning:message from:thisContext sender |
|
2671 |
! |
|
2672 |
||
2673 |
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
|
2674 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2675 |
|
783 | 2676 |
"in methods which are going to be obsoleted, a self-send to |
2677 |
this method is used to tell programmers that a method is |
|
2678 |
used which is going to be removed in later ST/X versions. |
|
2679 |
Find all methods which will be obsolete soon by looking at senders |
|
2680 |
of this message. |
|
2681 |
Hopefully, this warning message is annoying enough for you to |
|
2682 |
change the code ... ;-)" |
|
2683 |
||
2684 |
|spec| |
|
2685 |
||
2686 |
spec := aContext methodPrintString. |
|
2136 | 2687 |
('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR. |
2688 |
(' And may not be present in future ST/X versions.') errorPrintCR. |
|
2689 |
(' called from ' , aContext sender printString) errorPrintCR. |
|
783 | 2690 |
message notNil ifTrue:[ |
2647 | 2691 |
'------> ' errorPrint. message errorPrintCR |
783 | 2692 |
] |
2693 |
||
2694 |
" |
|
2695 |
Object obsoleteMethodWarning:'foo' from:thisContext sender sender |
|
2696 |
" |
|
2136 | 2697 |
|
2698 |
"Modified: 10.1.1997 / 19:08:42 / cg" |
|
783 | 2699 |
! ! |
2700 |
||
2701 |
!Object methodsFor:'dependents access'! |
|
2702 |
||
2703 |
addDependent:anObject |
|
2704 |
"make the argument, anObject be a dependent of the receiver" |
|
2705 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2706 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2707 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2708 |
"/ 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
|
2709 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2710 |
"/ 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
|
2711 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2712 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2713 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2714 |
[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2715 |
|deps dep| |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2716 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2717 |
deps := self dependents. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2718 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2719 |
"/ 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
|
2720 |
"/ many dependencies, we store a single dependent in |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2721 |
"/ 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
|
2722 |
"/ added. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2723 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2724 |
(deps isNil or:[deps size == 0]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2725 |
self dependents:(WeakArray with:anObject) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2726 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2727 |
deps class == WeakArray ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2728 |
dep := deps at:1. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2729 |
dep ~~ anObject ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2730 |
(dep isNil or:[dep == 0]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2731 |
deps at:1 put:anObject |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2732 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2733 |
self dependents:(WeakIdentitySet with:dep with:anObject) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2734 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2735 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2736 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2737 |
deps add:anObject |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2738 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2739 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2740 |
] valueNowOrOnUnwindDo:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2741 |
wasBlocked ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2742 |
OperatingSystem unblockInterrupts |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2743 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2744 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2745 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2746 |
"Modified: / 27.10.1997 / 19:35:52 / cg" |
783 | 2747 |
! |
2748 |
||
3309
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2749 |
breakDependents |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2750 |
"remove all dependencies from the receiver" |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2751 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2752 |
self dependents:nil. |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2753 |
self nonWeakDependents:nil |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2754 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2755 |
"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
|
2756 |
"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
|
2757 |
! |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2758 |
|
783 | 2759 |
dependents |
3222 | 2760 |
"return a Collection of dependents. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2761 |
The default implementation here uses a global WeakDictionary to store |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2762 |
dependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2763 |
This may be too slow for high frequency change&update, |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2764 |
therefore, some classes (Model) redefine this for better performance. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2765 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
783 | 2766 |
|
3222 | 2767 |
|deps| |
2768 |
||
2769 |
(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
|
2770 |
^ #(). |
3222 | 2771 |
]. |
2772 |
^ deps |
|
2773 |
||
2774 |
"Modified: / 26.1.1998 / 11:18:15 / cg" |
|
783 | 2775 |
! |
2776 |
||
2777 |
dependents:aCollection |
|
2778 |
"set the collection of dependents. |
|
2779 |
The default implementation here uses a global Dictionary to store |
|
2780 |
dependents which may be too slow for high frequency change&update. |
|
2781 |
Therefore, some classes (Model) redefine this for better performance." |
|
2782 |
||
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2783 |
"/ 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
|
2784 |
"/ 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
|
2785 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
2336 | 2786 |
"/ faster execution (and to avoid creation of garbage blocks). |
2787 |
||
2788 |
(OperatingSystem blockInterrupts) ifTrue:[ |
|
2647 | 2789 |
"/ the common case - already blocked |
2790 |
||
2791 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
|
2792 |
Dependencies removeKey:self ifAbsent:[] |
|
2793 |
] ifFalse:[ |
|
2794 |
Dependencies at:self put:aCollection |
|
2795 |
]. |
|
2796 |
^ self |
|
2336 | 2797 |
]. |
2798 |
||
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2799 |
[ |
2647 | 2800 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
2801 |
Dependencies removeKey:self ifAbsent:[] |
|
2802 |
] ifFalse:[ |
|
2803 |
Dependencies at:self put:aCollection |
|
2804 |
]. |
|
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2805 |
] valueNowOrOnUnwindDo:[ |
2647 | 2806 |
OperatingSystem unblockInterrupts |
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2807 |
] |
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2808 |
|
2336 | 2809 |
"Modified: 30.1.1997 / 21:22:10 / cg" |
783 | 2810 |
! |
2811 |
||
2812 |
dependentsDo:aBlock |
|
2813 |
"evaluate aBlock for all of my dependents" |
|
2814 |
||
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2815 |
|deps nwDeps| |
783 | 2816 |
|
2817 |
deps := self dependents. |
|
3222 | 2818 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2819 |
deps do:[:d | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2820 |
(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
|
2821 |
aBlock value:d |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2822 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2823 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2824 |
]. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2825 |
nwDeps := self nonWeakDependents. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2826 |
(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
|
2827 |
nwDeps do:aBlock |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2828 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2829 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2830 |
"Modified: / 30.1.1998 / 14:03:40 / cg" |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2831 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2832 |
|
2445 | 2833 |
myDependents |
2834 |
"same as dependents - ST-80 compatibility" |
|
2835 |
||
2836 |
^ self dependents |
|
2837 |
! |
|
2838 |
||
783 | 2839 |
release |
3309
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2840 |
"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
|
2841 |
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
|
2842 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2843 |
self breakDependents |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2844 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2845 |
"Modified: / 27.2.1998 / 11:29:35 / stefan" |
783 | 2846 |
! |
2847 |
||
2848 |
removeDependent:anObject |
|
2849 |
"make the argument, anObject be independent of the receiver" |
|
2850 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2851 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2852 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2853 |
"/ 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
|
2854 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2855 |
"/ 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
|
2856 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2857 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2858 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2859 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2860 |
|deps n d| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2861 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2862 |
deps := self dependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2863 |
deps size ~~ 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2864 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2865 |
"/ 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
|
2866 |
"/ 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
|
2867 |
"/ 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
|
2868 |
"/ 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
|
2869 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2870 |
deps class == WeakArray ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2871 |
((d := deps at:1) == anObject |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2872 |
or:[d isNil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2873 |
or:[d == 0]]) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2874 |
self dependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2875 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2876 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2877 |
deps remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2878 |
(n := deps size) == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2879 |
self dependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2880 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2881 |
n == 1 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2882 |
d := deps firstIfEmpty:nil. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2883 |
d notNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2884 |
deps := WeakArray with:d |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2885 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2886 |
deps := nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2887 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2888 |
self dependents:deps. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2889 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2890 |
] |
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 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2893 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2894 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2895 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2896 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2897 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2898 |
|
3228
b6b893e8f898
must look for size of value returned by self dependents
Claus Gittinger <cg@exept.de>
parents:
3222
diff
changeset
|
2899 |
"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
|
2900 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2901 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2902 |
!Object methodsFor:'dependents access (nonWeak)'! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2903 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2904 |
addNonWeakDependent:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2905 |
"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
|
2906 |
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
|
2907 |
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
|
2908 |
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
|
2909 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2910 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2911 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2912 |
"/ 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
|
2913 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2914 |
"/ 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
|
2915 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2916 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2917 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2918 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2919 |
|deps dep| |
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 |
deps := self nonWeakDependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2922 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2923 |
"/ 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
|
2924 |
"/ 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
|
2925 |
"/ 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
|
2926 |
"/ added. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2927 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2928 |
deps size == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2929 |
self nonWeakDependents:(Array with:anObject) |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2930 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2931 |
deps class == Array ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2932 |
dep := deps at:1. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2933 |
dep ~~ anObject ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2934 |
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
|
2935 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2936 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2937 |
deps add:anObject |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2938 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2939 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2940 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2941 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2942 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2943 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2944 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2945 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2946 |
"Created: / 19.4.1996 / 10:54:08 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2947 |
"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
|
2948 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2949 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2950 |
nonWeakDependents |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2951 |
"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
|
2952 |
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
|
2953 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2954 |
NonWeakDependencies isNil ifTrue:[^ #()]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2955 |
^ NonWeakDependencies at:self ifAbsent:#() |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2956 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2957 |
"Created: / 19.4.1996 / 10:55:06 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2958 |
"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
|
2959 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2960 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2961 |
nonWeakDependents:aCollection |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2962 |
"set the collection of nonWeak dependents. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2963 |
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
|
2964 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2965 |
[ |
2647 | 2966 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
2967 |
NonWeakDependencies removeKey:self ifAbsent:[] |
|
2968 |
] ifFalse:[ |
|
2969 |
NonWeakDependencies at:self put:aCollection |
|
2970 |
] |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2971 |
] valueUninterruptably |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2972 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2973 |
"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
|
2974 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2975 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2976 |
removeNonWeakDependent:anObject |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2977 |
"remove a nonWeak dependency from the receiver to the argument, anObject. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2978 |
(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
|
2979 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2980 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2981 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2982 |
"/ 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
|
2983 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2984 |
"/ 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
|
2985 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2986 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2987 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2988 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2989 |
|deps n| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2990 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2991 |
deps := self nonWeakDependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2992 |
deps size ~~ 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2993 |
deps class == Array ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2994 |
(deps at:1) == anObject ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2995 |
self nonWeakDependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2996 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2997 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2998 |
deps remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2999 |
(n := deps size) == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3000 |
self nonWeakDependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3001 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3002 |
n == 1 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3003 |
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
|
3004 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3005 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3006 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3007 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3008 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3009 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3010 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3011 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
3012 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3013 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3014 |
"Created: / 19.4.1996 / 11:44:44 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3015 |
"Modified: / 30.1.1998 / 14:04:01 / cg" |
783 | 3016 |
! ! |
3017 |
||
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3018 |
!Object methodsFor:'displaying'! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3019 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3020 |
displayOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3021 |
"ST-80 Compatibility |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3022 |
display the receiver in a graphicsContext at 0@0 |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3023 |
- this method allows for any object to be displayed in some view |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3024 |
(although the fallBack is to display its printString ...)" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3025 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3026 |
^ self displayOn:aGC x:0 y:0. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3027 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3028 |
"Created: 29.5.1996 / 16:28:58 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3029 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3030 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3031 |
displayOn:aGC at:aPoint |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3032 |
"ST-80 Compatibility |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3033 |
display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3034 |
for any object to be displayed in a ListView - for example." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3035 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3036 |
^ self displayOn:aGC x:(aPoint x) y:(aPoint y). |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3037 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3038 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3039 |
displayOn:aGC x:x y:y |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3040 |
"display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3041 |
for any object to be displayed in a ListView - for example." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3042 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3043 |
self displayOn:aGC x:x y:y opaque:false |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3044 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3045 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3046 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3047 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3048 |
displayOn:aGc x:x y:y opaque:opaque |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3049 |
"display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3050 |
for any object to be displayed in a ListView - for example. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3051 |
The fallBack here shows the receivers displayString." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3052 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3053 |
|s| |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3054 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3055 |
s := self displayString. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3056 |
opaque ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3057 |
aGc displayOpaqueString:s x:x y:y. |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3058 |
] ifFalse:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3059 |
aGc displayString:s x:x y:y. |
3023
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 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3062 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3063 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3064 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3065 |
displayOpaqueOn:aGC x:x y:y |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3066 |
"display the receiver in a graphicsContext - this method allows |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3067 |
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
|
3068 |
|
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3069 |
self displayOn:aGC x:x y:y opaque:true |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3070 |
|
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3071 |
"Modified: / 29.5.1996 / 16:29:38 / cg" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3072 |
"Created: / 26.10.1997 / 15:01:36 / cg" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3073 |
! |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3074 |
|
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3075 |
displayString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3076 |
"return a string used when displaying the receiver in a view; |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3077 |
for example an Inspector. This is usually the same as printString, |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3078 |
but sometimes redefined for a better look." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3079 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3080 |
^ self printString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3081 |
|
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 |
#(1 2 3) printString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3084 |
#(1 2 3) displayString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3085 |
#(1 2 3) storeString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3086 |
" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3087 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3088 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3089 |
heightOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3090 |
"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
|
3091 |
|
4603 | 3092 |
^ (aGC font onDevice:aGC device) heightOf:(self displayString) |
3023
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 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3095 |
widthOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3096 |
"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
|
3097 |
|
4603 | 3098 |
^ (aGC font onDevice:aGC device) widthOf:(self displayString) |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3099 |
! ! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
3100 |
|
4808 | 3101 |
!Object methodsFor:'encoding & decoding'! |
3102 |
||
3103 |
decodeAsLiteralArray |
|
3104 |
^ self |
|
3105 |
! |
|
3106 |
||
3107 |
fromLiteralArrayEncoding:aSpecArray |
|
3108 |
"read my attributes from aSpecArray |
|
3109 |
" |
|
3110 |
|sel val |
|
3111 |
stop "{ Class:SmallInteger }" | |
|
3112 |
||
3113 |
stop := aSpecArray size. |
|
3114 |
||
3115 |
2 to:stop by:2 do:[:i| |
|
3116 |
sel := aSpecArray at:i. |
|
3117 |
val := aSpecArray at:i + 1. |
|
3118 |
||
3119 |
(self respondsTo:sel) ifTrue:[ |
|
3120 |
self perform:sel with:(val decodeAsLiteralArray) |
|
3121 |
] ifFalse:[ |
|
3122 |
Transcript show:self class name; show:': unhandled literalArrayEncoding attribute: '. |
|
3123 |
Transcript showCR:sel. |
|
3124 |
] |
|
3125 |
] |
|
3126 |
||
3127 |
||
3128 |
! |
|
3129 |
||
3130 |
literalArrayEncoding |
|
3131 |
"generate a literalArrayEncoding array for myself. |
|
3132 |
This uses #literalArrayEncodingSlotOrder which defines the slots and |
|
3133 |
order and #skippedInLiteralEncoding which defines slots to skip. |
|
3134 |
For most subclasses, there is no need to redefine those." |
|
3135 |
||
3136 |
|names encoding cls skipped| |
|
3137 |
||
3138 |
self isLiteral ifTrue:[ |
|
3139 |
^ self |
|
3140 |
]. |
|
3141 |
||
3142 |
skipped := self skippedInLiteralEncoding. |
|
3143 |
cls := self class. |
|
3144 |
names := cls allInstVarNames. |
|
3145 |
encoding := OrderedCollection with:(cls name). |
|
3146 |
||
3147 |
(self literalArrayEncodingSlotOrder) do:[:instSlot | |
|
3148 |
|value nm| |
|
3149 |
||
3150 |
nm := names at:instSlot. |
|
3151 |
||
3152 |
(skipped includes:nm) ifFalse:[ |
|
3153 |
(value := self instVarAt:instSlot) notNil ifTrue:[ |
|
3154 |
encoding add:(nm , ':') asSymbol. |
|
3155 |
encoding add:value literalArrayEncoding |
|
3156 |
] |
|
3157 |
] |
|
3158 |
]. |
|
3159 |
^ encoding asArray |
|
3160 |
||
3161 |
||
3162 |
! |
|
3163 |
||
3164 |
literalArrayEncodingSlotOrder |
|
3165 |
"define the order in which inst-slots are saved when generating |
|
3166 |
a literalArrayEncoding |
|
3167 |
" |
|
3168 |
^ 1 to:self class instSize |
|
3169 |
||
3170 |
! |
|
3171 |
||
3172 |
skippedInLiteralEncoding |
|
3173 |
"return a Collection with it's elements are slots for skipping |
|
3174 |
" |
|
3175 |
^ #() |
|
3176 |
||
3177 |
! ! |
|
3178 |
||
783 | 3179 |
!Object methodsFor:'error handling'! |
3180 |
||
3181 |
appropriateDebugger:aSelector |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3182 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3183 |
|
783 | 3184 |
"return an appropriate debugger to use. |
3185 |
If there is already a debugger active on the stack, and it is |
|
3186 |
the DebugView, return MiniDebugger (as a last chance) otherwise abort." |
|
3187 |
||
3188 |
|context| |
|
3189 |
||
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
3190 |
"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
|
3191 |
|
1685 | 3192 |
(Processor isNil |
4208 | 3193 |
or:[Processor activeProcessIsSystemProcess |
3194 |
or:[Smalltalk isInitialized not]]) ifTrue:[ |
|
3195 |
^ MiniDebugger |
|
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
3196 |
]. |
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
3197 |
|
783 | 3198 |
context := thisContext. |
2893 | 3199 |
context := context findNextContextWithSelector:aSelector or:nil or:nil. |
783 | 3200 |
[context notNil] whileTrue:[ |
4208 | 3201 |
((context receiver class == Debugger) |
3202 |
and:[context selector == aSelector]) ifTrue:[ |
|
3203 |
"we are already in some Debugger" |
|
3204 |
(Debugger == MiniDebugger) ifTrue:[ |
|
3205 |
"we are already in the MiniDebugger" |
|
3206 |
ErrorRecursion ifFalse:[ |
|
3207 |
Smalltalk fatalAbort:'recursive error ...' |
|
3208 |
] |
|
3209 |
]. |
|
3210 |
MiniDebugger isNil ifTrue:[ |
|
3211 |
Smalltalk fatalAbort:'no debugger' |
|
3212 |
]. |
|
3213 |
||
3214 |
"ok, an error occured while in the graphical debugger; |
|
3215 |
lets try MiniDebugger" |
|
3216 |
^ MiniDebugger |
|
3217 |
]. |
|
3218 |
context := context findNextContextWithSelector:aSelector or:nil or:nil. |
|
71 | 3219 |
]. |
783 | 3220 |
"not within Debugger - no problem" |
3221 |
^ Debugger |
|
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
3222 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
3223 |
"Modified: / 23.9.1996 / 12:14:52 / stefan" |
4208 | 3224 |
"Modified: / 19.5.1999 / 18:05:00 / cg" |
783 | 3225 |
! |
3226 |
||
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3227 |
cannotSendMessage:aMessage to:someReceiver |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3228 |
"this message is sent by the runtime system (VM), |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3229 |
when a message is sent to some object, whose class is not |
2231 | 3230 |
a valid behavior (see documentation in Behavior)." |
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3231 |
|
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3232 |
^ InternalErrorSignal |
4469
8719f53c8151
dont raise nonProceedable InternalErrorSignal proceedable.
Claus Gittinger <cg@exept.de>
parents:
4452
diff
changeset
|
3233 |
raiseWith:someReceiver |
8719f53c8151
dont raise nonProceedable InternalErrorSignal proceedable.
Claus Gittinger <cg@exept.de>
parents:
4452
diff
changeset
|
3234 |
errorString:('bad class in send of #' , aMessage selector) |
2231 | 3235 |
|
3236 |
"Modified: 23.1.1997 / 00:05:39 / cg" |
|
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3237 |
! |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
3238 |
|
783 | 3239 |
doesNotUnderstand:aMessage |
3240 |
"this message is sent by the runtime system (VM) when |
|
3241 |
a message is not understood by some object (i.e. there |
|
3242 |
is no method for that selector). The original message has |
|
3243 |
been packed into aMessage (i.e. the receiver, selector and |
|
3244 |
any arguments) and the original receiver is then sent the |
|
3245 |
#doesNotUnderstand: message. |
|
3246 |
Here, we raise another signal which usually enters the debugger. |
|
3247 |
You can of course redefine #doesNotUnderstand: in your classes |
|
1327 | 3248 |
to implement message delegation, |
3249 |
or handle the MessageNotUnderstoodSignal gracefully." |
|
783 | 3250 |
|
4558 | 3251 |
<context: #return> |
3252 |
||
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3253 |
|sel selStr errorString cls sender| |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3254 |
|
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3255 |
sel := aMessage selector. |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3256 |
selStr := sel printString. |
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3257 |
|
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3258 |
"/ Although sel should always be a symbol, |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3259 |
"/ always use printStrings in the code below. |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3260 |
"/ 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
|
3261 |
"/ 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
|
3262 |
|
783 | 3263 |
"/ handle the case of an error during early startup |
3264 |
"/ (output streams not yet initialized) |
|
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3265 |
|
783 | 3266 |
Stdout isNil ifTrue:[ |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3267 |
Smalltalk fatalAbort:'error during init: ' , selStr , ' not understood'. |
783 | 3268 |
]. |
3269 |
||
3270 |
"/ |
|
3271 |
"/ extract the class that should have implemented the message. |
|
3272 |
"/ (in case of a super-send, this is not the receivers class) |
|
3273 |
"/ |
|
4558 | 3274 |
cls := thisContext sender searchClass. |
783 | 3275 |
cls isNil ifTrue:[ |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3276 |
"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
|
3277 |
cls := self class |
783 | 3278 |
]. |
3279 |
||
3280 |
cls notNil ifTrue:[ |
|
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3281 |
"/ |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3282 |
"/ displayString is better than 'cls name', |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3283 |
"/ 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
|
3284 |
"/ (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
|
3285 |
"/ after changing a classes definition) |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3286 |
"/ |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3287 |
errorString := cls displayString. |
783 | 3288 |
] ifFalse:[ |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3289 |
errorString := '(** nil-class **)' |
783 | 3290 |
]. |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3291 |
sel class ~~ Symbol ifTrue:[ |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3292 |
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
|
3293 |
] ifFalse:[ |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3294 |
errorString := errorString , ' does not understand: ' , selStr. |
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3295 |
]. |
783 | 3296 |
|
3297 |
"/ |
|
3298 |
"/ this only happens, when YOU play around with my classvars ... |
|
1327 | 3299 |
"/ (or an error occurs during very early startup, when signals are not yet set) |
783 | 3300 |
"/ |
3301 |
MessageNotUnderstoodSignal isNil ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3302 |
^ MiniDebugger |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3303 |
enterWithMessage:'oops - MessageNotUnderstoodSignal is gone (nil)' |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3304 |
mayProceed:true. |
783 | 3305 |
]. |
3306 |
||
3307 |
"/ |
|
3308 |
"/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger |
|
3309 |
"/ |
|
3310 |
^ MessageNotUnderstoodSignal |
|
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3311 |
raiseRequestWith:aMessage |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3312 |
errorString:errorString |
4287
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3313 |
|
cb4ae74a5c11
better errorString when selector is not a symbol
Claus Gittinger <cg@exept.de>
parents:
4267
diff
changeset
|
3314 |
"Modified: / 9.6.1999 / 17:46:17 / cg" |
783 | 3315 |
! |
3316 |
||
3317 |
elementBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3318 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3319 |
|
1345 | 3320 |
"report an error that badElement is out of bounds |
3321 |
(i.e. cannot be put into that collection). |
|
3322 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3323 |
|
4558 | 3324 |
^ ElementOutOfBoundsSignal raise |
1345 | 3325 |
|
3326 |
"Modified: 8.5.1996 / 09:12:45 / cg" |
|
783 | 3327 |
! |
3328 |
||
3329 |
elementNotCharacter |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3330 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3331 |
|
1345 | 3332 |
"report an error that object to be stored is no Character. |
3333 |
(usually when storing into Strings). |
|
3334 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3335 |
|
4558 | 3336 |
^ ElementOutOfBoundsSignal raise |
1345 | 3337 |
|
3338 |
"Modified: 8.5.1996 / 09:12:49 / cg" |
|
783 | 3339 |
! |
3340 |
||
3341 |
elementNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3342 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3343 |
|
1345 | 3344 |
"report an error that object to be stored is not Integer. |
3345 |
(in collections that store integers only). |
|
3346 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3347 |
|
4558 | 3348 |
^ ElementOutOfBoundsSignal raise |
1345 | 3349 |
|
3350 |
"Modified: 8.5.1996 / 09:12:51 / cg" |
|
783 | 3351 |
! |
3352 |
||
3353 |
error |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3354 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3355 |
|
4558 | 3356 |
<context: #return> |
3357 |
||
1345 | 3358 |
"report error that an error occured. |
4558 | 3359 |
The error is reported by raising the Error exception, |
3360 |
which is non-proceedable. |
|
3361 |
If no handler has been setup, a debugger is entered." |
|
3362 |
||
3363 |
Error raiseWith:#error: |
|
3364 |
||
3365 |
" |
|
3366 |
nil error |
|
4529 | 3367 |
" |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3368 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3369 |
"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
|
3370 |
"Modified: / 2.8.1999 / 17:00:19 / stefan" |
783 | 3371 |
! |
3372 |
||
3373 |
error:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3374 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3375 |
|
4558 | 3376 |
<context: #return> |
3377 |
||
3378 |
"Raise an error with error message aString. |
|
3379 |
The error is reported by raising the Error exception, |
|
3380 |
which is non-proceedable. |
|
3381 |
If no handler has been setup, a debugger is entered." |
|
3382 |
||
3383 |
Error raiseWith:#error: errorString:aString |
|
4529 | 3384 |
|
3385 |
" |
|
3386 |
nil error:' bad bad bad' |
|
3387 |
" |
|
1345 | 3388 |
|
3389 |
"Modified: 8.5.1996 / 09:13:04 / cg" |
|
3390 |
! |
|
3391 |
||
4529 | 3392 |
error:aString mayProceed:mayProceed |
3393 |
"{ Pragma: +optSpace }" |
|
3394 |
||
1345 | 3395 |
"enter debugger with error-message aString. |
4558 | 3396 |
The error is reported by raising either the |
3397 |
non-proceedable Error exception, |
|
3398 |
or the ProceedableError exception." |
|
1345 | 3399 |
|
4529 | 3400 |
mayProceed ifTrue:[ |
4558 | 3401 |
^ ProceedableError raiseRequestWith:#error: errorString:aString |
4529 | 3402 |
]. |
3403 |
||
4558 | 3404 |
Error raiseWith:#error: errorString:aString |
4529 | 3405 |
|
3406 |
"Modified: 8.5.1996 / 09:13:04 / cg" |
|
783 | 3407 |
! |
3408 |
||
3409 |
errorKeyNotFound:aKey |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3410 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3411 |
|
1345 | 3412 |
"report an error that a key was not found in a collection. |
3413 |
The error is reported by raising the KeyNotFoundSignal exception." |
|
783 | 3414 |
|
4558 | 3415 |
^ KeyNotFoundSignal raiseRequestWith:aKey |
3416 |
||
3417 |
" |
|
3418 |
#(1 2) at:3 |
|
3419 |
" |
|
783 | 3420 |
! |
3421 |
||
3422 |
errorNotFound |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3423 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3424 |
|
1345 | 3425 |
"report an error that no element was found in a collection. |
3426 |
The error is reported by raising the NotFoundSignal exception." |
|
783 | 3427 |
|
4558 | 3428 |
^ NotFoundSignal raiseRequestWith:nil |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3429 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3430 |
"Modified: / 8.5.1996 / 09:13:11 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3431 |
"Modified: / 26.7.1999 / 10:51:50 / stefan" |
783 | 3432 |
! |
3433 |
||
3622 | 3434 |
errorSignal |
3435 |
^ self class errorSignal |
|
3436 |
||
3437 |
"Created: / 19.6.1998 / 02:32:32 / cg" |
|
3438 |
! |
|
3439 |
||
783 | 3440 |
halt |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3441 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3442 |
|
1345 | 3443 |
"enter debugger with halt-message. |
3444 |
The error is reported by raising the HaltSignal exception." |
|
783 | 3445 |
|
4558 | 3446 |
^ HaltSignal raiseRequestWith:#halt |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3447 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3448 |
"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
|
3449 |
"Modified: / 2.8.1999 / 17:00:29 / stefan" |
783 | 3450 |
! |
3451 |
||
3452 |
halt:aString |
|
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 |
"enter debugger with halt-message. |
3456 |
The error is reported by raising the HaltSignal exception." |
|
783 | 3457 |
|
4558 | 3458 |
^ HaltSignal raiseRequestWith:#halt: errorString:aString |
1345 | 3459 |
|
3460 |
"Modified: 8.5.1996 / 09:13:23 / cg" |
|
783 | 3461 |
! |
3462 |
||
3463 |
implementedBySubclass |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3464 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3465 |
|
783 | 3466 |
"this is sent by ST/V code - its the same as #subclassResponsibility" |
3467 |
||
3468 |
^ self subclassResponsibility |
|
3469 |
! |
|
3470 |
||
3471 |
indexNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3472 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3473 |
|
1345 | 3474 |
"report an error that index is not an Integer. |
3475 |
(when accessing collections indexed by an integer key). |
|
3476 |
The error is reported by raising the NonIntegerIndexSignal exception." |
|
783 | 3477 |
|
4558 | 3478 |
^ NonIntegerIndexSignal raiseRequestWith:nil |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3479 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3480 |
"Modified: / 8.5.1996 / 09:13:37 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3481 |
"Modified: / 26.7.1999 / 10:57:43 / stefan" |
783 | 3482 |
! |
3483 |
||
3450
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3484 |
indexNotInteger:anIndex |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3485 |
"{ Pragma: +optSpace }" |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3486 |
|
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3487 |
"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
|
3488 |
(when accessing collections indexed by an integer key). |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3489 |
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
|
3490 |
|
4558 | 3491 |
^ NonIntegerIndexSignal raiseRequestWith:anIndex |
3450
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3492 |
|
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3493 |
"Created: / 16.5.1998 / 19:39:41 / cg" |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3494 |
! |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3495 |
|
783 | 3496 |
integerCheckError |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3497 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3498 |
|
783 | 3499 |
"generated when a variable declared with an integer type gets a bad |
3500 |
value assigned" |
|
3501 |
||
3502 |
^ self error:'bad assign of ' , self printString , |
|
3503 |
' (' , self class name , ') to integer-typed variable' |
|
71 | 3504 |
! |
3505 |
||
2829
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3506 |
invalidCodeObject |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3507 |
"{ Pragma: +optSpace }" |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3508 |
|
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3509 |
self error:'not an executable code object' |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3510 |
|
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3511 |
"Created: 1.8.1997 / 00:16:44 / cg" |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3512 |
! |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3513 |
|
783 | 3514 |
invalidMessage |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3515 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3516 |
|
783 | 3517 |
"this is sent by ST/V code - its the same as #shouldNotImplement" |
3518 |
||
3519 |
^ self shouldNotImplement |
|
3520 |
! |
|
3521 |
||
3522 |
mustBeRectangle |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3523 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3524 |
|
783 | 3525 |
"report an argument-not-rectangle-error" |
3526 |
||
3527 |
^ self error:'argument must be a Rectangle' |
|
3528 |
! |
|
3529 |
||
3530 |
mustBeString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3531 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3532 |
|
783 | 3533 |
"report an argument-not-string-error" |
3534 |
||
3535 |
^ self error:'argument must be a String' |
|
3536 |
! |
|
3537 |
||
3538 |
notIndexed |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3539 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3540 |
|
4558 | 3541 |
<context: #return> |
3542 |
||
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3543 |
"report an error that receiver has no indexed instance variables. |
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3544 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3545 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3546 |
^ SubscriptOutOfBoundsSignal |
4558 | 3547 |
raiseErrorString:'receiver has no indexed variables' |
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3548 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3549 |
"Modified: 26.7.1996 / 16:43:13 / cg" |
783 | 3550 |
! |
3551 |
||
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3552 |
openDebuggerOnException:ex |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3553 |
"{ Pragma: +optSpace }" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3554 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3555 |
"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
|
3556 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3557 |
|msgString debugger| |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3558 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3559 |
msgString := ex errorString. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3560 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3561 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3562 |
if there is no debugger, |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3563 |
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
|
3564 |
ignore will raise an abortSignal. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3565 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3566 |
Debugger isNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3567 |
msgString := 'error: ' , msgString. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3568 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3569 |
Smalltalk isStandAloneApp ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3570 |
Dialog notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3571 |
(Dialog |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3572 |
confirm:msgString |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3573 |
title:(Smalltalk commandName) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3574 |
yesLabel:'ignore' noLabel:'exit' |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3575 |
) ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3576 |
^ AbortSignal raise |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3577 |
] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3578 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3579 |
msgString errorPrintCR. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3580 |
OperatingSystem exit:1 |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3581 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3582 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3583 |
msgString errorPrintCR. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3584 |
Smalltalk fatalAbort:'no Debugger defined' |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3585 |
]. |
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 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3588 |
find an appropriate debugger to use |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3589 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3590 |
debugger := self appropriateDebugger:(thisContext selector). |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3591 |
debugger isNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3592 |
^ AbortSignal raise |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3593 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3594 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3595 |
^ debugger |
4558 | 3596 |
enter:ex suspendedContext |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3597 |
withMessage:msgString |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3598 |
mayProceed:(ex mayProceed). |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3599 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3600 |
"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
|
3601 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3602 |
! |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
3603 |
|
783 | 3604 |
primitiveFailed |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3605 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3606 |
|
1345 | 3607 |
"report an error that some primitive code failed. |
3608 |
The error is reported by raising the PrimitiveFailureSignal exception." |
|
783 | 3609 |
|
4558 | 3610 |
^ PrimitiveFailureSignal raiseRequestWith:nil |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3611 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3612 |
"Modified: / 8.5.1996 / 09:14:07 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3613 |
"Modified: / 26.7.1999 / 10:58:08 / stefan" |
783 | 3614 |
! |
3615 |
||
3616 |
shouldNotImplement |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3617 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3618 |
|
1345 | 3619 |
"report an error that this message should not be implemented" |
783 | 3620 |
|
3621 |
^ self error:'method not appropriate for this class' |
|
1345 | 3622 |
|
3623 |
"Modified: 8.5.1996 / 09:09:44 / cg" |
|
783 | 3624 |
! |
3625 |
||
3626 |
subclassResponsibility |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3627 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3628 |
|
1345 | 3629 |
"report an error that this message should have been reimplemented in a |
783 | 3630 |
subclass" |
3631 |
||
4619 | 3632 |
^ self error:'method must be reimplemented in subclass' mayProceed:true |
1345 | 3633 |
|
3634 |
"Modified: 8.5.1996 / 09:09:26 / cg" |
|
783 | 3635 |
! |
3636 |
||
3637 |
subscriptBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3638 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3639 |
|
1345 | 3640 |
"report an error that some index is out of bounds. |
3641 |
(when accessing indexable collections). |
|
3642 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 3643 |
|
4558 | 3644 |
^ SubscriptOutOfBoundsSignal raiseRequestWith:nil |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3645 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3646 |
"Modified: / 26.7.1996 / 16:45:42 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
3647 |
"Modified: / 26.7.1999 / 10:58:27 / stefan" |
783 | 3648 |
! |
3649 |
||
3650 |
subscriptBoundsError:anIndex |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3651 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3652 |
|
1345 | 3653 |
"report an error that anIndex is out of bounds. |
3654 |
(when accessing indexable collections). |
|
3655 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 3656 |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
3657 |
^ SubscriptOutOfBoundsSignal |
4558 | 3658 |
raiseRequestWith:anIndex |
3659 |
errorString:('subscript (' , anIndex printString , ') out of bounds') |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
3660 |
|
1345 | 3661 |
"Modified: 8.5.1996 / 09:14:34 / cg" |
783 | 3662 |
! |
3663 |
||
3664 |
typeCheckError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3665 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3666 |
|
783 | 3667 |
"generated when a variable declared with a type hint gets a bad |
3668 |
value assigned" |
|
3669 |
||
3670 |
^ self error:'bad assign of ' , self printString , |
|
3671 |
' (' , self class name , ') to typed variable' |
|
3672 |
! ! |
|
3673 |
||
3674 |
!Object methodsFor:'evaluation'! |
|
3675 |
||
3676 |
value |
|
1327 | 3677 |
"return the receiver itself. |
3678 |
This allows every object to be used where blocks or valueHolders |
|
3679 |
are typically used, and allows for valueHolders and blocks to be |
|
3680 |
used interchangably in some situations. |
|
3681 |
||
783 | 3682 |
Time will show, if this is a good idea or leads to sloppy programming |
3683 |
style ... (the idea was borrowed from the Self language). |
|
1327 | 3684 |
|
3685 |
WARNING: dont 'optimize' away ifXXX: blocks |
|
2647 | 3686 |
(i.e. do NOT replace |
3687 |
foo ifTrue:[var1] ifFalse:[var2] |
|
3688 |
by: |
|
3689 |
foo ifTrue:var1 ifFalse:var2 |
|
3690 |
) |
|
3691 |
- the compilers will only generate inline code for the if, |
|
3692 |
iff the argument(s) are blocks - otherwise, a true send is |
|
3693 |
generated. |
|
3694 |
This 'oprimization' will work semantically correct, |
|
3695 |
but execute SLOWER instead." |
|
783 | 3696 |
|
3697 |
^ self |
|
71 | 3698 |
|
3699 |
" |
|
1327 | 3700 |
#(1 2 3 4) indexOf:5 ifAbsent:0 |
3701 |
#(1 2 3 4) indexOf:5 ifAbsent:[0] |
|
3702 |
1 > 2 ifTrue:['yes'] ifFalse:['no'] |
|
3703 |
1 > 2 ifTrue:'yes' ifFalse:'no' |
|
783 | 3704 |
" |
3705 |
||
3706 |
"DO NOT DO THIS (its slower) |
|
3707 |
(1 > 4) ifTrue:'oops' ifFalse:'ok' |
|
3708 |
||
3709 |
USE (the compiler optimizes blocks in if/while): |
|
3710 |
(1 > 4) ifTrue:['oops'] ifFalse:['ok'] |
|
3711 |
" |
|
1327 | 3712 |
|
3713 |
"Modified: 3.5.1996 / 11:57:08 / cg" |
|
783 | 3714 |
! ! |
3715 |
||
3330
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3716 |
!Object methodsFor:'finalization'! |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3717 |
|
4257
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3718 |
disposed |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3719 |
"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
|
3720 |
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
|
3721 |
Subclasses may redefine this method" |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3722 |
|
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3723 |
^ self |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3724 |
|
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3725 |
"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
|
3726 |
! |
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3727 |
|
4574
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3728 |
executor |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3729 |
"for VW & Squeak compatibility. |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3730 |
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
|
3731 |
|
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3732 |
^ self shallowCopyForFinalization |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3733 |
|
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3734 |
"Created: / 5.8.1999 / 14:06:19 / cg" |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3735 |
! |
bcd0132b8d49
going to rename shallowCopyForFinalization to executor
Claus Gittinger <cg@exept.de>
parents:
4558
diff
changeset
|
3736 |
|
3330
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3737 |
finalize |
4257
968bc96fd137
added #disposed to avoid errors in Registry.
Claus Gittinger <cg@exept.de>
parents:
4220
diff
changeset
|
3738 |
"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
|
3739 |
objects are finalized. This may change." |
3330
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3740 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3741 |
^ self |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3742 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3743 |
"Created: / 4.3.1998 / 10:40:30 / stefan" |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3744 |
! ! |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3745 |
|
783 | 3746 |
!Object methodsFor:'initialization'! |
3747 |
||
3748 |
initialize |
|
3749 |
"just to ignore initialize to objects which do not need it" |
|
3750 |
||
3751 |
^ self |
|
3752 |
! ! |
|
3753 |
||
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3754 |
!Object methodsFor:'interest'! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3755 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3756 |
addInterest:anInterest |
1762
e7267ff590ff
Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1751
diff
changeset
|
3757 |
"install an interest forwarder. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3758 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3759 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3760 |
self addNonWeakDependent:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3761 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3762 |
"Created: 14.10.1996 / 22:27:34 / stefan" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3763 |
! |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3764 |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3765 |
expressInterestIn:aspect for:anObject sendBack:aSelector |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3766 |
"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
|
3767 |
changes aspect." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3768 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3769 |
"/ 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
|
3770 |
"/ 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
|
3771 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3772 |
self addInterest:(InterestConverter |
2647 | 3773 |
destination:anObject |
3774 |
selector:aSelector |
|
3775 |
aspect:aspect) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3776 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3777 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3778 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3779 |
|
1422 | 3780 |
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
|
3781 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3782 |
p := Point new. |
1422 | 3783 |
Transcript showCR:'interest in #foo:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3784 |
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
|
3785 |
p x:1. |
1422 | 3786 |
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
|
3787 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3788 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3789 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3790 |
Delay waitForSeconds:1. |
1422 | 3791 |
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
|
3792 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3793 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3794 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3795 |
Delay waitForSeconds:1. |
1422 | 3796 |
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
|
3797 |
p retractInterestIn:#foo for:b. |
1422 | 3798 |
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
|
3799 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3800 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3801 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3802 |
Delay waitForSeconds:1. |
1422 | 3803 |
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
|
3804 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 3805 |
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
|
3806 |
p changed:#foo. |
1422 | 3807 |
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
|
3808 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3809 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3810 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3811 |
Delay waitForSeconds:1. |
1422 | 3812 |
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
|
3813 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 3814 |
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
|
3815 |
p changed:#foo. |
1422 | 3816 |
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
|
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:'no more interests:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3822 |
p retractInterestsFor:b. |
1422 | 3823 |
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
|
3824 |
p changed:#foo. |
1422 | 3825 |
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
|
3826 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3827 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3828 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3829 |
p release. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3830 |
" |
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 |
"Created: 19.4.1996 / 10:26:22 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3833 |
"Modified: 19.4.1996 / 12:34:08 / cg" |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3834 |
"Modified: 14.10.1996 / 22:28:20 / stefan" |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3835 |
! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3836 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3837 |
interests |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3838 |
"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
|
3839 |
Here, we use the nonWeakDependents for interests." |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3840 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3841 |
^ self nonWeakDependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3842 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3843 |
"Created: / 14.10.1996 / 22:20:51 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3844 |
"Modified: / 30.1.1998 / 14:07:35 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3845 |
! |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3846 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3847 |
interestsFor:someOne |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3848 |
"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
|
3849 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3850 |
|coll deps| |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3851 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3852 |
deps := self interests. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3853 |
deps size == 0 ifTrue:[^ #()]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3854 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3855 |
coll := IdentitySet new. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3856 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3857 |
deps do:[:dep | |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3858 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3859 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3860 |
coll add:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3861 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3862 |
] |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3863 |
]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3864 |
^ coll |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3865 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3866 |
"Created: / 30.1.1998 / 14:02:26 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3867 |
"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
|
3868 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3869 |
|
3960 | 3870 |
onChangeEvaluate:aBlock |
3871 |
"arrange for aBlock to be evaluated whenever the receiver changes." |
|
3872 |
||
3873 |
^ self onChangeSend:#value to:aBlock |
|
3874 |
||
3875 |
"Created: / 29.1.1999 / 16:01:22 / cg" |
|
3876 |
! |
|
3877 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3878 |
onChangeSend:aSelector to:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3879 |
"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
|
3880 |
changes." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3881 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3882 |
"/ 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
|
3883 |
"/ 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
|
3884 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3885 |
self addInterest:(InterestConverter |
2647 | 3886 |
destination:anObject |
3887 |
selector:aSelector) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3888 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3889 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3890 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3891 |
|
1422 | 3892 |
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
|
3893 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3894 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3895 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3896 |
p x:1. |
1422 | 3897 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3898 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3899 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3900 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3901 |
Delay waitForSeconds:1. |
1422 | 3902 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3903 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3904 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3905 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3906 |
Delay waitForSeconds:1. |
1422 | 3907 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3908 |
p retractInterestsFor:b. |
1422 | 3909 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3910 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3911 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3912 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3913 |
Delay waitForSeconds:1. |
1422 | 3914 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3915 |
p onChangeSend:#value to:b. |
1422 | 3916 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3917 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3918 |
Transcript cr. |
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 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3921 |
"Created: 19.4.1996 / 10:26:38 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3922 |
"Modified: 19.4.1996 / 12:34:26 / cg" |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3923 |
"Modified: 14.10.1996 / 22:28:27 / stefan" |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3924 |
! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3925 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3926 |
removeInterest:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3927 |
"remove an interest forwarder. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3928 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3929 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3930 |
self removeNonWeakDependent:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3931 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3932 |
"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
|
3933 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3934 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3935 |
retractInterestIn:aspect for:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3936 |
"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
|
3937 |
(as installed with #expressInterestIn:for:sendBack:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3938 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3939 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3940 |
"/ 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
|
3941 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3942 |
"/ cannot removeDependent within the loop - the collection rehashes |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3943 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3944 |
|deps coll| |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3945 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3946 |
deps := self interests. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3947 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3948 |
coll := IdentitySet new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3949 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3950 |
deps do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3951 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3952 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3953 |
dep aspect == aspect ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3954 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3955 |
^ self |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3956 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3957 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3958 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3959 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3960 |
coll do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3961 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3962 |
]. |
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 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3966 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3967 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3968 |
|
1422 | 3969 |
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
|
3970 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3971 |
p := Point new. |
1422 | 3972 |
Transcript showCR:'interest in #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3973 |
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
|
3974 |
p x:1. |
1422 | 3975 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3976 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3977 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3978 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3979 |
Delay waitForSeconds:1. |
1422 | 3980 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3981 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3982 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3983 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3984 |
Delay waitForSeconds:1. |
1422 | 3985 |
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
|
3986 |
p retractInterestIn:#foo for:b. |
1422 | 3987 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3988 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3989 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3990 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3991 |
Delay waitForSeconds:1. |
1422 | 3992 |
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
|
3993 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 3994 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3995 |
p changed:#foo. |
1422 | 3996 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3997 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3998 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3999 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4000 |
Delay waitForSeconds:1. |
1422 | 4001 |
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
|
4002 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 4003 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4004 |
p changed:#foo. |
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:'no more interests'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4011 |
p retractInterestsFor:b. |
1422 | 4012 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4013 |
p changed:#foo. |
1422 | 4014 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4015 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4016 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4017 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4018 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4019 |
"Created: / 19.4.1996 / 10:27:11 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4020 |
"Modified: / 14.10.1996 / 22:21:19 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4021 |
"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
|
4022 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4023 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4024 |
retractInterestsFor:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4025 |
"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
|
4026 |
(as installed with #onChangeSend:to:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4027 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4028 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4029 |
"/ 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
|
4030 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4031 |
|coll deps| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4032 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4033 |
"/ 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
|
4034 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
4035 |
deps := self interests. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4036 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4037 |
coll := IdentitySet new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4038 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4039 |
deps do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4040 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4041 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4042 |
coll add:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4043 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4044 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4045 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4046 |
coll do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4047 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4048 |
]. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4049 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4050 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4051 |
|
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 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4055 |
|
1422 | 4056 |
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
|
4057 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4058 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4059 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4060 |
p x:1. |
1422 | 4061 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4062 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4063 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4064 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4065 |
Delay waitForSeconds:1. |
1422 | 4066 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4067 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4068 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4069 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4070 |
Delay waitForSeconds:1. |
1422 | 4071 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4072 |
p retractInterestsFor:b. |
1422 | 4073 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4074 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4075 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4076 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4077 |
Delay waitForSeconds:1. |
1422 | 4078 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4079 |
p onChangeSend:#value to:b. |
1422 | 4080 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4081 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4082 |
Transcript cr. |
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 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4085 |
"Created: / 19.4.1996 / 10:23:46 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4086 |
"Modified: / 14.10.1996 / 22:21:25 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
4087 |
"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
|
4088 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
4089 |
|
783 | 4090 |
!Object methodsFor:'interrupt handling'! |
4091 |
||
4092 |
childSignalInterrupt |
|
4093 |
"death of a child process (unix process) - do nothing" |
|
4094 |
||
4095 |
^ self |
|
4096 |
! |
|
4097 |
||
4098 |
customInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4099 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4100 |
|
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4101 |
"a custom interrupt - but no handler has defined" |
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4102 |
|
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4103 |
self error:'custom interrupt' mayProceed:true |
783 | 4104 |
! |
4105 |
||
4106 |
errorInterrupt:errorID with:aParameter |
|
4107 |
"subsystem error. The arguments errorID and aParameter are the values passed |
|
4108 |
to the 'errorInterruptWithIDAndParameter(id, param)' function, |
|
4109 |
which can be called from C subsystems to raise an (asynchronous) |
|
4110 |
error exception. |
|
4111 |
||
4112 |
Currently, this is used to map XErrors to smalltalk errors, but can be |
|
4113 |
used from other C subsystems too, to upcast errors. |
|
4114 |
Especially, for subsystems which call errorHandler functions asynchronously. |
|
4115 |
IDs (currently) used: |
|
4116 |
#DisplayError ..... x-error interrupt |
|
4117 |
#XtError ..... xt-error interrupt (Xt interface is not yet published) |
|
71 | 4118 |
" |
783 | 4119 |
|
4120 |
|handler| |
|
4121 |
||
4122 |
handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil. |
|
4123 |
handler notNil ifTrue:[ |
|
4124 |
"/ |
|
4125 |
"/ handler found; let it do whatever it wants ... |
|
4126 |
"/ |
|
4127 |
handler errorInterrupt:errorID with:aParameter. |
|
4128 |
^ self |
|
4129 |
]. |
|
4130 |
||
4131 |
"/ |
|
4132 |
"/ no handler - raise errorSignal passing the errorId as parameter |
|
4133 |
"/ |
|
4134 |
^ ErrorSignal |
|
4135 |
raiseRequestWith:errorID |
|
4136 |
errorString:('Subsystem error. ErrorID = ' , errorID printString) |
|
4137 |
! |
|
4138 |
||
4139 |
exceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4140 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4141 |
|
783 | 4142 |
"exception interrupt - enter debugger" |
4143 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4144 |
self error:'exception Interrupt' mayProceed:true |
783 | 4145 |
! |
4146 |
||
4147 |
fpExceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4148 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4149 |
|
783 | 4150 |
"a floating point exception occured - this one |
4151 |
has to be handled differently since it comes asynchronous |
|
4152 |
on some machines (for example, on machines with a separate FPU |
|
4153 |
or superscalar architectures. Also, errors from within primitive code |
|
4154 |
(or library functions such as GL) are sent via the Unix-signal |
|
4155 |
mechanism this way." |
|
4156 |
||
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4157 |
|where rec| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4158 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4159 |
where := thisContext sender. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4160 |
rec := where receiver. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4161 |
rec isNumber ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4162 |
^ rec class |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4163 |
raise:#domainErrorSignal |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4164 |
receiver:rec |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4165 |
selector:where selector |
3398 | 4166 |
arguments:(where args asArray) |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4167 |
errorString:'floating point exception' |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4168 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4169 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4170 |
"/ could be in some C-library ... |
783 | 4171 |
^ Float domainErrorSignal raise |
4172 |
! |
|
4173 |
||
4174 |
internalError:msg |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4175 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4176 |
|
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
4177 |
"this is triggered, when VM hits some bad error, |
783 | 4178 |
such as corrupted class, corrupted method/selector array |
4179 |
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
|
4180 |
(for example, if you set an objects class to a non-behavior, nil etc.). |
783 | 4181 |
Its not guaranteed, that the system is in a working condition once |
4182 |
this error occurred ...." |
|
4183 |
||
4558 | 4184 |
InternalErrorSignal raiseWith:self errorString:msg |
783 | 4185 |
! |
4186 |
||
4187 |
ioInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4188 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4189 |
|
783 | 4190 |
"I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor). |
4191 |
If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler) |
|
4192 |
or it does not understand the ioInterrupt message. |
|
4193 |
In any case, this is a sign of some big trouble. Enter debugger." |
|
4194 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4195 |
self error:'I/O Interrupt - but no handler' mayProceed:true |
783 | 4196 |
! |
4197 |
||
4198 |
memoryInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4199 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4200 |
|
783 | 4201 |
"out-of-memory interrupt and no handler - enter debugger" |
4202 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4203 |
self error:'almost out of memory' mayProceed:true |
783 | 4204 |
! |
4205 |
||
4206 |
recursionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4207 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4208 |
|
783 | 4209 |
"recursion limit (actually: stack overflow) interrupt. |
4210 |
This interrupt is triggered, when a process stack grows above |
|
4211 |
its stackLimit - usually, this leads into the debugger, but |
|
2689 | 4212 |
could be caught and the stackLimit increased in the handler. |
783 | 4213 |
At the time we arrive here, the system has still some stack |
4214 |
as a reserve so we can continue to do some useful work or cleanup or |
|
4215 |
debugging for a while. |
|
4216 |
If the signal is ignored, and the stack continues to grow, there |
|
4217 |
will be a few more chances (and more interrupts) before the VM |
|
4218 |
hard-terminates the process." |
|
4219 |
||
4220 |
thisContext isRecursive ifFalse:[ |
|
4884 | 4221 |
"/ Processor activeProcess usedStackSize < Processor activeProcess maximumStackSize ifTrue:[ |
4222 |
"/ "/ mhmh - it hit me, but I am not responsible ... |
|
4223 |
"/ 'Stray recursionInterrupt ...' infoPrintCR. |
|
4224 |
"/ ^ self |
|
4225 |
"/ ]. |
|
4815
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4226 |
thisContext sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4227 |
thisContext sender sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4228 |
thisContext sender sender sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4229 |
thisContext sender sender sender sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4230 |
thisContext sender sender sender sender sender fullPrint. |
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4231 |
^ RecursionInterruptSignal raise |
783 | 4232 |
] |
4815
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4233 |
|
75c3243e523a
ignore stray recursion interrupts.
Claus Gittinger <cg@exept.de>
parents:
4808
diff
changeset
|
4234 |
"Modified: / 25.9.1999 / 18:28:11 / cg" |
783 | 4235 |
! |
4236 |
||
4237 |
schedulerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4238 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4239 |
|
783 | 4240 |
"scheduler interrupt (supposed to be sent to Processor). |
4241 |
If we arrive here, either the Processor does not understand it, |
|
4242 |
or it has been set to nil. In any case, this is a sign of some |
|
4243 |
big trouble. Enter debugger." |
|
4244 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4245 |
self error:'schedulerInterrupt - but no Processor' mayProceed:true |
783 | 4246 |
! |
4247 |
||
4248 |
signalInterrupt:signalNumber |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4249 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4250 |
|
783 | 4251 |
"unix signal occured - some signals are handled as Smalltalk Exceptions |
4252 |
(SIGPIPE), others (SIGBUS) are rather fatal ... |
|
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4253 |
In any case, IF a smalltalk-signal has been connected to the OS signal, |
783 | 4254 |
that one is raised. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4255 |
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
|
4256 |
signal. |
783 | 4257 |
TODO: add another argument, giving more detailed signal info (PC, VADDR, |
4258 |
exact cause etc.). This helps if segvs occur in primitive code. |
|
4259 |
Currently (temporary kludge), these are passed as global variables." |
|
4260 |
||
2773 | 4261 |
|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
|
4262 |
action title| |
783 | 4263 |
|
4264 |
" |
|
4265 |
special case - since SIGPIPE has an ST-signal associated |
|
4266 |
" |
|
4267 |
(signalNumber == 13) ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4268 |
"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
|
4269 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4270 |
^ PipeStream brokenPipeSignal raise. |
783 | 4271 |
]. |
4272 |
||
4273 |
"if there has been an ST-signal installed, use it ..." |
|
4274 |
||
4275 |
sig := OperatingSystem operatingSystemSignal:signalNumber. |
|
4276 |
sig notNil ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4277 |
^ sig raise |
783 | 4278 |
]. |
4279 |
||
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4280 |
"/ if handled, raise OSSignalInterruptSignal |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4281 |
|
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4282 |
OSSignalInterruptSignal isHandled ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4283 |
^ OSSignalInterruptSignal raiseWith:signalNumber |
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4284 |
]. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
4285 |
|
783 | 4286 |
" |
4287 |
... otherwise , bring up a box asking for what to do ... |
|
4288 |
" |
|
4289 |
name := OperatingSystem nameForSignal:signalNumber. |
|
4290 |
here := thisContext. |
|
4291 |
||
4292 |
" |
|
4293 |
the context, in which the signal occurred: |
|
4294 |
" |
|
4295 |
badContext := here sender. |
|
4296 |
||
4297 |
" |
|
4298 |
ungrab - in case it happened in a box/popupview |
|
4299 |
otherwise display stays locked |
|
4300 |
" |
|
2851
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4301 |
"/ Display notNil ifTrue:[ |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4302 |
"/ Display ungrabPointer. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4303 |
"/ Display ungrabKeyboard. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4304 |
"/ ]. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
4305 |
Screen notNil ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4306 |
Screen allScreens do:[:aScreen | |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4307 |
aScreen ungrabPointer. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4308 |
aScreen ungrabKeyboard. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4309 |
] |
783 | 4310 |
]. |
4311 |
||
4312 |
" |
|
4313 |
SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue) |
|
4314 |
since the system will retry the faulty instruction, which leads to |
|
4315 |
another signal - to avoid frustration, better not offer this option. |
|
4316 |
" |
|
4317 |
ignorable := (signalNumber ~~ OperatingSystem sigBUS) |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4318 |
and:[signalNumber ~~ OperatingSystem sigILL |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4319 |
and:[signalNumber ~~ OperatingSystem sigSEGV]]. |
783 | 4320 |
|
4321 |
ignorable ifFalse:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4322 |
here isRecursive ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4323 |
'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR. |
4537 | 4324 |
MiniDebugger |
4325 |
enterWithMessage:'recursive signal' |
|
4326 |
mayProceed:true. |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4327 |
^ self |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4328 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4329 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4330 |
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
|
4331 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4332 |
msg := 'OS-signal: ', name. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4333 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4334 |
"/ 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
|
4335 |
"/ 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
|
4336 |
"/ 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
|
4337 |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4338 |
InterruptPcLow notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4339 |
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
|
4340 |
pc ~~ 0 ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4341 |
msg := msg , ' PC=' , (pc printStringRadix:16) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4342 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4343 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4344 |
InterruptAddrLow notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4345 |
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
|
4346 |
addr ~~ 0 ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4347 |
msg := msg , ' ADDR=' , (addr printStringRadix:16) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4348 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4349 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4350 |
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
|
4351 |
badContext return. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4352 |
^ nil. |
783 | 4353 |
]. |
4354 |
||
4355 |
OptionBox isNil ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4356 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4357 |
a system without GUI ... |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4358 |
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
|
4359 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4360 |
MiniDebugger isNil ifTrue:[ |
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 |
a system without debugging facilities |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4363 |
(i.e. a standalone system) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4364 |
output a message and exit. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4365 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4366 |
('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
|
4367 |
Smalltalk exit. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4368 |
]. |
4537 | 4369 |
MiniDebugger |
4370 |
enterWithMessage:'Signal caught (' , name, ')' |
|
4371 |
mayProceed:true. |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4372 |
^ self |
783 | 4373 |
]. |
4374 |
||
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4375 |
titles := #('dump core' 'exit ST/X'). |
783 | 4376 |
actions := Array |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4377 |
with:[Smalltalk fatalAbort] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4378 |
with:[Smalltalk exit]. |
2773 | 4379 |
|
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4380 |
action := nil. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4381 |
title := 'OS Signal caught (' , name, ')'. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4382 |
title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4383 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4384 |
"/ if cought while in the scheduler or event dispatcher, |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4385 |
"/ a modal dialog is not possible ... |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4386 |
"/ (therefore, debug & return make no sense) |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4387 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4388 |
Processor activeProcess isSystemProcess ifFalse:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4389 |
titles := #('abort' 'debug') , titles. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4390 |
actions := (Array |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4391 |
with:[action := #abort] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4392 |
with:[action := #debug]) , actions. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4393 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4394 |
badContext canReturn ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4395 |
titles := #('return') , titles. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4396 |
actions := (Array with:[action := #return]) , actions. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4397 |
]. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4398 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4399 |
|
783 | 4400 |
ignorable ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4401 |
titles := titles, #('ignore'). |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4402 |
actions := actions , (Array with:[action := #ignore]). |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4403 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4404 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4405 |
box := OptionBox |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4406 |
title:title |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4407 |
numberOfOptions:actions size. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4408 |
ignorable ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4409 |
box defaultButtonIndex:(actions size) |
783 | 4410 |
]. |
4411 |
box buttonTitles:titles. |
|
4412 |
box actions:actions. |
|
2773 | 4413 |
box showAtPointer. |
4414 |
||
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4415 |
action == #return ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4416 |
badContext return |
2774
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 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4419 |
action == #abort ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4420 |
AbortSignal raise. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4421 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4422 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4423 |
action == #debug ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
4424 |
Debugger enter:here withMessage:('Signal ', name) mayProceed:true. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4425 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4426 |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
4427 |
"Modified: / 4.5.1998 / 20:39:16 / cg" |
783 | 4428 |
! |
4429 |
||
4430 |
spyInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4431 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4432 |
|
783 | 4433 |
"spy interrupt and no handler - enter debugger" |
4434 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4435 |
self error:'spy Interrupt - but no handler' mayProceed:true |
783 | 4436 |
! |
4437 |
||
4438 |
timerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4439 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4440 |
|
783 | 4441 |
"timer interrupt and no handler - enter debugger" |
4442 |
||
4522
29a6625dc7b1
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
4520
diff
changeset
|
4443 |
self error:'timer Interrupt - but no handler' mayProceed:true |
783 | 4444 |
! |
4445 |
||
4446 |
userInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4447 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4448 |
|
1792 | 4449 |
"user (^c) interrupt. |
4450 |
This is typically sent by the VM, when a ctrl-C is typed at the |
|
4451 |
controlling tty (i.e. in the xterm)." |
|
783 | 4452 |
|
4453 |
UserInterruptSignal raise |
|
1788 | 4454 |
! |
4455 |
||
4456 |
userInterruptIn:aContext |
|
4457 |
"{ Pragma: +optSpace }" |
|
4458 |
||
4459 |
"user (^c) interrupt - enter debugger, but show aContext |
|
1792 | 4460 |
as top-context. |
4461 |
This is used to hide any intermediate scheduler contexts, |
|
4462 |
in case of an interrupted process. Typically, this is sent by |
|
4463 |
the WindowGroup, when a keyboardEvent for the ctrl-C key is |
|
4464 |
processed." |
|
1788 | 4465 |
|
4634 | 4466 |
<context: #return> |
4467 |
||
4558 | 4468 |
UserInterruptSignal raiseRequestWith:nil errorString:nil in:aContext |
4452
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
4469 |
|
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
4470 |
"Created: / 18.10.1996 / 20:46:04 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
4471 |
"Modified: / 20.10.1996 / 13:06:38 / cg" |
3d050f505a0a
Raise proceedable signals proceedable.
Stefan Vogel <sv@exept.de>
parents:
4392
diff
changeset
|
4472 |
"Modified: / 26.7.1999 / 10:58:49 / stefan" |
71 | 4473 |
! ! |
4474 |
||
1 | 4475 |
!Object methodsFor:'message sending'! |
4476 |
||
4477 |
perform:aSelector |
|
4478 |
"send the message aSelector to the receiver" |
|
4479 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4480 |
%{ |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4481 |
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
|
4482 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4483 |
static struct inlineCache ilc_0 = __ILCPERF0(@line+14); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4484 |
static struct inlineCache ilc_1 = __ILCPERF0(@line+17-1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4485 |
static struct inlineCache ilc_2 = __ILCPERF0(@line+20-2); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4486 |
static struct inlineCache ilc_3 = __ILCPERF0(@line+23-3); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4487 |
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
|
4488 |
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
|
4489 |
static OBJ last_1 = nil; |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4490 |
static OBJ last_2 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4491 |
static OBJ last_3 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4492 |
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
|
4493 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4494 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4495 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4496 |
if (sel == last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4497 |
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
|
4498 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4499 |
if (sel == last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4500 |
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
|
4501 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4502 |
if (sel == last_2) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4503 |
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
|
4504 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4505 |
if (sel == last_3) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4506 |
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
|
4507 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4508 |
if (sel == last_4) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4509 |
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
|
4510 |
} |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4511 |
|
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4512 |
if (flip == 0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4513 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4514 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4515 |
last_0 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4516 |
} else if (flip == 1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4517 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4518 |
flip = 2; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4519 |
last_1 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4520 |
} else if (flip == 2) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4521 |
pIlc = &ilc_2; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4522 |
flip = 3; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4523 |
last_2 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4524 |
} else if (flip == 3) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4525 |
pIlc = &ilc_3; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4526 |
flip = 4; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4527 |
last_3 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4528 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4529 |
pIlc = &ilc_4; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4530 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4531 |
last_4 = sel; |
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 |
pIlc->ilc_func = __SEND0ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4534 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4535 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4536 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4537 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4538 |
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
|
4539 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4540 |
static struct inlineCache ilc0 = __DUMMYILCSELF0(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4541 |
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
|
4542 |
} |
1 | 4543 |
%} |
4544 |
! |
|
4545 |
||
783 | 4546 |
perform:aSelector inClass:aClass withArguments:argArray |
4547 |
"send the message aSelector with all args taken from argArray |
|
4548 |
to the receiver as a super-send message. |
|
4549 |
This is actually more flexible than the normal super-send, since it allows |
|
4550 |
to execute a method in ANY superclass of the receiver (not just the |
|
4551 |
immediate superclass). |
|
4552 |
Thus, it is (theoretically) possible to do |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4553 |
'5 perform:#< inClass:Magnitude withArguments:#(6)' |
783 | 4554 |
and evaluate Magnitudes compare method even if there was one in Number. |
4555 |
This method is used by the interpreter to evaluate super sends |
|
4556 |
and could be used for very special behavior (language extension ?). |
|
4557 |
||
4558 |
WARNING: this is an ST/X feature - probably not found in other smalltalks." |
|
4559 |
||
4560 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
|
4561 |
||
4562 |
" |
|
4563 |
check, if aClass is really a superclass of the receiver |
|
4564 |
" |
|
4565 |
(self class isSubclassOf:aClass) ifFalse:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4566 |
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
|
4567 |
^ nil |
783 | 4568 |
]. |
4569 |
%{ |
|
4570 |
REGISTER OBJ *argP; |
|
4571 |
int nargs, i; |
|
4572 |
||
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4573 |
if (__isArray(argArray)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4574 |
nargs = __arraySize(argArray); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4575 |
argP = __ArrayInstPtr(argArray)->a_element; |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4576 |
} else { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4577 |
if (__isNonNilObject(argArray)) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4578 |
static struct inlineCache ilcSize = __ILC0(@line+1); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4579 |
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
|
4580 |
if (!__isSmallInteger(numberOfArgs)) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4581 |
goto bad; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4582 |
nargs = __intVal(numberOfArgs); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4583 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4584 |
for (i=1; i <= nargs; i++) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4585 |
*argP++ = __AT_(argArray, __MKSMALLINT(i)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4586 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4587 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4588 |
} else { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4589 |
nargs = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4590 |
} |
783 | 4591 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4592 |
switch (nargs) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4593 |
case 0: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4594 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4595 |
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
|
4596 |
RETURN ( _SEND0(self, aSelector, aClass, &ilc0)); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4597 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4598 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4599 |
case 1: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4600 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4601 |
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
|
4602 |
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
|
4603 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4604 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4605 |
case 2: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4606 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4607 |
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
|
4608 |
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
|
4609 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4610 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4611 |
case 3: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4612 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4613 |
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
|
4614 |
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
|
4615 |
argP[0], argP[1], argP[2])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4616 |
} |
3177
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 |
case 4: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4619 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4620 |
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
|
4621 |
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
|
4622 |
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
|
4623 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4624 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4625 |
case 5: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4626 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4627 |
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
|
4628 |
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
|
4629 |
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
|
4630 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4631 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4632 |
case 6: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4633 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4634 |
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
|
4635 |
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
|
4636 |
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
|
4637 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4638 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4639 |
case 7: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4640 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4641 |
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
|
4642 |
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
|
4643 |
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
|
4644 |
argP[6])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4645 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4646 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4647 |
case 8: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4648 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4649 |
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
|
4650 |
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
|
4651 |
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
|
4652 |
argP[6], argP[7])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4653 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4654 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4655 |
case 9: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4656 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4657 |
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
|
4658 |
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
|
4659 |
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
|
4660 |
argP[6], argP[7], argP[8])); |
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 10: |
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 ilc10 = __DUMMYILCSELF10(@line+1); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4666 |
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
|
4667 |
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
|
4668 |
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
|
4669 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4670 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4671 |
case 11: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4672 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4673 |
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
|
4674 |
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
|
4675 |
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
|
4676 |
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
|
4677 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4678 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4679 |
case 12: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4680 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4681 |
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
|
4682 |
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
|
4683 |
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
|
4684 |
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
|
4685 |
argP[11])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4686 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4687 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4688 |
case 13: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4689 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4690 |
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
|
4691 |
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
|
4692 |
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
|
4693 |
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
|
4694 |
argP[11], argP[12])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4695 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4696 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4697 |
case 14: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4698 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4699 |
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
|
4700 |
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
|
4701 |
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
|
4702 |
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
|
4703 |
argP[11], argP[12], argP[13])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4704 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4705 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4706 |
case 15: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4707 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4708 |
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
|
4709 |
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
|
4710 |
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
|
4711 |
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
|
4712 |
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
|
4713 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4714 |
|
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4715 |
#ifdef _SEND16 |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4716 |
case 16: |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4717 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4718 |
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
|
4719 |
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
|
4720 |
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
|
4721 |
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
|
4722 |
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
|
4723 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4724 |
#endif |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4725 |
|
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4726 |
|
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4727 |
} |
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4728 |
bad:; |
1626 | 4729 |
%}. |
4730 |
"/ arrive here, if bad number of arguments (too many) |
|
4731 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
4732 |
||
783 | 4733 |
^ self primitiveFailed |
4734 |
! |
|
4735 |
||
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4736 |
perform:aSelector with:arg |
1 | 4737 |
"send the one-arg-message aSelector to the receiver" |
4738 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4739 |
%{ |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4740 |
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
|
4741 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4742 |
static struct inlineCache ilc_0 = __ILCPERF1(@line+14); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4743 |
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
|
4744 |
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
|
4745 |
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
|
4746 |
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
|
4747 |
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
|
4748 |
static OBJ last_1 = nil; |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4749 |
static OBJ last_2 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4750 |
static OBJ last_3 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4751 |
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
|
4752 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4753 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4754 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4755 |
if (sel == last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4756 |
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
|
4757 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4758 |
if (sel == last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4759 |
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
|
4760 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4761 |
if (sel == last_2) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4762 |
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
|
4763 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4764 |
if (sel == last_3) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4765 |
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
|
4766 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4767 |
if (sel == last_4) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4768 |
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
|
4769 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4770 |
|
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4771 |
if (flip == 0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4772 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4773 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4774 |
last_0 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4775 |
} else if (flip == 1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4776 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4777 |
flip = 2; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4778 |
last_1 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4779 |
} else if (flip == 2) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4780 |
pIlc = &ilc_2; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4781 |
flip = 3; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4782 |
last_2 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4783 |
} else if (flip == 3) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4784 |
pIlc = &ilc_3; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4785 |
flip = 4; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4786 |
last_3 = sel; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4787 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4788 |
pIlc = &ilc_4; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4789 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4790 |
last_4 = sel; |
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 |
pIlc->ilc_func = __SEND1ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4793 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4794 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4795 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4796 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4797 |
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
|
4798 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4799 |
static struct inlineCache ilc1 = __DUMMYILCSELF1(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4800 |
RETURN (_SEND1(self, aSelector, nil, &ilc1, arg)); |
1 | 4801 |
} |
4802 |
%} |
|
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4803 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4804 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4805 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4806 |
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
|
4807 |
"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
|
4808 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4809 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4810 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4811 |
static struct inlineCache ilc_0 = __ILCPERF2(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4812 |
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
|
4813 |
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
|
4814 |
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
|
4815 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4816 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4817 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4818 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4819 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4820 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4821 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4822 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4823 |
last_0 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4824 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4825 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4826 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4827 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4828 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4829 |
pIlc->ilc_func = __SEND2ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4830 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4831 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4832 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4833 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4834 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4835 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4836 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4837 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4838 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4839 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4840 |
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
|
4841 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4842 |
static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4843 |
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
|
4844 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4845 |
%} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4846 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4847 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4848 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4849 |
perform:aSelector with:arg1 with:arg2 with:arg3 |
1 | 4850 |
"send the three-arg-message aSelector to the receiver" |
4851 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4852 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4853 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4854 |
static struct inlineCache ilc_0 = __ILCPERF3(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4855 |
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
|
4856 |
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
|
4857 |
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
|
4858 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4859 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4860 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4861 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4862 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4863 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4864 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4865 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4866 |
last_0 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4867 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4868 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4869 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4870 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4871 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4872 |
pIlc->ilc_func = __SEND3ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4873 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4874 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4875 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4876 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4877 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4878 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4879 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4880 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4881 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4882 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4883 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4884 |
arg1, arg2, arg3) ); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4885 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4886 |
static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4887 |
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
|
4888 |
} |
1 | 4889 |
%} |
2437 | 4890 |
! |
4891 |
||
4892 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 |
|
4893 |
"send the four-arg-message aSelector to the receiver" |
|
4894 |
||
4895 |
%{ |
|
4896 |
struct inlineCache *pIlc; |
|
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4897 |
static struct inlineCache ilc_0 = __ILCPERF4(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4898 |
static struct inlineCache ilc_1 = __ILCPERF4(@line+28); |
2437 | 4899 |
static OBJ last_0 = nil; |
4900 |
static OBJ last_1 = nil; |
|
4901 |
static flip = 0; |
|
4902 |
||
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4903 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4904 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4905 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4906 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4907 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4908 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4909 |
last_0 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4910 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4911 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4912 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4913 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4914 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4915 |
pIlc->ilc_func = __SEND4ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4916 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4917 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4918 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4919 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4920 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4921 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4922 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4923 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4924 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4925 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4926 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4927 |
arg1, arg2, arg3, arg4) ); |
2437 | 4928 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4929 |
static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4930 |
RETURN (_SEND4(self, aSelector, nil, &ilc4, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4931 |
arg1, arg2, arg3, arg4)); |
2437 | 4932 |
} |
4933 |
%} |
|
1 | 4934 |
! |
4935 |
||
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4936 |
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
|
4937 |
"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
|
4938 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4939 |
%{ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4940 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4941 |
static struct inlineCache ilc_0 = __ILCPERF5(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4942 |
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
|
4943 |
static OBJ last_0 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4944 |
static OBJ last_1 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4945 |
static flip = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4946 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4947 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4948 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4949 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4950 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4951 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4952 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4953 |
last_0 = aSelector; |
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_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4956 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4957 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4958 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4959 |
pIlc->ilc_func = __SEND5ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4960 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4961 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4962 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4963 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4964 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4965 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4966 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4967 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4968 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4969 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4970 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4971 |
arg1, arg2, arg3, arg4, arg5) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4972 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4973 |
static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4974 |
RETURN (_SEND5(self, aSelector, nil, &ilc5, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4975 |
arg1, arg2, arg3, arg4, arg5)); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4976 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4977 |
%} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4978 |
! |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4979 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4980 |
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
|
4981 |
"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
|
4982 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4983 |
%{ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4984 |
struct inlineCache *pIlc; |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4985 |
static struct inlineCache ilc_0 = __ILCPERF6(@line+29); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4986 |
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
|
4987 |
static OBJ last_0 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4988 |
static OBJ last_1 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4989 |
static flip = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4990 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4991 |
if (InterruptPending == nil) { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4992 |
if (aSelector != last_0) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4993 |
if (aSelector != last_1) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4994 |
if (flip) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4995 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4996 |
flip = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
4997 |
last_0 = aSelector; |
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_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5000 |
flip = 1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5001 |
last_1 = aSelector; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5002 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5003 |
pIlc->ilc_func = __SEND6ADDR__; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5004 |
if (pIlc->ilc_poly) { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5005 |
__flushPolyCache(pIlc->ilc_poly); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5006 |
pIlc->ilc_poly = 0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5007 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5008 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5009 |
pIlc = &ilc_1; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5010 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5011 |
} else { |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5012 |
pIlc = &ilc_0; |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5013 |
} |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5014 |
|
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5015 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5016 |
arg1, arg2, arg3, arg4, arg5, arg6) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5017 |
} else { |
4090
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5018 |
static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1); |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5019 |
RETURN (_SEND6(self, aSelector, nil, &ilc6, |
ada783cc6b37
line numbers in primitive-perform.
Claus Gittinger <cg@exept.de>
parents:
4053
diff
changeset
|
5020 |
arg1, arg2, arg3, arg4, arg5, arg6)); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5021 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5022 |
%} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5023 |
! |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5024 |
|
1 | 5025 |
perform:aSelector withArguments:argArray |
5026 |
"send the message aSelector with all args taken from argArray |
|
44 | 5027 |
to the receiver." |
1 | 5028 |
|
77 | 5029 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
1 | 5030 |
|
5031 |
%{ |
|
5032 |
REGISTER OBJ *argP; |
|
5033 |
int nargs, i; |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5034 |
static struct inlineCache ilcSize = __ILC0(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5035 |
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
|
5036 |
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
|
5037 |
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
|
5038 |
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
|
5039 |
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
|
5040 |
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
|
5041 |
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
|
5042 |
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
|
5043 |
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
|
5044 |
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
|
5045 |
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
|
5046 |
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
|
5047 |
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
|
5048 |
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
|
5049 |
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
|
5050 |
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
|
5051 |
OBJ l; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5052 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5053 |
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */ |
71 | 5054 |
/* |
93 | 5055 |
* must set lineno in sender by hand here ... (because of NOCONTEXT) |
71 | 5056 |
*/ |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5057 |
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
|
5058 |
_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
|
5059 |
} |
71 | 5060 |
#endif |
1 | 5061 |
|
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5062 |
if (__isArray(argArray)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5063 |
nargs = __arraySize(argArray); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5064 |
argP = __ArrayInstPtr(argArray)->a_element; |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5065 |
} else { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5066 |
if (__isNonNilObject(argArray)) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5067 |
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
|
5068 |
if (!__isSmallInteger(numberOfArgs)) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5069 |
goto bad; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5070 |
nargs = __intVal(numberOfArgs); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5071 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5072 |
for (i=1; i <= nargs; i++) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5073 |
*argP++ = __AT_(argArray, __MKSMALLINT(i)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5074 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5075 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5076 |
} else { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5077 |
nargs = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5078 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5079 |
} |
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5080 |
switch (nargs) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5081 |
case 0: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5082 |
if ((InterruptPending != nil) || (aSelector != last0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5083 |
ilc0.ilc_func = __SEND0ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5084 |
if (ilc0.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5085 |
__flushPolyCache(ilc0.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5086 |
ilc0.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5087 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5088 |
last0 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5089 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5090 |
#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
|
5091 |
ilc0.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 5092 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5093 |
RETURN ((*ilc0.ilc_func)(self, aSelector, nil, &ilc0)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5094 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5095 |
case 1: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5096 |
if ((InterruptPending != nil) || (aSelector != last1)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5097 |
ilc1.ilc_func = __SEND1ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5098 |
if (ilc1.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5099 |
__flushPolyCache(ilc1.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5100 |
ilc1.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5101 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5102 |
last1 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5103 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5104 |
#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
|
5105 |
ilc1.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 5106 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5107 |
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
|
5108 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5109 |
case 2: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5110 |
if ((InterruptPending != nil) || (aSelector != last2)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5111 |
ilc2.ilc_func = __SEND2ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5112 |
if (ilc2.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5113 |
__flushPolyCache(ilc2.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5114 |
ilc2.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5115 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5116 |
last2 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5117 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5118 |
#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
|
5119 |
ilc2.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5120 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5121 |
RETURN ( (*ilc2.ilc_func)(self, aSelector, nil, &ilc2, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5122 |
argP[0], argP[1])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5123 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5124 |
case 3: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5125 |
if ((InterruptPending != nil) || (aSelector != last3)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5126 |
ilc3.ilc_func = __SEND3ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5127 |
if (ilc3.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5128 |
__flushPolyCache(ilc3.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5129 |
ilc3.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5130 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5131 |
last3 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5132 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5133 |
#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
|
5134 |
ilc3.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5135 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5136 |
RETURN ( (*ilc3.ilc_func)(self, aSelector, nil, &ilc3, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5137 |
argP[0], argP[1], argP[2])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5138 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5139 |
case 4: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5140 |
if ((InterruptPending != nil) || (aSelector != last4)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5141 |
ilc4.ilc_func = __SEND4ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5142 |
if (ilc4.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5143 |
__flushPolyCache(ilc4.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5144 |
ilc4.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5145 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5146 |
last4 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5147 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5148 |
#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
|
5149 |
ilc4.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5150 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5151 |
RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5152 |
argP[0], argP[1], argP[2], argP[3])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5153 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5154 |
case 5: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5155 |
if ((InterruptPending != nil) || (aSelector != last5)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5156 |
ilc5.ilc_func = __SEND5ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5157 |
if (ilc5.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5158 |
__flushPolyCache(ilc5.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5159 |
ilc5.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5160 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5161 |
last5 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5162 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5163 |
#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
|
5164 |
ilc5.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5165 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5166 |
RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5167 |
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
|
5168 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5169 |
case 6: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5170 |
if ((InterruptPending != nil) || (aSelector != last6)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5171 |
ilc6.ilc_func = __SEND6ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5172 |
if (ilc6.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5173 |
__flushPolyCache(ilc6.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5174 |
ilc6.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5175 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5176 |
last6 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5177 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5178 |
#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
|
5179 |
ilc6.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5180 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5181 |
RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5182 |
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
|
5183 |
argP[5])); |
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 7: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5186 |
if ((InterruptPending != nil) || (aSelector != last7)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5187 |
ilc7.ilc_func = __SEND7ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5188 |
if (ilc7.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5189 |
__flushPolyCache(ilc7.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5190 |
ilc7.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 |
last7 = 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 |
ilc7.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 ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, |
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 |
argP[5], argP[6])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5200 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5201 |
case 8: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5202 |
if ((InterruptPending != nil) || (aSelector != last8)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5203 |
ilc8.ilc_func = __SEND8ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5204 |
last8 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5205 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5206 |
#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
|
5207 |
ilc8.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5208 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5209 |
RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5210 |
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
|
5211 |
argP[5], argP[6], argP[7])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5212 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5213 |
case 9: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5214 |
if ((InterruptPending != nil) || (aSelector != last9)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5215 |
ilc9.ilc_func = __SEND9ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5216 |
last9 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5217 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5218 |
#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
|
5219 |
ilc9.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5220 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5221 |
RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5222 |
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
|
5223 |
argP[5], argP[6], argP[7], argP[8])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5224 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5225 |
case 10: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5226 |
if ((InterruptPending != nil) || (aSelector != last10)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5227 |
ilc10.ilc_func = __SEND10ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5228 |
last10 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5229 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5230 |
#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
|
5231 |
ilc10.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5232 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5233 |
RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5234 |
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
|
5235 |
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
|
5236 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5237 |
case 11: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5238 |
if ((InterruptPending != nil) || (aSelector != last11)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5239 |
ilc11.ilc_func = __SEND11ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5240 |
last11 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5241 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5242 |
#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
|
5243 |
ilc11.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5244 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5245 |
RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5246 |
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
|
5247 |
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
|
5248 |
argP[10])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5249 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5250 |
case 12: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5251 |
if ((InterruptPending != nil) || (aSelector != last12)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5252 |
ilc12.ilc_func = __SEND12ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5253 |
last12 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5254 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5255 |
#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
|
5256 |
ilc12.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5257 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5258 |
RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5259 |
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
|
5260 |
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
|
5261 |
argP[10], argP[11])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5262 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5263 |
case 13: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5264 |
if ((InterruptPending != nil) || (aSelector != last13)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5265 |
ilc13.ilc_func = __SEND13ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5266 |
last13 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5267 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5268 |
#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
|
5269 |
ilc13.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5270 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5271 |
RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5272 |
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
|
5273 |
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
|
5274 |
argP[10], argP[11], argP[12])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5275 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5276 |
case 14: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5277 |
if ((InterruptPending != nil) || (aSelector != last14)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5278 |
ilc14.ilc_func = __SEND14ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5279 |
last14 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5280 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5281 |
#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
|
5282 |
ilc14.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 5283 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5284 |
RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5285 |
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
|
5286 |
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
|
5287 |
argP[10], argP[11], argP[12], argP[13])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5288 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5289 |
case 15: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
5290 |
if ((InterruptPending != nil) || (aSelector != last15)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5291 |
ilc15.ilc_func = __SEND15ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5292 |
last15 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5293 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
5294 |
#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
|
5295 |
ilc15.ilc_lineNo = __pilc->ilc_lineNo; |
77 | 5296 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5297 |
RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5298 |
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
|
5299 |
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
|
5300 |
argP[10], argP[11], argP[12], argP[13], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5301 |
argP[14])); |
1 | 5302 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
5303 |
bad:; |
1626 | 5304 |
%}. |
5305 |
"/ arrive here, if bad number of arguments (too many) |
|
5306 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
5307 |
||
1 | 5308 |
^ self primitiveFailed |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5309 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5310 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5311 |
performMethod:aMethod |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5312 |
"invoke aMethod on the receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5313 |
The method should be a zero-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5314 |
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
|
5315 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5316 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5317 |
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
|
5318 |
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
|
5319 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5320 |
^ aMethod valueWithReceiver:self arguments:#() |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5321 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5322 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5323 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5324 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5325 |
mthd := SmallInteger compiledMethodAt:#negated. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5326 |
Transcript showCR:(1 performMethod:mthd) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5327 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5328 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5329 |
"BAD USE example: |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5330 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5331 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5332 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5333 |
mthd := Point compiledMethodAt:#x. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5334 |
Transcript showCR:((1->2) performMethod:mthd) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5335 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5336 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5337 |
"Modified: 31.7.1997 / 17:41:50 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5338 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5339 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5340 |
performMethod:aMethod arguments:argumentArray |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5341 |
"invoke aMethod on the receiver, passing an argumentArray. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5342 |
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
|
5343 |
expected by the method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5344 |
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
|
5345 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5346 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5347 |
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
|
5348 |
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
|
5349 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5350 |
^ aMethod valueWithReceiver:self arguments:argumentArray |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5351 |
|
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 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5354 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5355 |
mthd := SmallInteger compiledMethodAt:#+. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5356 |
Transcript showCR:(1 performMethod:mthd arguments:#(2)) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5357 |
" |
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 |
"Created: 31.7.1997 / 17:46:31 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5360 |
! |
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 |
performMethod:aMethod with:arg |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5363 |
"invoke aMethod on the receiver, passing an argument. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5364 |
The method should be a one-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5365 |
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
|
5366 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5367 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5368 |
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
|
5369 |
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
|
5370 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5371 |
^ aMethod valueWithReceiver:self arguments:(Array with:arg) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5372 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5373 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5374 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5375 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5376 |
mthd := SmallInteger compiledMethodAt:#+. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5377 |
Transcript showCR:(1 performMethod:mthd with:2) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5378 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5379 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5380 |
"Modified: 31.7.1997 / 17:42:32 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5381 |
! |
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 |
performMethod:aMethod with:arg1 with:arg2 |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5384 |
"invoke aMethod on the receiver, passing two arguments. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5385 |
The method should be a two-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5386 |
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
|
5387 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5388 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5389 |
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
|
5390 |
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
|
5391 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5392 |
^ 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
|
5393 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5394 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5395 |
|mthd arr| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5396 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5397 |
arr := Array new:1. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5398 |
mthd := Array compiledMethodAt:#basicAt:put:. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5399 |
arr performMethod:mthd with:1 with:'foo'. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5400 |
Transcript showCR:arr |
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 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5403 |
"Modified: 31.7.1997 / 17:44:54 / cg" |
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 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5406 |
performMethod:aMethod with:arg1 with:arg2 with:arg3 |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5407 |
"invoke aMethod on the receiver, passing three arguments. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5408 |
The method should be a three-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5409 |
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
|
5410 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5411 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5412 |
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
|
5413 |
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
|
5414 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5415 |
^ 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
|
5416 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5417 |
"Created: 31.7.1997 / 17:45:20 / cg" |
1 | 5418 |
! ! |
5419 |
||
5420 |
!Object methodsFor:'printing & storing'! |
|
5421 |
||
5422 |
className |
|
5423 |
"return the classname of the receivers class" |
|
5424 |
||
5425 |
^ self class name |
|
56 | 5426 |
|
293 | 5427 |
" |
5428 |
1 className |
|
5429 |
1 class className 'this may change ...' |
|
5430 |
$a className |
|
5431 |
$a class className 'this may change ...' |
|
5432 |
" |
|
1 | 5433 |
! |
5434 |
||
5435 |
classNameWithArticle |
|
71 | 5436 |
"return a string consisting of classname preceeded by an article. |
5437 |
(dont expect me to write national variants for this ... :-) |
|
5438 |
If you have special preferences, redefine it ..." |
|
1 | 5439 |
|
1391 | 5440 |
|classname cls| |
5441 |
||
5442 |
(cls := self class) == self ifTrue:[ |
|
2647 | 5443 |
^ 'a funny object' |
1391 | 5444 |
]. |
5445 |
classname := cls displayString. |
|
85 | 5446 |
^ classname article , ' ' , classname |
56 | 5447 |
|
293 | 5448 |
" |
5449 |
1 classNameWithArticle |
|
5450 |
(1->2) classNameWithArticle |
|
5451 |
XWorkstation basicNew classNameWithArticle |
|
5452 |
" |
|
1391 | 5453 |
|
5454 |
"Modified: 13.5.1996 / 12:16:14 / cg" |
|
1 | 5455 |
! |
5456 |
||
783 | 5457 |
errorPrint |
5458 |
"print the receiver on the standard error stream." |
|
5459 |
||
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5460 |
Stream streamErrorSignal catch:[ |
2647 | 5461 |
self printOn:Stderr |
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5462 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5463 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5464 |
"Modified: 7.3.1996 / 19:11:29 / cg" |
783 | 5465 |
! |
5466 |
||
1425 | 5467 |
errorPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5468 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5469 |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5470 |
"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
|
5471 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5472 |
Stream streamErrorSignal catch:[ |
2647 | 5473 |
self printOn:Stderr. |
5474 |
Stderr cr |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5475 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5476 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5477 |
"Modified: 7.3.1996 / 19:13:01 / cg" |
1425 | 5478 |
"Created: 20.5.1996 / 10:20:41 / cg" |
5479 |
! |
|
5480 |
||
5481 |
errorPrintNL |
|
5482 |
"{ Pragma: +optSpace }" |
|
5483 |
||
5484 |
"print the receiver followed by a cr on the standard error stream. |
|
5485 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
5486 |
||
5487 |
^ self errorPrintCR |
|
5488 |
||
5489 |
"Modified: 20.5.1996 / 10:24:45 / cg" |
|
5490 |
! |
|
5491 |
||
5492 |
errorPrintNewline |
|
5493 |
"{ Pragma: +optSpace }" |
|
5494 |
||
5495 |
"print the receiver followed by a cr on the standard error stream. |
|
5496 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
5497 |
||
5498 |
self errorPrintCR. |
|
5499 |
||
5500 |
"Modified: 20.5.1996 / 10:24:38 / cg" |
|
71 | 5501 |
! |
5502 |
||
356 | 5503 |
infoPrint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5504 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5505 |
|
356 | 5506 |
"print the receiver on the standard error stream. |
5507 |
This is meant for information messages which are not warnings |
|
5508 |
or fatal messages. |
|
5509 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
5510 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5511 |
InfoPrinting == true ifTrue:[ |
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5512 |
self errorPrint |
356 | 5513 |
] |
5514 |
! |
|
5515 |
||
1425 | 5516 |
infoPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5517 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5518 |
|
356 | 5519 |
"print the receiver followed by a cr on the standard error stream. |
5520 |
This is meant for information messages which are not warnings |
|
5521 |
or fatal messages. |
|
5522 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
5523 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5524 |
InfoPrinting == true ifTrue:[ |
2647 | 5525 |
self errorPrintCR |
356 | 5526 |
] |
1425 | 5527 |
|
5528 |
"Created: 20.5.1996 / 10:21:28 / cg" |
|
5529 |
! |
|
5530 |
||
5531 |
infoPrintNL |
|
5532 |
"{ Pragma: +optSpace }" |
|
5533 |
||
5534 |
"print the receiver followed by a cr on the standard error stream. |
|
5535 |
This is meant for information messages which are not warnings |
|
5536 |
or fatal messages. |
|
5537 |
These messages can be turned on/off by 'Object infoPrinting:true/false'. |
|
5538 |
||
5539 |
Please use #infoPrintCR - this method exists for backward compatibility." |
|
5540 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5541 |
^ self infoPrintCR |
1425 | 5542 |
|
5543 |
"Modified: 20.5.1996 / 10:25:07 / cg" |
|
356 | 5544 |
! |
5545 |
||
783 | 5546 |
|
1887 | 5547 |
"print the receiver on the standard output stream (which is not the Transcript)" |
783 | 5548 |
|
5549 |
self printOn:Stdout |
|
1887 | 5550 |
|
5551 |
"Modified: 4.11.1996 / 23:36:58 / cg" |
|
783 | 5552 |
! |
5553 |
||
1425 | 5554 |
printCR |
1887 | 5555 |
"print the receiver followed by a cr on the standard output stream (which is not the Transcript)" |
783 | 5556 |
|
5557 |
self printOn:Stdout. |
|
5558 |
Stdout cr |
|
1425 | 5559 |
|
5560 |
"Created: 20.5.1996 / 10:21:37 / cg" |
|
1887 | 5561 |
"Modified: 4.11.1996 / 23:37:06 / cg" |
1425 | 5562 |
! |
5563 |
||
5564 |
printNL |
|
5565 |
"print the receiver followed by a cr on the standard output stream |
|
5566 |
This exists for GNU Smalltalk compatibility - please use #printCR." |
|
5567 |
||
5568 |
^ self printCR |
|
5569 |
||
5570 |
"Modified: 20.5.1996 / 10:25:31 / cg" |
|
5571 |
! |
|
5572 |
||
5573 |
printNewline |
|
5574 |
"print the receiver followed by a cr on the standard output stream. |
|
5575 |
This exists for backward compatibility - please use #printCR." |
|
5576 |
||
5577 |
self printCR |
|
5578 |
||
5579 |
"Modified: 20.5.1996 / 10:25:46 / cg" |
|
783 | 5580 |
! |
5581 |
||
5582 |
printOn:aStream |
|
4392 | 5583 |
"append a user printed representation of the receiver to aStream. |
5584 |
The format is suitable for a human - not meant to be read back. |
|
5585 |
||
783 | 5586 |
The default here is to output the receivers class name. |
5587 |
BUT: this method is heavily redefined for objects which |
|
5588 |
can print prettier." |
|
5589 |
||
5590 |
aStream nextPutAll:self classNameWithArticle |
|
5591 |
! |
|
5592 |
||
5593 |
printOn:aStream leftPaddedTo:size |
|
5594 |
"print the receiver on aStream, padding with spaces up to size. |
|
5595 |
padding is done on the left." |
|
5596 |
||
5597 |
self printOn:aStream leftPaddedTo:size with:(Character space) |
|
5598 |
||
5599 |
" |
|
5600 |
123 printOn:Transcript leftPaddedTo:10. Transcript cr |
|
5601 |
123 printOn:Transcript leftPaddedTo:2. Transcript cr |
|
5602 |
" |
|
71 | 5603 |
! |
5604 |
||
783 | 5605 |
printOn:aStream leftPaddedTo:size with:padCharacter |
5606 |
"print the receiver on aStream, padding with padCharacters up to size. |
|
5607 |
padding is done on the left." |
|
5608 |
||
5609 |
aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter) |
|
5610 |
||
5611 |
" |
|
5612 |
123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr |
|
5613 |
123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr |
|
5614 |
" |
|
5615 |
! |
|
5616 |
||
5617 |
printOn:aStream paddedTo:size |
|
5618 |
"print the receiver on aStream, padding with spaces up to size." |
|
5619 |
||
5620 |
self printOn:aStream paddedTo:size with:(Character space) |
|
5621 |
||
5622 |
" |
|
5623 |
123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr |
|
5624 |
" |
|
71 | 5625 |
! |
5626 |
||
783 | 5627 |
printOn:aStream paddedTo:size with:padCharacter |
5628 |
"print the receiver on aStream, padding with padCharacter up to size" |
|
5629 |
||
5630 |
aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter). |
|
5631 |
||
5632 |
" |
|
5633 |
123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr |
|
5634 |
123 printOn:Transcript paddedTo:10 with:$. . Transcript cr |
|
5635 |
" |
|
5636 |
! |
|
5637 |
||
5638 |
printOn:aStream zeroPaddedTo:size |
|
5639 |
"print the receiver on aStream, padding with zeros up to size. |
|
5640 |
Usually used with float numbers." |
|
5641 |
||
5642 |
self printOn:aStream paddedTo:size with:$0. |
|
5643 |
||
5644 |
" |
|
5645 |
123.0 printOn:Transcript zeroPaddedTo:10 |
|
5646 |
" |
|
5647 |
! |
|
5648 |
||
5649 |
printRightAdjustLen:size |
|
5650 |
"obsolete - just a name confusion. |
|
5651 |
This method will go away ..." |
|
5652 |
||
5653 |
(self printStringLeftPaddedTo:size) printOn:Stdout |
|
71 | 5654 |
! |
5655 |
||
5656 |
printString |
|
5657 |
"return a string for printing the receiver. |
|
5658 |
Since we now use printOn: as the basic print mechanism, |
|
5659 |
we have to create a stream and print into it." |
|
5660 |
||
5661 |
|s| |
|
5662 |
||
5663 |
s := WriteStream on:(String new:30). |
|
5664 |
self printOn:s. |
|
5665 |
^ s contents |
|
5666 |
! |
|
5667 |
||
783 | 5668 |
printStringLeftPaddedTo:size |
5669 |
"return my printString as a right-adjusted string of length size; |
|
5670 |
characters on the left are filled with spaces. |
|
5671 |
If the printString is longer than size, |
|
5672 |
it is returned unchanged (i.e. not truncated)" |
|
5673 |
||
5674 |
^ self printStringLeftPaddedTo:size with:(Character space) |
|
5675 |
||
5676 |
" |
|
5677 |
10 printStringLeftPaddedTo:10 |
|
5678 |
1 printStringLeftPaddedTo:10 |
|
5679 |
" |
|
5680 |
! |
|
5681 |
||
5682 |
printStringLeftPaddedTo:size ifLarger:alternative |
|
5683 |
"return my printString as a right-adjusted string of length size; |
|
5684 |
characters on the left are filled with spaces. |
|
5685 |
If the printString is larger than size, |
|
5686 |
return the result from evaluating alternative." |
|
5687 |
||
5688 |
^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative |
|
5689 |
||
5690 |
" |
|
5691 |
12 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5692 |
123 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5693 |
1234 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5694 |
" |
|
5695 |
! |
|
5696 |
||
5697 |
printStringLeftPaddedTo:size with:padCharacter |
|
5698 |
"return my printString as a right-adjusted string of length size; |
|
5699 |
characters on the left are filled with padCharacter. |
|
5700 |
If the printString is longer than size, |
|
5701 |
it is returned unchanged (i.e. not truncated)" |
|
5702 |
||
5703 |
^ (self printString) leftPaddedTo:size with:padCharacter |
|
5704 |
||
5705 |
" |
|
5706 |
123 printStringLeftPaddedTo:10 with:$. |
|
5707 |
1 printStringLeftPaddedTo:10 with:$. |
|
5708 |
(Float pi) printStringLeftPaddedTo:20 with:$* |
|
5709 |
" |
|
5710 |
! |
|
5711 |
||
5712 |
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative |
|
5713 |
"return my printString as a right-adjusted string of length size; |
|
5714 |
characters on the left are filled with padCharacter. |
|
5715 |
If the printString is larger than size, |
|
369 | 5716 |
return the result from evaluating alternative." |
5717 |
||
5718 |
|s| |
|
5719 |
||
5720 |
s := self printString. |
|
5721 |
s size > size ifTrue:[^ alternative value]. |
|
783 | 5722 |
^ s leftPaddedTo:size with:padCharacter |
369 | 5723 |
|
5724 |
" |
|
783 | 5725 |
12 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
5726 |
123 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
5727 |
1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
293 | 5728 |
" |
13 | 5729 |
! |
5730 |
||
5731 |
printStringPaddedTo:size |
|
56 | 5732 |
"return a printed representation of the receiver, |
369 | 5733 |
padded with spaces (at the right) up to size. |
293 | 5734 |
If the printString is longer than size, |
5735 |
it is returned unchanged (i.e. not truncated)" |
|
13 | 5736 |
|
5737 |
^ self printStringPaddedTo:size with:(Character space) |
|
5738 |
||
293 | 5739 |
" |
5740 |
123 printStringPaddedTo:10 |
|
5741 |
1234567890123456 printStringPaddedTo:10 |
|
5742 |
'hello' printStringPaddedTo:10 |
|
5743 |
" |
|
2 | 5744 |
! |
5745 |
||
369 | 5746 |
printStringPaddedTo:size ifLarger:alternative |
5747 |
"return a printed representation of the receiver, |
|
5748 |
padded with spaces (at the right) up to size. |
|
5749 |
If the resulting printString is too large, |
|
5750 |
return the result from evaluating alternative." |
|
5751 |
||
5752 |
^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative |
|
5753 |
||
5754 |
" |
|
5755 |
12 printStringPaddedTo:3 ifLarger:['***'] |
|
5756 |
123 printStringPaddedTo:3 ifLarger:['***'] |
|
5757 |
1234 printStringPaddedTo:3 ifLarger:['***'] |
|
5758 |
" |
|
5759 |
! |
|
5760 |
||
783 | 5761 |
printStringPaddedTo:size with:padCharacter |
5762 |
"return a printed representation of the receiver, |
|
5763 |
padded with padCharacter (at the right) up to size. |
|
5764 |
If the printString is longer than size, |
|
5765 |
it is returned unchanged (i.e. not truncated)" |
|
5766 |
||
5767 |
^ (self printString) paddedTo:size with:padCharacter |
|
5768 |
||
5769 |
" |
|
5770 |
123 printStringPaddedTo:10 with:$. |
|
5771 |
123 printStringPaddedTo:10 with:$* |
|
5772 |
123 printStringPaddedTo:3 with:$* |
|
5773 |
1234 printStringPaddedTo:3 with:$* |
|
5774 |
" |
|
5775 |
! |
|
5776 |
||
5777 |
printStringPaddedTo:size with:padCharacter ifLarger:alternative |
|
5778 |
"return a printed representation of the receiver, |
|
5779 |
padded with padCharacter (at the right) up to size. |
|
5780 |
If the resulting printString is too large, |
|
5781 |
return the result from evaluating alternative." |
|
5782 |
||
5783 |
|s| |
|
5784 |
||
5785 |
s := self printString. |
|
5786 |
s size > size ifTrue:[^ alternative value]. |
|
5787 |
^ s paddedTo:size with:padCharacter |
|
5788 |
||
5789 |
" |
|
5790 |
123 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
5791 |
12345 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
5792 |
" |
|
5793 |
! |
|
5794 |
||
5795 |
printStringRightAdjustLen:size |
|
5796 |
"obsolete - just a name confusion. |
|
5797 |
This method will go away ..." |
|
5798 |
||
5799 |
^ self printStringLeftPaddedTo:size |
|
5800 |
! |
|
5801 |
||
2 | 5802 |
printStringZeroPaddedTo:size |
71 | 5803 |
"return a printed representation of the receiver, |
369 | 5804 |
padded with zero (at the right) characters up to size. |
13 | 5805 |
Usually used with float numbers." |
2 | 5806 |
|
5807 |
^ self printStringPaddedTo:size with:$0 |
|
13 | 5808 |
|
293 | 5809 |
" |
5810 |
123.0 printStringZeroPaddedTo:10 |
|
5811 |
" |
|
2 | 5812 |
! |
5813 |
||
783 | 5814 |
store |
5815 |
"store the receiver on standard output. |
|
5816 |
this method is useless, but included for compatibility." |
|
5817 |
||
5818 |
self storeOn:Stdout |
|
71 | 5819 |
! |
5820 |
||
1425 | 5821 |
storeCR |
5822 |
"store the receiver on standard output; append a carriage return." |
|
5823 |
||
5824 |
self store. |
|
5825 |
Character cr print |
|
5826 |
||
5827 |
"Created: 20.5.1996 / 10:26:01 / cg" |
|
5828 |
"Modified: 20.5.1996 / 10:26:57 / cg" |
|
5829 |
! |
|
5830 |
||
783 | 5831 |
storeNl |
5832 |
"store the receiver on standard output; append a newline. |
|
1425 | 5833 |
This method is included for backward compatibility- use #storeCR." |
5834 |
||
5835 |
self storeCR. |
|
5836 |
||
5837 |
"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
|
5838 |
! |
7e058858cc3b
New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents:
446
diff
changeset
|
5839 |
|
56 | 5840 |
storeOn:aStream |
5841 |
"store the receiver on aStream; i.e. print an expression which will |
|
293 | 5842 |
reconstruct the receiver. |
5843 |
Notice, that no self referencing or cyclic objects can be represented |
|
5844 |
in this format. |
|
5845 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 5846 |
|
5847 |
|myClass hasSemi sz "{ Class: SmallInteger }" | |
|
1 | 5848 |
|
25 | 5849 |
thisContext isRecursive ifTrue:[ |
2647 | 5850 |
('Object [error]: storeString of self referencing object.') errorPrintCR. |
5851 |
aStream nextPutAll:'#("recursive")'. |
|
5852 |
^ self |
|
25 | 5853 |
]. |
56 | 5854 |
|
1 | 5855 |
myClass := self class. |
56 | 5856 |
aStream nextPut:$(. |
5857 |
aStream nextPutAll:self class name. |
|
5858 |
||
1 | 5859 |
hasSemi := false. |
5860 |
myClass isVariable ifTrue:[ |
|
2647 | 5861 |
aStream nextPutAll:' basicNew:'. |
5862 |
self basicSize printOn:aStream |
|
1 | 5863 |
] ifFalse:[ |
2647 | 5864 |
aStream nextPutAll:' basicNew' |
1 | 5865 |
]. |
56 | 5866 |
|
1 | 5867 |
sz := myClass instSize. |
5868 |
1 to:sz do:[:i | |
|
2647 | 5869 |
aStream nextPutAll:' instVarAt:'. |
5870 |
i printOn:aStream. |
|
5871 |
aStream nextPutAll:' put:'. |
|
5872 |
(self instVarAt:i) storeOn:aStream. |
|
5873 |
aStream nextPut:$;. |
|
5874 |
hasSemi := true |
|
1 | 5875 |
]. |
5876 |
myClass isVariable ifTrue:[ |
|
2647 | 5877 |
sz := self basicSize. |
5878 |
1 to:sz do:[:i | |
|
5879 |
aStream nextPutAll:' basicAt:'. |
|
5880 |
i printOn:aStream. |
|
5881 |
aStream nextPutAll:' put:'. |
|
5882 |
(self basicAt:i) storeOn:aStream. |
|
5883 |
aStream nextPut:$;. |
|
5884 |
hasSemi := true |
|
5885 |
] |
|
1 | 5886 |
]. |
5887 |
hasSemi ifTrue:[ |
|
2647 | 5888 |
aStream nextPutAll:' yourself' |
1 | 5889 |
]. |
56 | 5890 |
aStream nextPut:$). |
293 | 5891 |
|
5892 |
" |
|
5893 |
|s| |
|
5894 |
||
5895 |
s := WriteStream on:(String new). |
|
5896 |
('hello' -> 'world') storeOn:s. |
|
5897 |
s := ReadStream on:(s contents). |
|
5898 |
(Object readFrom:s) inspect |
|
5899 |
" |
|
5900 |
" |
|
5901 |
|s| |
|
5902 |
||
5903 |
s := 'data' asFilename writeStream. |
|
5904 |
('hello' -> 'world') storeOn:s. |
|
5905 |
s close. |
|
5906 |
||
5907 |
s := 'data' asFilename readStream. |
|
5908 |
(Object readFrom:s) inspect |
|
5909 |
" |
|
5910 |
||
5911 |
"does not work example:" |
|
5912 |
" |
|
5913 |
|s a| |
|
5914 |
||
5915 |
a := Array new:2. |
|
5916 |
a at:1 put:a. |
|
5917 |
||
5918 |
s := 'data' asFilename writeStream. |
|
5919 |
a storeOn:s. |
|
5920 |
s close. |
|
5921 |
||
5922 |
s := 'data' asFilename readStream. |
|
5923 |
(Object readFrom:s) inspect |
|
5924 |
" |
|
1417 | 5925 |
|
2287 | 5926 |
"Modified: 28.1.1997 / 00:36:12 / cg" |
1 | 5927 |
! |
5928 |
||
56 | 5929 |
storeString |
293 | 5930 |
"return a string representing an expression to reconstruct the receiver. |
5931 |
Notice, that no self referencing or cyclic objects can be represented |
|
5932 |
in this format. |
|
5933 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 5934 |
|
5935 |
|s| |
|
5936 |
||
5937 |
s := WriteStream on:(String new:50). |
|
5938 |
self storeOn:s. |
|
5939 |
^ s contents |
|
783 | 5940 |
! ! |
5941 |
||
5942 |
!Object methodsFor:'queries'! |
|
5943 |
||
5944 |
basicSize |
|
5945 |
"return the number of the receivers indexed instance variables, |
|
5946 |
0 if it has none. |
|
5947 |
||
2148 | 5948 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
783 | 5949 |
|
5950 |
%{ /* NOCONTEXT */ |
|
5951 |
||
5952 |
REGISTER int nbytes; |
|
5953 |
REGISTER OBJ myClass; |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5954 |
int nInstBytes; |
783 | 5955 |
|
5956 |
/* |
|
5957 |
* notice the missing test for self being a nonNilObject - |
|
5958 |
* this can be done since basicSize is defined both in UndefinedObject |
|
5959 |
* and SmallInteger |
|
5960 |
*/ |
|
5961 |
myClass = __qClass(self); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5962 |
nbytes = __qSize(self); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5963 |
nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) ); |
1133 | 5964 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5965 |
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
|
5966 |
case __MASKSMALLINT(POINTERARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5967 |
case __MASKSMALLINT(WKPOINTERARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5968 |
nbytes -= nInstBytes; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5969 |
RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) ); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5970 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5971 |
case __MASKSMALLINT(BYTEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5972 |
nbytes -= nInstBytes; |
2647 | 5973 |
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
|
5974 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5975 |
case __MASKSMALLINT(FLOATARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5976 |
nbytes -= nInstBytes; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5977 |
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
|
5978 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5979 |
case __MASKSMALLINT(DOUBLEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5980 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5981 |
nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1); |
783 | 5982 |
#endif |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5983 |
nbytes -= nInstBytes; |
2647 | 5984 |
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
|
5985 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5986 |
case __MASKSMALLINT(WORDARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5987 |
case __MASKSMALLINT(SWORDARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5988 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5989 |
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
|
5990 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5991 |
case __MASKSMALLINT(LONGARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5992 |
case __MASKSMALLINT(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5993 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5994 |
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
|
5995 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5996 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5997 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5998 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5999 |
nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6000 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6001 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6002 |
RETURN ( __MKSMALLINT(nbytes>>3) ); /* notice the hardcoded 8 here - not sizeof(long long) */ |
783 | 6003 |
} |
6004 |
%}. |
|
6005 |
^ 0 |
|
1 | 6006 |
! |
6007 |
||
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6008 |
byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6009 |
"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
|
6010 |
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
|
6011 |
instvars i.e. byteArrays, wordArrays etc. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6012 |
Notice: for Strings the returned size may look strange. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6013 |
Only useful with binary storage." |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6014 |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6015 |
|myClass| |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6016 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6017 |
myClass := self class. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6018 |
myClass isVariable ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6019 |
myClass isPointers ifFalse:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6020 |
myClass isBytes ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6021 |
^ self basicSize. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6022 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6023 |
myClass isWords ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6024 |
^ self basicSize * 2. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6025 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6026 |
myClass isSignedWords ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6027 |
^ self basicSize * 2. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6028 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6029 |
myClass isLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6030 |
^ self basicSize * 4. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6031 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6032 |
myClass isSignedLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6033 |
^ self basicSize * 4. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6034 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6035 |
myClass isLongLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6036 |
^ self basicSize * 8. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6037 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6038 |
myClass isSignedLongLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6039 |
^ self basicSize * 8. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6040 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6041 |
myClass isFloats ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6042 |
^ self basicSize * %{ __MKSMALLINT(sizeof(float)) %}. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6043 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6044 |
myClass isDoubles ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6045 |
^ self basicSize * %{ __MKSMALLINT(sizeof(double)) %}. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6046 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6047 |
self halt:'oops'. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6048 |
] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6049 |
]. |
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6050 |
^ 0 |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6051 |
|
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6052 |
" |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6053 |
Point new byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6054 |
'hello' byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6055 |
(ByteArray with:1 with:2) byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6056 |
(FloatArray with:1.5) byteSize |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6057 |
(DoubleArray with:1.5) byteSize |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6058 |
(WordArray with:1 with:2) byteSize |
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6059 |
" |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6060 |
! |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
6061 |
|
783 | 6062 |
class |
6063 |
"return the receivers class" |
|
6064 |
||
6065 |
%{ /* NOCONTEXT */ |
|
6066 |
||
6067 |
RETURN ( __Class(self) ); |
|
6068 |
%} |
|
6069 |
! |
|
6070 |
||
6071 |
respondsTo:aSelector |
|
6072 |
"return true, if the receiver implements a method with selector equal |
|
6073 |
to aSelector; i.e. if there is a method for aSelector in either the |
|
6074 |
receivers class or one of its superclasses. |
|
6075 |
||
6076 |
Notice, that this does not imply, that such a message can be sent without |
|
6077 |
an error being raised. For example, an implementation could send |
|
6078 |
#shouldNotImplement or #subclassResponsibility." |
|
6079 |
||
6080 |
" |
|
6081 |
should we go via the cache, or search (by class) ? |
|
6082 |
The first is faster, most of the time; while the 2nd fills |
|
6083 |
the cache with useless data if this is sent in a loop over all objects. |
|
6084 |
For now, use the cache ... |
|
6085 |
" |
|
6086 |
%{ /* NOCONTEXT */ |
|
6087 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
6088 |
if (__lookup(__Class(self), aSelector) == nil) { |
783 | 6089 |
RETURN ( false ); |
6090 |
} |
|
6091 |
RETURN ( true ); |
|
6092 |
%} |
|
6093 |
. |
|
6094 |
" |
|
6095 |
^ self class canUnderstand:aSelector |
|
6096 |
" |
|
6097 |
||
6098 |
"'aString' respondsTo:#+" |
|
6099 |
"'aString' respondsTo:#," |
|
6100 |
"'aString' respondsTo:#collect:" |
|
6101 |
! |
|
6102 |
||
6103 |
respondsToArithmetic |
|
6104 |
"return true, if the receiver responds to arithmetic messages. |
|
6105 |
false is returned here - the method is redefined in ArithmeticValue." |
|
6106 |
||
6107 |
^ false |
|
6108 |
! |
|
6109 |
||
6110 |
size |
|
6111 |
"return the number of the receivers indexed instance variables; |
|
6112 |
this method may be redefined in subclasses" |
|
6113 |
||
6114 |
^ self basicSize |
|
6115 |
! |
|
6116 |
||
6117 |
species |
|
6118 |
"return a class which is similar to (or the same as) the receivers class. |
|
6119 |
This is used to create an appropriate object when creating derived |
|
6120 |
copies in the collection classes (sometimes redefined)." |
|
6121 |
||
6122 |
^ self class |
|
6123 |
! |
|
6124 |
||
6125 |
yourself |
|
6126 |
"return the receiver - used for cascades to return self at the end" |
|
6127 |
||
6128 |
^ self |
|
6129 |
! ! |
|
6130 |
||
6131 |
!Object methodsFor:'secure message sending'! |
|
6132 |
||
6133 |
askFor:aSelector |
|
6134 |
"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
|
6135 |
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
|
6136 |
Otherwise the real value returned. |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6137 |
Useful to send messages such as: #isColor to unknown |
783 | 6138 |
receivers." |
6139 |
||
6140 |
^ self perform:aSelector ifNotUnderstood:[false] |
|
6141 |
||
6142 |
" |
|
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6143 |
1 askFor:#isColor |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6144 |
Color red askFor:#isColor |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6145 |
|
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6146 |
1 askFor:#isFoo |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6147 |
Color red askFor:#isFoo |
783 | 6148 |
" |
6149 |
! |
|
6150 |
||
6151 |
perform:aSelector ifNotUnderstood:exceptionBlock |
|
6152 |
"try to send message aSelector to the receiver. |
|
6153 |
If its understood, return the methods returned value, |
|
6154 |
otherwise return the value of the exceptionBlock" |
|
6155 |
||
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6156 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6157 |
|
783 | 6158 |
MessageNotUnderstoodSignal handle:[:ex | |
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6159 |
"/ 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
|
6160 |
"/ we have sent originally |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6161 |
ex parameter selector == aSelector ifFalse:[ |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6162 |
ex reject |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6163 |
] |
783 | 6164 |
] do:[ |
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6165 |
val := self perform:aSelector. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6166 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6167 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6168 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6169 |
^ exceptionBlock value |
783 | 6170 |
]. |
6171 |
^ val |
|
6172 |
||
6173 |
" |
|
6174 |
1.2345 perform:#foo ifNotUnderstood:['sorry'] |
|
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6175 |
1.2345 perform:#sqrt ifNotUnderstood:['sorry'] |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6176 |
12345 perform:#sqrt ifNotUnderstood:['sorry'] |
783 | 6177 |
" |
1 | 6178 |
! |
6179 |
||
783 | 6180 |
perform:aSelector with:argument ifNotUnderstood:exceptionBlock |
6181 |
"try to send message aSelector to the receiver. |
|
6182 |
If its understood, return the methods returned value, |
|
6183 |
otherwise return the value of the exceptionBlock" |
|
6184 |
||
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6185 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6186 |
|
783 | 6187 |
MessageNotUnderstoodSignal handle:[:ex | |
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6188 |
"/ 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
|
6189 |
"/ we have sent originally |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6190 |
ex parameter selector == aSelector ifFalse:[ |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6191 |
ex reject |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6192 |
] |
783 | 6193 |
] do:[ |
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6194 |
val := self perform:aSelector with:argument. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6195 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6196 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6197 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6198 |
^ exceptionBlock value |
783 | 6199 |
]. |
6200 |
^ val |
|
6201 |
||
6202 |
" |
|
6203 |
|unknown| |
|
6204 |
||
6205 |
unknown := 1. |
|
6206 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
6207 |
unknown := 'high there'. |
|
6208 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
6209 |
" |
|
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6210 |
! |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6211 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6212 |
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6213 |
"try to send message aSelector to the receiver. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6214 |
If its understood, return the methods returned value, |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6215 |
otherwise return the value of the exceptionBlock" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6216 |
|
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6217 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6218 |
|
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6219 |
MessageNotUnderstoodSignal handle:[:ex | |
4322
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6220 |
"/ 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
|
6221 |
"/ we have sent originally |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6222 |
ex parameter selector == aSelector ifFalse:[ |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6223 |
ex reject |
ae629533c1ef
in #perform:ifNotUnderstood: - reject if the bad selector
Claus Gittinger <cg@exept.de>
parents:
4287
diff
changeset
|
6224 |
] |
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6225 |
] do:[ |
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6226 |
val := self perform:aSelector withArguments:argumentArray. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6227 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6228 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6229 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
6230 |
^ exceptionBlock value |
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6231 |
]. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6232 |
^ val |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6233 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6234 |
" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6235 |
|unknown| |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6236 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6237 |
unknown := 1. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6238 |
(unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6239 |
unknown := 'high there'. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
6240 |
(unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline. |
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 |
"Modified: 27.3.1997 / 14:13:16 / cg" |
783 | 6244 |
! ! |
6245 |
||
2448 | 6246 |
!Object methodsFor:'signal constants'! |
6247 |
||
6248 |
messageNotUnderstoodSignal |
|
6249 |
^ MessageNotUnderstoodSignal |
|
6250 |
||
6251 |
"Created: 6.3.1997 / 15:46:52 / cg" |
|
6252 |
! ! |
|
6253 |
||
783 | 6254 |
!Object methodsFor:'special queries'! |
6255 |
||
6256 |
allOwners |
|
6257 |
"return a collection of all objects referencing the receiver" |
|
6258 |
||
6259 |
^ ObjectMemory whoReferences:self |
|
6260 |
! |
|
6261 |
||
6262 |
references:anObject |
|
6263 |
"return true, if the receiver refers to the argument, anObject. |
|
6264 |
- for debugging only" |
|
6265 |
||
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6266 |
%{ /* NOCONTEXT */ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6267 |
OBJ cls, flags; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6268 |
int nInsts, i; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6269 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6270 |
if (! __isNonNilObject(self)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6271 |
RETURN (false); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6272 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6273 |
|
783 | 6274 |
/* |
6275 |
* a little optimization: use the fact that all old objects |
|
6276 |
* refering to a new object are on the remSet; if I am not, |
|
6277 |
* a trivial reject is possible, if anObject is a newbee |
|
6278 |
*/ |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6279 |
if (__isNonNilObject(anObject)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6280 |
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
|
6281 |
int spc; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6282 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6283 |
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
|
6284 |
RETURN (false); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6285 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6286 |
} |
783 | 6287 |
} |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6288 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6289 |
cls = __qClass(self); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6290 |
if (cls == anObject) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6291 |
RETURN (true); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6292 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6293 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6294 |
flags = __ClassInstPtr(cls)->c_flags; |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
6295 |
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
|
6296 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6297 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6298 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6299 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6300 |
if (! nInsts) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6301 |
RETURN (false); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6302 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6303 |
#if defined(memsrch4) |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6304 |
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
|
6305 |
RETURN (true); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6306 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6307 |
#else |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6308 |
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
|
6309 |
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
|
6310 |
RETURN (true); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
6311 |
} |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6312 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6313 |
#endif /* memsrch4 */ |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6314 |
|
783 | 6315 |
%}. |
6316 |
||
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6317 |
"/ |myClass |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6318 |
"/ numInst "{ Class: SmallInteger }" | |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6319 |
"/ |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6320 |
"/ myClass := self class. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6321 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6322 |
"/ "check the class" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6323 |
"/ (myClass == anObject) ifTrue:[^ true]. |
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 |
"/ "check the instance variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6326 |
"/ numInst := myClass instSize. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6327 |
"/ 1 to:numInst do:[:i | |
2647 | 6328 |
"/ ((self instVarAt:i) == anObject) ifTrue:[^ true] |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6329 |
"/ ]. |
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 |
"/ "check the indexed variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6332 |
"/ myClass isVariable ifTrue:[ |
2647 | 6333 |
"/ myClass isPointers ifFalse:[ |
6334 |
"/ "/ |
|
6335 |
"/ "/ we could argue about the following unconditional return: |
|
6336 |
"/ "/ it says that a non pointer array never has a reference to the |
|
6337 |
"/ "/ corresponding object - not mimicing a reference to a copy of the |
|
6338 |
"/ "/ integer. However, it avoids useless searches in huge byteArray |
|
6339 |
"/ "/ like objects when searching for owners. If in doubt, remove it. |
|
6340 |
"/ "/ A consequence of the return below is that #[1 2 3] will say that it |
|
6341 |
"/ "/ 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
|
6342 |
"/ |
2647 | 6343 |
"/ ^ false. |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6344 |
"/ |
2647 | 6345 |
"/ "/ alternative: |
6346 |
"/ "/ anObject isNumber ifFalse:[^ false]. |
|
6347 |
"/ ]. |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6348 |
"/ |
2647 | 6349 |
"/ "/ |
6350 |
"/ "/ because arrays are so common, and those have a highly tuned |
|
6351 |
"/ "/ idenitytIndex method, use it |
|
6352 |
"/ "/ |
|
6353 |
"/ myClass == Array ifTrue:[ |
|
6354 |
"/ ^ (self identityIndexOf:anObject) ~~ 0 |
|
6355 |
"/ ]. |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6356 |
"/ |
2647 | 6357 |
"/ "/ |
6358 |
"/ "/ otherwise, do it the slow way |
|
6359 |
"/ "/ |
|
6360 |
"/ numInst := self basicSize. |
|
6361 |
"/ 1 to:numInst do:[:i | |
|
6362 |
"/ ((self basicAt:i) == anObject) ifTrue:[^ true] |
|
6363 |
"/ ] |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6364 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6365 |
|
783 | 6366 |
^ false |
6367 |
||
6368 |
" |
|
6369 |
|v| |
|
6370 |
||
6371 |
v := View new initialize. |
|
6372 |
v references:Display. |
|
6373 |
" |
|
6374 |
! |
|
6375 |
||
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6376 |
referencesAny:aCollection |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6377 |
"return true, if the receiver refers to any object from |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6378 |
the argument, aCollection. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6379 |
- for debugging only" |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6380 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6381 |
%{ |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6382 |
OBJ cls, flags; |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6383 |
int nInsts, inst; |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6384 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6385 |
if (! __isNonNilObject(self)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6386 |
RETURN (false); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6387 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6388 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6389 |
if (__isArray(aCollection)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6390 |
int nObjs = __arraySize(aCollection); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6391 |
char *minAddr = 0, *maxAddr = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6392 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6393 |
if (nObjs == 0) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6394 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6395 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6396 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6397 |
/* |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6398 |
* a little optimization: use the fact that all old objects |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6399 |
* 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
|
6400 |
* a trivial reject is possible, if all objects are newbees. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6401 |
* as a side effect, gather min/max addresses |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6402 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6403 |
if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6404 |
int allNewBees = 1; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6405 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6406 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6407 |
minAddr = (char *)(__ArrayInstPtr(aCollection)->a_element[0]); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6408 |
maxAddr = minAddr; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6409 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6410 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6411 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6412 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6413 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6414 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6415 |
if (__isNonNilObject(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6416 |
int spc; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6417 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6418 |
if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6419 |
allNewBees = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6420 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6421 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6422 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6423 |
if ((char *)anObject < minAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6424 |
minAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6425 |
} else if ((char *)anObject > maxAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6426 |
maxAddr = (char *)anObject; |
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 |
if (allNewBees) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6430 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6431 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6432 |
} |
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 |
/* |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6435 |
* fetch min/max in searchList (if not already done) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6436 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6437 |
if (minAddr == 0) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6438 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6439 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6440 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6441 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6442 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6443 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6444 |
if ((char *)anObject < minAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6445 |
minAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6446 |
} else if ((char *)anObject > maxAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6447 |
maxAddr = (char *)anObject; |
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 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6450 |
} |
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 |
cls = __qClass(self); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6453 |
if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) { |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6454 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6455 |
if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)cls, nObjs)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6456 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6457 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6458 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6459 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6460 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6461 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6462 |
OBJ anObject; |
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 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6465 |
if (cls == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6466 |
RETURN (true); |
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 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6469 |
#endif /* memsrch4 */ |
3921
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 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6472 |
flags = __ClassInstPtr(cls)->c_flags; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6473 |
if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6474 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6475 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6476 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6477 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6478 |
if (! nInsts) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6479 |
RETURN (false); |
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 |
if (nObjs == 1) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6483 |
/* better reverse the loop */ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6484 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6485 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6486 |
anObject = __ArrayInstPtr(aCollection)->a_element[0]; |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6487 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6488 |
if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6489 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6490 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6491 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6492 |
for (inst=0; inst<nInsts; inst++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6493 |
if ((__InstPtr(self)->i_instvars[inst]) == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6494 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6495 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6496 |
} |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6497 |
#endif |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6498 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6499 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6500 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6501 |
for (inst=0; inst<nInsts; inst++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6502 |
OBJ instVar = __InstPtr(self)->i_instvars[inst]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6503 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6504 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6505 |
if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) { |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6506 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6507 |
if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)instVar, nObjs)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6508 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6509 |
} |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6510 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6511 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6512 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6513 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6514 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6515 |
if (instVar == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6516 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6517 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6518 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6519 |
#endif /* memsrch4 */ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6520 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6521 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6522 |
RETURN (false); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6523 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6524 |
%}. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6525 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6526 |
aCollection do:[:el | |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6527 |
(self references:el) ifTrue:[^ true]. |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6528 |
]. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6529 |
^ false |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6530 |
! |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6531 |
|
783 | 6532 |
referencesDerivedInstanceOf:aClass |
6533 |
"return true, if the receiver refers to an instance of |
|
6534 |
the argument, aClass or its subclass. This method exists |
|
6535 |
to support searching for users of a class." |
|
6536 |
||
6537 |
|myClass |
|
6538 |
numInst "{ Class: SmallInteger }" | |
|
6539 |
||
6540 |
myClass := self class. |
|
6541 |
||
6542 |
"check the class" |
|
6543 |
(myClass isKindOf:aClass) ifTrue:[^ true]. |
|
6544 |
||
6545 |
"check the instance variables" |
|
6546 |
numInst := myClass instSize. |
|
6547 |
1 to:numInst do:[:i | |
|
6548 |
((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
6549 |
]. |
|
6550 |
||
6551 |
"check the indexed variables" |
|
6552 |
myClass isVariable ifTrue:[ |
|
6553 |
myClass isPointers ifFalse:[ |
|
6554 |
"no need to search in non pointer fields" |
|
6555 |
((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false]. |
|
6556 |
]. |
|
6557 |
numInst := self basicSize. |
|
6558 |
1 to:numInst do:[:i | |
|
6559 |
((self basicAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
6560 |
] |
|
6561 |
]. |
|
6562 |
^ false |
|
6563 |
||
6564 |
" |
|
6565 |
(1 @ 3.4) referencesDerivedInstanceOf:Number |
|
6566 |
(1 @ 3.4) referencesDerivedInstanceOf:Array |
|
6567 |
View new initialize referencesDerivedInstanceOf:DeviceWorkstation |
|
6568 |
" |
|
6569 |
! |
|
6570 |
||
6571 |
referencesInstanceOf:aClass |
|
6572 |
"return true, if the receiver refers to an instance of |
|
6573 |
the argument, aClass.This method exists |
|
6574 |
to support searching for users of a class." |
|
6575 |
||
6576 |
|myClass |
|
6577 |
numInst "{ Class: SmallInteger }" | |
|
6578 |
||
6579 |
myClass := self class. |
|
6580 |
||
6581 |
"check the class" |
|
6582 |
(myClass isMemberOf:aClass) ifTrue:[^ true]. |
|
6583 |
||
6584 |
"check the instance variables" |
|
6585 |
numInst := myClass instSize. |
|
6586 |
1 to:numInst do:[:i | |
|
6587 |
((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
6588 |
]. |
|
6589 |
||
6590 |
"check the indexed variables" |
|
6591 |
myClass isVariable ifTrue:[ |
|
6592 |
myClass isPointers ifFalse:[ |
|
6593 |
"no need to search in non-pointer indexed fields" |
|
6594 |
myClass isLongs ifTrue:[ |
|
6595 |
(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false]. |
|
6596 |
] ifFalse:[ |
|
6597 |
myClass isFloatsOrDoubles ifTrue:[^ aClass == Float]. |
|
6598 |
^ aClass == SmallInteger |
|
6599 |
] |
|
6600 |
]. |
|
6601 |
numInst := self basicSize. |
|
6602 |
1 to:numInst do:[:i | |
|
6603 |
((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
6604 |
] |
|
6605 |
]. |
|
6606 |
^ false |
|
6607 |
||
6608 |
" |
|
6609 |
(1 @ 3.4) referencesInstanceOf:Float |
|
6610 |
(1 @ 3.4) referencesInstanceOf:Fraction |
|
6611 |
View new initialize referencesInstanceOf:(Display class) |
|
6612 |
" |
|
1 | 6613 |
! ! |
783 | 6614 |
|
2295 | 6615 |
!Object methodsFor:'synchronized evaluation'! |
6616 |
||
6617 |
freeSynchronizationSemaphore |
|
6618 |
"free synchronizationSemaphore. May be used, to save memory when |
|
6619 |
an object is no longer used synchronized." |
|
6620 |
||
2342 | 6621 |
|sema| |
2295 | 6622 |
|
6623 |
sema := self synchronizationSemaphore. |
|
6624 |
sema notNil ifTrue:[ |
|
2647 | 6625 |
sema wait. "/ get lock |
6626 |
self synchronizationSemaphore:nil. |
|
2295 | 6627 |
]. |
6628 |
||
6629 |
" |
|
6630 |
self synchronized:[]. |
|
6631 |
self synchronizationSemaphore. |
|
6632 |
self freeSynchronizationSemaphore. |
|
6633 |
" |
|
6634 |
||
6635 |
"Created: 28.1.1997 / 19:31:20 / stefan" |
|
6636 |
"Modified: 28.1.1997 / 19:47:55 / stefan" |
|
6637 |
! |
|
6638 |
||
6639 |
synchronizationSemaphore |
|
6640 |
"return the synchronization semaphore for myself. |
|
6641 |
subclasses may redefine" |
|
6642 |
||
6643 |
^ SynchronizationSemaphores at:self ifAbsent:[]. |
|
6644 |
||
6645 |
" |
|
6646 |
self synchronizationSemaphore |
|
6647 |
" |
|
6648 |
||
6649 |
"Modified: 28.1.1997 / 19:47:09 / stefan" |
|
6650 |
! |
|
6651 |
||
6652 |
synchronizationSemaphore:aSemaphore |
|
6653 |
"set the synchronisationSemaphore for myself. |
|
6654 |
subclasses may redefine this method" |
|
6655 |
||
6656 |
aSemaphore isNil ifTrue:[ |
|
2647 | 6657 |
"/ remove Semaphore |
6658 |
SynchronizationSemaphores removeKey:self ifAbsent:[]. |
|
2295 | 6659 |
] ifFalse:[ |
2647 | 6660 |
SynchronizationSemaphores at:self put:aSemaphore. |
2295 | 6661 |
]. |
6662 |
||
6663 |
"Modified: 28.1.1997 / 19:37:48 / stefan" |
|
6664 |
! |
|
6665 |
||
6666 |
synchronized:aBlock |
|
6667 |
"evaluate aBlock synchronized, i.e. use a monitor for this object" |
|
6668 |
||
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6669 |
|sema blocked gotSema| |
2327 | 6670 |
|
6671 |
blocked := OperatingSystem blockInterrupts. |
|
6672 |
||
6673 |
"/ the following avoids creation of an additional |
|
6674 |
"/ block in the common case |
|
2295 | 6675 |
|
6676 |
sema := self synchronizationSemaphore. |
|
6677 |
sema isNil ifTrue:[ |
|
2647 | 6678 |
"get a locked semaphore (with count = 0)" |
6679 |
sema := Semaphore new. |
|
6680 |
self synchronizationSemaphore:sema. |
|
6681 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
6682 |
^ aBlock valueNowOrOnUnwindDo:[sema signal]. |
|
2327 | 6683 |
]. |
6684 |
||
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6685 |
" |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6686 |
Poll sema (never waits). |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6687 |
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
|
6688 |
of some blocks. |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6689 |
" |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6690 |
(sema waitWithTimeout:0) notNil ifTrue:[ |
2647 | 6691 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
6692 |
^ aBlock valueNowOrOnUnwindDo:[sema signal]. |
|
2295 | 6693 |
]. |
2327 | 6694 |
|
6695 |
[ |
|
2647 | 6696 |
gotSema := sema wait. |
6697 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
6698 |
^ aBlock value. |
|
2327 | 6699 |
] valueNowOrOnUnwindDo:[ |
2647 | 6700 |
gotSema notNil ifTrue:[gotSema signal] |
2327 | 6701 |
]. |
2295 | 6702 |
|
6703 |
" |
|
6704 |
[Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork. |
|
6705 |
[Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork. |
|
6706 |
" |
|
6707 |
||
6708 |
"Created: 28.1.1997 / 17:52:56 / stefan" |
|
2327 | 6709 |
"Modified: 30.1.1997 / 13:38:54 / cg" |
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6710 |
"Modified: 20.2.1997 / 09:43:35 / stefan" |
2295 | 6711 |
! ! |
6712 |
||
783 | 6713 |
!Object methodsFor:'system primitives'! |
6714 |
||
1957 | 6715 |
asOop |
6716 |
"ST-80 compatibility: |
|
6717 |
ST-80 returns an OOP-identity based number here (I guess: its address |
|
6718 |
or index); since ST/X has no such thing, and the objects address cannot |
|
6719 |
be used (since its changing over time), we return the objects identityHash |
|
6720 |
key, which provides (at least) some identity indication. |
|
6721 |
However, notice that (in contrast to ST-80's #asOop), the identityHash |
|
6722 |
key of two non-identical objects may be the same. |
|
6723 |
You'd better not use it - especially do not misuse it." |
|
6724 |
||
6725 |
^ self identityHash |
|
6726 |
||
6727 |
"Created: 9.11.1996 / 19:09:56 / cg" |
|
6728 |
"Modified: 9.11.1996 / 19:16:04 / cg" |
|
6729 |
! |
|
6730 |
||
783 | 6731 |
become:anotherObject |
6732 |
"make all references to the receiver become references to anotherObject |
|
859 | 6733 |
and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become. |
6734 |
This can be a very dangerous operation - be warned. |
|
861 | 6735 |
In general, using #become: should be avoided if possible, since it may |
6736 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
6737 |
||
6738 |
This may also be an expensive (i.e. slow) operation, |
|
783 | 6739 |
since in the worst case, the whole memory has to be searched for |
6740 |
references to the two objects (although the primitive tries hard to |
|
6741 |
limit the search, for acceptable performance in most cases). |
|
6742 |
This method fails, if the receiver or the argument is a SmallInteger |
|
6743 |
or nil, or is a context of a living method (i.e. one that has not already |
|
6744 |
returned). |
|
859 | 6745 |
(notice that #become: is not used heavily by the system |
783 | 6746 |
- the Collection-classes have been rewritten to not use it.)" |
6747 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6748 |
if (__primBecome(self, anotherObject)) { |
783 | 6749 |
RETURN ( self ); |
859 | 6750 |
} |
6751 |
%}. |
|
783 | 6752 |
self primitiveFailed |
6753 |
! |
|
6754 |
||
6755 |
becomeNil |
|
6756 |
"make all references to the receiver become nil - effectively getting |
|
859 | 6757 |
rid of the receiver. |
6758 |
This can be a very dangerous operation - be warned. |
|
6759 |
||
6760 |
This may be an expensive (i.e. slow) operation. |
|
783 | 6761 |
The receiver may not be a SmallInteger or a context of a living method." |
6762 |
||
6763 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6764 |
if (__primBecomeNil(self)) { |
783 | 6765 |
RETURN ( nil ); |
859 | 6766 |
} |
6767 |
%}. |
|
6768 |
self primitiveFailed |
|
6769 |
! |
|
6770 |
||
6771 |
becomeSameAs:anotherObject |
|
6772 |
"make all references to the receiver become references to anotherObject |
|
861 | 6773 |
but NOT vice versa (as done in #become:). |
859 | 6774 |
This can be a very dangerous operation - be warned. |
861 | 6775 |
In general, using #become: should be avoided if possible, since it may |
6776 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
6777 |
||
6778 |
This may also be an expensive (i.e. slow) operation, |
|
859 | 6779 |
since in the worst case, the whole memory has to be searched for |
6780 |
references to the two objects (although the primitive tries hard to |
|
6781 |
limit the search, for acceptable performance in most cases). |
|
6782 |
This method fails, if the receiver or the argument is a SmallInteger |
|
6783 |
or nil, or is a context of a living method (i.e. one that has not already returned)." |
|
6784 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6785 |
if (__primBecomeSameAs(self, anotherObject)) { |
859 | 6786 |
RETURN ( self ); |
6787 |
} |
|
6788 |
%}. |
|
783 | 6789 |
self primitiveFailed |
6790 |
! |
|
6791 |
||
6792 |
changeClassTo:otherClass |
|
6793 |
"changes the class of the receiver to the argument, otherClass. |
|
6794 |
This is only allowed (possible), if the receivers class and the argument |
|
6795 |
have the same structure (i.e. number of named instance variables and |
|
6796 |
type of indexed instance variables). |
|
6797 |
If the structures do not match, or any of the original class or new class |
|
6798 |
is UndefinedObject or a Smallinteger, a primitive error is triggered." |
|
6799 |
||
6800 |
|myClass ok| |
|
6801 |
||
6802 |
"check for UndefinedObject/SmallInteger receiver or newClass" |
|
6803 |
%{ |
|
1133 | 6804 |
{ |
4363
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6805 |
OBJ other = otherClass; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6806 |
|
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6807 |
if (__isNonNilObject(self) |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6808 |
&& __isNonNilObject(other) |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6809 |
&& (other != UndefinedObject) |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6810 |
&& (other != SmallInteger)) { |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6811 |
ok = true; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6812 |
} else { |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6813 |
ok = false; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6814 |
} |
783 | 6815 |
} |
6816 |
%}. |
|
6817 |
ok ifTrue:[ |
|
4363
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6818 |
ok := false. |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6819 |
myClass := self class. |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6820 |
myClass flags == otherClass flags ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6821 |
myClass instSize == otherClass instSize ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6822 |
"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
|
6823 |
ok := true. |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6824 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6825 |
myClass isPointers ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6826 |
myClass isVariable ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6827 |
ok := true |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6828 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6829 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6830 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6831 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6832 |
myClass isPointers ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6833 |
"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
|
6834 |
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
|
6835 |
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
|
6836 |
|
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6837 |
otherClass isPointers ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6838 |
otherClass isVariable ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6839 |
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
|
6840 |
ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6841 |
ok := true |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6842 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6843 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6844 |
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
|
6845 |
ifTrue:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6846 |
ok := true |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6847 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6848 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6849 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6850 |
"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
|
6851 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6852 |
] ifFalse:[ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6853 |
"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
|
6854 |
"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
|
6855 |
(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
|
6856 |
ok := true |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6857 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6858 |
] |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6859 |
] |
783 | 6860 |
]. |
6861 |
ok ifTrue:[ |
|
4363
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6862 |
"now, change the receivers class ..." |
783 | 6863 |
%{ |
4363
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6864 |
{ |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6865 |
OBJ me = self; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6866 |
|
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6867 |
__qClass(me) = otherClass; |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6868 |
__STORE(me, otherClass); |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6869 |
RETURN (me); |
f07f766dbb93
oops - changeClassTo: did not accept extended bit-indexed classes
Claus Gittinger <cg@exept.de>
parents:
4360
diff
changeset
|
6870 |
} |
783 | 6871 |
%}. |
6872 |
]. |
|
1022
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6873 |
|
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6874 |
" |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6875 |
the receiver cannot be represented as a instance of |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6876 |
the desired class. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6877 |
For example, you cannot change a bitInstance (byteArray etc.) |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6878 |
into a pointer object and vice versa. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6879 |
" |
783 | 6880 |
self primitiveFailed |
6881 |
! |
|
6882 |
||
6883 |
changeClassToThatOf:anObject |
|
6884 |
"changes the class of the receiver to that of the argument, anObject. |
|
6885 |
This is only allowed (possible), if the receivers class and the arguments |
|
6886 |
class have the same structure (i.e. number of named instance variables and |
|
6887 |
type of indexed instance variables). If the structures do not match, or any |
|
6888 |
of the objects is nil or a Smallinteger, a primitive error is triggered." |
|
6889 |
||
6890 |
self changeClassTo:(anObject class) |
|
6891 |
! ! |
|
6892 |
||
1867 | 6893 |
!Object methodsFor:'testing'! |
6894 |
||
6895 |
? defaultValue |
|
3465 | 6896 |
"a syntactic shugar-piece: |
6897 |
if the receiver is nil, return the defaultValue; |
|
1867 | 6898 |
otherwise, return the receiver. |
6899 |
This method is only redefined in UndefinedObject - therefore, |
|
6900 |
the recevier is retuned here. |
|
6901 |
||
1958 | 6902 |
Thus, if foo and bar are simple variables or constants, |
4360 | 6903 |
foo ? bar |
1958 | 6904 |
is the same as: |
4360 | 6905 |
(foo isNil ifTrue:[bar] ifFalse:[foo]) |
1958 | 6906 |
|
6907 |
if they are message sends, the equivalent code is: |
|
4360 | 6908 |
[ |
6909 |
|t1 t2| |
|
6910 |
||
6911 |
t1 := foo. |
|
6912 |
t2 := bar. |
|
6913 |
t1 isNil ifTrue:[t2] ifFalse:[t1] |
|
6914 |
] value |
|
1958 | 6915 |
|
1867 | 6916 |
Can be used to provide defaultValues to variables, |
6917 |
as in: |
|
4360 | 6918 |
foo := arg ? #defaultValue |
2147 | 6919 |
|
2148 | 6920 |
Note: this method should never be redefined in classes other than UndefinedObject. |
4360 | 6921 |
Notice: |
6922 |
This method is open coded (inlined) by the compiler(s) |
|
6923 |
- redefining it may not work as expected." |
|
1867 | 6924 |
|
6925 |
^ self |
|
6926 |
||
6927 |
" |
|
6928 |
1 ? #default |
|
6929 |
nil ? #default |
|
6930 |
" |
|
6931 |
||
3465 | 6932 |
"Created: / 4.11.1996 / 20:36:19 / cg" |
6933 |
"Modified: / 19.5.1998 / 17:39:56 / cg" |
|
1867 | 6934 |
! |
6935 |
||
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6936 |
?? defaultValue |
3465 | 6937 |
"a syntactic shugar-piece: |
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6938 |
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
|
6939 |
(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
|
6940 |
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
|
6941 |
otherwise, return the receiver. |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6942 |
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
|
6943 |
the recevier is retuned here. |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6944 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6945 |
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
|
6946 |
foo ?? bar |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6947 |
is the same as: |
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6948 |
(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
|
6949 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6950 |
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
|
6951 |
[ |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6952 |
|t t2| |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6953 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6954 |
t := foo. |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6955 |
t isNil ifTrue:[bar value] ifFalse:[t] |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6956 |
] value |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6957 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6958 |
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
|
6959 |
as in: |
4360 | 6960 |
foo := arg ?? [ self computeDefault ] |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6961 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6962 |
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
|
6963 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6964 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6965 |
^ self |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6966 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6967 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6968 |
1 ?? #default |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6969 |
nil ?? #default |
4360 | 6970 |
1 ?? [ self halt. 1 + 2 ] |
6971 |
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
|
6972 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6973 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6974 |
"Created: / 4.11.1996 / 20:36:19 / cg" |
3466 | 6975 |
"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
|
6976 |
! |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6977 |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6978 |
ifNil:aBlockOrValue |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6979 |
"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
|
6980 |
This is much like #?, but sends #value to the argument in case of a nil |
4360 | 6981 |
receiver. |
6982 |
Notice: |
|
6983 |
This method is open coded (inlined) by the compiler(s) |
|
6984 |
- redefining it may not work as expected." |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6985 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6986 |
^ self |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6987 |
! |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6988 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6989 |
ifNil:nilBlockOrValue ifNotNil:notNilBlockOrValue |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6990 |
"return the value of the first arg, if I am nil, |
4360 | 6991 |
the result from evaluating the 2nd argument, if I am not nil. |
6992 |
Notice: |
|
6993 |
This method is open coded (inlined) by the compiler(s) |
|
6994 |
- redefining it may not work as expected." |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6995 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6996 |
^ notNilBlockOrValue value |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6997 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6998 |
! |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
6999 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7000 |
ifNotNil:aBlockOrValue |
4360 | 7001 |
"return myself if nil, or the result from evaluating the argument, |
7002 |
if I am not nil. |
|
7003 |
Notice: |
|
7004 |
This method is open coded (inlined) by the compiler(s) |
|
7005 |
- redefining it may not work as expected." |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7006 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7007 |
^ aBlockOrValue value |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7008 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7009 |
! |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7010 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7011 |
ifNotNil:notNilBlockOrValue ifNil:nilBlockOrValue |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7012 |
"return the value of the 2nd arg, if I am nil, |
4360 | 7013 |
the result from evaluating the 1st argument, if I am not nil. |
7014 |
Notice: |
|
7015 |
This method is open coded (inlined) by the compiler(s) |
|
7016 |
- redefining it may not work as expected." |
|
4339
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7017 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7018 |
^ notNilBlockOrValue value |
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 |
|
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7021 |
! |
18c19912a67c
added #ifNil and friends - squeak compatibility.
Claus Gittinger <cg@exept.de>
parents:
4322
diff
changeset
|
7022 |
|
1867 | 7023 |
isArray |
7024 |
"return true, if the receiver is some kind of array (or weakArray etc); |
|
7025 |
false is returned here - the method is only redefined in Array." |
|
7026 |
||
7027 |
^ false |
|
7028 |
! |
|
7029 |
||
7030 |
isAssociation |
|
7031 |
"return true, if the receiver is some kind of association; |
|
7032 |
false is returned here - the method is only redefined in Association." |
|
7033 |
||
7034 |
^ false |
|
7035 |
||
7036 |
"Created: 14.5.1996 / 17:03:45 / cg" |
|
7037 |
! |
|
7038 |
||
7039 |
isBehavior |
|
7040 |
"return true, if the receiver is some kind of class (i.e. behavior); |
|
7041 |
false is returned here - the method is only redefined in Behavior." |
|
7042 |
||
7043 |
^ false |
|
7044 |
! |
|
7045 |
||
7046 |
isBlock |
|
7047 |
"return true, if the receiver is some kind of block; |
|
7048 |
false returned here - the method is only redefined in Block." |
|
7049 |
||
7050 |
^ false |
|
7051 |
! |
|
7052 |
||
7053 |
isCharacter |
|
7054 |
"return true, if the receiver is some kind of character; |
|
7055 |
false is returned here - the method is only redefined in Character." |
|
7056 |
||
7057 |
^ false |
|
7058 |
! |
|
7059 |
||
7060 |
isClass |
|
7061 |
"return true, if the receiver is some kind of class (real class, |
|
7062 |
not just behavior); |
|
7063 |
false is returned here - the method is only redefined in Class." |
|
7064 |
||
7065 |
^ false |
|
7066 |
! |
|
7067 |
||
7068 |
isCollection |
|
7069 |
"return true, if the receiver is some kind of collection; |
|
7070 |
false is returned here - the method is only redefined in Collection." |
|
7071 |
||
7072 |
^ false |
|
7073 |
! |
|
7074 |
||
7075 |
isColor |
|
7076 |
"return true, if the receiver is some kind of color; |
|
7077 |
false is returned here - the method is only redefined in Color." |
|
7078 |
||
7079 |
^ false |
|
7080 |
! |
|
7081 |
||
7082 |
isContext |
|
7083 |
"return true, if the receiver is some kind of context; |
|
7084 |
false returned here - the method is only redefined in Context." |
|
7085 |
||
7086 |
^ false |
|
7087 |
! |
|
7088 |
||
7089 |
isExternalStream |
|
7090 |
"return true, if the receiver is some kind of externalStream; |
|
7091 |
false is returned here - the method is only redefined in ExternalStream." |
|
7092 |
||
7093 |
^false |
|
7094 |
! |
|
7095 |
||
7096 |
isFileStream |
|
7097 |
"return true, if the receiver is some kind of fileStream; |
|
7098 |
false is returned here - the method is only redefined in FileStream." |
|
7099 |
||
7100 |
^false |
|
7101 |
! |
|
7102 |
||
1887 | 7103 |
isFixedPoint |
7104 |
"return true, if the receiver is some kind of fixedPoint number; |
|
7105 |
false is returned here - the method is only redefined in FixedPoint." |
|
7106 |
||
7107 |
^ false |
|
7108 |
||
7109 |
"Created: 5.11.1996 / 19:23:04 / cg" |
|
7110 |
! |
|
7111 |
||
1867 | 7112 |
isFixedSize |
7113 |
"return true if the receiver cannot grow easily |
|
7114 |
(i.e. a grow may be expensive, since it involves a become:)" |
|
7115 |
||
7116 |
^ true |
|
7117 |
! |
|
7118 |
||
7119 |
isForm |
|
7120 |
"return true, if the receiver is some kind of form; |
|
7121 |
false is returned here - the method is only redefined in Form." |
|
7122 |
||
7123 |
^ false |
|
7124 |
! |
|
7125 |
||
7126 |
isFraction |
|
7127 |
"return true, if the receiver is some kind of fraction; |
|
7128 |
false is returned here - the method is only redefined in Fraction." |
|
7129 |
||
7130 |
^ false |
|
7131 |
! |
|
7132 |
||
7133 |
isImage |
|
7134 |
"return true, if the receiver is some kind of image; |
|
7135 |
false is returned here - the method is only redefined in Image." |
|
7136 |
||
7137 |
^ false |
|
7138 |
! |
|
7139 |
||
7140 |
isImageOrForm |
|
7141 |
"return true, if the receiver is some kind of image or form; |
|
7142 |
false is returned here - the method is only redefined in Image and Form." |
|
7143 |
||
7144 |
^ false |
|
7145 |
! |
|
7146 |
||
2673
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7147 |
isImmediate |
4666 | 7148 |
"return true if I am an immediate object |
7149 |
i.e. I am represented in the pointer itself and |
|
7150 |
no real object header/storage is used me. |
|
7151 |
(currently, only SmallIntegers and nil return true)" |
|
2673
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7152 |
|
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7153 |
^ self class hasImmediateInstances |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7154 |
|
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7155 |
"Created: 3.6.1997 / 12:00:18 / cg" |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7156 |
! |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
7157 |
|
1867 | 7158 |
isInteger |
7159 |
"return true, if the receiver is some kind of integer number; |
|
7160 |
false is returned here - the method is only redefined in Integer." |
|
7161 |
||
7162 |
^ false |
|
7163 |
! |
|
7164 |
||
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7165 |
isJavaClass |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7166 |
"return true, if this is a javaClass. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7167 |
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
|
7168 |
|
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7169 |
^ false |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7170 |
|
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7171 |
"Created: / 26.3.1997 / 13:34:54 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7172 |
"Modified: / 8.5.1998 / 21:25:21 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7173 |
! |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7174 |
|
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7175 |
isJavaContext |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7176 |
"return true, if this is a javaContext. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7177 |
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
|
7178 |
|
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7179 |
^ false |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7180 |
|
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7181 |
"Created: / 8.5.1998 / 21:24:27 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7182 |
"Modified: / 8.5.1998 / 21:25:35 / cg" |
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7183 |
! |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7184 |
|
4816 | 7185 |
isJavaMethod |
7186 |
"return true, if this is a JavaMethod. |
|
7187 |
false is returned here - the method is only redefined in JavaMethod." |
|
7188 |
||
7189 |
^ false |
|
7190 |
||
7191 |
"Modified: / 8.5.1998 / 21:25:46 / cg" |
|
7192 |
"Created: / 25.9.1999 / 23:26:12 / cg" |
|
7193 |
! |
|
7194 |
||
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7195 |
isJavaObject |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7196 |
"return true, if this is a javaObject. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7197 |
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
|
7198 |
|
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7199 |
^ false |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7200 |
|
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7201 |
"Created: / 26.3.1997 / 13:34:48 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7202 |
"Modified: / 8.5.1998 / 21:25:46 / cg" |
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7203 |
! |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
7204 |
|
1867 | 7205 |
isKindOf:aClass |
7206 |
"return true, if the receiver is an instance of aClass or one of its |
|
7207 |
subclasses, false otherwise. |
|
7208 |
Advice: |
|
7209 |
use of this to check objects for certain attributes/protocoll should |
|
7210 |
be avoided; it limits the reusability of your classes by limiting use |
|
7211 |
to instances of certain classes and fences you into a specific inheritance |
|
7212 |
hierarchy. |
|
7213 |
Use check-methods to check an object for a certain attributes/protocol |
|
7214 |
(such as #isXXXX, #respondsTo: or #isNumber). |
|
7215 |
||
7216 |
Using #isKindOf: is considered BAD STYLE. |
|
7217 |
||
7218 |
Advice2: |
|
7219 |
Be aware, that using an #isXXX method is usually much faster than |
|
7220 |
using #isKindOf:; because isKindOf: has to walk up all the superclass |
|
7221 |
hierarchy, comparing every class on the way. |
|
7222 |
Due to caching in the VM, a call to #isXXX is normally reached via |
|
7223 |
a single function call. |
|
7224 |
" |
|
7225 |
||
7226 |
%{ /* NOCONTEXT */ |
|
7227 |
register OBJ thisClass; |
|
7228 |
||
7229 |
thisClass = __Class(self); |
|
7230 |
while (thisClass != nil) { |
|
7231 |
if (thisClass == aClass) { |
|
7232 |
RETURN ( true ); |
|
7233 |
} |
|
7234 |
thisClass = __ClassInstPtr(thisClass)->c_superclass; |
|
7235 |
} |
|
7236 |
%} |
|
7237 |
. |
|
7238 |
"/ |
|
7239 |
"/ the above code is equivalent to: |
|
7240 |
"/ |
|
7241 |
"/ thisClass := self class. |
|
7242 |
"/ [thisClass notNil] whileTrue:[ |
|
7243 |
"/ thisClass == aClass ifTrue:[^ true]. |
|
7244 |
"/ thisClass := thisClass superclass |
|
7245 |
"/ ] |
|
7246 |
"/ |
|
7247 |
^ false |
|
7248 |
! |
|
7249 |
||
7250 |
isLayout |
|
7251 |
"return true, if the receiver is some kind of layout; |
|
7252 |
false is returned here - the method is only redefined in Layout." |
|
7253 |
||
7254 |
^ false |
|
7255 |
! |
|
7256 |
||
7257 |
isLiteral |
|
4666 | 7258 |
"return true, if the receiver can be represented as a literal constant in ST syntax; |
1867 | 7259 |
false is returned here - the method is redefined in some classes." |
7260 |
||
7261 |
^ false |
|
7262 |
! |
|
7263 |
||
7264 |
isMemberOf:aClass |
|
7265 |
"return true, if the receiver is an instance of aClass, false otherwise. |
|
7266 |
Advice: |
|
7267 |
use of this to check objects for certain attributes/protocoll should |
|
7268 |
be avoided; it limits the reusability of your classes by limiting use |
|
7269 |
to instances of a certain class. |
|
7270 |
Use check-methods to check an object for a certain attributes/protocol |
|
7271 |
(such as #isXXX, #respondsTo: or #isNumber); |
|
7272 |
||
3044 | 7273 |
Using #isMemberOf: is considered BAD STYLE. |
7274 |
Notice: |
|
7275 |
This method is open coded (inlined) by the compiler(s) |
|
7276 |
- redefining it may not work as expected." |
|
1867 | 7277 |
|
7278 |
^ (self class) == aClass |
|
7279 |
! |
|
7280 |
||
7281 |
isMeta |
|
7282 |
"return true, if the receiver is some kind of metaclass; |
|
7283 |
false is returned here - the method is only redefined in Metaclass." |
|
7284 |
||
7285 |
^ false |
|
7286 |
! |
|
7287 |
||
7288 |
isMethod |
|
7289 |
"return true, if the receiver is some kind of method; |
|
7290 |
false returned here - the method is only redefined in Method." |
|
7291 |
||
7292 |
^ false |
|
7293 |
! |
|
7294 |
||
7295 |
isNamespace |
|
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7296 |
"return true, if this is a nameSpace. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7297 |
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
|
7298 |
|
1867 | 7299 |
^ false |
7300 |
||
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7301 |
"Created: / 11.10.1996 / 18:08:56 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7302 |
"Modified: / 8.5.1998 / 21:26:05 / cg" |
1867 | 7303 |
! |
7304 |
||
7305 |
isNumber |
|
7306 |
"return true, if the receiver is some kind of number; |
|
7307 |
false is returned here - the method is only redefined in Number." |
|
7308 |
||
7309 |
^ false |
|
7310 |
! |
|
7311 |
||
7312 |
isPoint |
|
7313 |
"return true, if the receiver is some kind of point; |
|
7314 |
false is returned here - the method is only redefined in Point." |
|
7315 |
||
7316 |
^ false |
|
7317 |
! |
|
7318 |
||
7319 |
isReal |
|
7320 |
"return true, if the receiver is some kind of real number; |
|
7321 |
false is returned here - the method is only redefined in LimitedPrecisionReal." |
|
7322 |
||
7323 |
^ false |
|
7324 |
! |
|
7325 |
||
7326 |
isRectangle |
|
7327 |
"return true, if the receiver is some kind of rectangle; |
|
7328 |
false is returned here - the method is only redefined in Rectangle." |
|
7329 |
||
7330 |
^ false |
|
7331 |
! |
|
7332 |
||
7333 |
isRemoteObject |
|
7334 |
"return true, if the receiver is some kind of remoteObject, |
|
7335 |
false if its local - the method is only redefined in RemoteObject." |
|
7336 |
||
7337 |
^ false |
|
7338 |
||
7339 |
"Created: 28.10.1996 / 15:18:45 / cg" |
|
7340 |
"Modified: 28.10.1996 / 15:20:57 / cg" |
|
7341 |
! |
|
7342 |
||
7343 |
isSequenceable |
|
7344 |
"return true, if the receiver is some kind of sequenceable collection; |
|
7345 |
false is returned here - the method is only redefined in SequenceableCollection." |
|
7346 |
||
7347 |
^ false |
|
7348 |
! |
|
7349 |
||
7350 |
isSequenceableCollection |
|
7351 |
"OBSOLETE: use isSequenceable for ST-80 compatibility. |
|
4007 | 7352 |
This method is a historic leftover and will be removed soon ... |
7353 |
(although its name is much better than #isSequenceable - sigh)" |
|
1867 | 7354 |
|
7355 |
self obsoleteMethodWarning:'use #isSequenceable'. |
|
7356 |
^ false |
|
7357 |
! |
|
7358 |
||
7359 |
isSignal |
|
7360 |
"return true, if the receiver is some kind of signal; |
|
7361 |
false returned here - the method is only redefined in Signal." |
|
7362 |
||
7363 |
^ false |
|
7364 |
! |
|
7365 |
||
7366 |
isStream |
|
7367 |
"return true, if the receiver is some kind of stream; |
|
7368 |
false is returned here - the method is only redefined in Stream." |
|
7369 |
||
7370 |
^ false |
|
7371 |
! |
|
7372 |
||
7373 |
isString |
|
7374 |
"return true, if the receiver is some kind of string; |
|
4683 | 7375 |
false is returned here - the method is only redefined in CharacterArray." |
1867 | 7376 |
|
7377 |
^ false |
|
7378 |
! |
|
7379 |
||
4007 | 7380 |
isStringCollection |
7381 |
"return true, if the receiver is some kind of stringCollection; |
|
7382 |
false is returned here - the method is only redefined in StringCollection." |
|
7383 |
||
7384 |
^ false |
|
7385 |
! |
|
7386 |
||
1867 | 7387 |
isSymbol |
7388 |
"return true, if the receiver is some kind of symbol; |
|
7389 |
false is returned here - the method is only redefined in Symbol." |
|
7390 |
||
7391 |
^ false |
|
7392 |
! |
|
7393 |
||
7394 |
isText |
|
7395 |
"return true, if the receiver is some kind of text object; |
|
7396 |
false is returned here - the method is only redefined in Text." |
|
7397 |
||
7398 |
^ false |
|
7399 |
||
7400 |
"Created: 12.5.1996 / 10:56:50 / cg" |
|
7401 |
! |
|
7402 |
||
4009 | 7403 |
isValueModel |
7404 |
"return true, if the receiver is some kind of valueModel; |
|
7405 |
false is returned here - the method is only redefined in ValueModel." |
|
7406 |
||
7407 |
^ false |
|
7408 |
||
7409 |
! |
|
7410 |
||
1867 | 7411 |
isVariable |
7412 |
"return true if the receiver has indexed instance variables, |
|
7413 |
false otherwise." |
|
7414 |
||
7415 |
^ self class isVariable |
|
7416 |
! |
|
7417 |
||
2704 | 7418 |
isVariableBinding |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7419 |
"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
|
7420 |
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
|
7421 |
|
2704 | 7422 |
^ false |
7423 |
||
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7424 |
"Created: / 19.6.1997 / 17:38:44 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7425 |
"Modified: / 8.5.1998 / 21:26:55 / cg" |
2704 | 7426 |
! |
7427 |
||
1867 | 7428 |
isView |
7429 |
"return true, if the receiver is some kind of view; |
|
7430 |
false is returned here - the method is only redefined in View." |
|
7431 |
||
7432 |
^ false |
|
7433 |
! ! |
|
7434 |
||
4664 | 7435 |
!Object methodsFor:'tracing'! |
7436 |
||
4682 | 7437 |
traceInto:aRequestor level:level from:referrer |
4664 | 7438 |
"double dispatch into tracer, passing my type implicitely in the selector" |
7439 |
||
4682 | 7440 |
^ aRequestor traceObject:self level:level from:referrer |
4664 | 7441 |
|
7442 |
"Created: / 2.9.1999 / 09:05:17 / stefan" |
|
7443 |
! ! |
|
7444 |
||
783 | 7445 |
!Object methodsFor:'user interaction & notifications'! |
7446 |
||
7447 |
activityNotification:aString |
|
7448 |
"this can be sent from deeply nested methods, which are going to perform |
|
7449 |
some long-time activity. |
|
7450 |
If there is a handler for the ActivityNotificationSignal signal, that one is raised, |
|
7451 |
passing the argument. The handler should show this message whereever it likes, |
|
7452 |
and proceed. If there is no handler, this is simply ignored. |
|
7453 |
||
7454 |
This is very useful to pass busy messages up to some higher level (typically a view) |
|
7455 |
which likes to display that message in its label or a busy-box. |
|
7456 |
It could also be put into some logfile or printed on the standard output/error." |
|
7457 |
||
7458 |
ActivityNotificationSignal isHandled ifTrue:[ |
|
861 | 7459 |
^ ActivityNotificationSignal raiseRequestWith:self errorString:aString |
783 | 7460 |
]. |
7461 |
||
7462 |
" |
|
7463 |
nil activityNotification:'hello there' |
|
7464 |
self activityNotification:'hello there' |
|
7465 |
" |
|
7466 |
||
7467 |
" |
|
7468 |
ActivityNotificationSignal handle:[:ex | |
|
861 | 7469 |
ex errorString printNL. |
7470 |
ex proceed. |
|
783 | 7471 |
] do:[ |
861 | 7472 |
'hello' printNL. |
7473 |
self activityNotification:'doing some long time computation'. |
|
7474 |
'world' printNL. |
|
783 | 7475 |
] |
7476 |
" |
|
7477 |
||
7478 |
"Modified: 16.12.1995 / 18:23:42 / cg" |
|
7479 |
! |
|
7480 |
||
7481 |
confirm:aString |
|
7482 |
"launch a confirmer, which allows user to enter yes or no. |
|
7483 |
return true for yes, false for no" |
|
7484 |
||
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7485 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7486 |
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
|
7487 |
and return true (as if yes was answered) |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7488 |
Q: should we ask user by reading Stdin ? |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7489 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7490 |
Smalltalk isInitialized ifFalse:[ |
2647 | 7491 |
'*** confirmation requested during initialization:' printCR. |
7492 |
aString printCR. |
|
7493 |
'*** I''ll continue, assuming <yes> ...' printCR. |
|
7494 |
^ true |
|
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7495 |
]. |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7496 |
|
783 | 7497 |
Dialog isNil ifTrue:[ |
2647 | 7498 |
Transcript showCR:aString. |
7499 |
Transcript showCR:'continue, assuming <yes>'. |
|
7500 |
^ true |
|
783 | 7501 |
]. |
7502 |
Dialog autoload. "in case its autoloaded" |
|
7503 |
^ Dialog confirm:aString |
|
7504 |
||
7505 |
" |
|
7506 |
nil confirm:'hello' |
|
7507 |
self confirm:'hello' |
|
7508 |
" |
|
1417 | 7509 |
|
1425 | 7510 |
"Modified: 20.5.1996 / 10:28:40 / cg" |
783 | 7511 |
! |
7512 |
||
7513 |
errorNotify:aString |
|
7514 |
"launch a Notifier, showing top stack, telling user something |
|
2150 | 7515 |
and give user a chance to enter debugger." |
7516 |
||
7517 |
^ self |
|
2647 | 7518 |
errorNotify:aString |
7519 |
from:thisContext sender |
|
2150 | 7520 |
|
7521 |
" |
|
7522 |
nil errorNotify:'hello there' |
|
7523 |
self errorNotify:'hello there' |
|
7524 |
" |
|
7525 |
||
7526 |
"Modified: 11.1.1997 / 18:39:20 / cg" |
|
7527 |
! |
|
7528 |
||
7529 |
errorNotify:aString from:aContext |
|
7530 |
"launch a Notifier, showing top stack (above aContext), |
|
7531 |
telling user something and give user a chance to enter debugger." |
|
783 | 7532 |
|
3766
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7533 |
^ self errorNotify:aString from:aContext allowDebug:true |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7534 |
|
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7535 |
"Modified: / 17.8.1998 / 10:09:27 / cg" |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7536 |
! |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7537 |
|
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7538 |
errorNotify:aString from:aContext allowDebug:allowDebug |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7539 |
"launch a Notifier, showing top stack (above aContext), |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7540 |
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
|
7541 |
|
2082 | 7542 |
|info con sender action| |
783 | 7543 |
|
891 | 7544 |
Smalltalk isInitialized ifFalse:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7545 |
'errorNotification: ' print. aString printCR. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7546 |
^ self |
891 | 7547 |
]. |
7548 |
||
783 | 7549 |
Dialog isNil ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7550 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7551 |
on systems without GUI, simply show |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7552 |
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
|
7553 |
" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7554 |
Transcript showCR:aString. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7555 |
AbortSignal raise. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7556 |
^ self |
783 | 7557 |
]. |
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7558 |
|
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7559 |
Processor activeProcessIsSystemProcess ifTrue:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7560 |
action := #debug. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7561 |
sender := aContext. |
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7562 |
] ifFalse:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7563 |
Dialog autoload. "in case its autoloaded" |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7564 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7565 |
ErrorSignal handle:[:ex | |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7566 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7567 |
"/ a recursive error - quickly enter debugger |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7568 |
"/ 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
|
7569 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7570 |
('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
|
7571 |
action := #debug. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7572 |
ex return. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7573 |
] do:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7574 |
sender := aContext. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7575 |
sender isNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7576 |
sender := thisContext sender. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7577 |
"/ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7578 |
"/ 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
|
7579 |
"/ sender isBlockContext ifTrue:[ |
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7580 |
"/ sender := sender sender |
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7581 |
"/ ]. |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7582 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7583 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7584 |
"/ skip intermediate (signal & exception) contexts |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7585 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7586 |
DebugView notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7587 |
sender := DebugView interestingContextFrom:sender |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7588 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7589 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7590 |
"/ show the first 5 contexts |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7591 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7592 |
con := sender. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7593 |
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
|
7594 |
1 to:5 do:[:n | |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7595 |
con notNil ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7596 |
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
|
7597 |
con := con sender |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7598 |
] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7599 |
]. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7600 |
|
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7601 |
allowDebug ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7602 |
action := Dialog |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7603 |
choose:info |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7604 |
label:('Exception [' , Processor activeProcess nameOrId , ']') |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7605 |
labels:#('proceed' 'abort' 'debug') |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7606 |
values:#(#proceed #abort #debug) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7607 |
default:#debug. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7608 |
] ifFalse:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7609 |
action := Dialog |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7610 |
choose:info |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7611 |
label:('Exception [' , Processor activeProcess nameOrId , ']') |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7612 |
labels:#('proceed' 'abort') |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7613 |
values:#(#proceed #abort) |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7614 |
default:#abort. |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7615 |
] |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7616 |
]. |
2082 | 7617 |
]. |
7618 |
||
7619 |
action == #debug ifTrue:[ |
|
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7620 |
Debugger enter:sender withMessage:aString mayProceed:true |
2082 | 7621 |
] ifFalse:[ |
4535
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7622 |
action == #abort ifTrue:[ |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7623 |
AbortSignal raise |
aaed5f554d8b
code cleanup - removed all obsolete debugger entry protocol
Claus Gittinger <cg@exept.de>
parents:
4529
diff
changeset
|
7624 |
] |
783 | 7625 |
] |
7626 |
||
7627 |
" |
|
7628 |
nil errorNotify:'hello there' |
|
7629 |
self errorNotify:'hello there' |
|
7630 |
" |
|
1417 | 7631 |
|
3766
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7632 |
"Modified: / 8.2.1997 / 12:47:41 / cg" |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7633 |
"Created: / 17.8.1998 / 10:09:26 / cg" |
783 | 7634 |
! |
7635 |
||
7636 |
information:aString |
|
7637 |
"launch an InfoBox, telling user something. |
|
7638 |
These info-boxes can be suppressed by handling the |
|
7639 |
UserNotification- or InformationSignal and proceeding in the handler." |
|
7640 |
||
7641 |
InformationSignal isHandled ifTrue:[ |
|
7642 |
^ InformationSignal raiseRequestWith:self errorString:aString |
|
7643 |
]. |
|
7644 |
self notify:aString |
|
7645 |
||
7646 |
" |
|
7647 |
nil information:'hello there' |
|
7648 |
self information:'hello there' |
|
7649 |
" |
|
7650 |
||
7651 |
" |
|
7652 |
InformationSignal handle:[:ex | |
|
7653 |
'no box popped' printNL. |
|
7654 |
ex proceed. |
|
7655 |
] do:[ |
|
7656 |
'hello' printNL. |
|
7657 |
self information:'some info'. |
|
7658 |
'world' printNL. |
|
7659 |
] |
|
7660 |
" |
|
7661 |
||
7662 |
"Modified: 24.11.1995 / 22:29:49 / cg" |
|
7663 |
! |
|
7664 |
||
7665 |
notify:aString |
|
7666 |
"launch a Notifier, telling user something. |
|
7667 |
Use #information: for ignorable messages." |
|
7668 |
||
891 | 7669 |
Smalltalk isInitialized ifFalse:[ |
2647 | 7670 |
'information: ' print. aString printCR. |
7671 |
^ self |
|
891 | 7672 |
]. |
7673 |
||
783 | 7674 |
Dialog isNil ifTrue:[ |
2647 | 7675 |
" |
7676 |
on systems without GUI, simply show |
|
7677 |
the message on the Transcript. |
|
7678 |
" |
|
7679 |
Transcript showCR:aString. |
|
7680 |
^ self |
|
783 | 7681 |
]. |
7682 |
Dialog autoload. "in case its autoloaded" |
|
7683 |
Dialog information:aString |
|
7684 |
||
7685 |
" |
|
7686 |
nil notify:'hello there' |
|
7687 |
self notify:'hello there' |
|
7688 |
" |
|
1417 | 7689 |
|
1425 | 7690 |
"Modified: 20.5.1996 / 10:28:48 / cg" |
783 | 7691 |
! |
7692 |
||
7693 |
warn:aString |
|
7694 |
"launch a WarningBox, telling user something. |
|
7695 |
These warn-boxes can be suppressed by handling the |
|
7696 |
UserNotification- or WarningSignal and proceeding in the handler." |
|
7697 |
||
7698 |
WarningSignal isHandled ifTrue:[ |
|
2647 | 7699 |
^ WarningSignal raiseRequestWith:self errorString:aString |
783 | 7700 |
]. |
7701 |
||
891 | 7702 |
Smalltalk isInitialized ifFalse:[ |
2647 | 7703 |
'warning: ' print. aString printCR. |
7704 |
^ self |
|
891 | 7705 |
]. |
7706 |
||
783 | 7707 |
Dialog isNil ifTrue:[ |
2647 | 7708 |
" |
7709 |
on systems without GUI, simply show |
|
7710 |
the message on the Transcript. |
|
7711 |
" |
|
7712 |
Transcript showCR:aString. |
|
7713 |
^ self |
|
783 | 7714 |
]. |
7715 |
Dialog autoload. "in case its autoloaded" |
|
7716 |
Dialog warn:aString |
|
7717 |
||
7718 |
" |
|
7719 |
nil warn:'hello there' |
|
7720 |
self warn:'hello there' |
|
7721 |
" |
|
7722 |
||
7723 |
" |
|
7724 |
WarningSignal handle:[:ex | |
|
2647 | 7725 |
ex proceed. |
783 | 7726 |
] do:[ |
2647 | 7727 |
'hello' printNL. |
7728 |
self warn:'some info'. |
|
7729 |
'world' printNL. |
|
783 | 7730 |
] |
7731 |
" |
|
1417 | 7732 |
|
1425 | 7733 |
"Modified: 20.5.1996 / 10:28:53 / cg" |
783 | 7734 |
! ! |
7735 |
||
1788 | 7736 |
!Object class methodsFor:'documentation'! |
783 | 7737 |
|
7738 |
version |
|
4884 | 7739 |
^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.301 1999-10-08 15:24:09 cg Exp $' |
783 | 7740 |
! ! |
7741 |
Object initialize! |