author | Claus Gittinger <cg@exept.de> |
Thu, 11 Mar 1999 00:14:46 +0100 | |
changeset 4042 | 526c79cadbf8 |
parent 4009 | 15be251e3a47 |
child 4053 | eb3063f80058 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
159 | 3 |
All Rights Reserved |
1 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
783 | 13 |
nil subclass:#Object |
14 |
instanceVariableNames:'' |
|
15 |
classVariableNames:'ErrorSignal HaltSignal MessageNotUnderstoodSignal |
|
16 |
UserInterruptSignal RecursionInterruptSignal |
|
17 |
ExceptionInterruptSignal SubscriptOutOfBoundsSignal |
|
3101
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
18 |
IndexNotFoundSignal NonIntegerIndexSignal NotFoundSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
19 |
KeyNotFoundSignal ElementOutOfBoundsSignal UserNotificationSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
20 |
InformationSignal WarningSignal PrimitiveFailureSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
21 |
DeepCopyErrorSignal AbortSignal ErrorRecursion Dependencies |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
22 |
InfoPrinting ActivityNotificationSignal InternalErrorSignal |
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
23 |
NonWeakDependencies SynchronizationSemaphores ObjectAttributes |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
24 |
OSSignalInterruptSignal' |
783 | 25 |
poolDictionaries:'' |
26 |
category:'Kernel-Objects' |
|
1 | 27 |
! |
28 |
||
1788 | 29 |
!Object class methodsFor:'documentation'! |
71 | 30 |
|
88 | 31 |
copyright |
32 |
" |
|
33 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
159 | 34 |
All Rights Reserved |
88 | 35 |
|
36 |
This software is furnished under a license and may be used |
|
37 |
only in accordance with the terms of that license and with the |
|
38 |
inclusion of the above copyright notice. This software may not |
|
39 |
be provided or otherwise made available to, or used by, any |
|
40 |
other person. No title to or ownership of the software is |
|
41 |
hereby transferred. |
|
42 |
" |
|
43 |
! |
|
44 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
45 |
dependencies |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
46 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
47 |
ST/X dependencies are slightly modified from ST-80's |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
48 |
(we think they are better ;-). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
49 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
50 |
One problem occuring very often in ST-80 is that some object |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
51 |
cannot be garbage collected because some dependency is present, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
52 |
having the object as a dependent of some other object. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
53 |
In ST-80, this association remains alive (because a Dictionary |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
54 |
is used to hold dependents) - even if no other references exist to |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
55 |
to dependent or the dependee. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
56 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
57 |
This means, that in ST-80, a #release is mandatory in order to |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
58 |
prevent memory leaks. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
59 |
We think, that this is a bad solution, since after all, exactly that |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
60 |
kind of work should be performed by a garbage collector - you should not |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
61 |
need to care about dependencies. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
62 |
From a philosophical point of view, why should some object depend on |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
63 |
something that the programmer considers a dead object ? |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
64 |
(well - worse than that: it seems that some ST-80 code even depends on |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
65 |
that behavior) |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
66 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
67 |
In order to limit the trouble, ST-80 reimplemented the way dependents |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
68 |
are stored in the model class - this one keeps the dependents locally, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
69 |
so these dependents go away, once the model is reclaimed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
70 |
That may make things even more confusing: with models, no #release is |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
71 |
needed, with general objects it is mandatory. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
72 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
73 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
74 |
In ST/X, dependencies are implemented using a WeakDictionary; this means, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
75 |
that once the dependee dies, the dependency association is removed automatically, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
76 |
and the dependent can be reclaimed by the garbage collector, if no other |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
77 |
references exist to the dependent. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
78 |
In order to (at least) provide a mechanism for the old behavior |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
79 |
(in case your application heavily depends on the ST-80 mechanism), complementary |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
80 |
protocol to add nonWeak dependencies is provided |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
81 |
(see #addNonWeakDependent / #removeNonWeakDependent). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
82 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
83 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
84 |
Caveat: |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
85 |
since interests are implemented using InterestConverter (which are simply |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
86 |
forwarding messages), these must use the nonWeak mechanism (as done in ST-80 |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
87 |
automatically). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
88 |
The reason is that there are usually no direct references to the converters, |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
89 |
and those would be reclaimed if stored in a weakDictionary. |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
90 |
This means, that those interests MUST be removed with #retractInterest |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
91 |
(which is bug-compatible to ST-80). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
92 |
We rewrite things to provide a more convenient mechanism in the future ... |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
93 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
94 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
95 |
I like to hear comments on the above - do you think its better ? |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
96 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
97 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
98 |
|
71 | 99 |
documentation |
100 |
" |
|
1294 | 101 |
Object is the superclass of most other classes. |
102 |
(except for nil-subclasses, which inherit nothing, |
|
103 |
to catch any message into their #doesNotUnderstand: method) |
|
104 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
105 |
Protocol which is common to every object is defined here. |
71 | 106 |
Also some utility stuff (like notify) and error handling is implemented here. |
107 |
||
108 |
Object has no instance variables (and may not get any added). One reason is, that |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
109 |
UndefinedObject and SmallInteger are also inheriting from Object - these two cannot |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
110 |
have instance variables (due to their implementation). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
111 |
The other reason is that the runtime system (VM) knows about the layout of some built-in |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
112 |
classes (think of Class, Method, Block and also Integer or Float). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
113 |
If you were allowed to add instance variables to Object, the VM had to be recompiled |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
114 |
(and also rewritten in some places). |
71 | 115 |
|
1294 | 116 |
[Class variables:] |
71 | 117 |
|
2647 | 118 |
ErrorSignal <Signal> Signal raised for error/error: messages |
119 |
also, parent of all other signals. |
|
120 |
||
121 |
HaltSignal <Signal> Signal raised for halt/halt: messages |
|
122 |
||
123 |
MessageNotUnderstoodSignal Signals raised for various error conditions |
|
124 |
UserInterruptSignal |
|
125 |
RecursionInterruptSignal |
|
126 |
ExceptionInterruptSignal |
|
127 |
SubscriptOutOfBoundsSignal |
|
128 |
NonIntegerIndexSignal |
|
129 |
NotFoundSignal |
|
130 |
KeyNotFoundSignal |
|
131 |
ElementOutOfBoundsSignal |
|
132 |
InformationSignal |
|
133 |
WarningSignal |
|
134 |
DeepCopyErrorSignal |
|
135 |
InternalErrorSignal |
|
136 |
||
137 |
AbortSignal <Signal> Signal raised by debugger, to abort a computation |
|
138 |
BUT, the debugger will only raise it if it is handled. |
|
139 |
By handling the abortSignal, you can control where the |
|
140 |
debuggers abort-function resumes execution in case of |
|
141 |
an error. |
|
142 |
||
143 |
ErrorRecursion <Boolean> controls behavior when recursive errors occur (i.e. |
|
144 |
an error while handling an error). |
|
145 |
||
146 |
Dependencies <WeakDependencyDictionary> |
|
147 |
keeps track of object dependencies. |
|
148 |
||
149 |
InfoPrinting <Boolean> controls weather informational messages |
|
150 |
are printed. |
|
151 |
||
152 |
ActivityNotificationSignal <QuerySignal> |
|
153 |
raised on #activityNotification: |
|
154 |
||
155 |
NonWeakDependencies <Dictionary> keeps track of object dependencies. |
|
156 |
Dependents stay alive. |
|
157 |
||
158 |
SynchronizationSemaphores <WeakIdentityDictionary> |
|
159 |
Semaphores for per-object-monitor. |
|
2295 | 160 |
|
1294 | 161 |
|
162 |
[author:] |
|
2647 | 163 |
Claus Gittinger |
1294 | 164 |
|
71 | 165 |
" |
166 |
! ! |
|
1 | 167 |
|
1788 | 168 |
!Object class methodsFor:'initialization'! |
1 | 169 |
|
170 |
initialize |
|
171 |
"called only once - initialize signals" |
|
172 |
||
173 |
ErrorSignal isNil ifTrue:[ |
|
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
174 |
"/ have a chicken & egg problem here; |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
175 |
"/ signal wants object to be initialized, |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
176 |
"/ Object needs the genericSignal from Signal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
177 |
"/ So, make certain that on exists here. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
178 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
179 |
Signal initGenericSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
180 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
181 |
ErrorSignal := Signal genericSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
182 |
ErrorSignal nameClass:self message:#errorSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
183 |
ErrorSignal notifierString:'error encountered'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
184 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
185 |
HaltSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
186 |
HaltSignal nameClass:self message:#haltSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
187 |
HaltSignal notifierString:'halt encountered'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
188 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
189 |
MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
190 |
MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
191 |
MessageNotUnderstoodSignal notifierString:'message not understood'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
192 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
193 |
PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
194 |
PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
195 |
PrimitiveFailureSignal notifierString:'primitive failed'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
196 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
197 |
InternalErrorSignal := ErrorSignal newSignalMayProceed:false. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
198 |
InternalErrorSignal nameClass:self message:#internalErrorSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
199 |
InternalErrorSignal notifierString:'VM internal error: '. |
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
200 |
|
362 | 201 |
"/ UserInterruptSignal := ErrorSignal newSignalMayProceed:true. |
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
202 |
UserInterruptSignal := (Signal new) mayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
203 |
UserInterruptSignal nameClass:self message:#userInterruptSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
204 |
UserInterruptSignal notifierString:'user Interrupt'. |
159 | 205 |
|
362 | 206 |
"/ RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false. |
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
207 |
RecursionInterruptSignal := (Signal new) mayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
208 |
RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
209 |
RecursionInterruptSignal notifierString:'recursion limit reached'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
210 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
211 |
ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
212 |
ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
213 |
ExceptionInterruptSignal notifierString:'exception Interrupt'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
214 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
215 |
NotFoundSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
216 |
NotFoundSignal nameClass:self message:#notFoundSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
217 |
NotFoundSignal notifierString:'no such element'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
218 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
219 |
IndexNotFoundSignal := NotFoundSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
220 |
IndexNotFoundSignal nameClass:self message:#indexNotFoundSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
221 |
IndexNotFoundSignal notifierString:'bad index: '. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
222 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
223 |
SubscriptOutOfBoundsSignal := IndexNotFoundSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
224 |
SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
225 |
SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
226 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
227 |
ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
228 |
ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
229 |
ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
230 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
231 |
KeyNotFoundSignal := NotFoundSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
232 |
KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
233 |
KeyNotFoundSignal notifierString:'no such key: '. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
234 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
235 |
NonIntegerIndexSignal := IndexNotFoundSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
236 |
NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
237 |
NonIntegerIndexSignal notifierString:'index must be integer'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
238 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
239 |
UserNotificationSignal := QuerySignal new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
240 |
UserNotificationSignal nameClass:self message:#userNotificationSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
241 |
UserNotificationSignal notifierString:'user notifiaction wanted'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
242 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
243 |
InformationSignal := UserNotificationSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
244 |
InformationSignal nameClass:self message:#informationSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
245 |
InformationSignal notifierString:'information'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
246 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
247 |
WarningSignal := UserNotificationSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
248 |
WarningSignal nameClass:self message:#warnungSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
249 |
WarningSignal notifierString:'warning'. |
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 |
ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
252 |
ActivityNotificationSignal nameClass:self message:#activityNotificationSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
253 |
ActivityNotificationSignal notifierString:'activity'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
254 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
255 |
DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
256 |
DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
257 |
DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'. |
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 |
" |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
260 |
AbortSignal is not a child of ErrorSignal - |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
261 |
this would complicate abort from within a signal handler |
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 |
AbortSignal := Signal genericSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
264 |
AbortSignal nameClass:self message:#abortSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
265 |
AbortSignal notifierString:'unhandled abort signal'. |
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 |
" |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
268 |
OSSignalInterruptSignal is not a child of ErrorSignal - |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
269 |
it requires explicit catching. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
270 |
If unhandled, a debugger is entered. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
271 |
" |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
272 |
OSSignalInterruptSignal := Signal genericSignal newSignalMayProceed:true. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
273 |
OSSignalInterruptSignal nameClass:self message:#osSignalInterruptSignal. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
274 |
OSSignalInterruptSignal notifierString:'OS signal interrupt'. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
275 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
276 |
ObjectAttributes isNil ifTrue:[ |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
277 |
ObjectAttributes := WeakIdentityDictionary new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
278 |
]. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
279 |
|
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
280 |
Dependencies isNil ifTrue:[ |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
281 |
Dependencies := WeakDependencyDictionary new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
282 |
]. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
283 |
NonWeakDependencies isNil ifTrue:[ |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
284 |
NonWeakDependencies := IdentityDictionary new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
285 |
]. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
286 |
SynchronizationSemaphores isNil ifTrue:[ |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
287 |
SynchronizationSemaphores := WeakIdentityDictionary new. |
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
288 |
]. |
356 | 289 |
]. |
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
290 |
|
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
291 |
"/ initialize InfoPrinting to the VM's infoPrint setting |
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
292 |
"/ (which can be turned off via a command line argument) |
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
293 |
InfoPrinting := ObjectMemory infoPrinting. |
1 | 294 |
|
295 |
"Object initialize" |
|
812
00db9c0646fe
notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents:
783
diff
changeset
|
296 |
|
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
297 |
"Modified: / 22.1.1998 / 21:23:40 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
298 |
"Modified: / 3.2.1998 / 18:55:09 / cg" |
3999
57e83b6efee1
SubscriptOutOfBounds signal is raised proceedable,
Stefan Vogel <sv@exept.de>
parents:
3994
diff
changeset
|
299 |
"Modified: / 24.2.1999 / 11:40:04 / stefan" |
1 | 300 |
! ! |
301 |
||
3175
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
302 |
!Object class methodsFor:'ST80 compatibility'! |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
303 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
304 |
rootError |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
305 |
"return the signal used for error/error: - handling. |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
306 |
Same as errorSignal for ST80 compatibility." |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
307 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
308 |
^ ErrorSignal |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
309 |
|
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
310 |
"Created: / 15.1.1998 / 23:47:05 / stefan" |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
311 |
! ! |
b0181a625671
#rootError for ST80 compatibility (same as errorSignal)
Stefan Vogel <sv@exept.de>
parents:
3159
diff
changeset
|
312 |
|
1788 | 313 |
!Object class methodsFor:'Signal constants'! |
1 | 314 |
|
783 | 315 |
abortSignal |
316 |
"return the signal used to abort user actions. This signal is only |
|
2689 | 317 |
raised if caught (by the debugger), and will lead way out of the |
783 | 318 |
currently active doIt/printIt or inspectIt. (also some others use |
319 |
this for a save abort)" |
|
320 |
||
321 |
^ AbortSignal |
|
579
2d26193415b5
allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
322 |
! |
2d26193415b5
allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
323 |
|
782 | 324 |
activityNotificationSignal |
325 |
"return the signal used for activity notifications. |
|
326 |
A handler for this signal gets all #activityNotification: sends" |
|
327 |
||
328 |
^ ActivityNotificationSignal |
|
329 |
! |
|
330 |
||
159 | 331 |
deepCopyErrorSignal |
332 |
"return the signal raised when a deepcopy is asked for |
|
333 |
an object which cannot do this (for example, BlockClosures |
|
334 |
or Contexts)." |
|
335 |
||
336 |
^ DeepCopyErrorSignal |
|
337 |
! |
|
338 |
||
783 | 339 |
elementOutOfBoundsSignal |
340 |
"return the signal used for element error reporting |
|
341 |
(this signal is used for example when a value not in 0..255 is to |
|
342 |
be put into a bytearray)" |
|
343 |
||
344 |
^ ElementOutOfBoundsSignal |
|
345 |
! |
|
346 |
||
347 |
errorSignal |
|
348 |
"return the signal used for error/error: - handling" |
|
349 |
||
350 |
^ ErrorSignal |
|
351 |
! |
|
352 |
||
353 |
exceptionInterruptSignal |
|
354 |
"return the signal used for exception (display errors) error handling" |
|
355 |
||
356 |
^ ExceptionInterruptSignal |
|
357 |
! |
|
358 |
||
359 |
haltSignal |
|
360 |
"return the signal used for halt/halt: - handling" |
|
361 |
||
362 |
^ HaltSignal |
|
363 |
! |
|
364 |
||
3101
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
365 |
indexNotFoundSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
366 |
"return the signal used for bad index error reporting. |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
367 |
This is also the parentSignal of the nonIntegerIndex- and |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
368 |
subscriptOutOfBoundsSignal" |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
369 |
|
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
370 |
^ IndexNotFoundSignal |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
371 |
|
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
372 |
"Created: / 8.11.1997 / 19:15:48 / cg" |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
373 |
! |
6bb441e14a95
added indexNotFoundSignal (ST80 compat)
Claus Gittinger <cg@exept.de>
parents:
3078
diff
changeset
|
374 |
|
783 | 375 |
informationSignal |
376 |
"return the signal used for informations. |
|
377 |
A handler for this signal gets all #information: sends" |
|
378 |
||
379 |
^ InformationSignal |
|
380 |
! |
|
381 |
||
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
382 |
internalErrorSignal |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
383 |
"return the signal used to report internal (VM-) errors." |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
384 |
|
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
385 |
^ InternalErrorSignal |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
386 |
! |
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
387 |
|
783 | 388 |
keyNotFoundSignal |
389 |
"return the signal used for no such key error reporting" |
|
390 |
||
391 |
^ KeyNotFoundSignal |
|
392 |
! |
|
393 |
||
394 |
messageNotUnderstoodSignal |
|
395 |
"return the signal used for doesNotUnderstand: - error handling" |
|
396 |
||
397 |
^ MessageNotUnderstoodSignal |
|
398 |
! |
|
399 |
||
400 |
nonIntegerIndexSignal |
|
401 |
"return the signal used for bad subscript error reporting" |
|
402 |
||
403 |
^ NonIntegerIndexSignal |
|
404 |
! |
|
405 |
||
406 |
notFoundSignal |
|
407 |
"return the signal used for no element found error reporting" |
|
408 |
||
409 |
^ NotFoundSignal |
|
410 |
! |
|
411 |
||
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
412 |
osSignalInterruptSignal |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
413 |
"return the signal used for OS-signal error reporting; |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
414 |
This is only raised if handled - otherwise, a debugger is entered." |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
415 |
|
3557
b7eb2a1cb593
oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents:
3466
diff
changeset
|
416 |
^ OSSignalInterruptSignal |
b7eb2a1cb593
oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents:
3466
diff
changeset
|
417 |
|
b7eb2a1cb593
oops OSSignalInterruptSignal
Claus Gittinger <cg@exept.de>
parents:
3466
diff
changeset
|
418 |
"Modified: / 12.6.1998 / 16:27:26 / cg" |
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
419 |
! |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
420 |
|
783 | 421 |
primitiveFailureSignal |
422 |
"return the signal used for primitiveFailed - error handling" |
|
423 |
||
424 |
^ PrimitiveFailureSignal |
|
425 |
! |
|
426 |
||
427 |
privateMethodSignal |
|
428 |
"return the signal used for privateMethod - error handling" |
|
429 |
||
430 |
^ MessageNotUnderstoodSignal |
|
431 |
! |
|
432 |
||
433 |
recursionInterruptSignal |
|
434 |
"return the signal used for recursion overflow error handling" |
|
435 |
||
436 |
^ RecursionInterruptSignal |
|
437 |
! |
|
438 |
||
439 |
subscriptOutOfBoundsSignal |
|
440 |
"return the signal used for subscript error reporting. |
|
441 |
(this signal is used for example when an array is accessed with an |
|
442 |
index less than 1 or greater than the array size)" |
|
443 |
||
444 |
^ SubscriptOutOfBoundsSignal |
|
445 |
! |
|
446 |
||
447 |
userInterruptSignal |
|
448 |
"return the signal used for ^C interrupts handling" |
|
449 |
||
450 |
^ UserInterruptSignal |
|
451 |
! |
|
452 |
||
453 |
userNotificationSignal |
|
454 |
"the parent signal used with information and warnings. |
|
455 |
Handling this allows handling of both information- and warning notifications." |
|
456 |
||
457 |
^ UserNotificationSignal |
|
458 |
! |
|
459 |
||
460 |
warningSignal |
|
461 |
"return the signal used for warnings. |
|
462 |
A handler for this signal gets all #warn: sends" |
|
463 |
||
464 |
^ WarningSignal |
|
1 | 465 |
! ! |
466 |
||
1788 | 467 |
!Object class methodsFor:'info messages'! |
356 | 468 |
|
783 | 469 |
infoPrinting |
470 |
"return the flag which controls information messages." |
|
471 |
||
472 |
^ InfoPrinting |
|
473 |
! |
|
474 |
||
356 | 475 |
infoPrinting:aBoolean |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
476 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
477 |
|
356 | 478 |
"turn on/off printing of information messages. |
479 |
If the argument, aBoolean is false, infoPrint will not output |
|
480 |
messages. The default is true." |
|
481 |
||
482 |
InfoPrinting := aBoolean |
|
483 |
! ! |
|
484 |
||
1788 | 485 |
!Object class methodsFor:'queries'! |
3 | 486 |
|
487 |
isBuiltInClass |
|
49 | 488 |
"return true, if this class is known by the run-time-system, |
489 |
i.e. you cannot add/remove instance variables without recompiling |
|
1266 | 490 |
the VM. |
491 |
Here, true is returned for myself, false for subclasses." |
|
3 | 492 |
|
493 |
^ self == Object |
|
1266 | 494 |
|
495 |
"Modified: 23.4.1996 / 16:00:07 / cg" |
|
3 | 496 |
! ! |
497 |
||
1 | 498 |
!Object methodsFor:'accessing'! |
499 |
||
500 |
at:index |
|
501 |
"return the indexed instance variable with index, anInteger; |
|
502 |
this method can be redefined in subclasses." |
|
503 |
||
504 |
^ self basicAt:index |
|
505 |
! |
|
506 |
||
783 | 507 |
at:index put:anObject |
508 |
"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
|
509 |
this method can be redefined in subclasses. Returns anObject (sigh)" |
783 | 510 |
|
511 |
^ self basicAt:index put:anObject |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
512 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
513 |
"Modified: 19.4.1996 / 11:13:29 / cg" |
783 | 514 |
! |
515 |
||
1 | 516 |
basicAt:index |
517 |
"return the indexed instance variable with index, anInteger. |
|
518 |
Trigger an error if the receiver has no indexed instance variables. |
|
2148 | 519 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
1 | 520 |
|
521 |
%{ /* NOCONTEXT */ |
|
522 |
||
329 | 523 |
REGISTER int nbytes, indx; |
1 | 524 |
OBJ myClass; |
329 | 525 |
REGISTER char *pFirst; |
1 | 526 |
unsigned char *cp; |
527 |
unsigned short *sp; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
528 |
short *ssp; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
529 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
530 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
531 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
532 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
533 |
#endif |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
534 |
unsigned int32 *lp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
535 |
int32 *slp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
536 |
unsigned int32 ul; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
537 |
int32 l; |
1 | 538 |
OBJ *op; |
329 | 539 |
REGISTER int n; |
1 | 540 |
|
541 |
/* |
|
56 | 542 |
* notice the missing test for self being a nonNilObject - |
1 | 543 |
* this can be done since basicAt: is defined both in UndefinedObject |
544 |
* and SmallInteger |
|
545 |
*/ |
|
253 | 546 |
if (__isSmallInteger(index)) { |
2647 | 547 |
myClass = __qClass(self); |
548 |
indx = __intVal(index) - 1; |
|
549 |
n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
|
550 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */); |
|
551 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
552 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
|
553 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
554 |
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
|
555 |
case __MASKSMALLINT(POINTERARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
556 |
case __MASKSMALLINT(WKPOINTERARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
557 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
558 |
* pointers |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
559 |
*/ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
560 |
if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
561 |
op = (OBJ *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
562 |
RETURN ( *op ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
563 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
564 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
565 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
566 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
567 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
568 |
* (unsigned) bytes |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
569 |
*/ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
570 |
if ((unsigned)indx < nbytes) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
571 |
cp = (unsigned char *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
572 |
RETURN ( __MKSMALLINT(*cp & 0xFF) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
573 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
574 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
575 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
576 |
case __MASKSMALLINT(FLOATARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
577 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
578 |
* native floats |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
579 |
*/ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
580 |
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
|
581 |
float *fp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
582 |
OBJ v; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
583 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
584 |
fp = (float *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
585 |
__qMKSFLOAT(v, *fp); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
586 |
RETURN (v); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
587 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
588 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
589 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
590 |
case __MASKSMALLINT(DOUBLEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
591 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
592 |
* native doubles |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
593 |
*/ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
594 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
595 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
596 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
597 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
598 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
599 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
600 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
601 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
602 |
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
|
603 |
double *dp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
604 |
OBJ v; |
1 | 605 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
606 |
dp = (double *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
607 |
__qMKFLOAT(v, *dp); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
608 |
RETURN (v); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
609 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
610 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
611 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
612 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
613 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
614 |
* unsigned 16bit ints |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
615 |
*/ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
616 |
/* Notice: the hard coded shifts are by purpose; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
617 |
* it makes us independent of the short-size of the machine |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
618 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
619 |
if ((unsigned)indx < (nbytes>>1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
620 |
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
|
621 |
RETURN ( __MKSMALLINT(*sp & 0xFFFF) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
622 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
623 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
624 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
625 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
626 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
627 |
* signed 16bit ints |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
628 |
*/ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
629 |
/* Notice: the hard coded shifts are by purpose; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
630 |
* it makes us independent of the short-size of the machine |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
631 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
632 |
if ((unsigned)indx < (nbytes>>1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
633 |
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
|
634 |
RETURN ( __MKSMALLINT(*ssp) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
635 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
636 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
637 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
638 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
639 |
/* |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
640 |
* unsigned 32bit ints |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
641 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
642 |
/* Notice: the hard coded shifts are by purpose; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
643 |
* it makes us independent of the int-size of the machine |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
644 |
*/ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
645 |
if ((unsigned)indx < (nbytes>>2)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
646 |
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
|
647 |
ul = *lp; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
648 |
#ifdef alpha64 |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
649 |
RETURN ( __MKSMALLINT(ul) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
650 |
#else |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
651 |
if (ul <= _MAX_INT) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
652 |
RETURN ( __MKSMALLINT(ul) ); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
653 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
654 |
RETURN ( __MKULARGEINT(ul) ); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
655 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
656 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
657 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
658 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
659 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
660 |
/* |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
661 |
* signed 32bit ints |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
662 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
663 |
/* Notice: the hard coded shifts are by purpose; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
664 |
* it makes us independent of the int-size of the machine |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
665 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
666 |
if ((unsigned)indx < (nbytes>>2)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
667 |
slp = (int32 *)(pFirst + (indx<<2)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
668 |
l = *slp; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
669 |
#ifdef alpha64 |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
670 |
RETURN ( __MKSMALLINT(l) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
671 |
#else |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
672 |
if (__ISVALIDINTEGER(l)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
673 |
RETURN ( __MKSMALLINT(l) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
674 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
675 |
RETURN ( __MKLARGEINT(l) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
676 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
677 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
678 |
break; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
679 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
680 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
681 |
/* |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
682 |
* signed 64bit longlongs |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
683 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
684 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
685 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
686 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
687 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
688 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
689 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
690 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
691 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
692 |
/* Notice: the hard coded shifts are by purpose; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
693 |
* it makes us independent of the long/longlong-size of the machine |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
694 |
*/ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
695 |
if ((unsigned)indx < (nbytes>>3)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
696 |
#ifdef alpha64 |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
697 |
INT *slp, ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
698 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
699 |
slp = (INT *)(pFirst + (indx<<3)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
700 |
ll = *slp; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
701 |
if (__ISVALIDINTEGER(ll)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
702 |
RETURN ( __MKSMALLINT(ll) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
703 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
704 |
RETURN ( __MKLARGEINT(ll) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
705 |
#else |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
706 |
__int64__ *llp; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
707 |
extern OBJ __MKINT64(); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
708 |
|
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
709 |
llp = (__int64__ *)(pFirst + (indx<<3)); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
710 |
RETURN (__MKINT64(llp)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
711 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
712 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
713 |
break; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
714 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
715 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
716 |
/* |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
717 |
* unsigned 64bit longlongs |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
718 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
719 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
720 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
721 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
722 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
723 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
724 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
725 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
726 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
727 |
/* Notice: the hard coded shifts are by purpose; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
728 |
* it makes us independent of the long/longlong-size of the machine |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
729 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
730 |
if ((unsigned)indx < (nbytes>>3)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
731 |
#ifdef alpha64 |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
732 |
unsigned INT *slp, ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
733 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
734 |
slp = (unsigned INT *)(pFirst + (indx<<3)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
735 |
ll = *slp; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
736 |
if (ul <= _MAX_INT) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
737 |
RETURN ( __MKSMALLINT(ul) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
738 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
739 |
RETURN ( __MKULARGEINT(ul) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
740 |
#else |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
741 |
__uint64__ *llp; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
742 |
extern OBJ __MKUINT64(); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
743 |
|
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
744 |
llp = (__uint64__ *)(pFirst + (indx<<3)); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
745 |
RETURN (__MKUINT64(llp)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
746 |
#endif |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
747 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
748 |
break; |
2647 | 749 |
} |
1 | 750 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
751 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
752 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
753 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
754 |
%}. |
10 | 755 |
index isInteger ifFalse:[ |
2647 | 756 |
^ self indexNotInteger |
1 | 757 |
]. |
159 | 758 |
^ self subscriptBoundsError:index |
1 | 759 |
! |
760 |
||
761 |
basicAt:index put:anObject |
|
762 |
"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
|
763 |
Returns anObject (sigh). |
1 | 764 |
Trigger an error if the receiver has no indexed instance variables. |
2148 | 765 |
|
766 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
|
1 | 767 |
|
768 |
%{ /* NOCONTEXT */ |
|
769 |
||
770 |
register int nbytes, indx; |
|
771 |
OBJ myClass; |
|
772 |
register char *pFirst; |
|
773 |
char *cp; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
774 |
unsigned short *sp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
775 |
short *ssp; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
776 |
#ifdef alpha64 |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
777 |
# define int32 int |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
778 |
#else |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
779 |
# define int32 long |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
780 |
#endif |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
781 |
unsigned int32 *lp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
782 |
int32 *slp; |
3922
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
783 |
__uint64__ *llp; |
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
784 |
__int64__ *sllp; |
1 | 785 |
OBJ *op; |
329 | 786 |
/* int nInstBytes, ninstvars, flags; */ |
787 |
REGISTER int n; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
788 |
unsigned int u; |
1 | 789 |
int val; |
790 |
||
56 | 791 |
/* notice the missing test for self being a nonNilObject - |
77 | 792 |
this can be done since basicAt: is defined both in UndefinedObject |
1 | 793 |
and SmallInteger */ |
794 |
||
253 | 795 |
if (__isSmallInteger(index)) { |
2647 | 796 |
indx = __intVal(index) - 1; |
797 |
myClass = __qClass(self); |
|
798 |
n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
|
799 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */); |
|
800 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
801 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
|
802 |
||
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
803 |
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
|
804 |
case __MASKSMALLINT(POINTERARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
805 |
case __MASKSMALLINT(WKPOINTERARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
806 |
if ((unsigned)indx < (__BYTES2OBJS__(nbytes))) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
807 |
op = (OBJ *)pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
808 |
*op = anObject; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
809 |
__STORE(self, anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
810 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
811 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
812 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
813 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
814 |
case __MASKSMALLINT(BYTEARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
815 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
816 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
817 |
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
|
818 |
if ((unsigned)indx < nbytes) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
819 |
cp = pFirst + indx; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
820 |
*cp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
821 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
822 |
} |
2647 | 823 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
824 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
825 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
826 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
827 |
case __MASKSMALLINT(FLOATARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
828 |
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
|
829 |
float *fp; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
830 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
831 |
fp = (float *)pFirst + indx; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
832 |
if (anObject != nil) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
833 |
if (! __isSmallInteger(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
834 |
if (__qIsFloatLike(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
835 |
*fp = (float)(__floatVal(anObject)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
836 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
837 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
838 |
if (__qIsShortFloat(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
839 |
*fp = __shortFloatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
840 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
841 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
842 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
843 |
*fp = (float) __intVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
844 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
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 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
847 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
848 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
849 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
850 |
case __MASKSMALLINT(DOUBLEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
851 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
852 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
853 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
854 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
855 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
856 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
857 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
858 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
859 |
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
|
860 |
double *dp; |
13 | 861 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
862 |
dp = (double *)pFirst + indx; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
863 |
if (anObject != nil) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
864 |
if (! __isSmallInteger(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
865 |
if (__qIsFloatLike(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
866 |
*dp = __floatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
867 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
868 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
869 |
if (__qIsShortFloat(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
870 |
*dp = (double)__shortFloatVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
871 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
872 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
873 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
874 |
*dp = (double) __intVal(anObject); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
875 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
876 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
877 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
878 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
879 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
880 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
881 |
case __MASKSMALLINT(WORDARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
882 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
883 |
val = __intVal(anObject); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
884 |
if ((unsigned)val <= 0xFFFF) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
885 |
if ((unsigned)indx < (nbytes>>1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
886 |
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
|
887 |
*sp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
888 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
889 |
} |
2647 | 890 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
891 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
892 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
893 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
894 |
case __MASKSMALLINT(SWORDARRAY): |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
895 |
if (__isSmallInteger(anObject)) { |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
896 |
val = __intVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
897 |
if ((val >= -32768) && (val < 32768)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
898 |
if ((unsigned)indx < (nbytes>>1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
899 |
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
|
900 |
*ssp = val; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
901 |
RETURN ( anObject ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
902 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
903 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
904 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
905 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
906 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
907 |
case __MASKSMALLINT(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
908 |
if ((unsigned)indx < (nbytes>>2)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
909 |
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
|
910 |
if (__isSmallInteger(anObject)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
911 |
*slp = __intVal(anObject); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
912 |
RETURN ( anObject ); |
2647 | 913 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
914 |
n = __signedLongIntVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
915 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
916 |
* 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
|
917 |
* (would be a smallInteger) |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
918 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
919 |
if (n) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
920 |
*slp = n; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
921 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
922 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
923 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
924 |
break; |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
925 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
926 |
case __MASKSMALLINT(LONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
927 |
if ((unsigned)indx < (nbytes>>2)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
928 |
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
|
929 |
if (anObject == __MKSMALLINT(0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
930 |
*lp = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
931 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
932 |
} |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
933 |
u = __longIntVal(anObject); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
934 |
/* |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
935 |
* 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
|
936 |
* (would be a smallInteger) |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
937 |
*/ |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
938 |
if (u) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
939 |
*lp = u; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
940 |
RETURN ( anObject ); |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
941 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
942 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
943 |
break; |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
944 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
945 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
946 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
947 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
948 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
949 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
950 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
951 |
nbytes -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
952 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
953 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
954 |
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
|
955 |
__int64__ ll; |
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
956 |
|
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
957 |
sllp = (__int64__ *)(pFirst + (indx<<3)); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
958 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
959 |
if (anObject == __MKSMALLINT(0)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
960 |
ll.lo = ll.hi = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
961 |
*sllp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
962 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
963 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
964 |
if (__signedLong64IntVal(anObject, &ll)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
965 |
*sllp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
966 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
967 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
968 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
969 |
break; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
970 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
971 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
972 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
973 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
974 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
975 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
976 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
977 |
nbytes -= delta; |
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 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
980 |
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
|
981 |
__uint64__ ll; |
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
982 |
|
5a5c50c5027a
oops __int64 is already def'd on some systems
Claus Gittinger <cg@exept.de>
parents:
3921
diff
changeset
|
983 |
llp = (__uint64__ *)(pFirst + (indx<<3)); |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
984 |
if (anObject == __MKSMALLINT(0)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
985 |
ll.lo = ll.hi = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
986 |
*llp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
987 |
RETURN ( anObject ); |
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 (__unsignedLong64IntVal(anObject, &ll)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
990 |
*llp = ll; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
991 |
RETURN ( anObject ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
992 |
} |
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 |
break; |
2647 | 995 |
} |
1 | 996 |
} |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
997 |
|
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
998 |
# undef int32 |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
999 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1000 |
%}. |
10 | 1001 |
index isInteger ifFalse:[ |
2647 | 1002 |
" |
1003 |
the index should be an integer number |
|
1004 |
" |
|
1005 |
^ self indexNotInteger |
|
1 | 1006 |
]. |
1007 |
(index between:1 and:self size) ifFalse:[ |
|
2647 | 1008 |
" |
1009 |
the index is less than 1 or greater than the size of the |
|
1010 |
receiver collection |
|
1011 |
" |
|
1012 |
^ self subscriptBoundsError:index |
|
1 | 1013 |
]. |
643 | 1014 |
(self class isFloatsOrDoubles) ifTrue:[ |
2647 | 1015 |
anObject isNumber ifTrue:[ |
1016 |
^ self basicAt:index put:(anObject asFloat) |
|
1017 |
] |
|
13 | 1018 |
]. |
10 | 1019 |
anObject isInteger ifFalse:[ |
2647 | 1020 |
" |
1021 |
the object to put into the receiver collection |
|
1022 |
should be an integer number |
|
1023 |
" |
|
1024 |
^ self elementNotInteger |
|
2 | 1025 |
]. |
159 | 1026 |
" |
213 | 1027 |
the object to put into the receiver collection |
362 | 1028 |
is not an instance of the expected element class, |
1029 |
or the value is not within the elements valid range. |
|
159 | 1030 |
" |
2 | 1031 |
^ self elementBoundsError |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1032 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1033 |
"Modified: 19.4.1996 / 11:14:10 / cg" |
1 | 1034 |
! |
1035 |
||
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1036 |
byteAt:index |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1037 |
"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
|
1038 |
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
|
1039 |
(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
|
1040 |
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
|
1041 |
collection of bytes. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1042 |
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
|
1043 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1044 |
%{ /* NOCONTEXT */ |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1045 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1046 |
REGISTER int indx; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1047 |
int nIndex; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1048 |
REGISTER OBJ slf; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1049 |
REGISTER OBJ cls; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1050 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1051 |
if (__isSmallInteger(index)) { |
2647 | 1052 |
slf = self; |
1053 |
if (__isNonNilObject(slf)) { |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1054 |
unsigned char *pFirst; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1055 |
int nIndex; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1056 |
|
2647 | 1057 |
cls = __qClass(slf); |
1058 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1059 |
pFirst = __ByteArrayInstPtr(slf)->ba_element; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1060 |
pFirst += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1061 |
nIndex = __byteArraySize(slf); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1062 |
indx = __intVal(index) - 1; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1063 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1064 |
switch ((INT)(__ClassInstPtr(cls)->c_flags) & __MASKSMALLINT(ARRAYMASK)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1065 |
case __MASKSMALLINT(DOUBLEARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1066 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1067 |
if ((INT)pFirst & (__DOUBLE_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1068 |
int delta = __DOUBLE_ALIGN - ((INT)pFirst & (__DOUBLE_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1069 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1070 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1071 |
nIndex -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1072 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1073 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1074 |
/* fall into */ |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1075 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1076 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1077 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1078 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1079 |
case __MASKSMALLINT(SLONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1080 |
case __MASKSMALLINT(FLOATARRAY): |
2647 | 1081 |
if ((unsigned)indx < (unsigned)nIndex) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1082 |
RETURN ( __MKSMALLINT( pFirst[indx]) ); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1083 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1084 |
break; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1085 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1086 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1087 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1088 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1089 |
if ((INT)pFirst & (__LONGLONG_ALIGN-1)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1090 |
int delta = __LONGLONG_ALIGN - ((INT)pFirst & (__LONGLONG_ALIGN-1)); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1091 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1092 |
pFirst += delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1093 |
nIndex -= delta; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1094 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1095 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1096 |
if ((unsigned)indx < (unsigned)nIndex) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1097 |
RETURN ( __MKSMALLINT( pFirst[indx]) ); |
2647 | 1098 |
} |
1099 |
break; |
|
1100 |
} |
|
1101 |
} |
|
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1102 |
} |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1103 |
%}. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1104 |
"/ 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
|
1105 |
"/ 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
|
1106 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1107 |
^ self primitiveFailed |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1108 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1109 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1110 |
Point new byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1111 |
(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
|
1112 |
(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
|
1113 |
(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
|
1114 |
'hello' byteAt:1 |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1115 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1116 |
! |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1117 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1118 |
byteAt:index put:byteValue |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1119 |
"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
|
1120 |
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
|
1121 |
(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
|
1122 |
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
|
1123 |
collection of bytes. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1124 |
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
|
1125 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1126 |
%{ /* NOCONTEXT */ |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1127 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1128 |
REGISTER int indx; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1129 |
int val, nIndex; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1130 |
REGISTER OBJ slf; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1131 |
REGISTER OBJ cls; |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1132 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1133 |
if (__bothSmallInteger(index, byteValue)) { |
2647 | 1134 |
val = __intVal(byteValue); |
1135 |
if ((unsigned)(val) <= 0xFF /* i.e. (val >= 0) && (val <= 255) */) { |
|
1136 |
slf = self; |
|
1137 |
if (__isNonNilObject(slf)) { |
|
1138 |
cls = __qClass(slf); |
|
1139 |
||
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1140 |
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
|
1141 |
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
|
1142 |
case __MASKSMALLINT(BYTEARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1143 |
case __MASKSMALLINT(WORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1144 |
case __MASKSMALLINT(LONGARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1145 |
case __MASKSMALLINT(SWORDARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1146 |
case __MASKSMALLINT(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1147 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
1148 |
case __MASKSMALLINT(SLONGLONGARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1149 |
case __MASKSMALLINT(FLOATARRAY): |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
1150 |
case __MASKSMALLINT(DOUBLEARRAY): |
2647 | 1151 |
indx += __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars)); |
1152 |
nIndex = __byteArraySize(slf); |
|
1153 |
if ((unsigned)indx < (unsigned)nIndex) { |
|
1154 |
__ByteArrayInstPtr(slf)->ba_element[indx] = val; |
|
1155 |
RETURN ( byteValue ); |
|
1156 |
} |
|
1157 |
break; |
|
1158 |
} |
|
1159 |
} |
|
1160 |
} |
|
2574
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1161 |
} |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1162 |
%}. |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1163 |
"/ 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
|
1164 |
"/ 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
|
1165 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1166 |
^ self primitiveFailed |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1167 |
|
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1168 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1169 |
(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
|
1170 |
'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
|
1171 |
" |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1172 |
! |
3df87ac8838c
added #byteAt: / #byteAt:put: to access any non-pointer objects
Claus Gittinger <cg@exept.de>
parents:
2511
diff
changeset
|
1173 |
|
1 | 1174 |
instVarAt:index |
1175 |
"return a non-indexed instance variable; |
|
13 | 1176 |
peeking into an object this way is not very object oriented |
1177 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 1178 |
|
1179 |
%{ /* NOCONTEXT */ |
|
1180 |
||
1181 |
OBJ myClass; |
|
1182 |
int idx, ninstvars; |
|
1183 |
||
253 | 1184 |
if (__isSmallInteger(index)) { |
329 | 1185 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
1186 |
idx = __intVal(index) - 1; |
357 | 1187 |
/* |
1188 |
* do not allow return of non-object fields. |
|
1189 |
* if subclass did not make privisions for that, |
|
1190 |
* we wont do so here ... |
|
1191 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1192 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 1193 |
if (idx == 0) { |
1194 |
RETURN ( nil ) |
|
1195 |
} |
|
1196 |
} |
|
1133 | 1197 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
159 | 1198 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 1199 |
RETURN ( __InstPtr(self)->i_instvars[idx] ); |
159 | 1200 |
} |
1 | 1201 |
} |
1202 |
%} |
|
1203 |
. |
|
1204 |
index isInteger ifFalse:[ |
|
159 | 1205 |
^ self indexNotInteger |
1 | 1206 |
]. |
159 | 1207 |
^ self subscriptBoundsError:index |
1 | 1208 |
! |
1209 |
||
1210 |
instVarAt:index put:value |
|
1211 |
"change a non-indexed instance variable; |
|
13 | 1212 |
peeking into an object this way is not very object oriented |
1213 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 1214 |
|
1215 |
%{ /* NOCONTEXT */ |
|
1216 |
||
1217 |
OBJ myClass; |
|
1218 |
int idx, ninstvars; |
|
1219 |
||
253 | 1220 |
if (__isSmallInteger(index)) { |
329 | 1221 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
1222 |
idx = __intVal(index) - 1; |
1133 | 1223 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
357 | 1224 |
/* |
1225 |
* do not allow setting of non-object fields. |
|
1226 |
* if subclass did not make privisions for that, |
|
1227 |
* we wont do so here ... |
|
1228 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
1229 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 1230 |
if (idx == 0) { |
1231 |
RETURN ( nil ) |
|
1232 |
} |
|
1233 |
} |
|
159 | 1234 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 1235 |
__InstPtr(self)->i_instvars[idx] = value; |
159 | 1236 |
__STORE(self, value); |
1237 |
RETURN ( value ); |
|
1238 |
} |
|
1 | 1239 |
} |
1240 |
%} |
|
1241 |
. |
|
1242 |
index isInteger ifFalse:[ |
|
159 | 1243 |
^ self indexNotInteger |
1 | 1244 |
]. |
159 | 1245 |
^ self subscriptBoundsError:index |
359 | 1246 |
! |
1247 |
||
1248 |
instVarNamed:name |
|
1249 |
"return a non-indexed instance variables value by name; |
|
1250 |
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
|
1251 |
- 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
|
1252 |
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
|
1253 |
parsed ad runtime)" |
359 | 1254 |
|
1255 |
^ 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
|
1256 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1257 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1258 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1259 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1260 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1261 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1262 |
p instVarNamed:'x' |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1263 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1264 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1265 |
"Modified: 19.4.1996 / 11:12:39 / cg" |
359 | 1266 |
! |
1267 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1268 |
instVarNamed:name ifAbsent:exceptionBlock |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1269 |
"return a non-indexed instance variables value by name, |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1270 |
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
|
1271 |
peeking into an object this way is not very object oriented |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1272 |
- 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
|
1273 |
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
|
1274 |
parsed ad runtime)" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1275 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1276 |
|idx| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1277 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1278 |
idx := self class instVarOffsetOf:name. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1279 |
idx isNil ifTrue:[^ exceptionBlock value]. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1280 |
^ self instVarAt:idx |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1281 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1282 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1283 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1284 |
|p| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1285 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1286 |
p := Point x:10 y:20. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1287 |
p instVarNamed:'x' |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1288 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1289 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1290 |
"Created: 6.7.1996 / 23:02:49 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1291 |
"Modified: 6.7.1996 / 23:03:41 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1292 |
! |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
1293 |
|
359 | 1294 |
instVarNamed:name put:value |
1295 |
"set a non-indexed instance variable by name; |
|
1296 |
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
|
1297 |
- 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
|
1298 |
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
|
1299 |
parsed ad runtime)" |
359 | 1300 |
|
1301 |
^ 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
|
1302 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1303 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1304 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1305 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1306 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1307 |
p instVarNamed:'x' put:30. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1308 |
p |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1309 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1310 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1311 |
"Modified: 19.4.1996 / 11:12:49 / cg" |
1 | 1312 |
! ! |
1313 |
||
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1314 |
!Object methodsFor:'attributes access'! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1315 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1316 |
objectAttributeAt:key |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1317 |
"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
|
1318 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1319 |
| attrs | |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1320 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1321 |
attrs := self objectAttributes. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1322 |
(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
|
1323 |
^ attrs at:key ifAbsent:[] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1324 |
]. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1325 |
^ nil |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1326 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1327 |
"Created: / 22.1.1998 / 21:29:17 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1328 |
"Modified: / 3.2.1998 / 18:55:55 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1329 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1330 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1331 |
objectAttributeAt:key put:anObject |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1332 |
"store the attribute anObject referenced by key into the receiver" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1333 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1334 |
|wasBlocked| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1335 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1336 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1337 |
"/ is possibly accessed from multiple threads ... |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1338 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1339 |
wasBlocked := OperatingSystem blockInterrupts. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1340 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1341 |
| attrs | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1342 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1343 |
attrs := self objectAttributes. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1344 |
(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
|
1345 |
attrs := WeakIdentityDictionary new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1346 |
attrs at:key put:anObject. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1347 |
self objectAttributes:attrs. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1348 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1349 |
attrs at:key put:anObject. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1350 |
]. |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1351 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1352 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1353 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1354 |
] |
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 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1357 |
"Attaching additional attributes (slots) to an arbitrary object: |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1358 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1359 |
|p| |
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 |
p := Point new. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1362 |
p objectAttributeAt:#color put:#green. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1363 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1364 |
p objectAttributeAt:#color |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1365 |
" |
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 |
"Created: / 22.1.1998 / 21:29:25 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1368 |
"Modified: / 3.2.1998 / 18:57:58 / cg" |
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 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1371 |
objectAttributes |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1372 |
"return a Collection of attributes - nil if there is none. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1373 |
The default implementation here uses a global WeakDictionary to store |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1374 |
attributes |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1375 |
This may be too slow for high frequency slot access, |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1376 |
therefore, some classes may redefine this for better performance. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1377 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1378 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1379 |
^ ObjectAttributes at:self ifAbsent:[#()] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1380 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1381 |
"Created: / 22.1.1998 / 21:29:30 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1382 |
"Modified: / 3.2.1998 / 18:58:31 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1383 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1384 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1385 |
objectAttributes:aCollection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1386 |
"set the collection of attributes. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1387 |
The default implementation here uses a global Dictionary to store |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1388 |
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
|
1389 |
Therefore, some classes may redefine this for better performance." |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1390 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1391 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1392 |
"/ is possibly accessed from multiple threads. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1393 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1394 |
(OperatingSystem blockInterrupts) ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1395 |
"/ the common case - already blocked |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1396 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1397 |
(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
|
1398 |
ObjectAttributes removeKey:self ifAbsent:[] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1399 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1400 |
ObjectAttributes at:self put:aCollection |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1401 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1402 |
^ self |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1403 |
]. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1404 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1405 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1406 |
(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
|
1407 |
ObjectAttributes removeKey:self ifAbsent:[] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1408 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1409 |
ObjectAttributes at:self put:aCollection |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1410 |
]. |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1411 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1412 |
OperatingSystem unblockInterrupts |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1413 |
] |
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 |
"Created: / 22.1.1998 / 21:29:35 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1416 |
"Modified: / 3.2.1998 / 18:58:10 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1417 |
! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1418 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1419 |
removeObjectAttribute:anObject |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1420 |
"make the argument, anObject be no attribute of the receiver" |
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 |
|wasBlocked| |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1423 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1424 |
"/ must do this save from interrupts, since the attributes collection |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1425 |
"/ is possibly accessed from multiple threads. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1426 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1427 |
wasBlocked := OperatingSystem blockInterrupts. |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1428 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1429 |
|attrs n a| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1430 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1431 |
attrs := self objectAttributes. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1432 |
attrs notNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1433 |
attrs remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1434 |
attrs size == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1435 |
self objectAttributes:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1436 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1437 |
] |
3268
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1438 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1439 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
1440 |
OperatingSystem unblockInterrupts |
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 |
] |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1443 |
|
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1444 |
"Created: / 22.1.1998 / 21:29:39 / av" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1445 |
"Modified: / 3.2.1998 / 18:58:13 / cg" |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1446 |
! ! |
0974cb253cad
incorporated AV's objectAttributs
Claus Gittinger <cg@exept.de>
parents:
3259
diff
changeset
|
1447 |
|
783 | 1448 |
!Object methodsFor:'binary storage'! |
1449 |
||
1450 |
hasSpecialBinaryRepresentation |
|
1451 |
"return true, if the receiver has a special binary representation; |
|
1452 |
default here is false, but can be redefined in class which provide |
|
1453 |
their own storeBinary/readBinary methods. |
|
1454 |
||
1455 |
Normal user classes should not use this, it is meant as a hook for |
|
1456 |
special classes such as True, False, UndefinedObject or SmallInteger. |
|
1457 |
||
1458 |
If your instances should be stored in a special way, see |
|
1459 |
#representBinaryOn: and #readBinaryContentsFromdata:manager:." |
|
1460 |
||
1461 |
^ false |
|
1 | 1462 |
! |
1463 |
||
783 | 1464 |
readBinaryContentsFrom:stream manager:manager |
1465 |
"reconstruct the receivers instance variables by reading a binary |
|
1466 |
binary representation from stream. |
|
1467 |
This is a general implementation, walking over instances |
|
1468 |
and loading each recursively using manager. |
|
1469 |
Redefined by some classes to read a more compact representations |
|
1470 |
(see String, SmallInteger etc). |
|
1471 |
||
1472 |
Notice, that the object is already recreated as an empty corps |
|
1473 |
with instance variables all nil and bit-instances (bytes, words etc.) |
|
1474 |
already read and restored. |
|
1475 |
||
1476 |
Also notice: this method is not called for if a private representation |
|
1477 |
has been stored (see representBinaryOn:). |
|
1478 |
In that case, #readBinaryContentsFromData:manager: is called, which |
|
1479 |
has to be reimplemented in the objects class." |
|
1480 |
||
1481 |
|size "{ Class: SmallInteger }" |
|
1482 |
instvarArray| |
|
1483 |
||
1484 |
stream next == 1 ifTrue:[ |
|
1485 |
"/ |
|
1486 |
"/ special representation ... |
|
1487 |
"/ |
|
1488 |
instvarArray := Array new:(size := stream nextNumber:3). |
|
1489 |
1 to:size do:[:i | |
|
1490 |
instvarArray basicAt:i put:(manager nextObject) |
|
1491 |
]. |
|
1492 |
self readBinaryContentsFromData:instvarArray manager:manager. |
|
1493 |
^ self |
|
1494 |
]. |
|
1495 |
||
1496 |
"/ |
|
1497 |
"/ standard representation |
|
1498 |
"/ |
|
1499 |
size := self basicSize. |
|
1500 |
size ~~ 0 ifTrue:[ |
|
1501 |
self class isPointers ifTrue:[ |
|
1502 |
1 to:size do:[:i | |
|
1503 |
self basicAt:i put:(manager nextObject) |
|
1504 |
] |
|
1505 |
] |
|
1506 |
]. |
|
1507 |
size := self class instSize. |
|
1508 |
1 to:size do:[:i | |
|
1509 |
self instVarAt:i put:(manager nextObject) |
|
1510 |
]. |
|
1511 |
! |
|
1512 |
||
1513 |
readBinaryContentsFromData:instvarArray manager:manager |
|
1514 |
"reconstruct the receivers instance variables by filling instance |
|
1515 |
variables with values from instvarArray. This array contains the instvars |
|
1516 |
as specified in #representBinaryOn: when the object was stored. |
|
1517 |
It is the receivers responsibility to set its instance variables in the |
|
1518 |
same order from that array." |
|
1519 |
||
1520 |
^ self subclassResponsibility |
|
1521 |
||
1522 |
"typical implementation (see also comment in #representBinaryOn:) |
|
1523 |
(for an object with foo, bar and baz as instance variables, |
|
1524 |
which did not store baz and wants baz to be reinitialized to |
|
1525 |
some constant string) |
|
1526 |
||
1527 |
foo := instvarArray at:1. |
|
1528 |
bar := instvarArray at:2. |
|
1529 |
baz := 'aConstant'. |
|
1530 |
" |
|
1531 |
! |
|
1532 |
||
1533 |
representBinaryOn:manager |
|
1534 |
"this method is called by the storage manager to ask objects |
|
1535 |
if they wish to provide their own binary representation. |
|
1536 |
||
1537 |
If they want to do so, they should return an array containing all |
|
1538 |
instance variables (named & indexed pointer) to be stored. |
|
1539 |
If not redefined, this method returns nil which means that all |
|
1540 |
instance variables are to be stored. |
|
1541 |
||
1542 |
It should be redefined in objects which do not want all instance variables |
|
1543 |
to be stored (for example: objects which keep references to a view etc.). |
|
1544 |
||
1545 |
If this is redefined returning non-nil, the corresponding class needs |
|
1546 |
a redefined instance method named #readBinaryContentsFromData:manager: |
|
1547 |
which has to fill the receivers named (and optionally indexed pointer) |
|
1548 |
instance variables with corresponding values from a data array." |
|
1549 |
||
1550 |
^ nil |
|
1551 |
||
1552 |
"typical implementation: |
|
1553 |
(see also comment in #readBinaryContentsFromData:manager:) |
|
1554 |
for an object with foo, bar and baz as instance variables, |
|
1555 |
which does not want to store baz: |
|
1556 |
||
1557 |
representBinaryOn:manager |
|
1558 |
|data| |
|
1559 |
||
1560 |
data := Array new:2. |
|
1561 |
data at:1 put:foo. |
|
1562 |
data at:2 put:bar. |
|
1563 |
^ data |
|
1564 |
" |
|
159 | 1565 |
! |
1566 |
||
783 | 1567 |
storeBinaryDefinitionBodyOn:stream manager:manager |
1568 |
"append a binary representation of the receivers body onto stream. |
|
1569 |
This is a general implementation walking over instances storing |
|
1570 |
each recursively as an ID using manager. |
|
1571 |
Can be redefined in subclasses." |
|
1572 |
||
3078 | 1573 |
|basicSize "{ Class: SmallInteger }" |
1574 |
instSize "{ Class: SmallInteger }" |
|
1575 |
specialSize "{ Class: SmallInteger }" |
|
783 | 1576 |
myClass specialRep pointers| |
1577 |
||
1578 |
myClass := self class. |
|
1579 |
instSize := myClass instSize. |
|
1580 |
||
1581 |
(pointers := myClass isPointers) ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1582 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1583 |
"/ 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
|
1584 |
"/ also uncomment the corresponding line in |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1585 |
"/ Object>>binaryDefinitionFrom:manager: |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1586 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1587 |
"/ 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
|
1588 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1589 |
myClass isVariable ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1590 |
stream nextNumber:3 put:(basicSize := self basicSize) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1591 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1592 |
basicSize := 0 |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1593 |
]. |
783 | 1594 |
] ifFalse: [ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1595 |
stream nextNumber:4 put:(basicSize := self basicSize). |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1596 |
myClass isBytes ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1597 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1598 |
stream nextPut:(self basicAt:i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1599 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1600 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1601 |
myClass isWords ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1602 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1603 |
stream nextNumber:2 put:(self basicAt: i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1604 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1605 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1606 |
myClass isLongs ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1607 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1608 |
stream nextNumber:4 put:(self basicAt: i) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1609 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1610 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1611 |
myClass isFloats ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1612 |
"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
|
1613 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1614 |
Float storeBinaryIEEESingle:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1615 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1616 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1617 |
myClass isDoubles ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1618 |
"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
|
1619 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1620 |
Float storeBinaryIEEEDouble:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1621 |
] |
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 |
"/ should never be reached ... |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1624 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1625 |
manager putIdOf:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1626 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1627 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1628 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1629 |
] |
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 |
]. |
783 | 1632 |
]. |
1633 |
||
1634 |
(pointers or:[instSize ~~ 0]) ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1635 |
specialRep := self representBinaryOn:manager. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1636 |
specialRep notNil ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1637 |
specialSize := specialRep basicSize. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1638 |
stream nextPut:1. "/ means: private representation follows |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1639 |
stream nextNumber:3 put:specialSize. |
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 |
1 to:specialSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1642 |
manager putIdOf:(specialRep at:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1643 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1644 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1645 |
stream nextPut:0. "/ means: normal representation follows |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1646 |
"/ index pointers followed by named instanceVars |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1647 |
pointers ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1648 |
basicSize ~~ 0 ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1649 |
1 to:basicSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1650 |
manager putIdOf:(self basicAt:i) on:stream |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1651 |
]. |
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 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1654 |
instSize ~~ 0 ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1655 |
1 to:instSize do:[:i | |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1656 |
manager putIdOf:(self instVarAt: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 |
] |
1 | 1660 |
] |
783 | 1661 |
|
3078 | 1662 |
"Modified: / 2.11.1997 / 14:43:29 / cg" |
1 | 1663 |
! |
1664 |
||
783 | 1665 |
storeBinaryDefinitionOn:stream manager:manager |
1666 |
"append a binary representation of the receiver onto stream. |
|
1260 | 1667 |
This is an internal interface for binary storage mechanism. |
783 | 1668 |
This method first stores the class, then the body, which is done |
1669 |
in a separate method to allow redefinition of the bodies format. |
|
1670 |
Can be redefined in subclasses to write more compact representations |
|
1671 |
(see String, SmallInteger etc)." |
|
1672 |
||
1673 |
manager putIdOfClass:(self class) on:stream. |
|
1674 |
self storeBinaryDefinitionBodyOn:stream manager:manager |
|
1260 | 1675 |
|
1676 |
"Modified: 23.4.1996 / 09:31:12 / cg" |
|
783 | 1677 |
! |
1678 |
||
3078 | 1679 |
storeBinaryOn:aStreamOrFilename |
1680 |
"Writes a description of the receiver onto aStreamOrFilename, in a way that allows |
|
783 | 1681 |
the object's structure to be reconstructed from the stream's contents" |
1682 |
||
3078 | 1683 |
BinaryOutputManager store:self on:aStreamOrFilename |
899 | 1684 |
|
1685 |
" |
|
1686 |
|a s1 s2| |
|
1687 |
||
1688 |
s1 := 'hello'. |
|
1689 |
s2 := 'world'. |
|
1690 |
a := Array new:5. |
|
1691 |
a at:1 put:s1. |
|
1692 |
a at:2 put:s2. |
|
1693 |
a at:3 put:s1. |
|
1694 |
a at:4 put:s2. |
|
1695 |
a storeBinaryOn:'test.boss' |
|
1696 |
" |
|
1697 |
||
1698 |
" |
|
1699 |
(BinaryObjectStorage onOld:'test.boss' asFilename readStream) |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1700 |
next |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1701 |
inspect |
899 | 1702 |
" |
3078 | 1703 |
|
1704 |
"Modified: / 1.11.1997 / 21:16:24 / cg" |
|
783 | 1705 |
! |
1706 |
||
1707 |
storeBinaryOn:stream manager:manager |
|
1708 |
"append a binary representation of the receiver onto stream." |
|
1709 |
||
1710 |
manager putIdOf:self on:stream |
|
1 | 1711 |
! ! |
1712 |
||
1826 | 1713 |
!Object methodsFor:'change & update'! |
1 | 1714 |
|
783 | 1715 |
broadcast:aSelectorSymbol |
1716 |
"send a message with selector aSelectorSymbol to all my dependents" |
|
1717 |
||
1718 |
self dependentsDo:[:dependent | |
|
1719 |
dependent perform:aSelectorSymbol |
|
1720 |
] |
|
1721 |
! |
|
1722 |
||
1723 |
broadcast:aSelectorSymbol with:anArgument |
|
1724 |
"send a message with selector aSelectorSymbol with an additional |
|
1725 |
argument anArgument to all my dependents." |
|
1726 |
||
1727 |
self dependentsDo:[:dependent | |
|
1728 |
dependent perform:aSelectorSymbol with:anArgument |
|
1729 |
] |
|
1730 |
! |
|
1731 |
||
159 | 1732 |
changeRequest |
1733 |
"the receiver wants to change - check if all dependents |
|
1734 |
grant the request, and return true if so" |
|
1735 |
||
1736 |
self dependentsDo:[:dependent | |
|
1737 |
dependent updateRequest ifFalse:[^ false]. |
|
1738 |
]. |
|
1739 |
^ true |
|
1740 |
! |
|
1741 |
||
1742 |
changeRequest:aParameter |
|
1743 |
"the receiver wants to change - check if all dependents |
|
1744 |
grant the request, and return true if so" |
|
1745 |
||
1746 |
self dependentsDo:[:dependent | |
|
1747 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1748 |
]. |
|
1749 |
^ true |
|
1750 |
! |
|
1751 |
||
783 | 1752 |
changeRequest:aParameter from:anObject |
1753 |
"the receiver wants to change - check if all dependents |
|
1754 |
except anObject grant the request, and return true if so. |
|
1755 |
The argument anObject is typically going to be the one who is |
|
1756 |
about to send the change request." |
|
1757 |
||
1758 |
self dependentsDo:[:dependent | |
|
1759 |
dependent == anObject ifFalse:[ |
|
1760 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1761 |
] |
|
1762 |
]. |
|
1763 |
^ true |
|
1764 |
! |
|
1765 |
||
159 | 1766 |
changeRequestFrom:anObject |
1767 |
"the receiver wants to change - check if all dependents |
|
202 | 1768 |
except anObject grant the request, and return true if so. |
1769 |
The argument anObject is typically going to be the one who is |
|
1770 |
about to send the change request." |
|
159 | 1771 |
|
1772 |
self dependentsDo:[:dependent | |
|
1773 |
dependent == anObject ifFalse:[ |
|
1774 |
(dependent updateRequest) ifFalse:[^ false]. |
|
1775 |
] |
|
1776 |
]. |
|
1777 |
^ true |
|
1778 |
! |
|
1779 |
||
1 | 1780 |
changed |
1781 |
"notify all dependents that the receiver has changed. |
|
71 | 1782 |
Each dependent gets a '#update:'-message with the original |
1783 |
receiver as argument." |
|
1 | 1784 |
|
159 | 1785 |
self changed:nil |
1 | 1786 |
! |
1787 |
||
1788 |
changed:aParameter |
|
1789 |
"notify all dependents that the receiver has changed somehow. |
|
71 | 1790 |
Each dependent gets a '#update:'-message with aParameter |
1791 |
as argument." |
|
1 | 1792 |
|
159 | 1793 |
self changed:aParameter with:nil |
1 | 1794 |
! |
1795 |
||
71 | 1796 |
changed:aParameter with:anArgument |
1 | 1797 |
"notify all dependents that the receiver has changed somehow. |
159 | 1798 |
Each dependent gets a '#update:with:from:'-message, with aParameter |
71 | 1799 |
and anArgument as arguments." |
1 | 1800 |
|
159 | 1801 |
self dependentsDo:[:dependent | |
1802 |
dependent update:aParameter with:anArgument from:self |
|
1 | 1803 |
] |
1804 |
! |
|
1805 |
||
1806 |
update:aParameter |
|
71 | 1807 |
"the message is sent to a dependent, when one of the objects |
1808 |
on whom the receiver depends, has changed. The argument aParameter |
|
1809 |
is either the changed object or the argument to the #changed: message. |
|
1810 |
||
1811 |
Default behavior here is to do nothing" |
|
1 | 1812 |
|
1813 |
^ self |
|
1814 |
! |
|
1815 |
||
1816 |
update:aParameter with:anArgument |
|
1817 |
"dependent is notified of some change - |
|
159 | 1818 |
Default is to try update:" |
1 | 1819 |
|
1820 |
^ self update:aParameter |
|
1821 |
! |
|
1822 |
||
1823 |
update:aParameter with:anArgument from:sender |
|
1824 |
"dependent is notified of some change - |
|
159 | 1825 |
Default is to try update:with:" |
1 | 1826 |
|
1827 |
^ self update:aParameter with:anArgument |
|
159 | 1828 |
! |
1829 |
||
1830 |
updateRequest |
|
1831 |
"return true, if an update request is granted. |
|
1832 |
Default here is to grant updates - may be used |
|
1833 |
to lock updates if someone is making other changes |
|
202 | 1834 |
from within an update. Or if someone has locked its |
1835 |
state and does not want others to change things. |
|
1836 |
However, these dependents must all honor the |
|
1837 |
changeRequest - ifTrue - change protocol. I.e. they |
|
1838 |
must first ask all others via changeRequest, and only do the change |
|
1839 |
it returns true. The others must decide in updateRequest and |
|
1840 |
return true if they think a change is ok." |
|
159 | 1841 |
|
1842 |
^ true |
|
1843 |
! |
|
1844 |
||
1845 |
updateRequest:aSymbol |
|
1846 |
"return true, if an update request is granted. |
|
1847 |
Default here a simple updateRequest" |
|
1848 |
||
1849 |
^ self updateRequest |
|
1 | 1850 |
! ! |
1851 |
||
783 | 1852 |
!Object methodsFor:'cleanup'! |
1853 |
||
1854 |
lowSpaceCleanup |
|
1855 |
"ignored here - redefined in some classes to |
|
1856 |
cleanup in low-memory situations" |
|
1857 |
||
1858 |
^ self |
|
1859 |
! ! |
|
1860 |
||
1861 |
!Object methodsFor:'comparing'! |
|
1862 |
||
1863 |
= anObject |
|
3044 | 1864 |
"return true, if the receiver and the arg have the same structure. |
1865 |
Notice: |
|
1866 |
This method is partially open coded (inlined) by the compiler(s) |
|
1867 |
identical objects are always considered equal. |
|
1868 |
redefining it may not work as expected." |
|
783 | 1869 |
|
1870 |
^ self == anObject |
|
1871 |
! |
|
1872 |
||
1873 |
== anObject |
|
2505 | 1874 |
"return true, if the receiver and the arg are the same object. |
1875 |
Never redefine this in any class. |
|
3044 | 1876 |
Notice: |
1877 |
This method is open coded (inlined) by the compiler(s) |
|
1878 |
- redefining it may not work as expected." |
|
783 | 1879 |
|
1880 |
%{ /* NOCONTEXT */ |
|
1881 |
||
1882 |
RETURN ( (self == anObject) ? true : false ); |
|
1883 |
%} |
|
1884 |
! |
|
1885 |
||
1886 |
hash |
|
1887 |
"return an Integer useful as a hash key for the receiver. |
|
1888 |
This hash should return same values for objects with same |
|
1889 |
contents (i.e. use this to hash on structure)" |
|
1890 |
||
1891 |
^ self identityHash |
|
1892 |
! |
|
1893 |
||
1894 |
identityHash |
|
1895 |
"return an Integer useful as a hash key for the receiver. |
|
1896 |
This hash should return same values for the same object (i.e. use |
|
1897 |
this to hash on identity of objects). |
|
1898 |
||
1899 |
We cannot use the Objects address (as other smalltalks do) since |
|
1900 |
no object-table exists and the hashval must not change when objects |
|
1901 |
are moved by the collector. Therefore we assign each object a unique |
|
1902 |
Id in the object header itself as its hashed upon. |
|
1903 |
(luckily we have 11 bits spare to do this - unluckily its only 11 bits). |
|
1904 |
Time will show, if 11 bits are enough; if not, another entry in the |
|
1905 |
object header will be needed, adding 4 bytes to every object. Alternatively, |
|
1906 |
hashed-upon objects could add an instvar containing the hash value." |
|
1907 |
||
1908 |
%{ /* NOCONTEXT */ |
|
1909 |
||
1910 |
REGISTER unsigned hash; |
|
1911 |
static unsigned nextHash = 0; |
|
1912 |
||
1913 |
if (__isNonNilObject(self)) { |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1914 |
hash = __GET_HASH(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1915 |
if (hash == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1916 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1917 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1918 |
if (++nextHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1919 |
nextHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1920 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1921 |
hash = nextHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1922 |
__SET_HASH(self, hash); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1923 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1924 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1925 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1926 |
* now, we got 11 bits for hashing; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1927 |
* 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
|
1928 |
* 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
|
1929 |
* 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
|
1930 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1931 |
hash = __MAKE_HASH__(hash); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1932 |
RETURN ( __MKSMALLINT(hash) ); |
783 | 1933 |
} |
1934 |
%}. |
|
1935 |
^ 0 "never reached, since redefined in UndefinedObject and SmallInteger" |
|
1936 |
! |
|
1937 |
||
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1938 |
identityHashForBinaryStore |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1939 |
"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
|
1940 |
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
|
1941 |
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
|
1942 |
object writing phase." |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1943 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1944 |
%{ /* NOCONTEXT */ |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1945 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1946 |
REGISTER unsigned hash, hash1, hash2, sz; |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1947 |
OBJ o; |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1948 |
static unsigned nextHash = 0; |
2480 | 1949 |
static unsigned nextClassHash = 0; |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1950 |
|
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1951 |
if (__isNonNilObject(self)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1952 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1953 |
* my own identityHash |
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 |
hash1 = __GET_HASH(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1956 |
if (hash1 == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1957 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1958 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1959 |
if (++nextHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1960 |
nextHash = 1; |
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 |
hash1 = nextHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1963 |
__SET_HASH(self, hash1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1964 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1965 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1966 |
* my classes identityHash |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1967 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1968 |
o = __qClass(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1969 |
hash2 = __GET_HASH(o); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1970 |
if (hash2 == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1971 |
/* has no hash yet */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1972 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1973 |
if (++nextClassHash > __MAX_HASH__) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1974 |
nextClassHash = 1; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1975 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1976 |
hash2 = nextClassHash; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1977 |
__SET_HASH(o, hash2); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1978 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1979 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1980 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1981 |
* some bits of my size |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1982 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1983 |
sz = __qSize(self); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1984 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1985 |
/* |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1986 |
* 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
|
1987 |
* 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
|
1988 |
* 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
|
1989 |
* 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
|
1990 |
*/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1991 |
hash = (hash1 << 11) | hash2; /* 22 bits */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1992 |
hash = (hash << 8) | (sz & 0xFC); /* 30 bits */ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1993 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1994 |
while ((hash & 0x20000000) == 0) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1995 |
hash <<= 1; |
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 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
1998 |
RETURN ( __MKSMALLINT(hash) ); |
2479
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
1999 |
} |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2000 |
%}. |
2480 | 2001 |
^ 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
|
2002 |
! |
6d9c516e04d8
added special hash for binaryStorage
Claus Gittinger <cg@exept.de>
parents:
2478
diff
changeset
|
2003 |
|
783 | 2004 |
isNil |
3044 | 2005 |
"return true, if the receiver is nil. |
2006 |
Notice: |
|
2007 |
This method is open coded (inlined) by the compiler(s) |
|
2008 |
- redefining it may not work as expected." |
|
783 | 2009 |
|
2010 |
^ false |
|
2011 |
! |
|
2012 |
||
2013 |
notNil |
|
3044 | 2014 |
"return true, if the receiver is not nil. |
2015 |
Notice: |
|
2016 |
This method is open coded (inlined) by the compiler(s) |
|
2017 |
- redefining it may not work as expected." |
|
783 | 2018 |
|
2019 |
^ true |
|
2020 |
! |
|
2021 |
||
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2022 |
sameContentsAs:anObject |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2023 |
"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
|
2024 |
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
|
2025 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2026 |
|myClass otherClass |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2027 |
sz "{ Class: SmallInteger }" | |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2028 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2029 |
myClass := self class. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2030 |
myClass isVariable ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2031 |
sz := self basicSize. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2032 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2033 |
"compare the indexed variables" |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2034 |
1 to:sz do:[:i | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2035 |
(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
|
2036 |
] |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2037 |
]. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2038 |
|
3385 | 2039 |
"compare the instance variables" |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2040 |
sz := myClass instSize. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2041 |
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
|
2042 |
(self instVarAt:i) ~~ (anObject instVarAt:i) ifTrue:[^ false]. |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2043 |
]. |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2044 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2045 |
^ true |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2046 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2047 |
" |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2048 |
#(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
|
2049 |
(1@2) sameContentsAsIn:(1->2) |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2050 |
" |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2051 |
|
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2052 |
"Created: / 21.4.1998 / 15:56:40 / cg" |
3385 | 2053 |
"Modified: / 21.4.1998 / 15:58:15 / cg" |
3384
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2054 |
! |
b0f2f2aca95f
added #sameContentsAs: (helper for MessageTracer)
Claus Gittinger <cg@exept.de>
parents:
3380
diff
changeset
|
2055 |
|
783 | 2056 |
~= anObject |
3044 | 2057 |
"return true, if the receiver and the arg do not have the same structure. |
2058 |
Notice: |
|
2059 |
This method is partially open coded (inlined) by the compiler(s) |
|
2060 |
identical objects are never considered unequal. |
|
2061 |
redefining it may not work as expected." |
|
783 | 2062 |
|
2063 |
^ (self = anObject) not |
|
2064 |
! |
|
2065 |
||
2066 |
~~ anObject |
|
2505 | 2067 |
"return true, if the receiver and the arg are not the same object. |
2068 |
Never redefine this in any class. |
|
3044 | 2069 |
Notice: |
2070 |
This method is open coded (inlined) by the compiler(s) |
|
2071 |
- redefining it may not work as expected." |
|
783 | 2072 |
|
2073 |
%{ /* NOCONTEXT */ |
|
2074 |
RETURN ( (self == anObject) ? false : true ); |
|
2075 |
%} |
|
2076 |
! ! |
|
2077 |
||
2078 |
!Object methodsFor:'converting'! |
|
2079 |
||
3007 | 2080 |
-> anObject |
2081 |
"return an association with the receiver as key and |
|
2082 |
the argument as value" |
|
2083 |
||
2084 |
^ Association key:self value:anObject |
|
2085 |
! |
|
2086 |
||
783 | 2087 |
asValue |
2088 |
"return a valueHolder for for the receiver" |
|
2089 |
||
2090 |
^ ValueHolder with:self |
|
2091 |
! ! |
|
2092 |
||
2093 |
!Object methodsFor:'copying'! |
|
2094 |
||
2095 |
copy |
|
2096 |
"return a copy of the receiver - defaults to shallowcopy here. |
|
2097 |
Notice, that copy does not copy dependents." |
|
2098 |
||
2099 |
^ self shallowCopy postCopy |
|
2100 |
! |
|
2101 |
||
2102 |
deepCopy |
|
2103 |
"return a copy of the object with all subobjects also copied. |
|
2104 |
This method DOES handle cycles/self-refs; however the receivers |
|
2105 |
class is not copied (to avoid the 'total' copy). |
|
2106 |
This deepCopy is a bit slower than the old (unsecure) one, since it |
|
2107 |
keeps track of already copied objects. If you are sure, that your |
|
1129 | 2108 |
copied object does not include duplicates (or you do not care) and |
783 | 2109 |
no cycles, you can use the old simpleDeepCopy, which avoids this overhead, |
2110 |
but may run into trouble. |
|
2111 |
Notice, that copy does not copy dependents." |
|
2112 |
||
2113 |
^ self deepCopyUsing:(IdentityDictionary new) |
|
2114 |
||
2115 |
"an example which is not handled by the old deepCopy: |
|
2116 |
||
2117 |
|a| |
|
2118 |
a := Array new:3. |
|
2119 |
a at:3 put:a. |
|
2120 |
a deepCopy inspect |
|
2121 |
" |
|
1129 | 2122 |
|
2123 |
"Modified: 27.3.1996 / 16:31:20 / stefan" |
|
783 | 2124 |
! |
2125 |
||
2126 |
deepCopyError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2127 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2128 |
|
783 | 2129 |
"raise a signal, that deepCopy is not allowed for this object" |
2130 |
||
2131 |
^ DeepCopyErrorSignal raise |
|
2132 |
! |
|
2133 |
||
2134 |
deepCopyUsing:aDictionary |
|
2135 |
"a helper for deepCopy; return a copy of the object with |
|
2136 |
all subobjects also copied. If the to-be-copied object is in the dictionary, |
|
2137 |
use the value found there. The class of the receiver is not copied. |
|
2138 |
This method DOES handle cycles/self references." |
|
2139 |
||
2140 |
|myClass aCopy |
|
2141 |
sz "{ Class: SmallInteger }" |
|
2142 |
iOrig iCopy| |
|
2143 |
||
2144 |
myClass := self class. |
|
2145 |
myClass isVariable ifTrue:[ |
|
2146 |
sz := self basicSize. |
|
2147 |
aCopy := myClass basicNew:sz. |
|
2148 |
] ifFalse:[ |
|
2149 |
sz := 0. |
|
2150 |
aCopy := myClass basicNew |
|
2151 |
]. |
|
2152 |
aCopy setHashFrom:self. |
|
2153 |
||
2154 |
aDictionary at:self put:aCopy. |
|
143 | 2155 |
|
2156 |
" |
|
783 | 2157 |
copy indexed instvars - if any |
2158 |
" |
|
2159 |
sz ~~ 0 ifTrue:[ |
|
2160 |
myClass isBits ifTrue:[ |
|
2161 |
"block-copy indexed instvars" |
|
2162 |
aCopy replaceFrom:1 to:sz with:self startingAt:1 |
|
2163 |
] ifFalse:[ |
|
2164 |
"individual deep copy the indexed variables" |
|
2165 |
1 to:sz do:[:i | |
|
2166 |
iOrig := self basicAt:i. |
|
2167 |
iOrig notNil ifTrue:[ |
|
2168 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
2169 |
iCopy := aDictionary at:iOrig |
|
2170 |
] ifFalse:[ |
|
2171 |
iCopy := iOrig deepCopyUsing:aDictionary. |
|
2172 |
]. |
|
2173 |
aCopy basicAt:i put:iCopy |
|
2174 |
] |
|
2175 |
] |
|
2176 |
] |
|
2177 |
]. |
|
2178 |
||
2179 |
" |
|
2180 |
copy the instance variables |
|
2181 |
" |
|
2182 |
sz := myClass instSize. |
|
2183 |
sz ~~ 0 ifTrue:[ |
|
2184 |
1 to:sz do:[:i | |
|
2185 |
iOrig := self instVarAt:i. |
|
2186 |
iOrig notNil ifTrue:[ |
|
2187 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
2188 |
iCopy := aDictionary at:iOrig |
|
2189 |
] ifFalse:[ |
|
2190 |
iCopy := iOrig deepCopyUsing:aDictionary. |
|
2191 |
]. |
|
2192 |
aCopy instVarAt:i put:iCopy |
|
2193 |
] |
|
2194 |
]. |
|
2195 |
]. |
|
2196 |
||
2197 |
^ aCopy |
|
2198 |
! |
|
2199 |
||
2200 |
postCopy |
|
2201 |
"this is for compatibility with ST-80 code, which uses postCopy for |
|
2202 |
cleanup after copying, while ST/X passes the original in postCopyFrom: |
|
2203 |
(see there)" |
|
2204 |
||
2205 |
^ self |
|
2206 |
! |
|
2207 |
||
2208 |
setHashFrom:anObject |
|
2209 |
"set my identity-hash key to be the same as anObjects hash key. |
|
2210 |
This is an ST/X speciality, which is NOT available in other (especially OT based) |
|
2211 |
Smalltalks, and may not be available in future ST/X versions. |
|
2212 |
DO NEVER use this for normal application code." |
|
2213 |
||
2214 |
%{ /* NOCONTEXT */ |
|
2215 |
||
2216 |
REGISTER unsigned h; |
|
2217 |
||
2218 |
if (__isNonNilObject(self) && __isNonNilObject(anObject)) { |
|
2219 |
h = __GET_HASH(anObject); |
|
2220 |
__SET_HASH(self, h); |
|
2221 |
RETURN (self); |
|
2222 |
} |
|
2647 | 2223 |
%}. |
783 | 2224 |
self primitiveFailed "neither receiver not arg may be nil or SmallInteger" |
2225 |
! |
|
2226 |
||
2227 |
shallowCopy |
|
2228 |
"return a copy of the object with shared subobjects (a shallow copy) |
|
2229 |
i.e. the copy shares referenced instvars with its original." |
|
2230 |
||
2647 | 2231 |
%{ /* NOCONTEXT */ |
2232 |
int ninsts, spc; |
|
2233 |
int sz; |
|
3066 | 2234 |
OBJ theCopy; |
2647 | 2235 |
OBJ cls; |
2236 |
int flags; |
|
2237 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2238 |
cls = __qClass(self); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2239 |
flags = __intVal(__ClassInstPtr(cls)->c_flags); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2240 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2241 |
/* |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2242 |
* bail out for special objects .. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2243 |
*/ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2244 |
if (((flags & ~ARRAYMASK) == 0) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2245 |
&& ((flags & ARRAYMASK) != WKPOINTERARRAY)) { |
2652 | 2246 |
sz = __qSize(self); |
3078 | 2247 |
__PROTECT__(self); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2248 |
__qNew(theCopy, sz); /* OBJECT ALLOCATION */ |
3078 | 2249 |
__UNPROTECT__(self); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2250 |
if (theCopy) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2251 |
cls = __qClass(self); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2252 |
spc = __qSpace(theCopy); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2253 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2254 |
theCopy->o_class = cls; __STORE_SPC(theCopy, cls, spc); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2255 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2256 |
sz = sz - OHDR_SIZE; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2257 |
if (sz) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2258 |
char *src, *dst; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2259 |
|
3066 | 2260 |
src = (char *)(__InstPtr(self)->i_instvars); |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2261 |
dst = (char *)(__InstPtr(theCopy)->i_instvars); |
2647 | 2262 |
#ifdef bcopy4 |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2263 |
{ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2264 |
/* care for odd-number of longs */ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2265 |
int nW = sz >> 2; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2266 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2267 |
if (sz & 3) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2268 |
nW++; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2269 |
} |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2270 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2271 |
bcopy4(src, dst, nW); |
2647 | 2272 |
} |
2273 |
#else |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2274 |
bcopy(src, dst, sz); |
2647 | 2275 |
#endif |
2276 |
||
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2277 |
flags &= ARRAYMASK; |
2652 | 2278 |
if (flags == POINTERARRAY) { |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2279 |
ninsts = __BYTES2OBJS__(sz); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2280 |
} else { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2281 |
ninsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2282 |
} |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2283 |
if (ninsts) { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2284 |
do { |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2285 |
OBJ el; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2286 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2287 |
el = __InstPtr(theCopy)->i_instvars[ninsts-1]; |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2288 |
__STORE_SPC(theCopy, el, spc); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2289 |
} while (--ninsts); |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2290 |
} |
2647 | 2291 |
} |
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2292 |
RETURN (theCopy); |
2647 | 2293 |
} |
2294 |
} |
|
2295 |
%}. |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2296 |
"/ fallBack for special objects & memoryAllocation failure case |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2297 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2298 |
^ self slowShallowCopy |
783 | 2299 |
! |
2300 |
||
2301 |
shallowCopyForFinalization |
|
2302 |
"this is used to aquire a copy to be used for finalization - |
|
2303 |
(the copy will get a dispose-notification; see the documentation in the Registry class) |
|
2304 |
This method can be redefined for more efficient copying - especially for large objects." |
|
2305 |
||
2306 |
^ self shallowCopy |
|
2307 |
! |
|
2308 |
||
2309 |
simpleDeepCopy |
|
2310 |
"return a copy of the object with all subobjects also copied. |
|
2311 |
This method does NOT handle cycles - but is included to allow this |
|
2312 |
slightly faster copy in situations where it is known that |
|
2313 |
no recursive references occur (LargeIntegers for example). |
|
2314 |
NOTICE: you will run into trouble, when trying this with recursive |
|
2315 |
objects (usually recursionInterrupt or memory-alert). |
|
2316 |
This method corresponds to the 'traditional' deepCopy found in |
|
2317 |
the Blue book." |
|
2318 |
||
2319 |
|myClass aCopy |
|
2320 |
sz "{ Class: SmallInteger }" | |
|
2321 |
||
2322 |
myClass := self class. |
|
2323 |
myClass isVariable ifTrue:[ |
|
2324 |
sz := self basicSize. |
|
2325 |
aCopy := myClass basicNew:sz. |
|
2326 |
||
2327 |
"copy the indexed variables" |
|
2328 |
1 to:sz do:[:i | |
|
2329 |
aCopy basicAt:i put:((self basicAt:i) simpleDeepCopy) |
|
2330 |
] |
|
2331 |
] ifFalse:[ |
|
2332 |
aCopy := myClass basicNew |
|
2333 |
]. |
|
2334 |
||
2335 |
"copy the instance variables" |
|
2336 |
sz := myClass instSize. |
|
2337 |
1 to:sz do:[:i | |
|
2338 |
aCopy instVarAt:i put:((self instVarAt:i) simpleDeepCopy) |
|
2339 |
]. |
|
2340 |
||
2341 |
^ aCopy |
|
2342 |
||
2343 |
"a bad example (but ST/X should survive ...)" |
|
2344 |
" |
|
2345 |
|a| |
|
2346 |
a := Array new:3. |
|
2347 |
a at:3 put:a. |
|
2348 |
a simpleDeepCopy |
|
2349 |
" |
|
2651
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2350 |
! |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2351 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2352 |
slowShallowCopy |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2353 |
"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
|
2354 |
i.e. the copy shares referenced instvars with its original. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2355 |
This method is only invoked as a fallback from #shallowCopy." |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2356 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2357 |
|myClass aCopy |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2358 |
sz "{ Class: SmallInteger }" | |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2359 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2360 |
myClass := self class. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2361 |
myClass isVariable ifTrue:[ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2362 |
sz := self basicSize. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2363 |
aCopy := myClass basicNew:sz. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2364 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2365 |
"copy the indexed variables" |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2366 |
1 to:sz do:[:i | |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2367 |
aCopy basicAt:i put:(self basicAt:i) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2368 |
] |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2369 |
] ifFalse:[ |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2370 |
aCopy := myClass basicNew |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2371 |
]. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2372 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2373 |
"copy the instance variables" |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2374 |
sz := myClass instSize. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2375 |
1 to:sz do:[:i | |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2376 |
aCopy instVarAt:i put:(self instVarAt:i) |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2377 |
]. |
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2378 |
|
63087903a3e0
oops - shallowCopy was wrong
Claus Gittinger <cg@exept.de>
parents:
2647
diff
changeset
|
2379 |
^ aCopy |
783 | 2380 |
! ! |
2381 |
||
2382 |
!Object methodsFor:'debugging'! |
|
2383 |
||
2384 |
basicInspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2385 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2386 |
|
783 | 2387 |
"launch an inspector on the receiver. |
2388 |
this method should NOT be redefined in subclasses." |
|
2389 |
||
2390 |
Inspector isNil ifTrue:[ |
|
2647 | 2391 |
" |
2392 |
for systems without GUI |
|
2393 |
" |
|
2394 |
Transcript showCR:'no Inspector' |
|
783 | 2395 |
] ifFalse:[ |
2647 | 2396 |
Inspector openOn:self |
783 | 2397 |
] |
1417 | 2398 |
|
2399 |
"Modified: 18.5.1996 / 15:43:25 / cg" |
|
783 | 2400 |
! |
2401 |
||
2402 |
inspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2403 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2404 |
|
783 | 2405 |
"launch an inspector on the receiver. |
2406 |
this method (or better: inspectorClass) can be redefined in subclasses |
|
2407 |
to start special inspectors." |
|
2408 |
||
2409 |
|cls| |
|
2410 |
||
2411 |
cls := self inspectorClass. |
|
2412 |
cls isNil ifTrue:[ |
|
2413 |
^ self basicInspect |
|
2414 |
]. |
|
2415 |
cls openOn:self |
|
2416 |
||
2417 |
" |
|
2418 |
Object new inspect |
|
2419 |
(1 @ 2) inspect |
|
2420 |
Smalltalk inspect |
|
2421 |
#(1 2 3) asOrderedCollection inspect |
|
2422 |
(Color red) inspect |
|
2423 |
(Image fromFile:'bitmaps/garfield.gif') inspect |
|
143 | 2424 |
" |
71 | 2425 |
! |
2426 |
||
783 | 2427 |
inspectorClass |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2428 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2429 |
|
783 | 2430 |
"return the class to use for inspect. |
2431 |
Can (should) be redefined in classes for which a better inspector is available" |
|
2432 |
||
2433 |
^ Inspector |
|
2434 |
! |
|
2435 |
||
2436 |
mustBeKindOf:aClass |
|
2437 |
"for compatibility & debugging support: |
|
2438 |
check if the receiver isKindOf:aClass and raise an error if not. |
|
2439 |
Notice: |
|
2440 |
it is VERY questionable, if it makes sense to add manual |
|
2441 |
type checks to a dynamically typed language like smalltalk. |
|
2442 |
It will, at least, slow down performance, |
|
2443 |
make your code less reusable and clutter your code with stupid sends |
|
2444 |
of this selector. Also, read the comment in isKindOf:, regarding the |
|
2445 |
use of isXXX check methods. |
|
2446 |
You see: The author does not like this at all ..." |
|
2447 |
||
2448 |
(self isKindOf:aClass) ifFalse:[ |
|
2449 |
self error:'argument is not of expected type' |
|
2450 |
] |
|
2451 |
! |
|
2452 |
||
2453 |
obsoleteMethodWarning |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2454 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2455 |
|
783 | 2456 |
"in methods which are going to be obsoleted, a self send to |
2457 |
this method is used to tell programmers that a method is |
|
2458 |
used which is going to be removed in later ST/X versions. |
|
2459 |
Find all methods which will be obsolete soon by looking at senders |
|
2460 |
of this message. |
|
2461 |
Hopefully, this warning message is annoying enough for you to |
|
2462 |
change the code ... ;-)" |
|
2463 |
||
2464 |
self obsoleteMethodWarning:nil from:thisContext sender |
|
2465 |
! |
|
2466 |
||
2467 |
obsoleteMethodWarning:message |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2468 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2469 |
|
783 | 2470 |
"in methods which are going to be obsoleted, a self send to |
2471 |
this method is used to tell programmers that a method is |
|
2472 |
used which is going to be removed in later ST/X versions. |
|
2473 |
Find all methods which will be obsolete soon by looking at senders |
|
2474 |
of this message. |
|
2475 |
Hopefully, this warning message is annoying enough for you to |
|
2476 |
change the code ... ;-)" |
|
2477 |
||
2478 |
self obsoleteMethodWarning:message from:thisContext sender |
|
2479 |
! |
|
2480 |
||
2481 |
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
|
2482 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2483 |
|
783 | 2484 |
"in methods which are going to be obsoleted, a self-send to |
2485 |
this method is used to tell programmers that a method is |
|
2486 |
used which is going to be removed in later ST/X versions. |
|
2487 |
Find all methods which will be obsolete soon by looking at senders |
|
2488 |
of this message. |
|
2489 |
Hopefully, this warning message is annoying enough for you to |
|
2490 |
change the code ... ;-)" |
|
2491 |
||
2492 |
|spec| |
|
2493 |
||
2494 |
spec := aContext methodPrintString. |
|
2136 | 2495 |
('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintCR. |
2496 |
(' And may not be present in future ST/X versions.') errorPrintCR. |
|
2497 |
(' called from ' , aContext sender printString) errorPrintCR. |
|
783 | 2498 |
message notNil ifTrue:[ |
2647 | 2499 |
'------> ' errorPrint. message errorPrintCR |
783 | 2500 |
] |
2501 |
||
2502 |
" |
|
2503 |
Object obsoleteMethodWarning:'foo' from:thisContext sender sender |
|
2504 |
" |
|
2136 | 2505 |
|
2506 |
"Modified: 10.1.1997 / 19:08:42 / cg" |
|
783 | 2507 |
! ! |
2508 |
||
2509 |
!Object methodsFor:'dependents access'! |
|
2510 |
||
2511 |
addDependent:anObject |
|
2512 |
"make the argument, anObject be a dependent of the receiver" |
|
2513 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2514 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2515 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2516 |
"/ 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
|
2517 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2518 |
"/ 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
|
2519 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2520 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2521 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2522 |
[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2523 |
|deps dep| |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2524 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2525 |
deps := self dependents. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2526 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2527 |
"/ 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
|
2528 |
"/ many dependencies, we store a single dependent in |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2529 |
"/ 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
|
2530 |
"/ added. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2531 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2532 |
(deps isNil or:[deps size == 0]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2533 |
self dependents:(WeakArray with:anObject) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2534 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2535 |
deps class == WeakArray ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2536 |
dep := deps at:1. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2537 |
dep ~~ anObject ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2538 |
(dep isNil or:[dep == 0]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2539 |
deps at:1 put:anObject |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2540 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2541 |
self dependents:(WeakIdentitySet with:dep with:anObject) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2542 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2543 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2544 |
] ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2545 |
deps add:anObject |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2546 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2547 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2548 |
] valueNowOrOnUnwindDo:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2549 |
wasBlocked ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2550 |
OperatingSystem unblockInterrupts |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2551 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2552 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2553 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2554 |
"Modified: / 27.10.1997 / 19:35:52 / cg" |
783 | 2555 |
! |
2556 |
||
3309
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2557 |
breakDependents |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2558 |
"remove all dependencies from the receiver" |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2559 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2560 |
self dependents:nil. |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2561 |
self nonWeakDependents:nil |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2562 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2563 |
"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
|
2564 |
"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
|
2565 |
! |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2566 |
|
783 | 2567 |
dependents |
3222 | 2568 |
"return a Collection of dependents. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2569 |
The default implementation here uses a global WeakDictionary to store |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2570 |
dependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2571 |
This may be too slow for high frequency change&update, |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2572 |
therefore, some classes (Model) redefine this for better performance. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2573 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
783 | 2574 |
|
3222 | 2575 |
|deps| |
2576 |
||
2577 |
(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
|
2578 |
^ #(). |
3222 | 2579 |
]. |
2580 |
^ deps |
|
2581 |
||
2582 |
"Modified: / 26.1.1998 / 11:18:15 / cg" |
|
783 | 2583 |
! |
2584 |
||
2585 |
dependents:aCollection |
|
2586 |
"set the collection of dependents. |
|
2587 |
The default implementation here uses a global Dictionary to store |
|
2588 |
dependents which may be too slow for high frequency change&update. |
|
2589 |
Therefore, some classes (Model) redefine this for better performance." |
|
2590 |
||
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2591 |
"/ 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
|
2592 |
"/ 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
|
2593 |
"/ Used to use #valueUninterruptably here; inlined that code for slightly |
2336 | 2594 |
"/ faster execution (and to avoid creation of garbage blocks). |
2595 |
||
2596 |
(OperatingSystem blockInterrupts) ifTrue:[ |
|
2647 | 2597 |
"/ the common case - already blocked |
2598 |
||
2599 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
|
2600 |
Dependencies removeKey:self ifAbsent:[] |
|
2601 |
] ifFalse:[ |
|
2602 |
Dependencies at:self put:aCollection |
|
2603 |
]. |
|
2604 |
^ self |
|
2336 | 2605 |
]. |
2606 |
||
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2607 |
[ |
2647 | 2608 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
2609 |
Dependencies removeKey:self ifAbsent:[] |
|
2610 |
] ifFalse:[ |
|
2611 |
Dependencies at:self put:aCollection |
|
2612 |
]. |
|
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2613 |
] valueNowOrOnUnwindDo:[ |
2647 | 2614 |
OperatingSystem unblockInterrupts |
1624
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2615 |
] |
50c5849dc9d4
mhmh - care for dependent being already in the array,
Claus Gittinger <cg@exept.de>
parents:
1611
diff
changeset
|
2616 |
|
2336 | 2617 |
"Modified: 30.1.1997 / 21:22:10 / cg" |
783 | 2618 |
! |
2619 |
||
2620 |
dependentsDo:aBlock |
|
2621 |
"evaluate aBlock for all of my dependents" |
|
2622 |
||
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2623 |
|deps nwDeps| |
783 | 2624 |
|
2625 |
deps := self dependents. |
|
3222 | 2626 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2627 |
deps do:[:d | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2628 |
(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
|
2629 |
aBlock value:d |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2630 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2631 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2632 |
]. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2633 |
nwDeps := self nonWeakDependents. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2634 |
(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
|
2635 |
nwDeps do:aBlock |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2636 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2637 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2638 |
"Modified: / 30.1.1998 / 14:03:40 / cg" |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2639 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
2640 |
|
2445 | 2641 |
myDependents |
2642 |
"same as dependents - ST-80 compatibility" |
|
2643 |
||
2644 |
^ self dependents |
|
2645 |
! |
|
2646 |
||
783 | 2647 |
release |
3309
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2648 |
"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
|
2649 |
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
|
2650 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2651 |
self breakDependents |
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2652 |
|
3e24bdf9ba79
Define #breakDependents (ST80 compat, needed by STBroker).
Stefan Vogel <sv@exept.de>
parents:
3306
diff
changeset
|
2653 |
"Modified: / 27.2.1998 / 11:29:35 / stefan" |
783 | 2654 |
! |
2655 |
||
2656 |
removeDependent:anObject |
|
2657 |
"make the argument, anObject be independent of the receiver" |
|
2658 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2659 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2660 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2661 |
"/ 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
|
2662 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2663 |
"/ 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
|
2664 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2665 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2666 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2667 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2668 |
|deps n d| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2669 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2670 |
deps := self dependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2671 |
deps size ~~ 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2672 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2673 |
"/ 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
|
2674 |
"/ 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
|
2675 |
"/ 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
|
2676 |
"/ 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
|
2677 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2678 |
deps class == WeakArray ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2679 |
((d := deps at:1) == anObject |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2680 |
or:[d isNil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2681 |
or:[d == 0]]) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2682 |
self dependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2683 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2684 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2685 |
deps remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2686 |
(n := deps size) == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2687 |
self dependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2688 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2689 |
n == 1 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2690 |
d := deps firstIfEmpty:nil. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2691 |
d notNil ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2692 |
deps := WeakArray with:d |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2693 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2694 |
deps := nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2695 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2696 |
self dependents:deps. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2697 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2698 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2699 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2700 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2701 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2702 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2703 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2704 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2705 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2706 |
|
3228
b6b893e8f898
must look for size of value returned by self dependents
Claus Gittinger <cg@exept.de>
parents:
3222
diff
changeset
|
2707 |
"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
|
2708 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2709 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2710 |
!Object methodsFor:'dependents access (nonWeak)'! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2711 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2712 |
addNonWeakDependent:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2713 |
"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
|
2714 |
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
|
2715 |
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
|
2716 |
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
|
2717 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2718 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2719 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2720 |
"/ 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
|
2721 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2722 |
"/ 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
|
2723 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2724 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2725 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
2726 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2727 |
|deps dep| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2728 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2729 |
deps := self nonWeakDependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2730 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2731 |
"/ 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
|
2732 |
"/ 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
|
2733 |
"/ 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
|
2734 |
"/ added. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2735 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2736 |
deps size == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2737 |
self nonWeakDependents:(Array with:anObject) |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2738 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2739 |
deps class == Array ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2740 |
dep := deps at:1. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2741 |
dep ~~ anObject ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2742 |
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
|
2743 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2744 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2745 |
deps add:anObject |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2746 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2747 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2748 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2749 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2750 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2751 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2752 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2753 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2754 |
"Created: / 19.4.1996 / 10:54:08 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2755 |
"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
|
2756 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2757 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2758 |
nonWeakDependents |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2759 |
"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
|
2760 |
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
|
2761 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2762 |
NonWeakDependencies isNil ifTrue:[^ #()]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2763 |
^ NonWeakDependencies at:self ifAbsent:#() |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2764 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2765 |
"Created: / 19.4.1996 / 10:55:06 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2766 |
"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
|
2767 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2768 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2769 |
nonWeakDependents:aCollection |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2770 |
"set the collection of nonWeak dependents. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2771 |
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
|
2772 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2773 |
[ |
2647 | 2774 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
2775 |
NonWeakDependencies removeKey:self ifAbsent:[] |
|
2776 |
] ifFalse:[ |
|
2777 |
NonWeakDependencies at:self put:aCollection |
|
2778 |
] |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2779 |
] valueUninterruptably |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2780 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2781 |
"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
|
2782 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2783 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2784 |
removeNonWeakDependent:anObject |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2785 |
"remove a nonWeak dependency from the receiver to the argument, anObject. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2786 |
(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
|
2787 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2788 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2789 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2790 |
"/ 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
|
2791 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2792 |
"/ 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
|
2793 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2794 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2795 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2796 |
[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2797 |
|deps n| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2798 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2799 |
deps := self nonWeakDependents. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2800 |
deps size ~~ 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2801 |
deps class == Array ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2802 |
(deps at:1) == anObject ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2803 |
self nonWeakDependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2804 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2805 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2806 |
deps remove:anObject ifAbsent:[]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2807 |
(n := deps size) == 0 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2808 |
self nonWeakDependents:nil |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2809 |
] ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2810 |
n == 1 ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2811 |
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
|
2812 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2813 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2814 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2815 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2816 |
] valueNowOrOnUnwindDo:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2817 |
wasBlocked ifFalse:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2818 |
OperatingSystem unblockInterrupts |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
2819 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
2820 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2821 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2822 |
"Created: / 19.4.1996 / 11:44:44 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
2823 |
"Modified: / 30.1.1998 / 14:04:01 / cg" |
783 | 2824 |
! ! |
2825 |
||
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2826 |
!Object methodsFor:'displaying'! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2827 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2828 |
displayOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2829 |
"ST-80 Compatibility |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2830 |
display the receiver in a graphicsContext at 0@0 |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2831 |
- this method allows for any object to be displayed in some view |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2832 |
(although the fallBack is to display its printString ...)" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2833 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2834 |
^ self displayOn:aGC x:0 y:0. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2835 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2836 |
"Created: 29.5.1996 / 16:28:58 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2837 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2838 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2839 |
displayOn:aGC at:aPoint |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2840 |
"ST-80 Compatibility |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2841 |
display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2842 |
for any object to be displayed in a ListView - for example." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2843 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2844 |
^ self displayOn:aGC x:(aPoint x) y:(aPoint y). |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2845 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2846 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2847 |
displayOn:aGC x:x y:y |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2848 |
"display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2849 |
for any object to be displayed in a ListView - for example." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2850 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2851 |
self displayOn:aGC x:x y:y opaque:false |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2852 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2853 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2854 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2855 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2856 |
displayOn:aGc x:x y:y opaque:opaque |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2857 |
"display the receiver in a graphicsContext - this method allows |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2858 |
for any object to be displayed in a ListView - for example. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2859 |
The fallBack here shows the receivers displayString." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2860 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2861 |
|s| |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2862 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2863 |
s := self displayString. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2864 |
opaque ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2865 |
aGc displayOpaqueString:s x:x y:y. |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2866 |
] ifFalse:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2867 |
aGc displayString:s x:x y:y. |
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2868 |
]. |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2869 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2870 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2871 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2872 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2873 |
displayOpaqueOn:aGC x:x y:y |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2874 |
"display the receiver in a graphicsContext - this method allows |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2875 |
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
|
2876 |
|
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2877 |
self displayOn:aGC x:x y:y opaque:true |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2878 |
|
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2879 |
"Modified: / 29.5.1996 / 16:29:38 / cg" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2880 |
"Created: / 26.10.1997 / 15:01:36 / cg" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2881 |
! |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2882 |
|
3023
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2883 |
displayString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2884 |
"return a string used when displaying the receiver in a view; |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2885 |
for example an Inspector. This is usually the same as printString, |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2886 |
but sometimes redefined for a better look." |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2887 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2888 |
^ self printString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2889 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2890 |
" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2891 |
#(1 2 3) printString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2892 |
#(1 2 3) displayString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2893 |
#(1 2 3) storeString |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2894 |
" |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2895 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2896 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2897 |
heightOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2898 |
"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
|
2899 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2900 |
^ (aGC font on:aGC device) heightOf:(self displayString) |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2901 |
! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2902 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2903 |
widthOn:aGC |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2904 |
"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
|
2905 |
|
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2906 |
^ (aGC font on:aGC device) widthOf:(self displayString) |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2907 |
! ! |
674376809496
general listView support (#displayOn / widthOn / heightOn)
ca
parents:
3010
diff
changeset
|
2908 |
|
783 | 2909 |
!Object methodsFor:'error handling'! |
2910 |
||
2911 |
appropriateDebugger:aSelector |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2912 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2913 |
|
783 | 2914 |
"return an appropriate debugger to use. |
2915 |
If there is already a debugger active on the stack, and it is |
|
2916 |
the DebugView, return MiniDebugger (as a last chance) otherwise abort." |
|
2917 |
||
2918 |
|context| |
|
2919 |
||
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2920 |
"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
|
2921 |
|
1685 | 2922 |
(Processor isNil |
1684 | 2923 |
or:[Processor activeProcessIsSystemProcess]) ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2924 |
^ MiniDebugger |
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2925 |
]. |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2926 |
Smalltalk isInitialized ifFalse:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2927 |
^ MiniDebugger |
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2928 |
]. |
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2929 |
|
783 | 2930 |
context := thisContext. |
2893 | 2931 |
context := context findNextContextWithSelector:aSelector or:nil or:nil. |
783 | 2932 |
[context notNil] whileTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2933 |
((context receiver class == Debugger) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2934 |
and:[context selector == aSelector]) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2935 |
"we are already in some Debugger" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2936 |
(Debugger == MiniDebugger) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2937 |
"we are already in the MiniDebugger" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2938 |
ErrorRecursion ifFalse:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2939 |
Smalltalk fatalAbort:'recursive error ...' |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2940 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2941 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2942 |
MiniDebugger isNil ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2943 |
Smalltalk fatalAbort:'no debugger' |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2944 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2945 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2946 |
"ok, an error occured while in the graphical debugger; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2947 |
lets try MiniDebugger" |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2948 |
^ MiniDebugger |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2949 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2950 |
context := context findNextContextWithSelector:aSelector or:nil or:nil. |
71 | 2951 |
]. |
783 | 2952 |
"not within Debugger - no problem" |
2953 |
^ Debugger |
|
1678
1c0fc4e322d0
Change #appropriateDebugger: to call Minidebugger when being called by
Stefan Vogel <sv@exept.de>
parents:
1674
diff
changeset
|
2954 |
|
3063
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2955 |
"Modified: / 23.9.1996 / 12:14:52 / stefan" |
d4bc0c596b98
dependents always returns a collection.
Claus Gittinger <cg@exept.de>
parents:
3044
diff
changeset
|
2956 |
"Modified: / 27.10.1997 / 19:22:10 / cg" |
783 | 2957 |
! |
2958 |
||
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2959 |
cannotSendMessage:aMessage to:someReceiver |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2960 |
"this message is sent by the runtime system (VM), |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2961 |
when a message is sent to some object, whose class is not |
2231 | 2962 |
a valid behavior (see documentation in Behavior)." |
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2963 |
|
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2964 |
^ InternalErrorSignal |
2647 | 2965 |
raiseRequestWith:someReceiver |
2966 |
errorString:('bad class in send of #' , aMessage selector) |
|
2231 | 2967 |
|
2968 |
"Modified: 23.1.1997 / 00:05:39 / cg" |
|
2229
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2969 |
! |
a9881102b243
new feature: cannotSendMessage:to:
Claus Gittinger <cg@exept.de>
parents:
2227
diff
changeset
|
2970 |
|
783 | 2971 |
doesNotUnderstand:aMessage |
2972 |
"this message is sent by the runtime system (VM) when |
|
2973 |
a message is not understood by some object (i.e. there |
|
2974 |
is no method for that selector). The original message has |
|
2975 |
been packed into aMessage (i.e. the receiver, selector and |
|
2976 |
any arguments) and the original receiver is then sent the |
|
2977 |
#doesNotUnderstand: message. |
|
2978 |
Here, we raise another signal which usually enters the debugger. |
|
2979 |
You can of course redefine #doesNotUnderstand: in your classes |
|
1327 | 2980 |
to implement message delegation, |
2981 |
or handle the MessageNotUnderstoodSignal gracefully." |
|
783 | 2982 |
|
2983 |
|sel errorString cls sender| |
|
2984 |
||
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2985 |
sel := aMessage selector printString. |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2986 |
|
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2987 |
"/ Although sel should always be a symbol, |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2988 |
"/ always use printStrings in the code below. |
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2989 |
"/ 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
|
2990 |
"/ 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
|
2991 |
|
783 | 2992 |
"/ handle the case of an error during early startup |
2993 |
"/ (output streams not yet initialized) |
|
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
2994 |
|
783 | 2995 |
Stdout isNil ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
2996 |
Smalltalk fatalAbort:'error during init: ' , sel , ' not understood'. |
783 | 2997 |
]. |
2998 |
||
2999 |
"/ |
|
3000 |
"/ extract the class that should have implemented the message. |
|
3001 |
"/ (in case of a super-send, this is not the receivers class) |
|
3002 |
"/ |
|
3003 |
sender := thisContext sender. |
|
3004 |
cls := sender searchClass. |
|
3005 |
cls isNil ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3006 |
"it was NOT a super or directed send ..." |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3007 |
cls := self class |
783 | 3008 |
]. |
3009 |
||
3010 |
cls notNil ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3011 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3012 |
"/ displayString is better than 'cls name', |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3013 |
"/ since it appends (obsolete) for outdated classes. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3014 |
"/ (this happens if you send messages to old instances |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3015 |
"/ after changing a classes definition) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3016 |
"/ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3017 |
errorString := cls displayString. |
783 | 3018 |
] ifFalse:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3019 |
errorString := '(** nil-class **)' |
783 | 3020 |
]. |
3021 |
errorString := errorString , ' does not understand: ' , sel. |
|
3022 |
||
3023 |
"/ |
|
3024 |
"/ this only happens, when YOU play around with my classvars ... |
|
1327 | 3025 |
"/ (or an error occurs during very early startup, when signals are not yet set) |
783 | 3026 |
"/ |
3027 |
MessageNotUnderstoodSignal isNil ifTrue:[ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3028 |
^ MiniDebugger enterWithMessage:'oops - MessageNotUnderstoodSignal is gone (nil)'. |
783 | 3029 |
]. |
3030 |
||
3031 |
"/ |
|
3032 |
"/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger |
|
3033 |
"/ |
|
3034 |
^ MessageNotUnderstoodSignal |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3035 |
raiseRequestWith:aMessage |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3036 |
errorString:errorString |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3037 |
in:sender |
2818
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3038 |
|
58125948706b
care for bad selector in #doesNotUnderstand:
Claus Gittinger <cg@exept.de>
parents:
2774
diff
changeset
|
3039 |
"Modified: 31.7.1997 / 17:04:49 / cg" |
783 | 3040 |
! |
3041 |
||
3042 |
elementBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3043 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3044 |
|
1345 | 3045 |
"report an error that badElement is out of bounds |
3046 |
(i.e. cannot be put into that collection). |
|
3047 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3048 |
|
3049 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 3050 |
|
3051 |
"Modified: 8.5.1996 / 09:12:45 / cg" |
|
783 | 3052 |
! |
3053 |
||
3054 |
elementNotCharacter |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3055 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3056 |
|
1345 | 3057 |
"report an error that object to be stored is no Character. |
3058 |
(usually when storing into Strings). |
|
3059 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3060 |
|
3061 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 3062 |
|
3063 |
"Modified: 8.5.1996 / 09:12:49 / cg" |
|
783 | 3064 |
! |
3065 |
||
3066 |
elementNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3067 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3068 |
|
1345 | 3069 |
"report an error that object to be stored is not Integer. |
3070 |
(in collections that store integers only). |
|
3071 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 3072 |
|
3073 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 3074 |
|
3075 |
"Modified: 8.5.1996 / 09:12:51 / cg" |
|
783 | 3076 |
! |
3077 |
||
3078 |
enterDebuggerWith:anException message:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3079 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3080 |
|
783 | 3081 |
"enter the debugger with error-message aString" |
3082 |
||
1674 | 3083 |
^ self |
3084 |
enterDebuggerWithMessage:aString |
|
3085 |
on:anException suspendedContext |
|
3086 |
! |
|
3087 |
||
3088 |
enterDebuggerWithMessage:aString on:aContext |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3089 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3090 |
|
783 | 3091 |
"enter the debugger with error-message aString. |
3092 |
The first visible context shown there is aContext |
|
3093 |
(this allows intermediate helpers to hide themselfes from what is |
|
3094 |
presented to the user)" |
|
3095 |
||
1094
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
3096 |
|debugger msg| |
71 | 3097 |
|
3098 |
" |
|
783 | 3099 |
if there is no debugger, exit smalltalk |
3100 |
" |
|
3101 |
Debugger isNil ifTrue:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3102 |
msg := 'error: ' , aString. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3103 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3104 |
Smalltalk isStandAloneApp ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3105 |
Dialog notNil ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3106 |
(Dialog |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3107 |
confirm:msg title:(Smalltalk commandName) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3108 |
yesLabel:'ignore' noLabel:'exit' |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3109 |
) ifTrue:[ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3110 |
^ AbortSignal raise |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3111 |
] |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3112 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3113 |
msg errorPrintCR. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3114 |
OperatingSystem exit:1 |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3115 |
]. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3116 |
msg errorPrintCR. |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3117 |
Smalltalk fatalAbort:'no Debugger defined' |
783 | 3118 |
]. |
983 | 3119 |
|
783 | 3120 |
" |
3121 |
find an appropriate debugger to use |
|
71 | 3122 |
" |
783 | 3123 |
debugger := self appropriateDebugger:#'enter:withMessage:'. |
2773 | 3124 |
debugger isNil ifTrue:[ |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
3125 |
^ AbortSignal raise |
2773 | 3126 |
]. |
783 | 3127 |
^ debugger enter:aContext withMessage:aString. |
1094
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
3128 |
|
2773 | 3129 |
"Modified: 24.7.1997 / 10:09:20 / cg" |
783 | 3130 |
! |
3131 |
||
3132 |
error |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3133 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3134 |
|
1345 | 3135 |
"report error that an error occured. |
3136 |
The error is reported by raising the ErrorSignal exception." |
|
3137 |
||
3138 |
^ ErrorSignal raiseIn:thisContext sender |
|
3139 |
||
3140 |
"Modified: 8.5.1996 / 09:13:01 / cg" |
|
783 | 3141 |
! |
3142 |
||
3143 |
error:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3144 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3145 |
|
1345 | 3146 |
"enter debugger with error-message aString. |
3147 |
The error is reported by raising the ErrorSignal exception." |
|
783 | 3148 |
|
3149 |
^ ErrorSignal raiseRequestWith:#error: |
|
2647 | 3150 |
errorString:aString |
3151 |
in:thisContext sender |
|
1345 | 3152 |
|
3153 |
"Modified: 8.5.1996 / 09:13:04 / cg" |
|
3154 |
! |
|
3155 |
||
3156 |
error:aString in:aContext |
|
3157 |
"{ Pragma: +optSpace }" |
|
3158 |
||
3159 |
"enter debugger with error-message aString. |
|
3160 |
The error is reported by raising the ErrorSignal exception." |
|
3161 |
||
3162 |
^ ErrorSignal raiseRequestWith:#error: |
|
2647 | 3163 |
errorString:aString |
3164 |
in:aContext |
|
1345 | 3165 |
|
3166 |
"Created: 8.5.1996 / 09:07:59 / cg" |
|
3167 |
"Modified: 8.5.1996 / 09:13:06 / cg" |
|
783 | 3168 |
! |
3169 |
||
3170 |
errorKeyNotFound:aKey |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3171 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3172 |
|
1345 | 3173 |
"report an error that a key was not found in a collection. |
3174 |
The error is reported by raising the KeyNotFoundSignal exception." |
|
783 | 3175 |
|
3176 |
^ KeyNotFoundSignal raiseRequestWith:aKey in:thisContext sender |
|
1345 | 3177 |
|
3178 |
"Modified: 8.5.1996 / 09:13:08 / cg" |
|
783 | 3179 |
! |
3180 |
||
3181 |
errorNotFound |
|
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 |
|
1345 | 3184 |
"report an error that no element was found in a collection. |
3185 |
The error is reported by raising the NotFoundSignal exception." |
|
783 | 3186 |
|
3187 |
^ NotFoundSignal raiseIn:thisContext sender |
|
1345 | 3188 |
|
3189 |
"Modified: 8.5.1996 / 09:13:11 / cg" |
|
783 | 3190 |
! |
3191 |
||
3622 | 3192 |
errorSignal |
3193 |
^ self class errorSignal |
|
3194 |
||
3195 |
"Created: / 19.6.1998 / 02:32:32 / cg" |
|
3196 |
! |
|
3197 |
||
783 | 3198 |
halt |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3199 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3200 |
|
1345 | 3201 |
"enter debugger with halt-message. |
3202 |
The error is reported by raising the HaltSignal exception." |
|
783 | 3203 |
|
3204 |
^ HaltSignal raiseIn:thisContext sender. |
|
1345 | 3205 |
|
3206 |
"Modified: 8.5.1996 / 09:12:38 / cg" |
|
783 | 3207 |
! |
3208 |
||
3209 |
halt:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3210 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3211 |
|
1345 | 3212 |
"enter debugger with halt-message. |
3213 |
The error is reported by raising the HaltSignal exception." |
|
783 | 3214 |
|
3215 |
^ HaltSignal raiseRequestWith:#halt: |
|
2647 | 3216 |
errorString:aString |
3217 |
in:thisContext sender |
|
1345 | 3218 |
|
3219 |
"Modified: 8.5.1996 / 09:13:23 / cg" |
|
783 | 3220 |
! |
3221 |
||
3222 |
implementedBySubclass |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3223 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3224 |
|
783 | 3225 |
"this is sent by ST/V code - its the same as #subclassResponsibility" |
3226 |
||
3227 |
^ self subclassResponsibility |
|
3228 |
! |
|
3229 |
||
3230 |
indexNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3231 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3232 |
|
1345 | 3233 |
"report an error that index is not an Integer. |
3234 |
(when accessing collections indexed by an integer key). |
|
3235 |
The error is reported by raising the NonIntegerIndexSignal exception." |
|
783 | 3236 |
|
3237 |
^ NonIntegerIndexSignal raiseIn:thisContext sender |
|
1345 | 3238 |
|
3239 |
"Modified: 8.5.1996 / 09:13:37 / cg" |
|
783 | 3240 |
! |
3241 |
||
3450
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3242 |
indexNotInteger:anIndex |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3243 |
"{ Pragma: +optSpace }" |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3244 |
|
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3245 |
"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
|
3246 |
(when accessing collections indexed by an integer key). |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3247 |
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
|
3248 |
|
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3249 |
^ NonIntegerIndexSignal |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3250 |
raiseRequestWith:anIndex |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3251 |
in:thisContext sender |
3450
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3252 |
|
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3253 |
"Created: / 16.5.1998 / 19:39:41 / cg" |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3254 |
! |
8e2ebfb882bd
added indexNotInteger: (i.e. with argument)
Claus Gittinger <cg@exept.de>
parents:
3437
diff
changeset
|
3255 |
|
783 | 3256 |
integerCheckError |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3257 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3258 |
|
783 | 3259 |
"generated when a variable declared with an integer type gets a bad |
3260 |
value assigned" |
|
3261 |
||
3262 |
^ self error:'bad assign of ' , self printString , |
|
3263 |
' (' , self class name , ') to integer-typed variable' |
|
71 | 3264 |
! |
3265 |
||
2829
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3266 |
invalidCodeObject |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3267 |
"{ Pragma: +optSpace }" |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3268 |
|
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3269 |
self error:'not an executable code object' |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3270 |
|
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3271 |
"Created: 1.8.1997 / 00:16:44 / cg" |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3272 |
! |
909f31cc9b0b
must provide #invalidCodeObject
Claus Gittinger <cg@exept.de>
parents:
2819
diff
changeset
|
3273 |
|
783 | 3274 |
invalidMessage |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3275 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3276 |
|
783 | 3277 |
"this is sent by ST/V code - its the same as #shouldNotImplement" |
3278 |
||
3279 |
^ self shouldNotImplement |
|
3280 |
! |
|
3281 |
||
3282 |
mustBeRectangle |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3283 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3284 |
|
783 | 3285 |
"report an argument-not-rectangle-error" |
3286 |
||
3287 |
^ self error:'argument must be a Rectangle' |
|
3288 |
! |
|
3289 |
||
3290 |
mustBeString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3291 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3292 |
|
783 | 3293 |
"report an argument-not-string-error" |
3294 |
||
3295 |
^ self error:'argument must be a String' |
|
3296 |
! |
|
3297 |
||
3298 |
notIndexed |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3299 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3300 |
|
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3301 |
"report an error that receiver has no indexed instance variables. |
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3302 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3303 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3304 |
^ SubscriptOutOfBoundsSignal |
2647 | 3305 |
raiseErrorString:'receiver has no indexed variables' |
3306 |
in:thisContext sender |
|
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3307 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3308 |
"Modified: 26.7.1996 / 16:43:13 / cg" |
783 | 3309 |
! |
3310 |
||
3311 |
primitiveFailed |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3312 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3313 |
|
1345 | 3314 |
"report an error that some primitive code failed. |
3315 |
The error is reported by raising the PrimitiveFailureSignal exception." |
|
783 | 3316 |
|
3317 |
^ PrimitiveFailureSignal raiseIn:(thisContext sender) |
|
1345 | 3318 |
|
3319 |
"Modified: 8.5.1996 / 09:14:07 / cg" |
|
783 | 3320 |
! |
3321 |
||
3322 |
shouldNotImplement |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3323 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3324 |
|
1345 | 3325 |
"report an error that this message should not be implemented" |
783 | 3326 |
|
3327 |
^ self error:'method not appropriate for this class' |
|
1345 | 3328 |
|
3329 |
"Modified: 8.5.1996 / 09:09:44 / cg" |
|
783 | 3330 |
! |
3331 |
||
3332 |
subclassResponsibility |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3333 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3334 |
|
1345 | 3335 |
"report an error that this message should have been reimplemented in a |
783 | 3336 |
subclass" |
3337 |
||
1345 | 3338 |
^ self error:'method must be reimplemented in subclass' in:thisContext sender |
3339 |
||
3340 |
"Modified: 8.5.1996 / 09:09:26 / cg" |
|
783 | 3341 |
! |
3342 |
||
3343 |
subscriptBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3344 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3345 |
|
1345 | 3346 |
"report an error that some index is out of bounds. |
3347 |
(when accessing indexable collections). |
|
3348 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 3349 |
|
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3350 |
^ SubscriptOutOfBoundsSignal |
2647 | 3351 |
raiseIn:thisContext sender |
1611
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3352 |
|
f8c9a3ab9929
notIndexedError now uses SubscriptBoundsErrorSignal
Claus Gittinger <cg@exept.de>
parents:
1585
diff
changeset
|
3353 |
"Modified: 26.7.1996 / 16:45:42 / cg" |
783 | 3354 |
! |
3355 |
||
3356 |
subscriptBoundsError:anIndex |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3357 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3358 |
|
1345 | 3359 |
"report an error that anIndex is out of bounds. |
3360 |
(when accessing indexable collections). |
|
3361 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 3362 |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
3363 |
^ SubscriptOutOfBoundsSignal |
2647 | 3364 |
raiseRequestWith:anIndex |
3365 |
errorString:('subscript (' , anIndex printString , ') out of bounds') |
|
3366 |
in:thisContext sender |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
3367 |
|
1345 | 3368 |
"Modified: 8.5.1996 / 09:14:34 / cg" |
783 | 3369 |
! |
3370 |
||
3371 |
typeCheckError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3372 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3373 |
|
783 | 3374 |
"generated when a variable declared with a type hint gets a bad |
3375 |
value assigned" |
|
3376 |
||
3377 |
^ self error:'bad assign of ' , self printString , |
|
3378 |
' (' , self class name , ') to typed variable' |
|
3379 |
! ! |
|
3380 |
||
3381 |
!Object methodsFor:'evaluation'! |
|
3382 |
||
3383 |
value |
|
1327 | 3384 |
"return the receiver itself. |
3385 |
This allows every object to be used where blocks or valueHolders |
|
3386 |
are typically used, and allows for valueHolders and blocks to be |
|
3387 |
used interchangably in some situations. |
|
3388 |
||
783 | 3389 |
Time will show, if this is a good idea or leads to sloppy programming |
3390 |
style ... (the idea was borrowed from the Self language). |
|
1327 | 3391 |
|
3392 |
WARNING: dont 'optimize' away ifXXX: blocks |
|
2647 | 3393 |
(i.e. do NOT replace |
3394 |
foo ifTrue:[var1] ifFalse:[var2] |
|
3395 |
by: |
|
3396 |
foo ifTrue:var1 ifFalse:var2 |
|
3397 |
) |
|
3398 |
- the compilers will only generate inline code for the if, |
|
3399 |
iff the argument(s) are blocks - otherwise, a true send is |
|
3400 |
generated. |
|
3401 |
This 'oprimization' will work semantically correct, |
|
3402 |
but execute SLOWER instead." |
|
783 | 3403 |
|
3404 |
^ self |
|
71 | 3405 |
|
3406 |
" |
|
1327 | 3407 |
#(1 2 3 4) indexOf:5 ifAbsent:0 |
3408 |
#(1 2 3 4) indexOf:5 ifAbsent:[0] |
|
3409 |
1 > 2 ifTrue:['yes'] ifFalse:['no'] |
|
3410 |
1 > 2 ifTrue:'yes' ifFalse:'no' |
|
783 | 3411 |
" |
3412 |
||
3413 |
"DO NOT DO THIS (its slower) |
|
3414 |
(1 > 4) ifTrue:'oops' ifFalse:'ok' |
|
3415 |
||
3416 |
USE (the compiler optimizes blocks in if/while): |
|
3417 |
(1 > 4) ifTrue:['oops'] ifFalse:['ok'] |
|
3418 |
" |
|
1327 | 3419 |
|
3420 |
"Modified: 3.5.1996 / 11:57:08 / cg" |
|
783 | 3421 |
! ! |
3422 |
||
3330
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3423 |
!Object methodsFor:'finalization'! |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3424 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3425 |
finalize |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3426 |
"subclasses may redefine this method" |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3427 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3428 |
^ self |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3429 |
|
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3430 |
"Created: / 4.3.1998 / 10:40:30 / stefan" |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3431 |
! ! |
5e0af0183446
Add dummy #finalize (as in ST80)
Stefan Vogel <sv@exept.de>
parents:
3317
diff
changeset
|
3432 |
|
783 | 3433 |
!Object methodsFor:'initialization'! |
3434 |
||
3435 |
initialize |
|
3436 |
"just to ignore initialize to objects which do not need it" |
|
3437 |
||
3438 |
^ self |
|
3439 |
! ! |
|
3440 |
||
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3441 |
!Object methodsFor:'interest'! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3442 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3443 |
addInterest:anInterest |
1762
e7267ff590ff
Fix misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1751
diff
changeset
|
3444 |
"install an interest forwarder. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3445 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3446 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3447 |
self addNonWeakDependent:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3448 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3449 |
"Created: 14.10.1996 / 22:27:34 / stefan" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3450 |
! |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3451 |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3452 |
expressInterestIn:aspect for:anObject sendBack:aSelector |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3453 |
"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
|
3454 |
changes aspect." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3455 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3456 |
"/ 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
|
3457 |
"/ 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
|
3458 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3459 |
self addInterest:(InterestConverter |
2647 | 3460 |
destination:anObject |
3461 |
selector:aSelector |
|
3462 |
aspect:aspect) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3463 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3464 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3465 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3466 |
|
1422 | 3467 |
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
|
3468 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3469 |
p := Point new. |
1422 | 3470 |
Transcript showCR:'interest in #foo:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3471 |
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
|
3472 |
p x:1. |
1422 | 3473 |
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
|
3474 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3475 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3476 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3477 |
Delay waitForSeconds:1. |
1422 | 3478 |
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
|
3479 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3480 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3481 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3482 |
Delay waitForSeconds:1. |
1422 | 3483 |
Transcript showCR:'no more interest in #foo:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3484 |
p retractInterestIn:#foo for:b. |
1422 | 3485 |
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
|
3486 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3487 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3488 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3489 |
Delay waitForSeconds:1. |
1422 | 3490 |
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
|
3491 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 3492 |
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
|
3493 |
p changed:#foo. |
1422 | 3494 |
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
|
3495 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3496 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3497 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3498 |
Delay waitForSeconds:1. |
1422 | 3499 |
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
|
3500 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 3501 |
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
|
3502 |
p changed:#foo. |
1422 | 3503 |
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
|
3504 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3505 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3506 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3507 |
Delay waitForSeconds:1. |
1422 | 3508 |
Transcript showCR:'no more interests:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3509 |
p retractInterestsFor:b. |
1422 | 3510 |
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
|
3511 |
p changed:#foo. |
1422 | 3512 |
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
|
3513 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3514 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3515 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3516 |
p release. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3517 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3518 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3519 |
"Created: 19.4.1996 / 10:26:22 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3520 |
"Modified: 19.4.1996 / 12:34:08 / cg" |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3521 |
"Modified: 14.10.1996 / 22:28:20 / stefan" |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3522 |
! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3523 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3524 |
interests |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3525 |
"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
|
3526 |
Here, we use the nonWeakDependents for interests." |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3527 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3528 |
^ self nonWeakDependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3529 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3530 |
"Created: / 14.10.1996 / 22:20:51 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3531 |
"Modified: / 30.1.1998 / 14:07:35 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3532 |
! |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3533 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3534 |
interestsFor:someOne |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3535 |
"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
|
3536 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3537 |
|coll deps| |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3538 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3539 |
deps := self interests. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3540 |
deps size == 0 ifTrue:[^ #()]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3541 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3542 |
coll := IdentitySet new. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3543 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3544 |
deps do:[:dep | |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3545 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3546 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3547 |
coll add:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3548 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3549 |
] |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3550 |
]. |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3551 |
^ coll |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3552 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3553 |
"Created: / 30.1.1998 / 14:02:26 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3554 |
"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
|
3555 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3556 |
|
3960 | 3557 |
onChangeEvaluate:aBlock |
3558 |
"arrange for aBlock to be evaluated whenever the receiver changes." |
|
3559 |
||
3560 |
^ self onChangeSend:#value to:aBlock |
|
3561 |
||
3562 |
"Created: / 29.1.1999 / 16:01:22 / cg" |
|
3563 |
! |
|
3564 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3565 |
onChangeSend:aSelector to:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3566 |
"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
|
3567 |
changes." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3568 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3569 |
"/ 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
|
3570 |
"/ 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
|
3571 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3572 |
self addInterest:(InterestConverter |
2647 | 3573 |
destination:anObject |
3574 |
selector:aSelector) |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3575 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3576 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3577 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3578 |
|
1422 | 3579 |
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
|
3580 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3581 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3582 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3583 |
p x:1. |
1422 | 3584 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3585 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3586 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3587 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3588 |
Delay waitForSeconds:1. |
1422 | 3589 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3590 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3591 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3592 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3593 |
Delay waitForSeconds:1. |
1422 | 3594 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3595 |
p retractInterestsFor:b. |
1422 | 3596 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3597 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3598 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3599 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3600 |
Delay waitForSeconds:1. |
1422 | 3601 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3602 |
p onChangeSend:#value to:b. |
1422 | 3603 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3604 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3605 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3606 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3607 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3608 |
"Created: 19.4.1996 / 10:26:38 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3609 |
"Modified: 19.4.1996 / 12:34:26 / cg" |
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3610 |
"Modified: 14.10.1996 / 22:28:27 / stefan" |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3611 |
! |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3612 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3613 |
removeInterest:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3614 |
"remove an interest forwarder. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3615 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
3616 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3617 |
self removeNonWeakDependent:anInterest |
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3618 |
|
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3619 |
"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
|
3620 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3621 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3622 |
retractInterestIn:aspect for:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3623 |
"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
|
3624 |
(as installed with #expressInterestIn:for:sendBack:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3625 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3626 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3627 |
"/ 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
|
3628 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3629 |
"/ cannot removeDependent within the loop - the collection rehashes |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3630 |
|
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3631 |
|deps coll| |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3632 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3633 |
deps := self interests. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3634 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3635 |
coll := IdentitySet new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3636 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3637 |
deps do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3638 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3639 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3640 |
dep aspect == aspect ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3641 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3642 |
^ self |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3643 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3644 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3645 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3646 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3647 |
coll do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3648 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3649 |
]. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3650 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3651 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3652 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3653 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3654 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3655 |
|
1422 | 3656 |
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
|
3657 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3658 |
p := Point new. |
1422 | 3659 |
Transcript showCR:'interest in #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3660 |
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
|
3661 |
p x:1. |
1422 | 3662 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3663 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3664 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3665 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3666 |
Delay waitForSeconds:1. |
1422 | 3667 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3668 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3669 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3670 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3671 |
Delay waitForSeconds:1. |
1422 | 3672 |
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
|
3673 |
p retractInterestIn:#foo for:b. |
1422 | 3674 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3675 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3676 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3677 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3678 |
Delay waitForSeconds:1. |
1422 | 3679 |
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
|
3680 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 3681 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3682 |
p changed:#foo. |
1422 | 3683 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3684 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3685 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3686 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3687 |
Delay waitForSeconds:1. |
1422 | 3688 |
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
|
3689 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 3690 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3691 |
p changed:#foo. |
1422 | 3692 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3693 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3694 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3695 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3696 |
Delay waitForSeconds:1. |
1422 | 3697 |
Transcript showCR:'no more interests'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3698 |
p retractInterestsFor:b. |
1422 | 3699 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3700 |
p changed:#foo. |
1422 | 3701 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3702 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3703 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3704 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3705 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3706 |
"Created: / 19.4.1996 / 10:27:11 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3707 |
"Modified: / 14.10.1996 / 22:21:19 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3708 |
"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
|
3709 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3710 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3711 |
retractInterestsFor:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3712 |
"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
|
3713 |
(as installed with #onChangeSend:to:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3714 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3715 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3716 |
"/ 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
|
3717 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3718 |
|coll deps| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3719 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3720 |
"/ 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
|
3721 |
|
1751
0902cadafee2
Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents:
1705
diff
changeset
|
3722 |
deps := self interests. |
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3723 |
deps size ~~ 0 ifTrue:[ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3724 |
coll := IdentitySet new. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3725 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3726 |
deps do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3727 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3728 |
dep destination == someOne ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3729 |
coll add:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3730 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3731 |
] |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3732 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3733 |
coll do:[:dep | |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3734 |
self removeInterest:dep. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3735 |
]. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3736 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3737 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3738 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3739 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3740 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3741 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3742 |
|
1422 | 3743 |
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
|
3744 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3745 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3746 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3747 |
p x:1. |
1422 | 3748 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3749 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3750 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3751 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3752 |
Delay waitForSeconds:1. |
1422 | 3753 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3754 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3755 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3756 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3757 |
Delay waitForSeconds:1. |
1422 | 3758 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3759 |
p retractInterestsFor:b. |
1422 | 3760 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3761 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3762 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3763 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3764 |
Delay waitForSeconds:1. |
1422 | 3765 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3766 |
p onChangeSend:#value to:b. |
1422 | 3767 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3768 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3769 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3770 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3771 |
|
3254
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3772 |
"Created: / 19.4.1996 / 10:23:46 / cg" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3773 |
"Modified: / 14.10.1996 / 22:21:25 / stefan" |
40b21297d9ab
#interests & #weakDependents always return a collection
Claus Gittinger <cg@exept.de>
parents:
3228
diff
changeset
|
3774 |
"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
|
3775 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
3776 |
|
783 | 3777 |
!Object methodsFor:'interrupt handling'! |
3778 |
||
3779 |
childSignalInterrupt |
|
3780 |
"death of a child process (unix process) - do nothing" |
|
3781 |
||
3782 |
^ self |
|
3783 |
! |
|
3784 |
||
3785 |
customInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3786 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3787 |
|
783 | 3788 |
"a custom interrupt" |
3789 |
||
3790 |
^ self error:'custom interrupt' |
|
3791 |
! |
|
3792 |
||
3793 |
errorInterrupt:errorID with:aParameter |
|
3794 |
"subsystem error. The arguments errorID and aParameter are the values passed |
|
3795 |
to the 'errorInterruptWithIDAndParameter(id, param)' function, |
|
3796 |
which can be called from C subsystems to raise an (asynchronous) |
|
3797 |
error exception. |
|
3798 |
||
3799 |
Currently, this is used to map XErrors to smalltalk errors, but can be |
|
3800 |
used from other C subsystems too, to upcast errors. |
|
3801 |
Especially, for subsystems which call errorHandler functions asynchronously. |
|
3802 |
IDs (currently) used: |
|
3803 |
#DisplayError ..... x-error interrupt |
|
3804 |
#XtError ..... xt-error interrupt (Xt interface is not yet published) |
|
71 | 3805 |
" |
783 | 3806 |
|
3807 |
|handler| |
|
3808 |
||
3809 |
handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil. |
|
3810 |
handler notNil ifTrue:[ |
|
3811 |
"/ |
|
3812 |
"/ handler found; let it do whatever it wants ... |
|
3813 |
"/ |
|
3814 |
handler errorInterrupt:errorID with:aParameter. |
|
3815 |
^ self |
|
3816 |
]. |
|
3817 |
||
3818 |
"/ |
|
3819 |
"/ no handler - raise errorSignal passing the errorId as parameter |
|
3820 |
"/ |
|
3821 |
^ ErrorSignal |
|
3822 |
raiseRequestWith:errorID |
|
3823 |
errorString:('Subsystem error. ErrorID = ' , errorID printString) |
|
3824 |
! |
|
3825 |
||
3826 |
exceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3827 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3828 |
|
783 | 3829 |
"exception interrupt - enter debugger" |
3830 |
||
3831 |
self error:'exception Interrupt' |
|
3832 |
! |
|
3833 |
||
3834 |
fpExceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3835 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3836 |
|
783 | 3837 |
"a floating point exception occured - this one |
3838 |
has to be handled differently since it comes asynchronous |
|
3839 |
on some machines (for example, on machines with a separate FPU |
|
3840 |
or superscalar architectures. Also, errors from within primitive code |
|
3841 |
(or library functions such as GL) are sent via the Unix-signal |
|
3842 |
mechanism this way." |
|
3843 |
||
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3844 |
|where rec| |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3845 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3846 |
where := thisContext sender. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3847 |
rec := where receiver. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3848 |
rec isNumber ifTrue:[ |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3849 |
^ rec class |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3850 |
raise:#domainErrorSignal |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3851 |
receiver:rec |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3852 |
selector:where selector |
3398 | 3853 |
arguments:(where args asArray) |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3854 |
errorString:'floating point exception' |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3855 |
]. |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3856 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
3857 |
"/ could be in some C-library ... |
783 | 3858 |
^ Float domainErrorSignal raise |
3859 |
! |
|
3860 |
||
3861 |
internalError:msg |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3862 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3863 |
|
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
3864 |
"this is triggered, when VM hits some bad error, |
783 | 3865 |
such as corrupted class, corrupted method/selector array |
3866 |
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
|
3867 |
(for example, if you set an objects class to a non-behavior, nil etc.). |
783 | 3868 |
Its not guaranteed, that the system is in a working condition once |
3869 |
this error occurred ...." |
|
3870 |
||
2227
eb1e28c62f14
use an extra signal for internal errors
Claus Gittinger <cg@exept.de>
parents:
2209
diff
changeset
|
3871 |
^ InternalErrorSignal |
2647 | 3872 |
raiseRequestWith:self |
3873 |
errorString:msg |
|
783 | 3874 |
! |
3875 |
||
3876 |
ioInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3877 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3878 |
|
783 | 3879 |
"I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor). |
3880 |
If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler) |
|
3881 |
or it does not understand the ioInterrupt message. |
|
3882 |
In any case, this is a sign of some big trouble. Enter debugger." |
|
3883 |
||
3884 |
self error:'I/O Interrupt - but no handler' |
|
3885 |
! |
|
3886 |
||
3887 |
memoryInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3888 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3889 |
|
783 | 3890 |
"out-of-memory interrupt and no handler - enter debugger" |
3891 |
||
3892 |
^ self error:'almost out of memory' |
|
3893 |
! |
|
3894 |
||
3895 |
recursionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3896 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3897 |
|
783 | 3898 |
"recursion limit (actually: stack overflow) interrupt. |
3899 |
This interrupt is triggered, when a process stack grows above |
|
3900 |
its stackLimit - usually, this leads into the debugger, but |
|
2689 | 3901 |
could be caught and the stackLimit increased in the handler. |
783 | 3902 |
At the time we arrive here, the system has still some stack |
3903 |
as a reserve so we can continue to do some useful work or cleanup or |
|
3904 |
debugging for a while. |
|
3905 |
If the signal is ignored, and the stack continues to grow, there |
|
3906 |
will be a few more chances (and more interrupts) before the VM |
|
3907 |
hard-terminates the process." |
|
3908 |
||
3909 |
thisContext isRecursive ifFalse:[ |
|
3910 |
^ RecursionInterruptSignal raise |
|
3911 |
] |
|
3912 |
! |
|
3913 |
||
3914 |
schedulerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3915 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3916 |
|
783 | 3917 |
"scheduler interrupt (supposed to be sent to Processor). |
3918 |
If we arrive here, either the Processor does not understand it, |
|
3919 |
or it has been set to nil. In any case, this is a sign of some |
|
3920 |
big trouble. Enter debugger." |
|
3921 |
||
3922 |
self error:'schedulerInterrupt - but no Processor' |
|
3923 |
! |
|
3924 |
||
3925 |
signalInterrupt:signalNumber |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3926 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3927 |
|
783 | 3928 |
"unix signal occured - some signals are handled as Smalltalk Exceptions |
3929 |
(SIGPIPE), others (SIGBUS) are rather fatal ... |
|
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3930 |
In any case, IF a smalltalk-signal has been connected to the OS signal, |
783 | 3931 |
that one is raised. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
3932 |
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
|
3933 |
signal. |
783 | 3934 |
TODO: add another argument, giving more detailed signal info (PC, VADDR, |
3935 |
exact cause etc.). This helps if segvs occur in primitive code. |
|
3936 |
Currently (temporary kludge), these are passed as global variables." |
|
3937 |
||
2773 | 3938 |
|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
|
3939 |
action title| |
783 | 3940 |
|
3941 |
" |
|
3942 |
special case - since SIGPIPE has an ST-signal associated |
|
3943 |
" |
|
3944 |
(signalNumber == 13) ifTrue:[ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3945 |
"SIGPIPE - write on a pipe with no one to read" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3946 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3947 |
^ PipeStream brokenPipeSignal raise. |
783 | 3948 |
]. |
3949 |
||
3950 |
"if there has been an ST-signal installed, use it ..." |
|
3951 |
||
3952 |
sig := OperatingSystem operatingSystemSignal:signalNumber. |
|
3953 |
sig notNil ifTrue:[ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3954 |
^ sig raise |
783 | 3955 |
]. |
3956 |
||
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3957 |
"/ if handled, raise OSSignalInterruptSignal |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3958 |
|
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3959 |
OSSignalInterruptSignal isHandled ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3960 |
^ OSSignalInterruptSignal raiseWith:signalNumber |
3423
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3961 |
]. |
b4a43b4f098b
new signal: osSignalInterruptSignal;
Claus Gittinger <cg@exept.de>
parents:
3418
diff
changeset
|
3962 |
|
783 | 3963 |
" |
3964 |
... otherwise , bring up a box asking for what to do ... |
|
3965 |
" |
|
3966 |
name := OperatingSystem nameForSignal:signalNumber. |
|
3967 |
here := thisContext. |
|
3968 |
||
3969 |
" |
|
3970 |
the context, in which the signal occurred: |
|
3971 |
" |
|
3972 |
badContext := here sender. |
|
3973 |
||
3974 |
" |
|
3975 |
ungrab - in case it happened in a box/popupview |
|
3976 |
otherwise display stays locked |
|
3977 |
" |
|
2851
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3978 |
"/ Display notNil ifTrue:[ |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3979 |
"/ Display ungrabPointer. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3980 |
"/ Display ungrabKeyboard. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3981 |
"/ ]. |
856557e261a3
ungrab all screens in case of an error
Claus Gittinger <cg@exept.de>
parents:
2829
diff
changeset
|
3982 |
Screen notNil ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3983 |
Screen allScreens do:[:aScreen | |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3984 |
aScreen ungrabPointer. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3985 |
aScreen ungrabKeyboard. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3986 |
] |
783 | 3987 |
]. |
3988 |
||
3989 |
" |
|
3990 |
SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue) |
|
3991 |
since the system will retry the faulty instruction, which leads to |
|
3992 |
another signal - to avoid frustration, better not offer this option. |
|
3993 |
" |
|
3994 |
ignorable := (signalNumber ~~ OperatingSystem sigBUS) |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3995 |
and:[signalNumber ~~ OperatingSystem sigILL |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3996 |
and:[signalNumber ~~ OperatingSystem sigSEGV]]. |
783 | 3997 |
|
3998 |
ignorable ifFalse:[ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
3999 |
here isRecursive ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4000 |
'Object [hard error]: signal ' errorPrint. signalNumber errorPrintCR. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4001 |
MiniDebugger enterWithMessage:'recursive signal'. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4002 |
^ self |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4003 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4004 |
" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4005 |
a hard signal - go into debugger immediately |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4006 |
" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4007 |
msg := 'OS-signal: ', name. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4008 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4009 |
"/ the IRQ-PC is passed as low-hi, to avoid the need |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4010 |
"/ to allocate a LargeInteger in the VM during signal |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4011 |
"/ 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
|
4012 |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4013 |
InterruptPcLow notNil ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4014 |
pc := InterruptPcLow + (InterruptPcHi bitShift:(SmallInteger maxBits + 1 // 2)). |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4015 |
pc ~~ 0 ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4016 |
msg := msg , ' PC=' , (pc printStringRadix:16) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4017 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4018 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4019 |
InterruptAddrLow notNil ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4020 |
addr := InterruptAddrLow + (InterruptAddrHi bitShift:(SmallInteger maxBits + 1 // 2)). |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4021 |
addr ~~ 0 ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4022 |
msg := msg , ' ADDR=' , (addr printStringRadix:16) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4023 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4024 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4025 |
Debugger enter:here withMessage:msg. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4026 |
badContext return. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4027 |
^ nil. |
783 | 4028 |
]. |
4029 |
||
4030 |
OptionBox isNil ifTrue:[ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4031 |
" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4032 |
a system without GUI ... |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4033 |
go into minidebugger (if there is one) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4034 |
" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4035 |
MiniDebugger isNil ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4036 |
" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4037 |
a system without debugging facilities |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4038 |
(i.e. a standalone system) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4039 |
output a message and exit. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4040 |
" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4041 |
('Object [error]: exit due to Signal ' , name , ' - and no debugger.') errorPrintCR. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4042 |
Smalltalk exit. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4043 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4044 |
MiniDebugger enterWithMessage:'Signal caught (' , name, ')'. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4045 |
^ self |
783 | 4046 |
]. |
4047 |
||
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4048 |
titles := #('dump core' 'exit ST/X'). |
783 | 4049 |
actions := Array |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4050 |
with:[Smalltalk fatalAbort] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4051 |
with:[Smalltalk exit]. |
2773 | 4052 |
|
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4053 |
action := nil. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4054 |
title := 'OS Signal caught (' , name, ')'. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4055 |
title := (title , '\[in ST-process: ' , Processor activeProcess nameOrId ,']') withCRs. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4056 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4057 |
"/ if cought while in the scheduler or event dispatcher, |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4058 |
"/ a modal dialog is not possible ... |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4059 |
"/ (therefore, debug & return make no sense) |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4060 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4061 |
Processor activeProcess isSystemProcess ifFalse:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4062 |
titles := #('abort' 'debug') , titles. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4063 |
actions := (Array |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4064 |
with:[action := #abort] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4065 |
with:[action := #debug]) , actions. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4066 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4067 |
badContext canReturn ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4068 |
titles := #('return') , titles. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4069 |
actions := (Array with:[action := #return]) , actions. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4070 |
]. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4071 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4072 |
|
783 | 4073 |
ignorable ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4074 |
titles := titles, #('ignore'). |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4075 |
actions := actions , (Array with:[action := #ignore]). |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4076 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4077 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4078 |
box := OptionBox |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4079 |
title:title |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4080 |
numberOfOptions:actions size. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4081 |
ignorable ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4082 |
box defaultButtonIndex:(actions size) |
783 | 4083 |
]. |
4084 |
box buttonTitles:titles. |
|
4085 |
box actions:actions. |
|
2773 | 4086 |
box showAtPointer. |
4087 |
||
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4088 |
action == #return ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4089 |
badContext return |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4090 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4091 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4092 |
action == #abort ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4093 |
AbortSignal raise. |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4094 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4095 |
|
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4096 |
action == #debug ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
4097 |
Debugger enter:here withMessage:('Signal ', name). |
2774
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4098 |
]. |
5a7467b9a531
better signalInterrupt dialog
Claus Gittinger <cg@exept.de>
parents:
2773
diff
changeset
|
4099 |
|
3418
8aafd5280caf
construct IRQ-addr using correct shift amounts (alpha)
Claus Gittinger <cg@exept.de>
parents:
3398
diff
changeset
|
4100 |
"Modified: / 4.5.1998 / 20:39:16 / cg" |
783 | 4101 |
! |
4102 |
||
4103 |
spyInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4104 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4105 |
|
783 | 4106 |
"spy interrupt and no handler - enter debugger" |
4107 |
||
4108 |
self error:'spy Interrupt - but no handler' |
|
4109 |
! |
|
4110 |
||
4111 |
timerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4112 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4113 |
|
783 | 4114 |
"timer interrupt and no handler - enter debugger" |
4115 |
||
4116 |
self error:'timer Interrupt - but no handler' |
|
4117 |
! |
|
4118 |
||
4119 |
userInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4120 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
4121 |
|
1792 | 4122 |
"user (^c) interrupt. |
4123 |
This is typically sent by the VM, when a ctrl-C is typed at the |
|
4124 |
controlling tty (i.e. in the xterm)." |
|
783 | 4125 |
|
4126 |
UserInterruptSignal raise |
|
1788 | 4127 |
! |
4128 |
||
4129 |
userInterruptIn:aContext |
|
4130 |
"{ Pragma: +optSpace }" |
|
4131 |
||
4132 |
"user (^c) interrupt - enter debugger, but show aContext |
|
1792 | 4133 |
as top-context. |
4134 |
This is used to hide any intermediate scheduler contexts, |
|
4135 |
in case of an interrupted process. Typically, this is sent by |
|
4136 |
the WindowGroup, when a keyboardEvent for the ctrl-C key is |
|
4137 |
processed." |
|
1788 | 4138 |
|
4139 |
UserInterruptSignal raiseIn:aContext |
|
4140 |
||
4141 |
"Created: 18.10.1996 / 20:46:04 / cg" |
|
4142 |
"Modified: 20.10.1996 / 13:06:38 / cg" |
|
71 | 4143 |
! ! |
4144 |
||
1 | 4145 |
!Object methodsFor:'message sending'! |
4146 |
||
4147 |
perform:aSelector |
|
4148 |
"send the message aSelector to the receiver" |
|
4149 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4150 |
%{ |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4151 |
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
|
4152 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4153 |
static struct inlineCache ilc_0 = __ILCPERF0(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4154 |
static struct inlineCache ilc_1 = __ILCPERF0(@line); |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4155 |
static struct inlineCache ilc_2 = __ILCPERF0(@line); |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4156 |
static struct inlineCache ilc_3 = __ILCPERF0(@line); |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4157 |
static struct inlineCache ilc_4 = __ILCPERF0(@line); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4158 |
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
|
4159 |
static OBJ last_1 = nil; |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4160 |
static OBJ last_2 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4161 |
static OBJ last_3 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4162 |
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
|
4163 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4164 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4165 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4166 |
if (sel == last_0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4167 |
RETURN ( (*(ilc_0.ilc_func))(self, sel, nil, &ilc_0) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4168 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4169 |
if (sel == last_1) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4170 |
RETURN ( (*(ilc_1.ilc_func))(self, sel, nil, &ilc_1) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4171 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4172 |
if (sel == last_2) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4173 |
RETURN ( (*(ilc_2.ilc_func))(self, sel, nil, &ilc_2) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4174 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4175 |
if (sel == last_3) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4176 |
RETURN ( (*(ilc_3.ilc_func))(self, sel, nil, &ilc_3) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4177 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4178 |
if (sel == last_4) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4179 |
RETURN ( (*(ilc_4.ilc_func))(self, sel, nil, &ilc_4) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4180 |
} |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4181 |
|
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4182 |
if (flip == 0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4183 |
pIlc = &ilc_0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4184 |
flip = 1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4185 |
last_0 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4186 |
} else if (flip == 1) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4187 |
pIlc = &ilc_1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4188 |
flip = 2; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4189 |
last_1 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4190 |
} else if (flip == 2) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4191 |
pIlc = &ilc_2; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4192 |
flip = 3; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4193 |
last_2 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4194 |
} else if (flip == 3) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4195 |
pIlc = &ilc_3; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4196 |
flip = 4; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4197 |
last_3 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4198 |
} else { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4199 |
pIlc = &ilc_4; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4200 |
flip = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4201 |
last_4 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4202 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4203 |
pIlc->ilc_func = __SEND0ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4204 |
if (pIlc->ilc_poly) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4205 |
__flushPolyCache(pIlc->ilc_poly); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4206 |
pIlc->ilc_poly = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4207 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4208 |
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
|
4209 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4210 |
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
|
4211 |
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
|
4212 |
} |
1 | 4213 |
%} |
4214 |
! |
|
4215 |
||
783 | 4216 |
perform:aSelector inClass:aClass withArguments:argArray |
4217 |
"send the message aSelector with all args taken from argArray |
|
4218 |
to the receiver as a super-send message. |
|
4219 |
This is actually more flexible than the normal super-send, since it allows |
|
4220 |
to execute a method in ANY superclass of the receiver (not just the |
|
4221 |
immediate superclass). |
|
4222 |
Thus, it is (theoretically) possible to do |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4223 |
'5 perform:#< inClass:Magnitude withArguments:#(6)' |
783 | 4224 |
and evaluate Magnitudes compare method even if there was one in Number. |
4225 |
This method is used by the interpreter to evaluate super sends |
|
4226 |
and could be used for very special behavior (language extension ?). |
|
4227 |
||
4228 |
WARNING: this is an ST/X feature - probably not found in other smalltalks." |
|
4229 |
||
4230 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
|
4231 |
||
4232 |
" |
|
4233 |
check, if aClass is really a superclass of the receiver |
|
4234 |
" |
|
4235 |
(self class isSubclassOf:aClass) ifFalse:[ |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4236 |
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
|
4237 |
^ nil |
783 | 4238 |
]. |
4239 |
%{ |
|
4240 |
REGISTER OBJ *argP; |
|
4241 |
int nargs, i; |
|
4242 |
||
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4243 |
if (__isArray(argArray)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4244 |
nargs = __arraySize(argArray); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4245 |
argP = __ArrayInstPtr(argArray)->a_element; |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4246 |
} else { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4247 |
if (__isNonNilObject(argArray)) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4248 |
static struct inlineCache ilcSize = __ILC0(@line+1); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4249 |
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
|
4250 |
if (!__isSmallInteger(numberOfArgs)) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4251 |
goto bad; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4252 |
nargs = __intVal(numberOfArgs); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4253 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4254 |
for (i=1; i <= nargs; i++) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4255 |
*argP++ = __AT_(argArray, __MKSMALLINT(i)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4256 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4257 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4258 |
} else { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4259 |
nargs = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4260 |
} |
783 | 4261 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4262 |
switch (nargs) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4263 |
case 0: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4264 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4265 |
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
|
4266 |
RETURN ( _SEND0(self, aSelector, aClass, &ilc0)); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4267 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4268 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4269 |
case 1: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4270 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4271 |
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
|
4272 |
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
|
4273 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4274 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4275 |
case 2: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4276 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4277 |
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
|
4278 |
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
|
4279 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4280 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4281 |
case 3: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4282 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4283 |
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
|
4284 |
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
|
4285 |
argP[0], argP[1], argP[2])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4286 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4287 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4288 |
case 4: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4289 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4290 |
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
|
4291 |
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
|
4292 |
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
|
4293 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4294 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4295 |
case 5: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4296 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4297 |
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
|
4298 |
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
|
4299 |
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
|
4300 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4301 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4302 |
case 6: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4303 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4304 |
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
|
4305 |
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
|
4306 |
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
|
4307 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4308 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4309 |
case 7: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4310 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4311 |
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
|
4312 |
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
|
4313 |
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
|
4314 |
argP[6])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4315 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4316 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4317 |
case 8: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4318 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4319 |
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
|
4320 |
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
|
4321 |
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
|
4322 |
argP[6], argP[7])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4323 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4324 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4325 |
case 9: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4326 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4327 |
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
|
4328 |
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
|
4329 |
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
|
4330 |
argP[6], argP[7], argP[8])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4331 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4332 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4333 |
case 10: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4334 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4335 |
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
|
4336 |
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
|
4337 |
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
|
4338 |
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
|
4339 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4340 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4341 |
case 11: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4342 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4343 |
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
|
4344 |
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
|
4345 |
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
|
4346 |
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
|
4347 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4348 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4349 |
case 12: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4350 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4351 |
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
|
4352 |
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
|
4353 |
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
|
4354 |
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
|
4355 |
argP[11])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4356 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4357 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4358 |
case 13: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4359 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4360 |
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
|
4361 |
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
|
4362 |
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
|
4363 |
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
|
4364 |
argP[11], argP[12])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4365 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4366 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4367 |
case 14: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4368 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4369 |
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
|
4370 |
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
|
4371 |
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
|
4372 |
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
|
4373 |
argP[11], argP[12], argP[13])); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4374 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4375 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4376 |
case 15: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4377 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4378 |
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
|
4379 |
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
|
4380 |
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
|
4381 |
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
|
4382 |
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
|
4383 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4384 |
|
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4385 |
#ifdef _SEND16 |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4386 |
case 16: |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4387 |
{ |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4388 |
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
|
4389 |
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
|
4390 |
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
|
4391 |
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
|
4392 |
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
|
4393 |
} |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4394 |
#endif |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4395 |
|
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4396 |
|
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4397 |
} |
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4398 |
bad:; |
1626 | 4399 |
%}. |
4400 |
"/ arrive here, if bad number of arguments (too many) |
|
4401 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
4402 |
||
783 | 4403 |
^ self primitiveFailed |
4404 |
! |
|
4405 |
||
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4406 |
perform:aSelector with:arg |
1 | 4407 |
"send the one-arg-message aSelector to the receiver" |
4408 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4409 |
%{ |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4410 |
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
|
4411 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4412 |
static struct inlineCache ilc_0 = __ILCPERF1(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4413 |
static struct inlineCache ilc_1 = __ILCPERF1(@line); |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4414 |
static struct inlineCache ilc_2 = __ILCPERF1(@line); |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4415 |
static struct inlineCache ilc_3 = __ILCPERF1(@line); |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4416 |
static struct inlineCache ilc_4 = __ILCPERF1(@line); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4417 |
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
|
4418 |
static OBJ last_1 = nil; |
3317
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4419 |
static OBJ last_2 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4420 |
static OBJ last_3 = nil; |
8c0d47236f4b
now keep 5 inlineCaches in #perform: and #performWith:
Claus Gittinger <cg@exept.de>
parents:
3309
diff
changeset
|
4421 |
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
|
4422 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4423 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4424 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4425 |
if (sel == last_0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4426 |
RETURN ( (*(ilc_0.ilc_func))(self, sel, nil, &ilc_0, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4427 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4428 |
if (sel == last_1) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4429 |
RETURN ( (*(ilc_1.ilc_func))(self, sel, nil, &ilc_1, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4430 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4431 |
if (sel == last_2) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4432 |
RETURN ( (*(ilc_2.ilc_func))(self, sel, nil, &ilc_2, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4433 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4434 |
if (sel == last_3) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4435 |
RETURN ( (*(ilc_3.ilc_func))(self, sel, nil, &ilc_3, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4436 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4437 |
if (sel == last_4) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4438 |
RETURN ( (*(ilc_4.ilc_func))(self, sel, nil, &ilc_4, arg) ); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4439 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4440 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4441 |
if (flip == 0) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4442 |
pIlc = &ilc_0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4443 |
flip = 1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4444 |
last_0 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4445 |
} else if (flip == 1) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4446 |
pIlc = &ilc_1; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4447 |
flip = 2; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4448 |
last_1 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4449 |
} else if (flip == 2) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4450 |
pIlc = &ilc_2; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4451 |
flip = 3; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4452 |
last_2 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4453 |
} else if (flip == 3) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4454 |
pIlc = &ilc_3; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4455 |
flip = 4; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4456 |
last_3 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4457 |
} else { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4458 |
pIlc = &ilc_4; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4459 |
flip = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4460 |
last_4 = sel; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4461 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4462 |
pIlc->ilc_func = __SEND1ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4463 |
if (pIlc->ilc_poly) { |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4464 |
__flushPolyCache(pIlc->ilc_poly); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4465 |
pIlc->ilc_poly = 0; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4466 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4467 |
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
|
4468 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4469 |
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
|
4470 |
RETURN (_SEND1(self, aSelector, nil, &ilc1, arg)); |
1 | 4471 |
} |
4472 |
%} |
|
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4473 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4474 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4475 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4476 |
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
|
4477 |
"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
|
4478 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4479 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4480 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4481 |
static struct inlineCache ilc_0 = __ILCPERF2(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4482 |
static struct inlineCache ilc_1 = __ILCPERF2(@line); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4483 |
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
|
4484 |
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
|
4485 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4486 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4487 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4488 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4489 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4490 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4491 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4492 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4493 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4494 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4495 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4496 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4497 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4498 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4499 |
pIlc->ilc_func = __SEND2ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4500 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4501 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4502 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4503 |
} |
2647 | 4504 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4505 |
pIlc = &ilc_1; |
2647 | 4506 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4507 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4508 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4509 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4510 |
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
|
4511 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4512 |
static struct inlineCache ilc2 = __DUMMYILCSELF2(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4513 |
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
|
4514 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4515 |
%} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4516 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4517 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4518 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4519 |
perform:aSelector with:arg1 with:arg2 with:arg3 |
1 | 4520 |
"send the three-arg-message aSelector to the receiver" |
4521 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4522 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4523 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4524 |
static struct inlineCache ilc_0 = __ILCPERF3(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4525 |
static struct inlineCache ilc_1 = __ILCPERF3(@line); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4526 |
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
|
4527 |
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
|
4528 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4529 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4530 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4531 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4532 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4533 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4534 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4535 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4536 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4537 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4538 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4539 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4540 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4541 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4542 |
pIlc->ilc_func = __SEND3ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4543 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4544 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4545 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4546 |
} |
2647 | 4547 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4548 |
pIlc = &ilc_1; |
2647 | 4549 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4550 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4551 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4552 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4553 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4554 |
arg1, arg2, arg3) ); |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
4555 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4556 |
static struct inlineCache ilc3 = __DUMMYILCSELF3(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4557 |
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
|
4558 |
} |
1 | 4559 |
%} |
2437 | 4560 |
! |
4561 |
||
4562 |
perform:aSelector with:arg1 with:arg2 with:arg3 with:arg4 |
|
4563 |
"send the four-arg-message aSelector to the receiver" |
|
4564 |
||
4565 |
%{ |
|
4566 |
struct inlineCache *pIlc; |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4567 |
static struct inlineCache ilc_0 = __ILCPERF4(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4568 |
static struct inlineCache ilc_1 = __ILCPERF4(@line); |
2437 | 4569 |
static OBJ last_0 = nil; |
4570 |
static OBJ last_1 = nil; |
|
4571 |
static flip = 0; |
|
4572 |
||
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4573 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4574 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4575 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4576 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4577 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4578 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4579 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4580 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4581 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4582 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4583 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4584 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4585 |
pIlc->ilc_func = __SEND4ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4586 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4587 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4588 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4589 |
} |
2647 | 4590 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4591 |
pIlc = &ilc_1; |
2647 | 4592 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4593 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4594 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4595 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4596 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4597 |
arg1, arg2, arg3, arg4) ); |
2437 | 4598 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4599 |
static struct inlineCache ilc4 = __DUMMYILCSELF4(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4600 |
RETURN (_SEND4(self, aSelector, nil, &ilc4, |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4601 |
arg1, arg2, arg3, arg4)); |
2437 | 4602 |
} |
4603 |
%} |
|
1 | 4604 |
! |
4605 |
||
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4606 |
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
|
4607 |
"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
|
4608 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4609 |
%{ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4610 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4611 |
static struct inlineCache ilc_0 = __ILCPERF5(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4612 |
static struct inlineCache ilc_1 = __ILCPERF5(@line); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4613 |
static OBJ last_0 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4614 |
static OBJ last_1 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4615 |
static flip = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4616 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4617 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4618 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4619 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4620 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4621 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4622 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4623 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4624 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4625 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4626 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4627 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4628 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4629 |
pIlc->ilc_func = __SEND5ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4630 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4631 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4632 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4633 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4634 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4635 |
pIlc = &ilc_1; |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4636 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4637 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4638 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4639 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4640 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4641 |
arg1, arg2, arg3, arg4, arg5) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4642 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4643 |
static struct inlineCache ilc5 = __DUMMYILCSELF5(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4644 |
RETURN (_SEND5(self, aSelector, nil, &ilc5, |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4645 |
arg1, arg2, arg3, arg4, arg5)); |
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 |
%} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4648 |
! |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4649 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4650 |
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
|
4651 |
"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
|
4652 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4653 |
%{ |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4654 |
struct inlineCache *pIlc; |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4655 |
static struct inlineCache ilc_0 = __ILCPERF6(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4656 |
static struct inlineCache ilc_1 = __ILCPERF6(@line); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4657 |
static OBJ last_0 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4658 |
static OBJ last_1 = nil; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4659 |
static flip = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4660 |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4661 |
if (InterruptPending == nil) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4662 |
if (aSelector != last_0) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4663 |
if (aSelector != last_1) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4664 |
if (flip) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4665 |
pIlc = &ilc_0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4666 |
flip = 0; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4667 |
last_0 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4668 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4669 |
pIlc = &ilc_1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4670 |
flip = 1; |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4671 |
last_1 = aSelector; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4672 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4673 |
pIlc->ilc_func = __SEND6ADDR__; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4674 |
if (pIlc->ilc_poly) { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4675 |
__flushPolyCache(pIlc->ilc_poly); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4676 |
pIlc->ilc_poly = 0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4677 |
} |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4678 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4679 |
pIlc = &ilc_1; |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4680 |
} |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4681 |
} else { |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4682 |
pIlc = &ilc_0; |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4683 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4684 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4685 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, nil, pIlc, |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4686 |
arg1, arg2, arg3, arg4, arg5, arg6) ); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4687 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
4688 |
static struct inlineCache ilc6 = __DUMMYILCSELF6(@line+1); |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4689 |
RETURN (_SEND6(self, aSelector, nil, &ilc6, |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4690 |
arg1, arg2, arg3, arg4, arg5, arg6)); |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4691 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4692 |
%} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4693 |
! |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4694 |
|
1 | 4695 |
perform:aSelector withArguments:argArray |
4696 |
"send the message aSelector with all args taken from argArray |
|
44 | 4697 |
to the receiver." |
1 | 4698 |
|
77 | 4699 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
1 | 4700 |
|
4701 |
%{ |
|
4702 |
REGISTER OBJ *argP; |
|
4703 |
int nargs, i; |
|
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4704 |
static struct inlineCache ilcSize = __ILC0(@line); |
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4705 |
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
|
4706 |
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
|
4707 |
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
|
4708 |
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
|
4709 |
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
|
4710 |
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
|
4711 |
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
|
4712 |
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
|
4713 |
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
|
4714 |
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
|
4715 |
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
|
4716 |
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
|
4717 |
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
|
4718 |
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
|
4719 |
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
|
4720 |
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
|
4721 |
OBJ l; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4722 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4723 |
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */ |
71 | 4724 |
/* |
93 | 4725 |
* must set lineno in sender by hand here ... (because of NOCONTEXT) |
71 | 4726 |
*/ |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4727 |
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
|
4728 |
_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
|
4729 |
} |
71 | 4730 |
#endif |
1 | 4731 |
|
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4732 |
if (__isArray(argArray)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4733 |
nargs = __arraySize(argArray); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4734 |
argP = __ArrayInstPtr(argArray)->a_element; |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4735 |
} else { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4736 |
if (__isNonNilObject(argArray)) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4737 |
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
|
4738 |
if (!__isSmallInteger(numberOfArgs)) |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4739 |
goto bad; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4740 |
nargs = __intVal(numberOfArgs); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4741 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4742 |
for (i=1; i <= nargs; i++) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4743 |
*argP++ = __AT_(argArray, __MKSMALLINT(i)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4744 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4745 |
argP = (OBJ *)(&a1); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4746 |
} else { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4747 |
nargs = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4748 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4749 |
} |
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4750 |
switch (nargs) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4751 |
case 0: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4752 |
if ((InterruptPending != nil) || (aSelector != last0)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4753 |
ilc0.ilc_func = __SEND0ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4754 |
if (ilc0.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4755 |
__flushPolyCache(ilc0.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4756 |
ilc0.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4757 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4758 |
last0 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4759 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4760 |
#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
|
4761 |
ilc0.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 4762 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4763 |
RETURN ((*ilc0.ilc_func)(self, aSelector, nil, &ilc0)); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4764 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4765 |
case 1: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4766 |
if ((InterruptPending != nil) || (aSelector != last1)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4767 |
ilc1.ilc_func = __SEND1ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4768 |
if (ilc1.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4769 |
__flushPolyCache(ilc1.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4770 |
ilc1.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4771 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4772 |
last1 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4773 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4774 |
#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
|
4775 |
ilc1.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 4776 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4777 |
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
|
4778 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4779 |
case 2: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4780 |
if ((InterruptPending != nil) || (aSelector != last2)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4781 |
ilc2.ilc_func = __SEND2ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4782 |
if (ilc2.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4783 |
__flushPolyCache(ilc2.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4784 |
ilc2.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4785 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4786 |
last2 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4787 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4788 |
#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
|
4789 |
ilc2.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4790 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4791 |
RETURN ( (*ilc2.ilc_func)(self, aSelector, nil, &ilc2, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4792 |
argP[0], argP[1])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4793 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4794 |
case 3: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4795 |
if ((InterruptPending != nil) || (aSelector != last3)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4796 |
ilc3.ilc_func = __SEND3ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4797 |
if (ilc3.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4798 |
__flushPolyCache(ilc3.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4799 |
ilc3.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4800 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4801 |
last3 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4802 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4803 |
#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
|
4804 |
ilc3.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4805 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4806 |
RETURN ( (*ilc3.ilc_func)(self, aSelector, nil, &ilc3, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4807 |
argP[0], argP[1], argP[2])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4808 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4809 |
case 4: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4810 |
if ((InterruptPending != nil) || (aSelector != last4)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4811 |
ilc4.ilc_func = __SEND4ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4812 |
if (ilc4.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4813 |
__flushPolyCache(ilc4.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4814 |
ilc4.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4815 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4816 |
last4 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4817 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4818 |
#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
|
4819 |
ilc4.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4820 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4821 |
RETURN ( (*ilc4.ilc_func)(self, aSelector, nil, &ilc4, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4822 |
argP[0], argP[1], argP[2], argP[3])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4823 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4824 |
case 5: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4825 |
if ((InterruptPending != nil) || (aSelector != last5)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4826 |
ilc5.ilc_func = __SEND5ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4827 |
if (ilc5.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4828 |
__flushPolyCache(ilc5.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4829 |
ilc5.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4830 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4831 |
last5 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4832 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4833 |
#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
|
4834 |
ilc5.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4835 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4836 |
RETURN ( (*ilc5.ilc_func)(self, aSelector, nil, &ilc5, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4837 |
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
|
4838 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4839 |
case 6: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4840 |
if ((InterruptPending != nil) || (aSelector != last6)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4841 |
ilc6.ilc_func = __SEND6ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4842 |
if (ilc6.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4843 |
__flushPolyCache(ilc6.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4844 |
ilc6.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4845 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4846 |
last6 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4847 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4848 |
#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
|
4849 |
ilc6.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4850 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4851 |
RETURN ( (*ilc6.ilc_func)(self, aSelector, nil, &ilc6, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4852 |
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
|
4853 |
argP[5])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4854 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4855 |
case 7: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4856 |
if ((InterruptPending != nil) || (aSelector != last7)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4857 |
ilc7.ilc_func = __SEND7ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4858 |
if (ilc7.ilc_poly) { |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4859 |
__flushPolyCache(ilc7.ilc_poly); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4860 |
ilc7.ilc_poly = 0; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4861 |
} |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4862 |
last7 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4863 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4864 |
#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
|
4865 |
ilc7.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4866 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4867 |
RETURN ( (*ilc7.ilc_func)(self, aSelector, nil, &ilc7, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4868 |
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
|
4869 |
argP[5], argP[6])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4870 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4871 |
case 8: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4872 |
if ((InterruptPending != nil) || (aSelector != last8)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4873 |
ilc8.ilc_func = __SEND8ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4874 |
last8 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4875 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4876 |
#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
|
4877 |
ilc8.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4878 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4879 |
RETURN ( (*ilc8.ilc_func)(self, aSelector, nil, &ilc8, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4880 |
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
|
4881 |
argP[5], argP[6], argP[7])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4882 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4883 |
case 9: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4884 |
if ((InterruptPending != nil) || (aSelector != last9)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4885 |
ilc9.ilc_func = __SEND9ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4886 |
last9 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4887 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4888 |
#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
|
4889 |
ilc9.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4890 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4891 |
RETURN ( (*ilc9.ilc_func)(self, aSelector, nil, &ilc9, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4892 |
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
|
4893 |
argP[5], argP[6], argP[7], argP[8])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4894 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4895 |
case 10: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4896 |
if ((InterruptPending != nil) || (aSelector != last10)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4897 |
ilc10.ilc_func = __SEND10ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4898 |
last10 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4899 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4900 |
#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
|
4901 |
ilc10.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4902 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4903 |
RETURN ( (*ilc10.ilc_func)(self, aSelector, nil, &ilc10, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4904 |
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
|
4905 |
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
|
4906 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4907 |
case 11: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4908 |
if ((InterruptPending != nil) || (aSelector != last11)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4909 |
ilc11.ilc_func = __SEND11ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4910 |
last11 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4911 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4912 |
#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
|
4913 |
ilc11.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4914 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4915 |
RETURN ( (*ilc11.ilc_func)(self, aSelector, nil, &ilc11, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4916 |
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
|
4917 |
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
|
4918 |
argP[10])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4919 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4920 |
case 12: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4921 |
if ((InterruptPending != nil) || (aSelector != last12)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4922 |
ilc12.ilc_func = __SEND12ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4923 |
last12 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4924 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4925 |
#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
|
4926 |
ilc12.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4927 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4928 |
RETURN ( (*ilc12.ilc_func)(self, aSelector, nil, &ilc12, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4929 |
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
|
4930 |
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
|
4931 |
argP[10], argP[11])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4932 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4933 |
case 13: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4934 |
if ((InterruptPending != nil) || (aSelector != last13)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4935 |
ilc13.ilc_func = __SEND13ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4936 |
last13 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4937 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4938 |
#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
|
4939 |
ilc13.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4940 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4941 |
RETURN ( (*ilc13.ilc_func)(self, aSelector, nil, &ilc13, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4942 |
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
|
4943 |
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
|
4944 |
argP[10], argP[11], argP[12])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4945 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4946 |
case 14: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4947 |
if ((InterruptPending != nil) || (aSelector != last14)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4948 |
ilc14.ilc_func = __SEND14ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4949 |
last14 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4950 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4951 |
#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
|
4952 |
ilc14.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 4953 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4954 |
RETURN ( (*ilc14.ilc_func)(self, aSelector, nil, &ilc14, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4955 |
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
|
4956 |
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
|
4957 |
argP[10], argP[11], argP[12], argP[13])); |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4958 |
|
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4959 |
case 15: |
3306
66c9ab533baa
care for interruptPending in #perform-methods.
Claus Gittinger <cg@exept.de>
parents:
3268
diff
changeset
|
4960 |
if ((InterruptPending != nil) || (aSelector != last15)) { |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4961 |
ilc15.ilc_func = __SEND15ADDR__; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4962 |
last15 = aSelector; |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4963 |
} |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
4964 |
#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
|
4965 |
ilc15.ilc_lineNo = __pilc->ilc_lineNo; |
77 | 4966 |
#endif |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4967 |
RETURN ( (*ilc15.ilc_func)(self, aSelector, nil, &ilc15, |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4968 |
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
|
4969 |
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
|
4970 |
argP[10], argP[11], argP[12], argP[13], |
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4971 |
argP[14])); |
1 | 4972 |
} |
2895
41fbba8eb543
Fix #perform:withArguments for non-array arguments collections.
Stefan Vogel <sv@exept.de>
parents:
2893
diff
changeset
|
4973 |
bad:; |
1626 | 4974 |
%}. |
4975 |
"/ arrive here, if bad number of arguments (too many) |
|
4976 |
"/ ST/X (currently) only allows up to 15 method arguments |
|
4977 |
||
1 | 4978 |
^ self primitiveFailed |
2819
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4979 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4980 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4981 |
performMethod:aMethod |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4982 |
"invoke aMethod on the receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4983 |
The method should be a zero-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4984 |
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
|
4985 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4986 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
4987 |
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
|
4988 |
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
|
4989 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4990 |
^ aMethod valueWithReceiver:self arguments:#() |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4991 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4992 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4993 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4994 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4995 |
mthd := SmallInteger compiledMethodAt:#negated. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4996 |
Transcript showCR:(1 performMethod:mthd) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4997 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4998 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
4999 |
"BAD USE example: |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5000 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5001 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5002 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5003 |
mthd := Point compiledMethodAt:#x. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5004 |
Transcript showCR:((1->2) performMethod:mthd) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5005 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5006 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5007 |
"Modified: 31.7.1997 / 17:41:50 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5008 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5009 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5010 |
performMethod:aMethod arguments:argumentArray |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5011 |
"invoke aMethod on the receiver, passing an argumentArray. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5012 |
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
|
5013 |
expected by the method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5014 |
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
|
5015 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5016 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5017 |
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
|
5018 |
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
|
5019 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5020 |
^ aMethod valueWithReceiver:self arguments:argumentArray |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5021 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5022 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5023 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5024 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5025 |
mthd := SmallInteger compiledMethodAt:#+. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5026 |
Transcript showCR:(1 performMethod:mthd arguments:#(2)) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5027 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5028 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5029 |
"Created: 31.7.1997 / 17:46:31 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5030 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5031 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5032 |
performMethod:aMethod with:arg |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5033 |
"invoke aMethod on the receiver, passing an argument. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5034 |
The method should be a one-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5035 |
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
|
5036 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5037 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5038 |
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
|
5039 |
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
|
5040 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5041 |
^ aMethod valueWithReceiver:self arguments:(Array with:arg) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5042 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5043 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5044 |
|mthd| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5045 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5046 |
mthd := SmallInteger compiledMethodAt:#+. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5047 |
Transcript showCR:(1 performMethod:mthd with:2) |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5048 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5049 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5050 |
"Modified: 31.7.1997 / 17:42:32 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5051 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5052 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5053 |
performMethod:aMethod with:arg1 with:arg2 |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5054 |
"invoke aMethod on the receiver, passing two arguments. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5055 |
The method should be a two-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5056 |
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
|
5057 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5058 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5059 |
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
|
5060 |
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
|
5061 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5062 |
^ 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
|
5063 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5064 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5065 |
|mthd arr| |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5066 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5067 |
arr := Array new:1. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5068 |
mthd := Array compiledMethodAt:#basicAt:put:. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5069 |
arr performMethod:mthd with:1 with:'foo'. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5070 |
Transcript showCR:arr |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5071 |
" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5072 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5073 |
"Modified: 31.7.1997 / 17:44:54 / cg" |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5074 |
! |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5075 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5076 |
performMethod:aMethod with:arg1 with:arg2 with:arg3 |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5077 |
"invoke aMethod on the receiver, passing three arguments. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5078 |
The method should be a three-argument method. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5079 |
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
|
5080 |
in a functional way on a receiver. |
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5081 |
Warning: |
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5082 |
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
|
5083 |
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
|
5084 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5085 |
^ 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
|
5086 |
|
18316ec20169
added #performMethod: protocol for VW compatibility.
Claus Gittinger <cg@exept.de>
parents:
2818
diff
changeset
|
5087 |
"Created: 31.7.1997 / 17:45:20 / cg" |
1 | 5088 |
! ! |
5089 |
||
5090 |
!Object methodsFor:'printing & storing'! |
|
5091 |
||
5092 |
className |
|
5093 |
"return the classname of the receivers class" |
|
5094 |
||
5095 |
^ self class name |
|
56 | 5096 |
|
293 | 5097 |
" |
5098 |
1 className |
|
5099 |
1 class className 'this may change ...' |
|
5100 |
$a className |
|
5101 |
$a class className 'this may change ...' |
|
5102 |
" |
|
1 | 5103 |
! |
5104 |
||
5105 |
classNameWithArticle |
|
71 | 5106 |
"return a string consisting of classname preceeded by an article. |
5107 |
(dont expect me to write national variants for this ... :-) |
|
5108 |
If you have special preferences, redefine it ..." |
|
1 | 5109 |
|
1391 | 5110 |
|classname cls| |
5111 |
||
5112 |
(cls := self class) == self ifTrue:[ |
|
2647 | 5113 |
^ 'a funny object' |
1391 | 5114 |
]. |
5115 |
classname := cls displayString. |
|
85 | 5116 |
^ classname article , ' ' , classname |
56 | 5117 |
|
293 | 5118 |
" |
5119 |
1 classNameWithArticle |
|
5120 |
(1->2) classNameWithArticle |
|
5121 |
XWorkstation basicNew classNameWithArticle |
|
5122 |
" |
|
1391 | 5123 |
|
5124 |
"Modified: 13.5.1996 / 12:16:14 / cg" |
|
1 | 5125 |
! |
5126 |
||
783 | 5127 |
errorPrint |
5128 |
"print the receiver on the standard error stream." |
|
5129 |
||
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5130 |
Stream streamErrorSignal catch:[ |
2647 | 5131 |
self printOn:Stderr |
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5132 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5133 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5134 |
"Modified: 7.3.1996 / 19:11:29 / cg" |
783 | 5135 |
! |
5136 |
||
1425 | 5137 |
errorPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5138 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5139 |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5140 |
"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
|
5141 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5142 |
Stream streamErrorSignal catch:[ |
2647 | 5143 |
self printOn:Stderr. |
5144 |
Stderr cr |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5145 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5146 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
5147 |
"Modified: 7.3.1996 / 19:13:01 / cg" |
1425 | 5148 |
"Created: 20.5.1996 / 10:20:41 / cg" |
5149 |
! |
|
5150 |
||
5151 |
errorPrintNL |
|
5152 |
"{ Pragma: +optSpace }" |
|
5153 |
||
5154 |
"print the receiver followed by a cr on the standard error stream. |
|
5155 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
5156 |
||
5157 |
^ self errorPrintCR |
|
5158 |
||
5159 |
"Modified: 20.5.1996 / 10:24:45 / cg" |
|
5160 |
! |
|
5161 |
||
5162 |
errorPrintNewline |
|
5163 |
"{ Pragma: +optSpace }" |
|
5164 |
||
5165 |
"print the receiver followed by a cr on the standard error stream. |
|
5166 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
5167 |
||
5168 |
self errorPrintCR. |
|
5169 |
||
5170 |
"Modified: 20.5.1996 / 10:24:38 / cg" |
|
71 | 5171 |
! |
5172 |
||
356 | 5173 |
infoPrint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5174 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5175 |
|
356 | 5176 |
"print the receiver on the standard error stream. |
5177 |
This is meant for information messages which are not warnings |
|
5178 |
or fatal messages. |
|
5179 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
5180 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5181 |
InfoPrinting == true ifTrue:[ |
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5182 |
self errorPrint |
356 | 5183 |
] |
5184 |
! |
|
5185 |
||
1425 | 5186 |
infoPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5187 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
5188 |
|
356 | 5189 |
"print the receiver followed by a cr on the standard error stream. |
5190 |
This is meant for information messages which are not warnings |
|
5191 |
or fatal messages. |
|
5192 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
5193 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5194 |
InfoPrinting == true ifTrue:[ |
2647 | 5195 |
self errorPrintCR |
356 | 5196 |
] |
1425 | 5197 |
|
5198 |
"Created: 20.5.1996 / 10:21:28 / cg" |
|
5199 |
! |
|
5200 |
||
5201 |
infoPrintNL |
|
5202 |
"{ Pragma: +optSpace }" |
|
5203 |
||
5204 |
"print the receiver followed by a cr on the standard error stream. |
|
5205 |
This is meant for information messages which are not warnings |
|
5206 |
or fatal messages. |
|
5207 |
These messages can be turned on/off by 'Object infoPrinting:true/false'. |
|
5208 |
||
5209 |
Please use #infoPrintCR - this method exists for backward compatibility." |
|
5210 |
||
2114
706cf3f9019a
initialize InfoPrinting flag from VM's setting
Claus Gittinger <cg@exept.de>
parents:
2096
diff
changeset
|
5211 |
^ self infoPrintCR |
1425 | 5212 |
|
5213 |
"Modified: 20.5.1996 / 10:25:07 / cg" |
|
356 | 5214 |
! |
5215 |
||
783 | 5216 |
|
1887 | 5217 |
"print the receiver on the standard output stream (which is not the Transcript)" |
783 | 5218 |
|
5219 |
self printOn:Stdout |
|
1887 | 5220 |
|
5221 |
"Modified: 4.11.1996 / 23:36:58 / cg" |
|
783 | 5222 |
! |
5223 |
||
1425 | 5224 |
printCR |
1887 | 5225 |
"print the receiver followed by a cr on the standard output stream (which is not the Transcript)" |
783 | 5226 |
|
5227 |
self printOn:Stdout. |
|
5228 |
Stdout cr |
|
1425 | 5229 |
|
5230 |
"Created: 20.5.1996 / 10:21:37 / cg" |
|
1887 | 5231 |
"Modified: 4.11.1996 / 23:37:06 / cg" |
1425 | 5232 |
! |
5233 |
||
5234 |
printNL |
|
5235 |
"print the receiver followed by a cr on the standard output stream |
|
5236 |
This exists for GNU Smalltalk compatibility - please use #printCR." |
|
5237 |
||
5238 |
^ self printCR |
|
5239 |
||
5240 |
"Modified: 20.5.1996 / 10:25:31 / cg" |
|
5241 |
! |
|
5242 |
||
5243 |
printNewline |
|
5244 |
"print the receiver followed by a cr on the standard output stream. |
|
5245 |
This exists for backward compatibility - please use #printCR." |
|
5246 |
||
5247 |
self printCR |
|
5248 |
||
5249 |
"Modified: 20.5.1996 / 10:25:46 / cg" |
|
783 | 5250 |
! |
5251 |
||
5252 |
printOn:aStream |
|
5253 |
"print the receiver on the argument-stream. |
|
5254 |
The default here is to output the receivers class name. |
|
5255 |
BUT: this method is heavily redefined for objects which |
|
5256 |
can print prettier." |
|
5257 |
||
5258 |
aStream nextPutAll:self classNameWithArticle |
|
5259 |
! |
|
5260 |
||
5261 |
printOn:aStream leftPaddedTo:size |
|
5262 |
"print the receiver on aStream, padding with spaces up to size. |
|
5263 |
padding is done on the left." |
|
5264 |
||
5265 |
self printOn:aStream leftPaddedTo:size with:(Character space) |
|
5266 |
||
5267 |
" |
|
5268 |
123 printOn:Transcript leftPaddedTo:10. Transcript cr |
|
5269 |
123 printOn:Transcript leftPaddedTo:2. Transcript cr |
|
5270 |
" |
|
71 | 5271 |
! |
5272 |
||
783 | 5273 |
printOn:aStream leftPaddedTo:size with:padCharacter |
5274 |
"print the receiver on aStream, padding with padCharacters up to size. |
|
5275 |
padding is done on the left." |
|
5276 |
||
5277 |
aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter) |
|
5278 |
||
5279 |
" |
|
5280 |
123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr |
|
5281 |
123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr |
|
5282 |
" |
|
5283 |
! |
|
5284 |
||
5285 |
printOn:aStream paddedTo:size |
|
5286 |
"print the receiver on aStream, padding with spaces up to size." |
|
5287 |
||
5288 |
self printOn:aStream paddedTo:size with:(Character space) |
|
5289 |
||
5290 |
" |
|
5291 |
123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr |
|
5292 |
" |
|
71 | 5293 |
! |
5294 |
||
783 | 5295 |
printOn:aStream paddedTo:size with:padCharacter |
5296 |
"print the receiver on aStream, padding with padCharacter up to size" |
|
5297 |
||
5298 |
aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter). |
|
5299 |
||
5300 |
" |
|
5301 |
123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr |
|
5302 |
123 printOn:Transcript paddedTo:10 with:$. . Transcript cr |
|
5303 |
" |
|
5304 |
! |
|
5305 |
||
5306 |
printOn:aStream zeroPaddedTo:size |
|
5307 |
"print the receiver on aStream, padding with zeros up to size. |
|
5308 |
Usually used with float numbers." |
|
5309 |
||
5310 |
self printOn:aStream paddedTo:size with:$0. |
|
5311 |
||
5312 |
" |
|
5313 |
123.0 printOn:Transcript zeroPaddedTo:10 |
|
5314 |
" |
|
5315 |
! |
|
5316 |
||
5317 |
printRightAdjustLen:size |
|
5318 |
"obsolete - just a name confusion. |
|
5319 |
This method will go away ..." |
|
5320 |
||
5321 |
(self printStringLeftPaddedTo:size) printOn:Stdout |
|
71 | 5322 |
! |
5323 |
||
5324 |
printString |
|
5325 |
"return a string for printing the receiver. |
|
5326 |
Since we now use printOn: as the basic print mechanism, |
|
5327 |
we have to create a stream and print into it." |
|
5328 |
||
5329 |
|s| |
|
5330 |
||
5331 |
s := WriteStream on:(String new:30). |
|
5332 |
self printOn:s. |
|
5333 |
^ s contents |
|
5334 |
! |
|
5335 |
||
783 | 5336 |
printStringLeftPaddedTo:size |
5337 |
"return my printString as a right-adjusted string of length size; |
|
5338 |
characters on the left are filled with spaces. |
|
5339 |
If the printString is longer than size, |
|
5340 |
it is returned unchanged (i.e. not truncated)" |
|
5341 |
||
5342 |
^ self printStringLeftPaddedTo:size with:(Character space) |
|
5343 |
||
5344 |
" |
|
5345 |
10 printStringLeftPaddedTo:10 |
|
5346 |
1 printStringLeftPaddedTo:10 |
|
5347 |
" |
|
5348 |
! |
|
5349 |
||
5350 |
printStringLeftPaddedTo:size ifLarger:alternative |
|
5351 |
"return my printString as a right-adjusted string of length size; |
|
5352 |
characters on the left are filled with spaces. |
|
5353 |
If the printString is larger than size, |
|
5354 |
return the result from evaluating alternative." |
|
5355 |
||
5356 |
^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative |
|
5357 |
||
5358 |
" |
|
5359 |
12 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5360 |
123 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5361 |
1234 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
5362 |
" |
|
5363 |
! |
|
5364 |
||
5365 |
printStringLeftPaddedTo:size with:padCharacter |
|
5366 |
"return my printString as a right-adjusted string of length size; |
|
5367 |
characters on the left are filled with padCharacter. |
|
5368 |
If the printString is longer than size, |
|
5369 |
it is returned unchanged (i.e. not truncated)" |
|
5370 |
||
5371 |
^ (self printString) leftPaddedTo:size with:padCharacter |
|
5372 |
||
5373 |
" |
|
5374 |
123 printStringLeftPaddedTo:10 with:$. |
|
5375 |
1 printStringLeftPaddedTo:10 with:$. |
|
5376 |
(Float pi) printStringLeftPaddedTo:20 with:$* |
|
5377 |
" |
|
5378 |
! |
|
5379 |
||
5380 |
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative |
|
5381 |
"return my printString as a right-adjusted string of length size; |
|
5382 |
characters on the left are filled with padCharacter. |
|
5383 |
If the printString is larger than size, |
|
369 | 5384 |
return the result from evaluating alternative." |
5385 |
||
5386 |
|s| |
|
5387 |
||
5388 |
s := self printString. |
|
5389 |
s size > size ifTrue:[^ alternative value]. |
|
783 | 5390 |
^ s leftPaddedTo:size with:padCharacter |
369 | 5391 |
|
5392 |
" |
|
783 | 5393 |
12 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
5394 |
123 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
5395 |
1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
293 | 5396 |
" |
13 | 5397 |
! |
5398 |
||
5399 |
printStringPaddedTo:size |
|
56 | 5400 |
"return a printed representation of the receiver, |
369 | 5401 |
padded with spaces (at the right) up to size. |
293 | 5402 |
If the printString is longer than size, |
5403 |
it is returned unchanged (i.e. not truncated)" |
|
13 | 5404 |
|
5405 |
^ self printStringPaddedTo:size with:(Character space) |
|
5406 |
||
293 | 5407 |
" |
5408 |
123 printStringPaddedTo:10 |
|
5409 |
1234567890123456 printStringPaddedTo:10 |
|
5410 |
'hello' printStringPaddedTo:10 |
|
5411 |
" |
|
2 | 5412 |
! |
5413 |
||
369 | 5414 |
printStringPaddedTo:size ifLarger:alternative |
5415 |
"return a printed representation of the receiver, |
|
5416 |
padded with spaces (at the right) up to size. |
|
5417 |
If the resulting printString is too large, |
|
5418 |
return the result from evaluating alternative." |
|
5419 |
||
5420 |
^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative |
|
5421 |
||
5422 |
" |
|
5423 |
12 printStringPaddedTo:3 ifLarger:['***'] |
|
5424 |
123 printStringPaddedTo:3 ifLarger:['***'] |
|
5425 |
1234 printStringPaddedTo:3 ifLarger:['***'] |
|
5426 |
" |
|
5427 |
! |
|
5428 |
||
783 | 5429 |
printStringPaddedTo:size with:padCharacter |
5430 |
"return a printed representation of the receiver, |
|
5431 |
padded with padCharacter (at the right) up to size. |
|
5432 |
If the printString is longer than size, |
|
5433 |
it is returned unchanged (i.e. not truncated)" |
|
5434 |
||
5435 |
^ (self printString) paddedTo:size with:padCharacter |
|
5436 |
||
5437 |
" |
|
5438 |
123 printStringPaddedTo:10 with:$. |
|
5439 |
123 printStringPaddedTo:10 with:$* |
|
5440 |
123 printStringPaddedTo:3 with:$* |
|
5441 |
1234 printStringPaddedTo:3 with:$* |
|
5442 |
" |
|
5443 |
! |
|
5444 |
||
5445 |
printStringPaddedTo:size with:padCharacter ifLarger:alternative |
|
5446 |
"return a printed representation of the receiver, |
|
5447 |
padded with padCharacter (at the right) up to size. |
|
5448 |
If the resulting printString is too large, |
|
5449 |
return the result from evaluating alternative." |
|
5450 |
||
5451 |
|s| |
|
5452 |
||
5453 |
s := self printString. |
|
5454 |
s size > size ifTrue:[^ alternative value]. |
|
5455 |
^ s paddedTo:size with:padCharacter |
|
5456 |
||
5457 |
" |
|
5458 |
123 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
5459 |
12345 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
5460 |
" |
|
5461 |
! |
|
5462 |
||
5463 |
printStringRightAdjustLen:size |
|
5464 |
"obsolete - just a name confusion. |
|
5465 |
This method will go away ..." |
|
5466 |
||
5467 |
^ self printStringLeftPaddedTo:size |
|
5468 |
! |
|
5469 |
||
2 | 5470 |
printStringZeroPaddedTo:size |
71 | 5471 |
"return a printed representation of the receiver, |
369 | 5472 |
padded with zero (at the right) characters up to size. |
13 | 5473 |
Usually used with float numbers." |
2 | 5474 |
|
5475 |
^ self printStringPaddedTo:size with:$0 |
|
13 | 5476 |
|
293 | 5477 |
" |
5478 |
123.0 printStringZeroPaddedTo:10 |
|
5479 |
" |
|
2 | 5480 |
! |
5481 |
||
783 | 5482 |
store |
5483 |
"store the receiver on standard output. |
|
5484 |
this method is useless, but included for compatibility." |
|
5485 |
||
5486 |
self storeOn:Stdout |
|
71 | 5487 |
! |
5488 |
||
1425 | 5489 |
storeCR |
5490 |
"store the receiver on standard output; append a carriage return." |
|
5491 |
||
5492 |
self store. |
|
5493 |
Character cr print |
|
5494 |
||
5495 |
"Created: 20.5.1996 / 10:26:01 / cg" |
|
5496 |
"Modified: 20.5.1996 / 10:26:57 / cg" |
|
5497 |
! |
|
5498 |
||
783 | 5499 |
storeNl |
5500 |
"store the receiver on standard output; append a newline. |
|
1425 | 5501 |
This method is included for backward compatibility- use #storeCR." |
5502 |
||
5503 |
self storeCR. |
|
5504 |
||
5505 |
"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
|
5506 |
! |
7e058858cc3b
New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents:
446
diff
changeset
|
5507 |
|
56 | 5508 |
storeOn:aStream |
5509 |
"store the receiver on aStream; i.e. print an expression which will |
|
293 | 5510 |
reconstruct the receiver. |
5511 |
Notice, that no self referencing or cyclic objects can be represented |
|
5512 |
in this format. |
|
5513 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 5514 |
|
5515 |
|myClass hasSemi sz "{ Class: SmallInteger }" | |
|
1 | 5516 |
|
25 | 5517 |
thisContext isRecursive ifTrue:[ |
2647 | 5518 |
('Object [error]: storeString of self referencing object.') errorPrintCR. |
5519 |
aStream nextPutAll:'#("recursive")'. |
|
5520 |
^ self |
|
25 | 5521 |
]. |
56 | 5522 |
|
1 | 5523 |
myClass := self class. |
56 | 5524 |
aStream nextPut:$(. |
5525 |
aStream nextPutAll:self class name. |
|
5526 |
||
1 | 5527 |
hasSemi := false. |
5528 |
myClass isVariable ifTrue:[ |
|
2647 | 5529 |
aStream nextPutAll:' basicNew:'. |
5530 |
self basicSize printOn:aStream |
|
1 | 5531 |
] ifFalse:[ |
2647 | 5532 |
aStream nextPutAll:' basicNew' |
1 | 5533 |
]. |
56 | 5534 |
|
1 | 5535 |
sz := myClass instSize. |
5536 |
1 to:sz do:[:i | |
|
2647 | 5537 |
aStream nextPutAll:' instVarAt:'. |
5538 |
i printOn:aStream. |
|
5539 |
aStream nextPutAll:' put:'. |
|
5540 |
(self instVarAt:i) storeOn:aStream. |
|
5541 |
aStream nextPut:$;. |
|
5542 |
hasSemi := true |
|
1 | 5543 |
]. |
5544 |
myClass isVariable ifTrue:[ |
|
2647 | 5545 |
sz := self basicSize. |
5546 |
1 to:sz do:[:i | |
|
5547 |
aStream nextPutAll:' basicAt:'. |
|
5548 |
i printOn:aStream. |
|
5549 |
aStream nextPutAll:' put:'. |
|
5550 |
(self basicAt:i) storeOn:aStream. |
|
5551 |
aStream nextPut:$;. |
|
5552 |
hasSemi := true |
|
5553 |
] |
|
1 | 5554 |
]. |
5555 |
hasSemi ifTrue:[ |
|
2647 | 5556 |
aStream nextPutAll:' yourself' |
1 | 5557 |
]. |
56 | 5558 |
aStream nextPut:$). |
293 | 5559 |
|
5560 |
" |
|
5561 |
|s| |
|
5562 |
||
5563 |
s := WriteStream on:(String new). |
|
5564 |
('hello' -> 'world') storeOn:s. |
|
5565 |
s := ReadStream on:(s contents). |
|
5566 |
(Object readFrom:s) inspect |
|
5567 |
" |
|
5568 |
" |
|
5569 |
|s| |
|
5570 |
||
5571 |
s := 'data' asFilename writeStream. |
|
5572 |
('hello' -> 'world') storeOn:s. |
|
5573 |
s close. |
|
5574 |
||
5575 |
s := 'data' asFilename readStream. |
|
5576 |
(Object readFrom:s) inspect |
|
5577 |
" |
|
5578 |
||
5579 |
"does not work example:" |
|
5580 |
" |
|
5581 |
|s a| |
|
5582 |
||
5583 |
a := Array new:2. |
|
5584 |
a at:1 put:a. |
|
5585 |
||
5586 |
s := 'data' asFilename writeStream. |
|
5587 |
a storeOn:s. |
|
5588 |
s close. |
|
5589 |
||
5590 |
s := 'data' asFilename readStream. |
|
5591 |
(Object readFrom:s) inspect |
|
5592 |
" |
|
1417 | 5593 |
|
2287 | 5594 |
"Modified: 28.1.1997 / 00:36:12 / cg" |
1 | 5595 |
! |
5596 |
||
56 | 5597 |
storeString |
293 | 5598 |
"return a string representing an expression to reconstruct the receiver. |
5599 |
Notice, that no self referencing or cyclic objects can be represented |
|
5600 |
in this format. |
|
5601 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 5602 |
|
5603 |
|s| |
|
5604 |
||
5605 |
s := WriteStream on:(String new:50). |
|
5606 |
self storeOn:s. |
|
5607 |
^ s contents |
|
783 | 5608 |
! ! |
5609 |
||
5610 |
!Object methodsFor:'queries'! |
|
5611 |
||
5612 |
basicSize |
|
5613 |
"return the number of the receivers indexed instance variables, |
|
5614 |
0 if it has none. |
|
5615 |
||
2148 | 5616 |
This method should NOT be redefined in any subclass (except with great care, for tuning)" |
783 | 5617 |
|
5618 |
%{ /* NOCONTEXT */ |
|
5619 |
||
5620 |
REGISTER int nbytes; |
|
5621 |
REGISTER OBJ myClass; |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5622 |
int nInstBytes; |
783 | 5623 |
|
5624 |
/* |
|
5625 |
* notice the missing test for self being a nonNilObject - |
|
5626 |
* this can be done since basicSize is defined both in UndefinedObject |
|
5627 |
* and SmallInteger |
|
5628 |
*/ |
|
5629 |
myClass = __qClass(self); |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5630 |
nbytes = __qSize(self); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5631 |
nInstBytes = OHDR_SIZE + __OBJS2BYTES__( __intVal(__ClassInstPtr(myClass)->c_ninstvars) ); |
1133 | 5632 |
|
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5633 |
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
|
5634 |
case __MASKSMALLINT(POINTERARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5635 |
case __MASKSMALLINT(WKPOINTERARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5636 |
nbytes -= nInstBytes; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5637 |
RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) ); |
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5638 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5639 |
case __MASKSMALLINT(BYTEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5640 |
nbytes -= nInstBytes; |
2647 | 5641 |
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
|
5642 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5643 |
case __MASKSMALLINT(FLOATARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5644 |
nbytes -= nInstBytes; |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5645 |
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
|
5646 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5647 |
case __MASKSMALLINT(DOUBLEARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5648 |
#ifdef __NEED_DOUBLE_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5649 |
nInstBytes = (nInstBytes-1+__DOUBLE_ALIGN) &~ (__DOUBLE_ALIGN-1); |
783 | 5650 |
#endif |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5651 |
nbytes -= nInstBytes; |
2647 | 5652 |
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
|
5653 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5654 |
case __MASKSMALLINT(WORDARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5655 |
case __MASKSMALLINT(SWORDARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5656 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5657 |
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
|
5658 |
|
3177
a94f43a8304c
added #perform: with 5 & 6 args
Claus Gittinger <cg@exept.de>
parents:
3175
diff
changeset
|
5659 |
case __MASKSMALLINT(LONGARRAY): |
3159
6adde9718bdc
more variable-inst accesses; use switch instead of multiway-if.
Claus Gittinger <cg@exept.de>
parents:
3135
diff
changeset
|
5660 |
case __MASKSMALLINT(SLONGARRAY): |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5661 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5662 |
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
|
5663 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5664 |
case __MASKSMALLINT(LONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5665 |
case __MASKSMALLINT(SLONGLONGARRAY): |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5666 |
#ifdef __NEED_LONGLONG_ALIGN |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5667 |
nInstBytes = (nInstBytes-1+__LONGLONG_ALIGN) &~ (__LONGLONG_ALIGN-1); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5668 |
#endif |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5669 |
nbytes -= nInstBytes; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5670 |
RETURN ( __MKSMALLINT(nbytes>>3) ); /* notice the hardcoded 8 here - not sizeof(long long) */ |
783 | 5671 |
} |
5672 |
%}. |
|
5673 |
^ 0 |
|
1 | 5674 |
! |
5675 |
||
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5676 |
byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5677 |
"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
|
5678 |
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
|
5679 |
instvars i.e. byteArrays, wordArrays etc. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5680 |
Notice: for Strings the returned size may look strange. |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5681 |
Only useful with binary storage." |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5682 |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5683 |
|myClass| |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5684 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5685 |
myClass := self class. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5686 |
myClass isVariable ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5687 |
myClass isPointers ifFalse:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5688 |
myClass isBytes ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5689 |
^ self basicSize. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5690 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5691 |
myClass isWords ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5692 |
^ self basicSize * 2. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5693 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5694 |
myClass isSignedWords ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5695 |
^ self basicSize * 2. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5696 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5697 |
myClass isLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5698 |
^ self basicSize * 4. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5699 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5700 |
myClass isSignedLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5701 |
^ self basicSize * 4. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5702 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5703 |
myClass isLongLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5704 |
^ self basicSize * 8. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5705 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5706 |
myClass isSignedLongLongs ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5707 |
^ self basicSize * 8. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5708 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5709 |
myClass isFloats ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5710 |
^ self basicSize * %{ __MKSMALLINT(sizeof(float)) %}. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5711 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5712 |
myClass isDoubles ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5713 |
^ self basicSize * %{ __MKSMALLINT(sizeof(double)) %}. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5714 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5715 |
self halt:'oops'. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5716 |
] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5717 |
]. |
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5718 |
^ 0 |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5719 |
|
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5720 |
" |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5721 |
Point new byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5722 |
'hello' byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5723 |
(ByteArray with:1 with:2) byteSize |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5724 |
(FloatArray with:1.5) byteSize |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5725 |
(DoubleArray with:1.5) byteSize |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
5726 |
(WordArray with:1 with:2) byteSize |
2575
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5727 |
" |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5728 |
! |
797f7408e03c
added #byteSize (for binary storage)
Claus Gittinger <cg@exept.de>
parents:
2574
diff
changeset
|
5729 |
|
783 | 5730 |
class |
5731 |
"return the receivers class" |
|
5732 |
||
5733 |
%{ /* NOCONTEXT */ |
|
5734 |
||
5735 |
RETURN ( __Class(self) ); |
|
5736 |
%} |
|
5737 |
! |
|
5738 |
||
5739 |
respondsTo:aSelector |
|
5740 |
"return true, if the receiver implements a method with selector equal |
|
5741 |
to aSelector; i.e. if there is a method for aSelector in either the |
|
5742 |
receivers class or one of its superclasses. |
|
5743 |
||
5744 |
Notice, that this does not imply, that such a message can be sent without |
|
5745 |
an error being raised. For example, an implementation could send |
|
5746 |
#shouldNotImplement or #subclassResponsibility." |
|
5747 |
||
5748 |
" |
|
5749 |
should we go via the cache, or search (by class) ? |
|
5750 |
The first is faster, most of the time; while the 2nd fills |
|
5751 |
the cache with useless data if this is sent in a loop over all objects. |
|
5752 |
For now, use the cache ... |
|
5753 |
" |
|
5754 |
%{ /* NOCONTEXT */ |
|
5755 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
5756 |
if (__lookup(__Class(self), aSelector) == nil) { |
783 | 5757 |
RETURN ( false ); |
5758 |
} |
|
5759 |
RETURN ( true ); |
|
5760 |
%} |
|
5761 |
. |
|
5762 |
" |
|
5763 |
^ self class canUnderstand:aSelector |
|
5764 |
" |
|
5765 |
||
5766 |
"'aString' respondsTo:#+" |
|
5767 |
"'aString' respondsTo:#," |
|
5768 |
"'aString' respondsTo:#collect:" |
|
5769 |
! |
|
5770 |
||
5771 |
respondsToArithmetic |
|
5772 |
"return true, if the receiver responds to arithmetic messages. |
|
5773 |
false is returned here - the method is redefined in ArithmeticValue." |
|
5774 |
||
5775 |
^ false |
|
5776 |
! |
|
5777 |
||
5778 |
size |
|
5779 |
"return the number of the receivers indexed instance variables; |
|
5780 |
this method may be redefined in subclasses" |
|
5781 |
||
5782 |
^ self basicSize |
|
5783 |
! |
|
5784 |
||
5785 |
species |
|
5786 |
"return a class which is similar to (or the same as) the receivers class. |
|
5787 |
This is used to create an appropriate object when creating derived |
|
5788 |
copies in the collection classes (sometimes redefined)." |
|
5789 |
||
5790 |
^ self class |
|
5791 |
! |
|
5792 |
||
5793 |
yourself |
|
5794 |
"return the receiver - used for cascades to return self at the end" |
|
5795 |
||
5796 |
^ self |
|
5797 |
! ! |
|
5798 |
||
5799 |
!Object methodsFor:'secure message sending'! |
|
5800 |
||
5801 |
askFor:aSelector |
|
5802 |
"try to send the receiver the message, aSelector. |
|
5803 |
If it does not understand it, return false. Otherwise |
|
5804 |
the real value returned. |
|
5805 |
Useful to send messages such as: 'isColor' to unknown |
|
5806 |
receivers." |
|
5807 |
||
5808 |
^ self perform:aSelector ifNotUnderstood:[false] |
|
5809 |
||
5810 |
" |
|
5811 |
1 askFor:#isColor |
|
5812 |
" |
|
5813 |
! |
|
5814 |
||
5815 |
perform:aSelector ifNotUnderstood:exceptionBlock |
|
5816 |
"try to send message aSelector to the receiver. |
|
5817 |
If its understood, return the methods returned value, |
|
5818 |
otherwise return the value of the exceptionBlock" |
|
5819 |
||
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5820 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5821 |
|
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5822 |
"/ cg: used to return from the handler here; |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5823 |
"/ however, the following is much faster in that |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5824 |
"/ it avoids the need for a full block. |
783 | 5825 |
|
5826 |
MessageNotUnderstoodSignal handle:[:ex | |
|
5827 |
] do:[ |
|
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5828 |
val := self perform:aSelector. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5829 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5830 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5831 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5832 |
^ exceptionBlock value |
783 | 5833 |
]. |
5834 |
^ val |
|
5835 |
||
5836 |
" |
|
5837 |
1.2345 perform:#foo ifNotUnderstood:['sorry'] |
|
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5838 |
1.2345 perform:#sqrt ifNotUnderstood:['sorry'] |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5839 |
12345 perform:#sqrt ifNotUnderstood:['sorry'] |
783 | 5840 |
" |
1 | 5841 |
! |
5842 |
||
783 | 5843 |
perform:aSelector with:argument ifNotUnderstood:exceptionBlock |
5844 |
"try to send message aSelector to the receiver. |
|
5845 |
If its understood, return the methods returned value, |
|
5846 |
otherwise return the value of the exceptionBlock" |
|
5847 |
||
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5848 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5849 |
|
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5850 |
"/ cg: used to return from the handler here; |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5851 |
"/ however, the following is much faster in that |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5852 |
"/ it avoids the need for another full block. |
783 | 5853 |
|
5854 |
MessageNotUnderstoodSignal handle:[:ex | |
|
5855 |
] do:[ |
|
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5856 |
val := self perform:aSelector with:argument. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5857 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5858 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5859 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5860 |
^ exceptionBlock value |
783 | 5861 |
]. |
5862 |
^ val |
|
5863 |
||
5864 |
" |
|
5865 |
|unknown| |
|
5866 |
||
5867 |
unknown := 1. |
|
5868 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
5869 |
unknown := 'high there'. |
|
5870 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
5871 |
" |
|
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5872 |
! |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5873 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5874 |
perform:aSelector withArguments:argumentArray ifNotUnderstood:exceptionBlock |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5875 |
"try to send message aSelector to the receiver. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5876 |
If its understood, return the methods returned value, |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5877 |
otherwise return the value of the exceptionBlock" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5878 |
|
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5879 |
|val ok| |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5880 |
|
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5881 |
"/ cg: used to return from the handler here; |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5882 |
"/ however, the following is much faster in that |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5883 |
"/ it avoids the need for another full block. |
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5884 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5885 |
MessageNotUnderstoodSignal handle:[:ex | |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5886 |
] do:[ |
3994
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5887 |
val := self perform:aSelector withArguments:argumentArray. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5888 |
ok := true. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5889 |
]. |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5890 |
ok isNil ifTrue:[ |
e156620a43df
slightly tuned #perform:ifNotUnderstood: methods.
Claus Gittinger <cg@exept.de>
parents:
3961
diff
changeset
|
5891 |
^ exceptionBlock value |
2506
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5892 |
]. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5893 |
^ val |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5894 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5895 |
" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5896 |
|unknown| |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5897 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5898 |
unknown := 1. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5899 |
(unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5900 |
unknown := 'high there'. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5901 |
(unknown perform:#+ withArguments:#(2) ifNotUnderstood:['sorry']) printNewline. |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5902 |
" |
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5903 |
|
255c87b6fb4f
added #perform:withArguments:ifNotUnderstood:
Claus Gittinger <cg@exept.de>
parents:
2505
diff
changeset
|
5904 |
"Modified: 27.3.1997 / 14:13:16 / cg" |
783 | 5905 |
! ! |
5906 |
||
2448 | 5907 |
!Object methodsFor:'signal constants'! |
5908 |
||
5909 |
messageNotUnderstoodSignal |
|
5910 |
^ MessageNotUnderstoodSignal |
|
5911 |
||
5912 |
"Created: 6.3.1997 / 15:46:52 / cg" |
|
5913 |
! ! |
|
5914 |
||
783 | 5915 |
!Object methodsFor:'special queries'! |
5916 |
||
5917 |
allOwners |
|
5918 |
"return a collection of all objects referencing the receiver" |
|
5919 |
||
5920 |
^ ObjectMemory whoReferences:self |
|
5921 |
! |
|
5922 |
||
5923 |
references:anObject |
|
5924 |
"return true, if the receiver refers to the argument, anObject. |
|
5925 |
- for debugging only" |
|
5926 |
||
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5927 |
%{ /* NOCONTEXT */ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5928 |
OBJ cls, flags; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5929 |
int nInsts, i; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5930 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5931 |
if (! __isNonNilObject(self)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5932 |
RETURN (false); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5933 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5934 |
|
783 | 5935 |
/* |
5936 |
* a little optimization: use the fact that all old objects |
|
5937 |
* refering to a new object are on the remSet; if I am not, |
|
5938 |
* a trivial reject is possible, if anObject is a newbee |
|
5939 |
*/ |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5940 |
if (__isNonNilObject(anObject)) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5941 |
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
|
5942 |
int spc; |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5943 |
|
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5944 |
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
|
5945 |
RETURN (false); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5946 |
} |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5947 |
} |
783 | 5948 |
} |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5949 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5950 |
cls = __qClass(self); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5951 |
if (cls == anObject) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5952 |
RETURN (true); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5953 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5954 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5955 |
flags = __ClassInstPtr(cls)->c_flags; |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
5956 |
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
|
5957 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5958 |
} else { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5959 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5960 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5961 |
if (! nInsts) { |
3396
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5962 |
RETURN (false); |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5963 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5964 |
#if defined(memsrch4) |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5965 |
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
|
5966 |
RETURN (true); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5967 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5968 |
#else |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5969 |
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
|
5970 |
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
|
5971 |
RETURN (true); |
78f572bb3677
pass messageSend as parameter to domainError exception (in fpException)
Claus Gittinger <cg@exept.de>
parents:
3385
diff
changeset
|
5972 |
} |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5973 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5974 |
#endif /* memsrch4 */ |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5975 |
|
783 | 5976 |
%}. |
5977 |
||
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5978 |
"/ |myClass |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5979 |
"/ numInst "{ Class: SmallInteger }" | |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
5980 |
"/ |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5981 |
"/ myClass := self class. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5982 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5983 |
"/ "check the class" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5984 |
"/ (myClass == anObject) ifTrue:[^ true]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5985 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5986 |
"/ "check the instance variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5987 |
"/ numInst := myClass instSize. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5988 |
"/ 1 to:numInst do:[:i | |
2647 | 5989 |
"/ ((self instVarAt:i) == anObject) ifTrue:[^ true] |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5990 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5991 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5992 |
"/ "check the indexed variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
5993 |
"/ myClass isVariable ifTrue:[ |
2647 | 5994 |
"/ myClass isPointers ifFalse:[ |
5995 |
"/ "/ |
|
5996 |
"/ "/ we could argue about the following unconditional return: |
|
5997 |
"/ "/ it says that a non pointer array never has a reference to the |
|
5998 |
"/ "/ corresponding object - not mimicing a reference to a copy of the |
|
5999 |
"/ "/ integer. However, it avoids useless searches in huge byteArray |
|
6000 |
"/ "/ like objects when searching for owners. If in doubt, remove it. |
|
6001 |
"/ "/ A consequence of the return below is that #[1 2 3] will say that it |
|
6002 |
"/ "/ 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
|
6003 |
"/ |
2647 | 6004 |
"/ ^ false. |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6005 |
"/ |
2647 | 6006 |
"/ "/ alternative: |
6007 |
"/ "/ anObject isNumber ifFalse:[^ false]. |
|
6008 |
"/ ]. |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6009 |
"/ |
2647 | 6010 |
"/ "/ |
6011 |
"/ "/ because arrays are so common, and those have a highly tuned |
|
6012 |
"/ "/ idenitytIndex method, use it |
|
6013 |
"/ "/ |
|
6014 |
"/ myClass == Array ifTrue:[ |
|
6015 |
"/ ^ (self identityIndexOf:anObject) ~~ 0 |
|
6016 |
"/ ]. |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6017 |
"/ |
2647 | 6018 |
"/ "/ |
6019 |
"/ "/ otherwise, do it the slow way |
|
6020 |
"/ "/ |
|
6021 |
"/ numInst := self basicSize. |
|
6022 |
"/ 1 to:numInst do:[:i | |
|
6023 |
"/ ((self basicAt:i) == anObject) ifTrue:[^ true] |
|
6024 |
"/ ] |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6025 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
6026 |
|
783 | 6027 |
^ false |
6028 |
||
6029 |
" |
|
6030 |
|v| |
|
6031 |
||
6032 |
v := View new initialize. |
|
6033 |
v references:Display. |
|
6034 |
" |
|
6035 |
! |
|
6036 |
||
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6037 |
referencesAny:aCollection |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6038 |
"return true, if the receiver refers to any object from |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6039 |
the argument, aCollection. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6040 |
- for debugging only" |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6041 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6042 |
%{ |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6043 |
OBJ cls, flags; |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6044 |
int nInsts, inst; |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6045 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6046 |
if (! __isNonNilObject(self)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6047 |
RETURN (false); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6048 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6049 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6050 |
if (__isArray(aCollection)) { |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6051 |
int nObjs = __arraySize(aCollection); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6052 |
char *minAddr = 0, *maxAddr = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6053 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6054 |
if (nObjs == 0) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6055 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6056 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6057 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6058 |
/* |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6059 |
* a little optimization: use the fact that all old objects |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6060 |
* 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
|
6061 |
* a trivial reject is possible, if all objects are newbees. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6062 |
* as a side effect, gather min/max addresses |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6063 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6064 |
if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6065 |
int allNewBees = 1; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6066 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6067 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6068 |
minAddr = (char *)(__ArrayInstPtr(aCollection)->a_element[0]); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6069 |
maxAddr = minAddr; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6070 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6071 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6072 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6073 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6074 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6075 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6076 |
if (__isNonNilObject(anObject)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6077 |
int spc; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6078 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6079 |
if (((spc = __qSpace(anObject)) != NEWSPACE) && (spc != SURVSPACE)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6080 |
allNewBees = 0; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6081 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6082 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6083 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6084 |
if ((char *)anObject < minAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6085 |
minAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6086 |
} else if ((char *)anObject > maxAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6087 |
maxAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6088 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6089 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6090 |
if (allNewBees) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6091 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6092 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6093 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6094 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6095 |
/* |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6096 |
* fetch min/max in searchList (if not already done) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6097 |
*/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6098 |
if (minAddr == 0) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6099 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6100 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6101 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6102 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6103 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6104 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6105 |
if ((char *)anObject < minAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6106 |
minAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6107 |
} else if ((char *)anObject > maxAddr) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6108 |
maxAddr = (char *)anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6109 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6110 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6111 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6112 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6113 |
cls = __qClass(self); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6114 |
if (((char *)cls >= minAddr) && ((char *)cls <= maxAddr)) { |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6115 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6116 |
if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)cls, nObjs)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6117 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6118 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6119 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6120 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6121 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6122 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6123 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6124 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6125 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6126 |
if (cls == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6127 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6128 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6129 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6130 |
#endif /* memsrch4 */ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6131 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6132 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6133 |
flags = __ClassInstPtr(cls)->c_flags; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6134 |
if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6135 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6136 |
} else { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6137 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6138 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6139 |
if (! nInsts) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6140 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6141 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6142 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6143 |
if (nObjs == 1) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6144 |
/* better reverse the loop */ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6145 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6146 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6147 |
anObject = __ArrayInstPtr(aCollection)->a_element[0]; |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6148 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6149 |
if (memsrch4(__InstPtr(self)->i_instvars, (INT)anObject, nInsts)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6150 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6151 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6152 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6153 |
for (inst=0; inst<nInsts; inst++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6154 |
if ((__InstPtr(self)->i_instvars[inst]) == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6155 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6156 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6157 |
} |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6158 |
#endif |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6159 |
RETURN (false); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6160 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6161 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6162 |
for (inst=0; inst<nInsts; inst++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6163 |
OBJ instVar = __InstPtr(self)->i_instvars[inst]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6164 |
int i; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6165 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6166 |
if (((char *)instVar >= minAddr) && ((char *)instVar <= maxAddr)) { |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6167 |
#if defined(memsrch4) |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6168 |
if (memsrch4(__ArrayInstPtr(aCollection)->a_element, (INT)instVar, nObjs)) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6169 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6170 |
} |
3694
429ec70365a6
tuned #referencesAny (for ref-chain search)
Claus Gittinger <cg@exept.de>
parents:
3622
diff
changeset
|
6171 |
#else |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6172 |
for (i=0; i<nObjs; i++) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6173 |
OBJ anObject; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6174 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6175 |
anObject = __ArrayInstPtr(aCollection)->a_element[i]; |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6176 |
if (instVar == anObject) { |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6177 |
RETURN (true); |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6178 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6179 |
} |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6180 |
#endif /* memsrch4 */ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6181 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6182 |
} |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6183 |
RETURN (false); |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6184 |
} |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6185 |
%}. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6186 |
|
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6187 |
aCollection do:[:el | |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6188 |
(self references:el) ifTrue:[^ true]. |
3259
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6189 |
]. |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6190 |
^ false |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6191 |
! |
ead60aee4cd3
tuned #references: & added #referencesAny:
Claus Gittinger <cg@exept.de>
parents:
3254
diff
changeset
|
6192 |
|
783 | 6193 |
referencesDerivedInstanceOf:aClass |
6194 |
"return true, if the receiver refers to an instance of |
|
6195 |
the argument, aClass or its subclass. This method exists |
|
6196 |
to support searching for users of a class." |
|
6197 |
||
6198 |
|myClass |
|
6199 |
numInst "{ Class: SmallInteger }" | |
|
6200 |
||
6201 |
myClass := self class. |
|
6202 |
||
6203 |
"check the class" |
|
6204 |
(myClass isKindOf:aClass) ifTrue:[^ true]. |
|
6205 |
||
6206 |
"check the instance variables" |
|
6207 |
numInst := myClass instSize. |
|
6208 |
1 to:numInst do:[:i | |
|
6209 |
((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
6210 |
]. |
|
6211 |
||
6212 |
"check the indexed variables" |
|
6213 |
myClass isVariable ifTrue:[ |
|
6214 |
myClass isPointers ifFalse:[ |
|
6215 |
"no need to search in non pointer fields" |
|
6216 |
((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false]. |
|
6217 |
]. |
|
6218 |
numInst := self basicSize. |
|
6219 |
1 to:numInst do:[:i | |
|
6220 |
((self basicAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
6221 |
] |
|
6222 |
]. |
|
6223 |
^ false |
|
6224 |
||
6225 |
" |
|
6226 |
(1 @ 3.4) referencesDerivedInstanceOf:Number |
|
6227 |
(1 @ 3.4) referencesDerivedInstanceOf:Array |
|
6228 |
View new initialize referencesDerivedInstanceOf:DeviceWorkstation |
|
6229 |
" |
|
6230 |
! |
|
6231 |
||
6232 |
referencesInstanceOf:aClass |
|
6233 |
"return true, if the receiver refers to an instance of |
|
6234 |
the argument, aClass.This method exists |
|
6235 |
to support searching for users of a class." |
|
6236 |
||
6237 |
|myClass |
|
6238 |
numInst "{ Class: SmallInteger }" | |
|
6239 |
||
6240 |
myClass := self class. |
|
6241 |
||
6242 |
"check the class" |
|
6243 |
(myClass isMemberOf:aClass) ifTrue:[^ true]. |
|
6244 |
||
6245 |
"check the instance variables" |
|
6246 |
numInst := myClass instSize. |
|
6247 |
1 to:numInst do:[:i | |
|
6248 |
((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
6249 |
]. |
|
6250 |
||
6251 |
"check the indexed variables" |
|
6252 |
myClass isVariable ifTrue:[ |
|
6253 |
myClass isPointers ifFalse:[ |
|
6254 |
"no need to search in non-pointer indexed fields" |
|
6255 |
myClass isLongs ifTrue:[ |
|
6256 |
(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false]. |
|
6257 |
] ifFalse:[ |
|
6258 |
myClass isFloatsOrDoubles ifTrue:[^ aClass == Float]. |
|
6259 |
^ aClass == SmallInteger |
|
6260 |
] |
|
6261 |
]. |
|
6262 |
numInst := self basicSize. |
|
6263 |
1 to:numInst do:[:i | |
|
6264 |
((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
6265 |
] |
|
6266 |
]. |
|
6267 |
^ false |
|
6268 |
||
6269 |
" |
|
6270 |
(1 @ 3.4) referencesInstanceOf:Float |
|
6271 |
(1 @ 3.4) referencesInstanceOf:Fraction |
|
6272 |
View new initialize referencesInstanceOf:(Display class) |
|
6273 |
" |
|
1 | 6274 |
! ! |
783 | 6275 |
|
2295 | 6276 |
!Object methodsFor:'synchronized evaluation'! |
6277 |
||
6278 |
freeSynchronizationSemaphore |
|
6279 |
"free synchronizationSemaphore. May be used, to save memory when |
|
6280 |
an object is no longer used synchronized." |
|
6281 |
||
2342 | 6282 |
|sema| |
2295 | 6283 |
|
6284 |
sema := self synchronizationSemaphore. |
|
6285 |
sema notNil ifTrue:[ |
|
2647 | 6286 |
sema wait. "/ get lock |
6287 |
self synchronizationSemaphore:nil. |
|
2295 | 6288 |
]. |
6289 |
||
6290 |
" |
|
6291 |
self synchronized:[]. |
|
6292 |
self synchronizationSemaphore. |
|
6293 |
self freeSynchronizationSemaphore. |
|
6294 |
" |
|
6295 |
||
6296 |
"Created: 28.1.1997 / 19:31:20 / stefan" |
|
6297 |
"Modified: 28.1.1997 / 19:47:55 / stefan" |
|
6298 |
! |
|
6299 |
||
6300 |
synchronizationSemaphore |
|
6301 |
"return the synchronization semaphore for myself. |
|
6302 |
subclasses may redefine" |
|
6303 |
||
6304 |
^ SynchronizationSemaphores at:self ifAbsent:[]. |
|
6305 |
||
6306 |
" |
|
6307 |
self synchronizationSemaphore |
|
6308 |
" |
|
6309 |
||
6310 |
"Modified: 28.1.1997 / 19:47:09 / stefan" |
|
6311 |
! |
|
6312 |
||
6313 |
synchronizationSemaphore:aSemaphore |
|
6314 |
"set the synchronisationSemaphore for myself. |
|
6315 |
subclasses may redefine this method" |
|
6316 |
||
6317 |
aSemaphore isNil ifTrue:[ |
|
2647 | 6318 |
"/ remove Semaphore |
6319 |
SynchronizationSemaphores removeKey:self ifAbsent:[]. |
|
2295 | 6320 |
] ifFalse:[ |
2647 | 6321 |
SynchronizationSemaphores at:self put:aSemaphore. |
2295 | 6322 |
]. |
6323 |
||
6324 |
"Modified: 28.1.1997 / 19:37:48 / stefan" |
|
6325 |
! |
|
6326 |
||
6327 |
synchronized:aBlock |
|
6328 |
"evaluate aBlock synchronized, i.e. use a monitor for this object" |
|
6329 |
||
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6330 |
|sema blocked gotSema| |
2327 | 6331 |
|
6332 |
blocked := OperatingSystem blockInterrupts. |
|
6333 |
||
6334 |
"/ the following avoids creation of an additional |
|
6335 |
"/ block in the common case |
|
2295 | 6336 |
|
6337 |
sema := self synchronizationSemaphore. |
|
6338 |
sema isNil ifTrue:[ |
|
2647 | 6339 |
"get a locked semaphore (with count = 0)" |
6340 |
sema := Semaphore new. |
|
6341 |
self synchronizationSemaphore:sema. |
|
6342 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
6343 |
^ aBlock valueNowOrOnUnwindDo:[sema signal]. |
|
2327 | 6344 |
]. |
6345 |
||
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6346 |
" |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6347 |
Poll sema (never waits). |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6348 |
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
|
6349 |
of some blocks. |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6350 |
" |
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6351 |
(sema waitWithTimeout:0) notNil ifTrue:[ |
2647 | 6352 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
6353 |
^ aBlock valueNowOrOnUnwindDo:[sema signal]. |
|
2295 | 6354 |
]. |
2327 | 6355 |
|
6356 |
[ |
|
2647 | 6357 |
gotSema := sema wait. |
6358 |
blocked ifFalse:[OperatingSystem unblockInterrupts]. |
|
6359 |
^ aBlock value. |
|
2327 | 6360 |
] valueNowOrOnUnwindDo:[ |
2647 | 6361 |
gotSema notNil ifTrue:[gotSema signal] |
2327 | 6362 |
]. |
2295 | 6363 |
|
6364 |
" |
|
6365 |
[Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'1']] fork. |
|
6366 |
[Object synchronized:[Delay waitForSeconds:2. Transcript showCR:'2']] fork. |
|
6367 |
" |
|
6368 |
||
6369 |
"Created: 28.1.1997 / 17:52:56 / stefan" |
|
2327 | 6370 |
"Modified: 30.1.1997 / 13:38:54 / cg" |
2412
f20a5b10e6ab
Further optim. for #synchronized.
Stefan Vogel <sv@exept.de>
parents:
2359
diff
changeset
|
6371 |
"Modified: 20.2.1997 / 09:43:35 / stefan" |
2295 | 6372 |
! ! |
6373 |
||
783 | 6374 |
!Object methodsFor:'system primitives'! |
6375 |
||
1957 | 6376 |
asOop |
6377 |
"ST-80 compatibility: |
|
6378 |
ST-80 returns an OOP-identity based number here (I guess: its address |
|
6379 |
or index); since ST/X has no such thing, and the objects address cannot |
|
6380 |
be used (since its changing over time), we return the objects identityHash |
|
6381 |
key, which provides (at least) some identity indication. |
|
6382 |
However, notice that (in contrast to ST-80's #asOop), the identityHash |
|
6383 |
key of two non-identical objects may be the same. |
|
6384 |
You'd better not use it - especially do not misuse it." |
|
6385 |
||
6386 |
^ self identityHash |
|
6387 |
||
6388 |
"Created: 9.11.1996 / 19:09:56 / cg" |
|
6389 |
"Modified: 9.11.1996 / 19:16:04 / cg" |
|
6390 |
! |
|
6391 |
||
783 | 6392 |
become:anotherObject |
6393 |
"make all references to the receiver become references to anotherObject |
|
859 | 6394 |
and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become. |
6395 |
This can be a very dangerous operation - be warned. |
|
861 | 6396 |
In general, using #become: should be avoided if possible, since it may |
6397 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
6398 |
||
6399 |
This may also be an expensive (i.e. slow) operation, |
|
783 | 6400 |
since in the worst case, the whole memory has to be searched for |
6401 |
references to the two objects (although the primitive tries hard to |
|
6402 |
limit the search, for acceptable performance in most cases). |
|
6403 |
This method fails, if the receiver or the argument is a SmallInteger |
|
6404 |
or nil, or is a context of a living method (i.e. one that has not already |
|
6405 |
returned). |
|
859 | 6406 |
(notice that #become: is not used heavily by the system |
783 | 6407 |
- the Collection-classes have been rewritten to not use it.)" |
6408 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6409 |
if (__primBecome(self, anotherObject)) { |
783 | 6410 |
RETURN ( self ); |
859 | 6411 |
} |
6412 |
%}. |
|
783 | 6413 |
self primitiveFailed |
6414 |
! |
|
6415 |
||
6416 |
becomeNil |
|
6417 |
"make all references to the receiver become nil - effectively getting |
|
859 | 6418 |
rid of the receiver. |
6419 |
This can be a very dangerous operation - be warned. |
|
6420 |
||
6421 |
This may be an expensive (i.e. slow) operation. |
|
783 | 6422 |
The receiver may not be a SmallInteger or a context of a living method." |
6423 |
||
6424 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6425 |
if (__primBecomeNil(self)) { |
783 | 6426 |
RETURN ( nil ); |
859 | 6427 |
} |
6428 |
%}. |
|
6429 |
self primitiveFailed |
|
6430 |
! |
|
6431 |
||
6432 |
becomeSameAs:anotherObject |
|
6433 |
"make all references to the receiver become references to anotherObject |
|
861 | 6434 |
but NOT vice versa (as done in #become:). |
859 | 6435 |
This can be a very dangerous operation - be warned. |
861 | 6436 |
In general, using #become: should be avoided if possible, since it may |
6437 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
6438 |
||
6439 |
This may also be an expensive (i.e. slow) operation, |
|
859 | 6440 |
since in the worst case, the whole memory has to be searched for |
6441 |
references to the two objects (although the primitive tries hard to |
|
6442 |
limit the search, for acceptable performance in most cases). |
|
6443 |
This method fails, if the receiver or the argument is a SmallInteger |
|
6444 |
or nil, or is a context of a living method (i.e. one that has not already returned)." |
|
6445 |
%{ |
|
1688
8a42db1eea60
removed all COMMA_CON / CON_COMMA uses
Claus Gittinger <cg@exept.de>
parents:
1685
diff
changeset
|
6446 |
if (__primBecomeSameAs(self, anotherObject)) { |
859 | 6447 |
RETURN ( self ); |
6448 |
} |
|
6449 |
%}. |
|
783 | 6450 |
self primitiveFailed |
6451 |
! |
|
6452 |
||
6453 |
changeClassTo:otherClass |
|
6454 |
"changes the class of the receiver to the argument, otherClass. |
|
6455 |
This is only allowed (possible), if the receivers class and the argument |
|
6456 |
have the same structure (i.e. number of named instance variables and |
|
6457 |
type of indexed instance variables). |
|
6458 |
If the structures do not match, or any of the original class or new class |
|
6459 |
is UndefinedObject or a Smallinteger, a primitive error is triggered." |
|
6460 |
||
6461 |
|myClass ok| |
|
6462 |
||
6463 |
"check for UndefinedObject/SmallInteger receiver or newClass" |
|
6464 |
%{ |
|
1133 | 6465 |
{ |
2647 | 6466 |
OBJ other = otherClass; |
6467 |
||
6468 |
if (__isNonNilObject(self) |
|
6469 |
&& __isNonNilObject(other) |
|
6470 |
&& (other != UndefinedObject) |
|
6471 |
&& (other != SmallInteger)) { |
|
6472 |
ok = true; |
|
6473 |
} else { |
|
6474 |
ok = false; |
|
6475 |
} |
|
783 | 6476 |
} |
6477 |
%}. |
|
6478 |
ok ifTrue:[ |
|
2647 | 6479 |
ok := false. |
6480 |
myClass := self class. |
|
6481 |
myClass flags == otherClass flags ifTrue:[ |
|
6482 |
myClass instSize == otherClass instSize ifTrue:[ |
|
6483 |
"same instance layout and types: its ok to do it" |
|
6484 |
ok := true. |
|
6485 |
] ifFalse:[ |
|
6486 |
myClass isPointers ifTrue:[ |
|
6487 |
myClass isVariable ifTrue:[ |
|
6488 |
ok := true |
|
6489 |
] |
|
6490 |
] |
|
6491 |
] |
|
6492 |
] ifFalse:[ |
|
6493 |
myClass isPointers ifTrue:[ |
|
6494 |
"if newClass is a variable class, with instSize <= my instsize, |
|
6495 |
we can do it (effectively mapping additional instvars into the |
|
6496 |
variable part) - usefulness is questionable, though" |
|
6497 |
||
6498 |
otherClass isPointers ifTrue:[ |
|
6499 |
otherClass isVariable ifTrue:[ |
|
6500 |
otherClass instSize <= (myClass instSize + self basicSize) |
|
6501 |
ifTrue:[ |
|
6502 |
ok := true |
|
6503 |
] |
|
6504 |
] ifFalse:[ |
|
6505 |
otherClass instSize == (myClass instSize + self basicSize) |
|
6506 |
ifTrue:[ |
|
6507 |
ok := true |
|
6508 |
] |
|
6509 |
] |
|
6510 |
] ifFalse:[ |
|
6511 |
"it does not make sense to convert pointers to bytes ..." |
|
6512 |
] |
|
6513 |
] ifFalse:[ |
|
6514 |
"does it make sense, to convert bits ?" |
|
6515 |
"could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..." |
|
6516 |
(myClass isBits and:[otherClass isBits]) ifTrue:[ |
|
6517 |
ok := true |
|
6518 |
] |
|
6519 |
] |
|
6520 |
] |
|
783 | 6521 |
]. |
6522 |
ok ifTrue:[ |
|
2647 | 6523 |
"now, change the receivers class ..." |
783 | 6524 |
%{ |
1133 | 6525 |
{ |
6526 |
OBJ me = self; |
|
6527 |
||
2647 | 6528 |
__qClass(me) = otherClass; |
6529 |
__STORE(me, otherClass); |
|
6530 |
RETURN (me); |
|
1133 | 6531 |
} |
783 | 6532 |
%}. |
6533 |
]. |
|
1022
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6534 |
|
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6535 |
" |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6536 |
the receiver cannot be represented as a instance of |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6537 |
the desired class. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6538 |
For example, you cannot change a bitInstance (byteArray etc.) |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6539 |
into a pointer object and vice versa. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
6540 |
" |
783 | 6541 |
self primitiveFailed |
6542 |
! |
|
6543 |
||
6544 |
changeClassToThatOf:anObject |
|
6545 |
"changes the class of the receiver to that of the argument, anObject. |
|
6546 |
This is only allowed (possible), if the receivers class and the arguments |
|
6547 |
class have the same structure (i.e. number of named instance variables and |
|
6548 |
type of indexed instance variables). If the structures do not match, or any |
|
6549 |
of the objects is nil or a Smallinteger, a primitive error is triggered." |
|
6550 |
||
6551 |
self changeClassTo:(anObject class) |
|
6552 |
! ! |
|
6553 |
||
1867 | 6554 |
!Object methodsFor:'testing'! |
6555 |
||
6556 |
? defaultValue |
|
3465 | 6557 |
"a syntactic shugar-piece: |
6558 |
if the receiver is nil, return the defaultValue; |
|
1867 | 6559 |
otherwise, return the receiver. |
6560 |
This method is only redefined in UndefinedObject - therefore, |
|
6561 |
the recevier is retuned here. |
|
6562 |
||
1958 | 6563 |
Thus, if foo and bar are simple variables or constants, |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6564 |
foo ? bar |
1958 | 6565 |
is the same as: |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6566 |
(foo isNil ifTrue:[bar] ifFalse:[foo]) |
1958 | 6567 |
|
6568 |
if they are message sends, the equivalent code is: |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6569 |
[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6570 |
|t1 t2| |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6571 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6572 |
t1 := foo. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6573 |
t2 := bar. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6574 |
t1 isNil ifTrue:[t2] ifFalse:[t1] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6575 |
] value |
1958 | 6576 |
|
1867 | 6577 |
Can be used to provide defaultValues to variables, |
6578 |
as in: |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6579 |
foo := arg ? #defaultValue |
2147 | 6580 |
|
2148 | 6581 |
Note: this method should never be redefined in classes other than UndefinedObject. |
1867 | 6582 |
" |
6583 |
||
6584 |
^ self |
|
6585 |
||
6586 |
" |
|
6587 |
1 ? #default |
|
6588 |
nil ? #default |
|
6589 |
" |
|
6590 |
||
3465 | 6591 |
"Created: / 4.11.1996 / 20:36:19 / cg" |
6592 |
"Modified: / 19.5.1998 / 17:39:56 / cg" |
|
1867 | 6593 |
! |
6594 |
||
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6595 |
?? defaultValue |
3465 | 6596 |
"a syntactic shugar-piece: |
6597 |
much like ?, but sends value to the argument if required. |
|
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6598 |
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
|
6599 |
otherwise, return the receiver. |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6600 |
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
|
6601 |
the recevier is retuned here. |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6602 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6603 |
Thus, if foo and bar are simple variables or constants, |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6604 |
foo ?? bar |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6605 |
is the same as: |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6606 |
(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
|
6607 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6608 |
if they are message sends, the equivalent code is: |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6609 |
[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6610 |
|t t2| |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6611 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6612 |
t := foo. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6613 |
t isNil ifTrue:[bar value] ifFalse:[t] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6614 |
] value |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6615 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6616 |
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
|
6617 |
as in: |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
6618 |
foo := arg ?? #defaultValue |
3463
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6619 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6620 |
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
|
6621 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6622 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6623 |
^ self |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6624 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6625 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6626 |
1 ?? #default |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6627 |
nil ?? #default |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6628 |
" |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6629 |
|
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6630 |
"Created: / 4.11.1996 / 20:36:19 / cg" |
3466 | 6631 |
"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
|
6632 |
! |
2df184db7eef
added ?? - much like ?, but sends #value to its argument.
Claus Gittinger <cg@exept.de>
parents:
3450
diff
changeset
|
6633 |
|
1867 | 6634 |
isArray |
6635 |
"return true, if the receiver is some kind of array (or weakArray etc); |
|
6636 |
false is returned here - the method is only redefined in Array." |
|
6637 |
||
6638 |
^ false |
|
6639 |
! |
|
6640 |
||
6641 |
isAssociation |
|
6642 |
"return true, if the receiver is some kind of association; |
|
6643 |
false is returned here - the method is only redefined in Association." |
|
6644 |
||
6645 |
^ false |
|
6646 |
||
6647 |
"Created: 14.5.1996 / 17:03:45 / cg" |
|
6648 |
! |
|
6649 |
||
6650 |
isBehavior |
|
6651 |
"return true, if the receiver is some kind of class (i.e. behavior); |
|
6652 |
false is returned here - the method is only redefined in Behavior." |
|
6653 |
||
6654 |
^ false |
|
6655 |
! |
|
6656 |
||
6657 |
isBlock |
|
6658 |
"return true, if the receiver is some kind of block; |
|
6659 |
false returned here - the method is only redefined in Block." |
|
6660 |
||
6661 |
^ false |
|
6662 |
! |
|
6663 |
||
6664 |
isCharacter |
|
6665 |
"return true, if the receiver is some kind of character; |
|
6666 |
false is returned here - the method is only redefined in Character." |
|
6667 |
||
6668 |
^ false |
|
6669 |
! |
|
6670 |
||
6671 |
isClass |
|
6672 |
"return true, if the receiver is some kind of class (real class, |
|
6673 |
not just behavior); |
|
6674 |
false is returned here - the method is only redefined in Class." |
|
6675 |
||
6676 |
^ false |
|
6677 |
! |
|
6678 |
||
6679 |
isCollection |
|
6680 |
"return true, if the receiver is some kind of collection; |
|
6681 |
false is returned here - the method is only redefined in Collection." |
|
6682 |
||
6683 |
^ false |
|
6684 |
! |
|
6685 |
||
6686 |
isColor |
|
6687 |
"return true, if the receiver is some kind of color; |
|
6688 |
false is returned here - the method is only redefined in Color." |
|
6689 |
||
6690 |
^ false |
|
6691 |
! |
|
6692 |
||
6693 |
isContext |
|
6694 |
"return true, if the receiver is some kind of context; |
|
6695 |
false returned here - the method is only redefined in Context." |
|
6696 |
||
6697 |
^ false |
|
6698 |
! |
|
6699 |
||
6700 |
isExternalStream |
|
6701 |
"return true, if the receiver is some kind of externalStream; |
|
6702 |
false is returned here - the method is only redefined in ExternalStream." |
|
6703 |
||
6704 |
^false |
|
6705 |
! |
|
6706 |
||
6707 |
isFileStream |
|
6708 |
"return true, if the receiver is some kind of fileStream; |
|
6709 |
false is returned here - the method is only redefined in FileStream." |
|
6710 |
||
6711 |
^false |
|
6712 |
! |
|
6713 |
||
1887 | 6714 |
isFixedPoint |
6715 |
"return true, if the receiver is some kind of fixedPoint number; |
|
6716 |
false is returned here - the method is only redefined in FixedPoint." |
|
6717 |
||
6718 |
^ false |
|
6719 |
||
6720 |
"Created: 5.11.1996 / 19:23:04 / cg" |
|
6721 |
! |
|
6722 |
||
1867 | 6723 |
isFixedSize |
6724 |
"return true if the receiver cannot grow easily |
|
6725 |
(i.e. a grow may be expensive, since it involves a become:)" |
|
6726 |
||
6727 |
^ true |
|
6728 |
! |
|
6729 |
||
6730 |
isForm |
|
6731 |
"return true, if the receiver is some kind of form; |
|
6732 |
false is returned here - the method is only redefined in Form." |
|
6733 |
||
6734 |
^ false |
|
6735 |
! |
|
6736 |
||
6737 |
isFraction |
|
6738 |
"return true, if the receiver is some kind of fraction; |
|
6739 |
false is returned here - the method is only redefined in Fraction." |
|
6740 |
||
6741 |
^ false |
|
6742 |
! |
|
6743 |
||
6744 |
isImage |
|
6745 |
"return true, if the receiver is some kind of image; |
|
6746 |
false is returned here - the method is only redefined in Image." |
|
6747 |
||
6748 |
^ false |
|
6749 |
! |
|
6750 |
||
6751 |
isImageOrForm |
|
6752 |
"return true, if the receiver is some kind of image or form; |
|
6753 |
false is returned here - the method is only redefined in Image and Form." |
|
6754 |
||
6755 |
^ false |
|
6756 |
! |
|
6757 |
||
2673
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6758 |
isImmediate |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6759 |
"return true if this object has immediate representation" |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6760 |
|
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6761 |
^ self class hasImmediateInstances |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6762 |
|
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6763 |
"Created: 3.6.1997 / 12:00:18 / cg" |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6764 |
! |
f514189f6096
added #isImmediate for VW compatibility
Claus Gittinger <cg@exept.de>
parents:
2655
diff
changeset
|
6765 |
|
1867 | 6766 |
isInteger |
6767 |
"return true, if the receiver is some kind of integer number; |
|
6768 |
false is returned here - the method is only redefined in Integer." |
|
6769 |
||
6770 |
^ false |
|
6771 |
! |
|
6772 |
||
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6773 |
isJavaClass |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6774 |
"return true, if this is a javaClass. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6775 |
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
|
6776 |
|
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6777 |
^ false |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6778 |
|
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6779 |
"Created: / 26.3.1997 / 13:34:54 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6780 |
"Modified: / 8.5.1998 / 21:25:21 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6781 |
! |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6782 |
|
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6783 |
isJavaContext |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6784 |
"return true, if this is a javaContext. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6785 |
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
|
6786 |
|
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6787 |
^ false |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6788 |
|
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6789 |
"Created: / 8.5.1998 / 21:24:27 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6790 |
"Modified: / 8.5.1998 / 21:25:35 / cg" |
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6791 |
! |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6792 |
|
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6793 |
isJavaObject |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6794 |
"return true, if this is a javaObject. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6795 |
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
|
6796 |
|
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6797 |
^ false |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6798 |
|
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6799 |
"Created: / 26.3.1997 / 13:34:48 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6800 |
"Modified: / 8.5.1998 / 21:25:46 / cg" |
2502
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6801 |
! |
8f3bf6043968
added #isJavaObject & #isJavaClass
Claus Gittinger <cg@exept.de>
parents:
2480
diff
changeset
|
6802 |
|
1867 | 6803 |
isKindOf:aClass |
6804 |
"return true, if the receiver is an instance of aClass or one of its |
|
6805 |
subclasses, false otherwise. |
|
6806 |
Advice: |
|
6807 |
use of this to check objects for certain attributes/protocoll should |
|
6808 |
be avoided; it limits the reusability of your classes by limiting use |
|
6809 |
to instances of certain classes and fences you into a specific inheritance |
|
6810 |
hierarchy. |
|
6811 |
Use check-methods to check an object for a certain attributes/protocol |
|
6812 |
(such as #isXXXX, #respondsTo: or #isNumber). |
|
6813 |
||
6814 |
Using #isKindOf: is considered BAD STYLE. |
|
6815 |
||
6816 |
Advice2: |
|
6817 |
Be aware, that using an #isXXX method is usually much faster than |
|
6818 |
using #isKindOf:; because isKindOf: has to walk up all the superclass |
|
6819 |
hierarchy, comparing every class on the way. |
|
6820 |
Due to caching in the VM, a call to #isXXX is normally reached via |
|
6821 |
a single function call. |
|
6822 |
" |
|
6823 |
||
6824 |
%{ /* NOCONTEXT */ |
|
6825 |
register OBJ thisClass; |
|
6826 |
||
6827 |
thisClass = __Class(self); |
|
6828 |
while (thisClass != nil) { |
|
6829 |
if (thisClass == aClass) { |
|
6830 |
RETURN ( true ); |
|
6831 |
} |
|
6832 |
thisClass = __ClassInstPtr(thisClass)->c_superclass; |
|
6833 |
} |
|
6834 |
%} |
|
6835 |
. |
|
6836 |
"/ |
|
6837 |
"/ the above code is equivalent to: |
|
6838 |
"/ |
|
6839 |
"/ thisClass := self class. |
|
6840 |
"/ [thisClass notNil] whileTrue:[ |
|
6841 |
"/ thisClass == aClass ifTrue:[^ true]. |
|
6842 |
"/ thisClass := thisClass superclass |
|
6843 |
"/ ] |
|
6844 |
"/ |
|
6845 |
^ false |
|
6846 |
! |
|
6847 |
||
6848 |
isLayout |
|
6849 |
"return true, if the receiver is some kind of layout; |
|
6850 |
false is returned here - the method is only redefined in Layout." |
|
6851 |
||
6852 |
^ false |
|
6853 |
! |
|
6854 |
||
6855 |
isLiteral |
|
6856 |
"return true, if the receiver can be represented as a constant in ST syntax; |
|
6857 |
false is returned here - the method is redefined in some classes." |
|
6858 |
||
6859 |
^ false |
|
6860 |
! |
|
6861 |
||
6862 |
isMemberOf:aClass |
|
6863 |
"return true, if the receiver is an instance of aClass, false otherwise. |
|
6864 |
Advice: |
|
6865 |
use of this to check objects for certain attributes/protocoll should |
|
6866 |
be avoided; it limits the reusability of your classes by limiting use |
|
6867 |
to instances of a certain class. |
|
6868 |
Use check-methods to check an object for a certain attributes/protocol |
|
6869 |
(such as #isXXX, #respondsTo: or #isNumber); |
|
6870 |
||
3044 | 6871 |
Using #isMemberOf: is considered BAD STYLE. |
6872 |
Notice: |
|
6873 |
This method is open coded (inlined) by the compiler(s) |
|
6874 |
- redefining it may not work as expected." |
|
1867 | 6875 |
|
6876 |
^ (self class) == aClass |
|
6877 |
! |
|
6878 |
||
6879 |
isMeta |
|
6880 |
"return true, if the receiver is some kind of metaclass; |
|
6881 |
false is returned here - the method is only redefined in Metaclass." |
|
6882 |
||
6883 |
^ false |
|
6884 |
! |
|
6885 |
||
6886 |
isMethod |
|
6887 |
"return true, if the receiver is some kind of method; |
|
6888 |
false returned here - the method is only redefined in Method." |
|
6889 |
||
6890 |
^ false |
|
6891 |
! |
|
6892 |
||
6893 |
isNamespace |
|
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6894 |
"return true, if this is a nameSpace. |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6895 |
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
|
6896 |
|
1867 | 6897 |
^ false |
6898 |
||
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6899 |
"Created: / 11.10.1996 / 18:08:56 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
6900 |
"Modified: / 8.5.1998 / 21:26:05 / cg" |
1867 | 6901 |
! |
6902 |
||
6903 |
isNumber |
|
6904 |
"return true, if the receiver is some kind of number; |
|
6905 |
false is returned here - the method is only redefined in Number." |
|
6906 |
||
6907 |
^ false |
|
6908 |
! |
|
6909 |
||
6910 |
isPoint |
|
6911 |
"return true, if the receiver is some kind of point; |
|
6912 |
false is returned here - the method is only redefined in Point." |
|
6913 |
||
6914 |
^ false |
|
6915 |
! |
|
6916 |
||
6917 |
isReal |
|
6918 |
"return true, if the receiver is some kind of real number; |
|
6919 |
false is returned here - the method is only redefined in LimitedPrecisionReal." |
|
6920 |
||
6921 |
^ false |
|
6922 |
! |
|
6923 |
||
6924 |
isRectangle |
|
6925 |
"return true, if the receiver is some kind of rectangle; |
|
6926 |
false is returned here - the method is only redefined in Rectangle." |
|
6927 |
||
6928 |
^ false |
|
6929 |
! |
|
6930 |
||
6931 |
isRemoteObject |
|
6932 |
"return true, if the receiver is some kind of remoteObject, |
|
6933 |
false if its local - the method is only redefined in RemoteObject." |
|
6934 |
||
6935 |
^ false |
|
6936 |
||
6937 |
"Created: 28.10.1996 / 15:18:45 / cg" |
|
6938 |
"Modified: 28.10.1996 / 15:20:57 / cg" |
|
6939 |
! |
|
6940 |
||
6941 |
isSequenceable |
|
6942 |
"return true, if the receiver is some kind of sequenceable collection; |
|
6943 |
false is returned here - the method is only redefined in SequenceableCollection." |
|
6944 |
||
6945 |
^ false |
|
6946 |
! |
|
6947 |
||
6948 |
isSequenceableCollection |
|
6949 |
"OBSOLETE: use isSequenceable for ST-80 compatibility. |
|
4007 | 6950 |
This method is a historic leftover and will be removed soon ... |
6951 |
(although its name is much better than #isSequenceable - sigh)" |
|
1867 | 6952 |
|
6953 |
self obsoleteMethodWarning:'use #isSequenceable'. |
|
6954 |
^ false |
|
6955 |
! |
|
6956 |
||
6957 |
isSignal |
|
6958 |
"return true, if the receiver is some kind of signal; |
|
6959 |
false returned here - the method is only redefined in Signal." |
|
6960 |
||
6961 |
^ false |
|
6962 |
! |
|
6963 |
||
6964 |
isStream |
|
6965 |
"return true, if the receiver is some kind of stream; |
|
6966 |
false is returned here - the method is only redefined in Stream." |
|
6967 |
||
6968 |
^ false |
|
6969 |
! |
|
6970 |
||
6971 |
isString |
|
6972 |
"return true, if the receiver is some kind of string; |
|
6973 |
false is returned here - the method is only redefined in String." |
|
6974 |
||
6975 |
^ false |
|
6976 |
! |
|
6977 |
||
4007 | 6978 |
isStringCollection |
6979 |
"return true, if the receiver is some kind of stringCollection; |
|
6980 |
false is returned here - the method is only redefined in StringCollection." |
|
6981 |
||
6982 |
^ false |
|
6983 |
! |
|
6984 |
||
1867 | 6985 |
isSymbol |
6986 |
"return true, if the receiver is some kind of symbol; |
|
6987 |
false is returned here - the method is only redefined in Symbol." |
|
6988 |
||
6989 |
^ false |
|
6990 |
! |
|
6991 |
||
6992 |
isText |
|
6993 |
"return true, if the receiver is some kind of text object; |
|
6994 |
false is returned here - the method is only redefined in Text." |
|
6995 |
||
6996 |
^ false |
|
6997 |
||
6998 |
"Created: 12.5.1996 / 10:56:50 / cg" |
|
6999 |
! |
|
7000 |
||
4009 | 7001 |
isValueModel |
7002 |
"return true, if the receiver is some kind of valueModel; |
|
7003 |
false is returned here - the method is only redefined in ValueModel." |
|
7004 |
||
7005 |
^ false |
|
7006 |
||
7007 |
! |
|
7008 |
||
1867 | 7009 |
isVariable |
7010 |
"return true if the receiver has indexed instance variables, |
|
7011 |
false otherwise." |
|
7012 |
||
7013 |
^ self class isVariable |
|
7014 |
! |
|
7015 |
||
2704 | 7016 |
isVariableBinding |
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7017 |
"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
|
7018 |
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
|
7019 |
|
2704 | 7020 |
^ false |
7021 |
||
3436
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7022 |
"Created: / 19.6.1997 / 17:38:44 / cg" |
1a80952e6619
added #isJavaContext and some comments.
Claus Gittinger <cg@exept.de>
parents:
3423
diff
changeset
|
7023 |
"Modified: / 8.5.1998 / 21:26:55 / cg" |
2704 | 7024 |
! |
7025 |
||
1867 | 7026 |
isView |
7027 |
"return true, if the receiver is some kind of view; |
|
7028 |
false is returned here - the method is only redefined in View." |
|
7029 |
||
7030 |
^ false |
|
7031 |
! ! |
|
7032 |
||
783 | 7033 |
!Object methodsFor:'user interaction & notifications'! |
7034 |
||
7035 |
activityNotification:aString |
|
7036 |
"this can be sent from deeply nested methods, which are going to perform |
|
7037 |
some long-time activity. |
|
7038 |
If there is a handler for the ActivityNotificationSignal signal, that one is raised, |
|
7039 |
passing the argument. The handler should show this message whereever it likes, |
|
7040 |
and proceed. If there is no handler, this is simply ignored. |
|
7041 |
||
7042 |
This is very useful to pass busy messages up to some higher level (typically a view) |
|
7043 |
which likes to display that message in its label or a busy-box. |
|
7044 |
It could also be put into some logfile or printed on the standard output/error." |
|
7045 |
||
7046 |
ActivityNotificationSignal isHandled ifTrue:[ |
|
861 | 7047 |
^ ActivityNotificationSignal raiseRequestWith:self errorString:aString |
783 | 7048 |
]. |
7049 |
||
7050 |
" |
|
7051 |
nil activityNotification:'hello there' |
|
7052 |
self activityNotification:'hello there' |
|
7053 |
" |
|
7054 |
||
7055 |
" |
|
7056 |
ActivityNotificationSignal handle:[:ex | |
|
861 | 7057 |
ex errorString printNL. |
7058 |
ex proceed. |
|
783 | 7059 |
] do:[ |
861 | 7060 |
'hello' printNL. |
7061 |
self activityNotification:'doing some long time computation'. |
|
7062 |
'world' printNL. |
|
783 | 7063 |
] |
7064 |
" |
|
7065 |
||
7066 |
"Modified: 16.12.1995 / 18:23:42 / cg" |
|
7067 |
! |
|
7068 |
||
7069 |
confirm:aString |
|
7070 |
"launch a confirmer, which allows user to enter yes or no. |
|
7071 |
return true for yes, false for no" |
|
7072 |
||
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7073 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7074 |
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
|
7075 |
and return true (as if yes was answered) |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7076 |
Q: should we ask user by reading Stdin ? |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7077 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7078 |
Smalltalk isInitialized ifFalse:[ |
2647 | 7079 |
'*** confirmation requested during initialization:' printCR. |
7080 |
aString printCR. |
|
7081 |
'*** I''ll continue, assuming <yes> ...' printCR. |
|
7082 |
^ true |
|
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7083 |
]. |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
7084 |
|
783 | 7085 |
Dialog isNil ifTrue:[ |
2647 | 7086 |
Transcript showCR:aString. |
7087 |
Transcript showCR:'continue, assuming <yes>'. |
|
7088 |
^ true |
|
783 | 7089 |
]. |
7090 |
Dialog autoload. "in case its autoloaded" |
|
7091 |
^ Dialog confirm:aString |
|
7092 |
||
7093 |
" |
|
7094 |
nil confirm:'hello' |
|
7095 |
self confirm:'hello' |
|
7096 |
" |
|
1417 | 7097 |
|
1425 | 7098 |
"Modified: 20.5.1996 / 10:28:40 / cg" |
783 | 7099 |
! |
7100 |
||
7101 |
errorNotify:aString |
|
7102 |
"launch a Notifier, showing top stack, telling user something |
|
2150 | 7103 |
and give user a chance to enter debugger." |
7104 |
||
7105 |
^ self |
|
2647 | 7106 |
errorNotify:aString |
7107 |
from:thisContext sender |
|
2150 | 7108 |
|
7109 |
" |
|
7110 |
nil errorNotify:'hello there' |
|
7111 |
self errorNotify:'hello there' |
|
7112 |
" |
|
7113 |
||
7114 |
"Modified: 11.1.1997 / 18:39:20 / cg" |
|
7115 |
! |
|
7116 |
||
7117 |
errorNotify:aString from:aContext |
|
7118 |
"launch a Notifier, showing top stack (above aContext), |
|
7119 |
telling user something and give user a chance to enter debugger." |
|
783 | 7120 |
|
3766
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7121 |
^ self errorNotify:aString from:aContext allowDebug:true |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7122 |
|
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7123 |
"Modified: / 17.8.1998 / 10:09:27 / cg" |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7124 |
! |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7125 |
|
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7126 |
errorNotify:aString from:aContext allowDebug:allowDebug |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7127 |
"launch a Notifier, showing top stack (above aContext), |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7128 |
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
|
7129 |
|
2082 | 7130 |
|info con sender action| |
783 | 7131 |
|
891 | 7132 |
Smalltalk isInitialized ifFalse:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7133 |
'errorNotification: ' print. aString printCR. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7134 |
^ self |
891 | 7135 |
]. |
7136 |
||
783 | 7137 |
Dialog isNil ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7138 |
" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7139 |
on systems without GUI, simply show |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7140 |
the message on the Transcript and abort. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7141 |
" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7142 |
Transcript showCR:aString. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7143 |
AbortSignal raise. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7144 |
^ self |
783 | 7145 |
]. |
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7146 |
|
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7147 |
Processor activeProcessIsSystemProcess ifTrue:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7148 |
action := #debug. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7149 |
sender := aContext. |
2203
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7150 |
] ifFalse:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7151 |
Dialog autoload. "in case its autoloaded" |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7152 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7153 |
ErrorSignal handle:[:ex | |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7154 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7155 |
"/ a recursive error - quickly enter debugger |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7156 |
"/ this happened, when I corrupted the Dialog class ... |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7157 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7158 |
('Object [error]: ' , ex errorString , ' caught in errorNotification') errorPrintCR. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7159 |
action := #debug. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7160 |
ex return. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7161 |
] do:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7162 |
sender := aContext. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7163 |
sender isNil ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7164 |
sender := thisContext sender. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7165 |
"/ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7166 |
"/ 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
|
7167 |
"/ sender isBlockContext ifTrue:[ |
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7168 |
"/ sender := sender sender |
5899dbf1b69c
go directly into the debugger if an error occurs
Claus Gittinger <cg@exept.de>
parents:
2194
diff
changeset
|
7169 |
"/ ]. |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7170 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7171 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7172 |
"/ skip intermediate (signal & exception) contexts |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7173 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7174 |
DebugView notNil ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7175 |
sender := DebugView interestingContextFrom:sender |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7176 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7177 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7178 |
"/ show the first 5 contexts |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7179 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7180 |
con := sender. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7181 |
info := aString , Character cr asString , Character cr asString. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7182 |
1 to:5 do:[:n | |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7183 |
con notNil ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7184 |
info := info , con printString , Character cr asString. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7185 |
con := con sender |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7186 |
] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7187 |
]. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7188 |
|
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7189 |
allowDebug ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7190 |
action := Dialog |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7191 |
choose:info |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7192 |
label:('Exception [' , Processor activeProcess nameOrId , ']') |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7193 |
labels:#('proceed' 'abort' 'debug') |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7194 |
values:#(#proceed #abort #debug) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7195 |
default:#debug. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7196 |
] ifFalse:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7197 |
action := Dialog |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7198 |
choose:info |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7199 |
label:('Exception [' , Processor activeProcess nameOrId , ']') |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7200 |
labels:#('proceed' 'abort') |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7201 |
values:#(#proceed #abort) |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7202 |
default:#abort. |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7203 |
] |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7204 |
]. |
2082 | 7205 |
]. |
7206 |
||
7207 |
action == #debug ifTrue:[ |
|
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7208 |
Debugger enter:sender withMessage:aString |
2082 | 7209 |
] ifFalse:[ |
3921
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7210 |
action == #abort ifTrue:[ |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7211 |
AbortSignal raise |
8e07cb118aa3
added longlong indexed instvars;
Claus Gittinger <cg@exept.de>
parents:
3841
diff
changeset
|
7212 |
] |
783 | 7213 |
] |
7214 |
||
7215 |
" |
|
7216 |
nil errorNotify:'hello there' |
|
7217 |
self errorNotify:'hello there' |
|
7218 |
" |
|
1417 | 7219 |
|
3766
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7220 |
"Modified: / 8.2.1997 / 12:47:41 / cg" |
f352e71081ed
better errorNotify (debug-option supressable)
Claus Gittinger <cg@exept.de>
parents:
3694
diff
changeset
|
7221 |
"Created: / 17.8.1998 / 10:09:26 / cg" |
783 | 7222 |
! |
7223 |
||
7224 |
information:aString |
|
7225 |
"launch an InfoBox, telling user something. |
|
7226 |
These info-boxes can be suppressed by handling the |
|
7227 |
UserNotification- or InformationSignal and proceeding in the handler." |
|
7228 |
||
7229 |
InformationSignal isHandled ifTrue:[ |
|
7230 |
^ InformationSignal raiseRequestWith:self errorString:aString |
|
7231 |
]. |
|
7232 |
self notify:aString |
|
7233 |
||
7234 |
" |
|
7235 |
nil information:'hello there' |
|
7236 |
self information:'hello there' |
|
7237 |
" |
|
7238 |
||
7239 |
" |
|
7240 |
InformationSignal handle:[:ex | |
|
7241 |
'no box popped' printNL. |
|
7242 |
ex proceed. |
|
7243 |
] do:[ |
|
7244 |
'hello' printNL. |
|
7245 |
self information:'some info'. |
|
7246 |
'world' printNL. |
|
7247 |
] |
|
7248 |
" |
|
7249 |
||
7250 |
"Modified: 24.11.1995 / 22:29:49 / cg" |
|
7251 |
! |
|
7252 |
||
7253 |
notify:aString |
|
7254 |
"launch a Notifier, telling user something. |
|
7255 |
Use #information: for ignorable messages." |
|
7256 |
||
891 | 7257 |
Smalltalk isInitialized ifFalse:[ |
2647 | 7258 |
'information: ' print. aString printCR. |
7259 |
^ self |
|
891 | 7260 |
]. |
7261 |
||
783 | 7262 |
Dialog isNil ifTrue:[ |
2647 | 7263 |
" |
7264 |
on systems without GUI, simply show |
|
7265 |
the message on the Transcript. |
|
7266 |
" |
|
7267 |
Transcript showCR:aString. |
|
7268 |
^ self |
|
783 | 7269 |
]. |
7270 |
Dialog autoload. "in case its autoloaded" |
|
7271 |
Dialog information:aString |
|
7272 |
||
7273 |
" |
|
7274 |
nil notify:'hello there' |
|
7275 |
self notify:'hello there' |
|
7276 |
" |
|
1417 | 7277 |
|
1425 | 7278 |
"Modified: 20.5.1996 / 10:28:48 / cg" |
783 | 7279 |
! |
7280 |
||
7281 |
warn:aString |
|
7282 |
"launch a WarningBox, telling user something. |
|
7283 |
These warn-boxes can be suppressed by handling the |
|
7284 |
UserNotification- or WarningSignal and proceeding in the handler." |
|
7285 |
||
7286 |
WarningSignal isHandled ifTrue:[ |
|
2647 | 7287 |
^ WarningSignal raiseRequestWith:self errorString:aString |
783 | 7288 |
]. |
7289 |
||
891 | 7290 |
Smalltalk isInitialized ifFalse:[ |
2647 | 7291 |
'warning: ' print. aString printCR. |
7292 |
^ self |
|
891 | 7293 |
]. |
7294 |
||
783 | 7295 |
Dialog isNil ifTrue:[ |
2647 | 7296 |
" |
7297 |
on systems without GUI, simply show |
|
7298 |
the message on the Transcript. |
|
7299 |
" |
|
7300 |
Transcript showCR:aString. |
|
7301 |
^ self |
|
783 | 7302 |
]. |
7303 |
Dialog autoload. "in case its autoloaded" |
|
7304 |
Dialog warn:aString |
|
7305 |
||
7306 |
" |
|
7307 |
nil warn:'hello there' |
|
7308 |
self warn:'hello there' |
|
7309 |
" |
|
7310 |
||
7311 |
" |
|
7312 |
WarningSignal handle:[:ex | |
|
2647 | 7313 |
ex proceed. |
783 | 7314 |
] do:[ |
2647 | 7315 |
'hello' printNL. |
7316 |
self warn:'some info'. |
|
7317 |
'world' printNL. |
|
783 | 7318 |
] |
7319 |
" |
|
1417 | 7320 |
|
1425 | 7321 |
"Modified: 20.5.1996 / 10:28:53 / cg" |
783 | 7322 |
! ! |
7323 |
||
1788 | 7324 |
!Object class methodsFor:'documentation'! |
783 | 7325 |
|
7326 |
version |
|
4009 | 7327 |
^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.255 1999-02-26 13:48:59 cg Exp $' |
783 | 7328 |
! ! |
7329 |
Object initialize! |