author | Claus Gittinger <cg@exept.de> |
Fri, 19 Jul 1996 12:44:16 +0200 | |
changeset 1585 | 5cfa7f2586ad |
parent 1533 | 179ce527e383 |
child 1611 | f8c9a3ab9929 |
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 |
|
18 |
NonIntegerIndexSignal NotFoundSignal KeyNotFoundSignal |
|
19 |
ElementOutOfBoundsSignal UserNotificationSignal InformationSignal |
|
20 |
WarningSignal PrimitiveFailureSignal DeepCopyErrorSignal |
|
21 |
AbortSignal ErrorRecursion Dependencies InfoPrinting |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
22 |
ActivityNotificationSignal NonWeakDependencies' |
783 | 23 |
poolDictionaries:'' |
24 |
category:'Kernel-Objects' |
|
1 | 25 |
! |
26 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
27 |
!Object class methodsFor:'documentation'! |
71 | 28 |
|
88 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
159 | 32 |
All Rights Reserved |
88 | 33 |
|
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
43 |
dependencies |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
44 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
45 |
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
|
46 |
(we think they are better ;-). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
47 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
48 |
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
|
49 |
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
|
50 |
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
|
51 |
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
|
52 |
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
|
53 |
to dependent or the dependee. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
54 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
55 |
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
|
56 |
prevent memory leaks. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
57 |
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
|
58 |
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
|
59 |
need to care about dependencies. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
60 |
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
|
61 |
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
|
62 |
(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
|
63 |
that behavior) |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
64 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
65 |
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
|
66 |
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
|
67 |
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
|
68 |
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
|
69 |
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
|
70 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
71 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
72 |
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
|
73 |
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
|
74 |
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
|
75 |
references exist to the dependent. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
76 |
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
|
77 |
(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
|
78 |
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
|
79 |
(see #addNonWeakDependent / #removeNonWeakDependent). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
80 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
81 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
82 |
Caveat: |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
83 |
since interrests are implemented using InterrestConverter (which are simply |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
84 |
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
|
85 |
automatically). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
86 |
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
|
87 |
and those would be reclaimed if stored in a weakDictionary. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
88 |
This means, that those interrests MUST be removed with #retractInterrest |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
89 |
(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
|
90 |
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
|
91 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
92 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
93 |
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
|
94 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
95 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
96 |
|
71 | 97 |
documentation |
98 |
" |
|
1294 | 99 |
Object is the superclass of most other classes. |
100 |
(except for nil-subclasses, which inherit nothing, |
|
101 |
to catch any message into their #doesNotUnderstand: method) |
|
102 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
103 |
Protocol which is common to every object is defined here. |
71 | 104 |
Also some utility stuff (like notify) and error handling is implemented here. |
105 |
||
106 |
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
|
107 |
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
|
108 |
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
|
109 |
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
|
110 |
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
|
111 |
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
|
112 |
(and also rewritten in some places). |
71 | 113 |
|
1294 | 114 |
[Class variables:] |
71 | 115 |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
116 |
ErrorSignal <Signal> Signal raised for error/error: messages |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
117 |
also, parent of all other signals. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
118 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
119 |
HaltSignal <Signal> Signal raised for halt/halt: messages |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
120 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
121 |
MessageNotUnderstoodSignal Signals raised for various error conditions |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
122 |
UserInterruptSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
123 |
RecursionInterruptSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
124 |
ExceptionInterruptSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
125 |
SubscriptOutOfBoundsSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
126 |
NonIntegerIndexSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
127 |
NotFoundSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
128 |
KeyNotFoundSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
129 |
ElementOutOfBoundsSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
130 |
InformationSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
131 |
WarningSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
132 |
DeepCopyErrorSignal |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
133 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
134 |
AbortSignal <Signal> Signal raised by debugger, to abort a computation |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
135 |
BUT, the debugger will only raise it if it is handled. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
136 |
By handling the abortSignal, you can control where the |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
137 |
debuggers abort-function resumes execution in case of |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
138 |
an error. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
139 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
140 |
ErrorRecursion <Boolean> controls behavior when recursive errors occur (i.e. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
141 |
an error while handling an error). |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
142 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
143 |
Dependencies <Dictionary> keeps track of object dependencies |
1294 | 144 |
|
145 |
[author:] |
|
146 |
Claus Gittinger |
|
147 |
||
71 | 148 |
" |
149 |
! ! |
|
1 | 150 |
|
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
151 |
!Object class methodsFor:'initialization'! |
1 | 152 |
|
153 |
initialize |
|
154 |
"called only once - initialize signals" |
|
155 |
||
156 |
ErrorSignal isNil ifTrue:[ |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
157 |
ErrorSignal := (Signal new) mayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
158 |
ErrorSignal nameClass:self message:#errorSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
159 |
ErrorSignal notifierString:'error encountered'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
160 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
161 |
HaltSignal := ErrorSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
162 |
HaltSignal nameClass:self message:#haltSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
163 |
HaltSignal notifierString:'halt encountered'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
164 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
165 |
MessageNotUnderstoodSignal := ErrorSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
166 |
MessageNotUnderstoodSignal nameClass:self message:#messageNotUnderstoodSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
167 |
MessageNotUnderstoodSignal notifierString:'message not understood'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
168 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
169 |
PrimitiveFailureSignal := ErrorSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
170 |
PrimitiveFailureSignal nameClass:self message:#primitiveFailureSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
171 |
PrimitiveFailureSignal notifierString:'primitive failed'. |
159 | 172 |
|
362 | 173 |
"/ UserInterruptSignal := ErrorSignal newSignalMayProceed:true. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
174 |
UserInterruptSignal := (Signal new) newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
175 |
UserInterruptSignal nameClass:self message:#userInterruptSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
176 |
UserInterruptSignal notifierString:'user Interrupt'. |
159 | 177 |
|
362 | 178 |
"/ RecursionInterruptSignal := ErrorSignal newSignalMayProceed:false. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
179 |
RecursionInterruptSignal := (Signal new) mayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
180 |
RecursionInterruptSignal nameClass:self message:#recursionInterruptSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
181 |
RecursionInterruptSignal notifierString:'recursion limit reached'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
182 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
183 |
ExceptionInterruptSignal := ErrorSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
184 |
ExceptionInterruptSignal nameClass:self message:#exceptionInterruptSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
185 |
ExceptionInterruptSignal notifierString:'exception Interrupt'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
186 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
187 |
SubscriptOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
188 |
SubscriptOutOfBoundsSignal nameClass:self message:#subscriptOutOfBoundsSignal. |
1377 | 189 |
SubscriptOutOfBoundsSignal notifierString:'subscript out of bounds: '. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
190 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
191 |
ElementOutOfBoundsSignal := ErrorSignal newSignalMayProceed:false. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
192 |
ElementOutOfBoundsSignal nameClass:self message:#elementOutOfBoundsSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
193 |
ElementOutOfBoundsSignal notifierString:'element not appropriate or out of bounds'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
194 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
195 |
NotFoundSignal := ErrorSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
196 |
NotFoundSignal nameClass:self message:#notFoundSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
197 |
NotFoundSignal notifierString:'no such element'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
198 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
199 |
KeyNotFoundSignal := ErrorSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
200 |
KeyNotFoundSignal nameClass:self message:#keyNotFoundSignal. |
1377 | 201 |
KeyNotFoundSignal notifierString:'no such key: '. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
202 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
203 |
NonIntegerIndexSignal := ErrorSignal newSignalMayProceed:false. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
204 |
NonIntegerIndexSignal nameClass:self message:#nonIntegerIndexSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
205 |
NonIntegerIndexSignal notifierString:'index must be integer'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
206 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
207 |
UserNotificationSignal := QuerySignal new newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
208 |
UserNotificationSignal nameClass:self message:#userNotificationSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
209 |
UserNotificationSignal notifierString:'user notifiaction'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
210 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
211 |
InformationSignal := UserNotificationSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
212 |
InformationSignal nameClass:self message:#informationSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
213 |
InformationSignal notifierString:'information'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
214 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
215 |
WarningSignal := UserNotificationSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
216 |
WarningSignal nameClass:self message:#warnungSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
217 |
WarningSignal notifierString:'warning'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
218 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
219 |
ActivityNotificationSignal := UserNotificationSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
220 |
ActivityNotificationSignal nameClass:self message:#activityNotificationSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
221 |
ActivityNotificationSignal notifierString:'activity'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
222 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
223 |
DeepCopyErrorSignal := ErrorSignal newSignalMayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
224 |
DeepCopyErrorSignal nameClass:self message:#deepCopyErrorSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
225 |
DeepCopyErrorSignal notifierString:'object cannot be deepCopy-ed'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
226 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
227 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
228 |
AbortSignal is not a child of ErrorSignal - |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
229 |
this would complicate abort from within a signal handler |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
230 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
231 |
AbortSignal := Signal new mayProceed:true. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
232 |
AbortSignal nameClass:self message:#abortSignal. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
233 |
AbortSignal notifierString:'unhandled abort signal'. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
234 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
235 |
Dependencies isNil ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
236 |
Dependencies := WeakIdentityDictionary new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
237 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
238 |
NonWeakDependencies isNil ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
239 |
NonWeakDependencies := IdentityDictionary new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
240 |
] |
356 | 241 |
]. |
242 |
InfoPrinting := true |
|
1 | 243 |
|
244 |
"Object initialize" |
|
812
00db9c0646fe
notificationsignals are no longer children of ErrorSignal
Claus Gittinger <cg@exept.de>
parents:
783
diff
changeset
|
245 |
|
1377 | 246 |
"Modified: 12.5.1996 / 14:10:40 / cg" |
1 | 247 |
! ! |
248 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
249 |
!Object class methodsFor:'Signal constants'! |
1 | 250 |
|
783 | 251 |
abortSignal |
252 |
"return the signal used to abort user actions. This signal is only |
|
253 |
raised if cought (by the debugger), and will lead way out of the |
|
254 |
currently active doIt/printIt or inspectIt. (also some others use |
|
255 |
this for a save abort)" |
|
256 |
||
257 |
^ AbortSignal |
|
579
2d26193415b5
allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
258 |
! |
2d26193415b5
allow catching of information: and warn: boxes
Claus Gittinger <cg@exept.de>
parents:
530
diff
changeset
|
259 |
|
782 | 260 |
activityNotificationSignal |
261 |
"return the signal used for activity notifications. |
|
262 |
A handler for this signal gets all #activityNotification: sends" |
|
263 |
||
264 |
^ ActivityNotificationSignal |
|
265 |
! |
|
266 |
||
159 | 267 |
deepCopyErrorSignal |
268 |
"return the signal raised when a deepcopy is asked for |
|
269 |
an object which cannot do this (for example, BlockClosures |
|
270 |
or Contexts)." |
|
271 |
||
272 |
^ DeepCopyErrorSignal |
|
273 |
! |
|
274 |
||
783 | 275 |
elementOutOfBoundsSignal |
276 |
"return the signal used for element error reporting |
|
277 |
(this signal is used for example when a value not in 0..255 is to |
|
278 |
be put into a bytearray)" |
|
279 |
||
280 |
^ ElementOutOfBoundsSignal |
|
281 |
! |
|
282 |
||
283 |
errorSignal |
|
284 |
"return the signal used for error/error: - handling" |
|
285 |
||
286 |
^ ErrorSignal |
|
287 |
! |
|
288 |
||
289 |
exceptionInterruptSignal |
|
290 |
"return the signal used for exception (display errors) error handling" |
|
291 |
||
292 |
^ ExceptionInterruptSignal |
|
293 |
! |
|
294 |
||
295 |
haltSignal |
|
296 |
"return the signal used for halt/halt: - handling" |
|
297 |
||
298 |
^ HaltSignal |
|
299 |
! |
|
300 |
||
301 |
informationSignal |
|
302 |
"return the signal used for informations. |
|
303 |
A handler for this signal gets all #information: sends" |
|
304 |
||
305 |
^ InformationSignal |
|
306 |
! |
|
307 |
||
308 |
keyNotFoundSignal |
|
309 |
"return the signal used for no such key error reporting" |
|
310 |
||
311 |
^ KeyNotFoundSignal |
|
312 |
! |
|
313 |
||
314 |
messageNotUnderstoodSignal |
|
315 |
"return the signal used for doesNotUnderstand: - error handling" |
|
316 |
||
317 |
^ MessageNotUnderstoodSignal |
|
318 |
! |
|
319 |
||
320 |
nonIntegerIndexSignal |
|
321 |
"return the signal used for bad subscript error reporting" |
|
322 |
||
323 |
^ NonIntegerIndexSignal |
|
324 |
! |
|
325 |
||
326 |
notFoundSignal |
|
327 |
"return the signal used for no element found error reporting" |
|
328 |
||
329 |
^ NotFoundSignal |
|
330 |
! |
|
331 |
||
332 |
primitiveFailureSignal |
|
333 |
"return the signal used for primitiveFailed - error handling" |
|
334 |
||
335 |
^ PrimitiveFailureSignal |
|
336 |
! |
|
337 |
||
338 |
privateMethodSignal |
|
339 |
"return the signal used for privateMethod - error handling" |
|
340 |
||
341 |
^ MessageNotUnderstoodSignal |
|
342 |
! |
|
343 |
||
344 |
recursionInterruptSignal |
|
345 |
"return the signal used for recursion overflow error handling" |
|
346 |
||
347 |
^ RecursionInterruptSignal |
|
348 |
! |
|
349 |
||
350 |
subscriptOutOfBoundsSignal |
|
351 |
"return the signal used for subscript error reporting. |
|
352 |
(this signal is used for example when an array is accessed with an |
|
353 |
index less than 1 or greater than the array size)" |
|
354 |
||
355 |
^ SubscriptOutOfBoundsSignal |
|
356 |
! |
|
357 |
||
358 |
userInterruptSignal |
|
359 |
"return the signal used for ^C interrupts handling" |
|
360 |
||
361 |
^ UserInterruptSignal |
|
362 |
! |
|
363 |
||
364 |
userNotificationSignal |
|
365 |
"the parent signal used with information and warnings. |
|
366 |
Handling this allows handling of both information- and warning notifications." |
|
367 |
||
368 |
^ UserNotificationSignal |
|
369 |
! |
|
370 |
||
371 |
warningSignal |
|
372 |
"return the signal used for warnings. |
|
373 |
A handler for this signal gets all #warn: sends" |
|
374 |
||
375 |
^ WarningSignal |
|
1 | 376 |
! ! |
377 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
378 |
!Object class methodsFor:'info messages'! |
356 | 379 |
|
783 | 380 |
infoPrinting |
381 |
"return the flag which controls information messages." |
|
382 |
||
383 |
^ InfoPrinting |
|
384 |
! |
|
385 |
||
356 | 386 |
infoPrinting:aBoolean |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
387 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
388 |
|
356 | 389 |
"turn on/off printing of information messages. |
390 |
If the argument, aBoolean is false, infoPrint will not output |
|
391 |
messages. The default is true." |
|
392 |
||
393 |
InfoPrinting := aBoolean |
|
394 |
! ! |
|
395 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
396 |
!Object class methodsFor:'queries'! |
3 | 397 |
|
398 |
isBuiltInClass |
|
49 | 399 |
"return true, if this class is known by the run-time-system, |
400 |
i.e. you cannot add/remove instance variables without recompiling |
|
1266 | 401 |
the VM. |
402 |
Here, true is returned for myself, false for subclasses." |
|
3 | 403 |
|
404 |
^ self == Object |
|
1266 | 405 |
|
406 |
"Modified: 23.4.1996 / 16:00:07 / cg" |
|
3 | 407 |
! ! |
408 |
||
1 | 409 |
!Object methodsFor:'accessing'! |
410 |
||
411 |
at:index |
|
412 |
"return the indexed instance variable with index, anInteger; |
|
413 |
this method can be redefined in subclasses." |
|
414 |
||
415 |
^ self basicAt:index |
|
416 |
! |
|
417 |
||
783 | 418 |
at:index put:anObject |
419 |
"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
|
420 |
this method can be redefined in subclasses. Returns anObject (sigh)" |
783 | 421 |
|
422 |
^ self basicAt:index put:anObject |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
423 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
424 |
"Modified: 19.4.1996 / 11:13:29 / cg" |
783 | 425 |
! |
426 |
||
1 | 427 |
basicAt:index |
428 |
"return the indexed instance variable with index, anInteger. |
|
429 |
Trigger an error if the receiver has no indexed instance variables. |
|
430 |
This method should NOT be redefined in any subclass" |
|
431 |
||
432 |
%{ /* NOCONTEXT */ |
|
433 |
||
329 | 434 |
REGISTER int nbytes, indx; |
1 | 435 |
OBJ myClass; |
329 | 436 |
REGISTER char *pFirst; |
1 | 437 |
unsigned char *cp; |
438 |
unsigned short *sp; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
439 |
short *ssp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
440 |
unsigned long *lp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
441 |
long *slp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
442 |
unsigned long ul; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
443 |
long l; |
1 | 444 |
OBJ *op; |
329 | 445 |
/* int nInstBytes, nInstVars, flags; */ |
446 |
REGISTER int n; |
|
1 | 447 |
|
448 |
||
449 |
/* |
|
56 | 450 |
* notice the missing test for self being a nonNilObject - |
1 | 451 |
* this can be done since basicAt: is defined both in UndefinedObject |
452 |
* and SmallInteger |
|
453 |
*/ |
|
253 | 454 |
if (__isSmallInteger(index)) { |
329 | 455 |
myClass = __qClass(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
456 |
indx = __intVal(index) - 1; |
1133 | 457 |
n /* nInstVars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
329 | 458 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* nInstVars */); |
459 |
nbytes = __qSize(self) - n /* nInstBytes */; |
|
1133 | 460 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
329 | 461 |
|
462 |
/* |
|
463 |
* replaced switch by open-coded if; this is slightly faster |
|
464 |
* since it avoids the range check and also handles the most common case first |
|
465 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
466 |
n = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK); |
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
467 |
|
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
468 |
if ((n == __MASKSMALLINT(POINTERARRAY)) |
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
469 |
|| (n == __MASKSMALLINT(WKPOINTERARRAY))) { |
329 | 470 |
if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) { |
471 |
op = (OBJ *)pFirst + indx; |
|
472 |
RETURN ( *op ); |
|
473 |
} |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
474 |
} else if (n == __MASKSMALLINT(BYTEARRAY)) { |
329 | 475 |
if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) { |
476 |
cp = (unsigned char *)pFirst + indx; |
|
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
477 |
RETURN ( __MKSMALLINT(*cp & 0xFF) ); |
329 | 478 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
479 |
} else if (n == __MASKSMALLINT(FLOATARRAY)) { |
329 | 480 |
if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) { |
481 |
float *fp; |
|
482 |
||
483 |
fp = (float *)pFirst + indx; |
|
1133 | 484 |
RETURN ( __MKFLOAT((double)(*fp)) COMMA_CON ); |
329 | 485 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
486 |
} else if (n == __MASKSMALLINT(DOUBLEARRAY)) { |
329 | 487 |
if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) { |
488 |
double *dp; |
|
1 | 489 |
|
56 | 490 |
#ifdef NEED_DOUBLE_ALIGN |
329 | 491 |
/* |
492 |
* care for filler |
|
493 |
*/ |
|
494 |
pFirst += sizeof(FILLTYPE); |
|
56 | 495 |
#endif |
329 | 496 |
dp = (double *)pFirst + indx; |
1133 | 497 |
RETURN ( __MKFLOAT(*dp) COMMA_CON ); |
329 | 498 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
499 |
} else if (n == __MASKSMALLINT(WORDARRAY)) { |
329 | 500 |
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { |
501 |
sp = (unsigned short *)pFirst + indx; |
|
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
502 |
RETURN ( __MKSMALLINT(*sp & 0xFFFF) ); |
329 | 503 |
} |
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
504 |
} else if (n == __MASKSMALLINT(SWORDARRAY)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
505 |
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
506 |
ssp = (short *)pFirst + indx; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
507 |
RETURN ( __MKSMALLINT(*ssp) ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
508 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
509 |
} else if (n == __MASKSMALLINT(LONGARRAY)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
510 |
if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
511 |
lp = (unsigned long *)pFirst + indx; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
512 |
ul = *lp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
513 |
if (ul <= _MAX_INT) |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
514 |
RETURN ( __MKSMALLINT(ul) ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
515 |
RETURN ( __MKULARGEINT(ul) ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
516 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
517 |
} else if (n == __MASKSMALLINT(SLONGARRAY)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
518 |
if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
519 |
slp = (long *)pFirst + indx; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
520 |
l = *slp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
521 |
if ((l >= _MIN_INT) && (l <= _MAX_INT)) |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
522 |
RETURN ( __MKSMALLINT(l) ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
523 |
RETURN ( __MKLARGEINT(l) ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
524 |
} |
159 | 525 |
} |
1 | 526 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
527 |
%}. |
10 | 528 |
index isInteger ifFalse:[ |
159 | 529 |
^ self indexNotInteger |
1 | 530 |
]. |
159 | 531 |
^ self subscriptBoundsError:index |
1 | 532 |
! |
533 |
||
534 |
basicAt:index put:anObject |
|
535 |
"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
|
536 |
Returns anObject (sigh). |
1 | 537 |
Trigger an error if the receiver has no indexed instance variables. |
538 |
This method should NOT be redefined in any subclass" |
|
539 |
||
540 |
%{ /* NOCONTEXT */ |
|
541 |
||
542 |
register int nbytes, indx; |
|
543 |
OBJ myClass; |
|
544 |
register char *pFirst; |
|
545 |
char *cp; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
546 |
unsigned short *sp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
547 |
short *ssp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
548 |
unsigned long *lp; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
549 |
long *slp; |
1 | 550 |
OBJ *op; |
329 | 551 |
/* int nInstBytes, ninstvars, flags; */ |
552 |
REGISTER int n; |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
553 |
unsigned int u; |
1 | 554 |
int val; |
555 |
||
56 | 556 |
/* notice the missing test for self being a nonNilObject - |
77 | 557 |
this can be done since basicAt: is defined both in UndefinedObject |
1 | 558 |
and SmallInteger */ |
559 |
||
253 | 560 |
if (__isSmallInteger(index)) { |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
561 |
indx = __intVal(index) - 1; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
562 |
myClass = __qClass(self); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
563 |
n /* ninstvars */ = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
564 |
n /* nInstBytes */ = OHDR_SIZE + __OBJS2BYTES__(n /* ninstvars */); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
565 |
nbytes = __qSize(self) - n /* nInstBytes */; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
566 |
pFirst = (char *)(__InstPtr(self)) + n /* nInstBytes */; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
567 |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
568 |
n = (INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(ARRAYMASK); |
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
569 |
|
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
570 |
/* |
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
571 |
* replaced switch by open-coded if; this is slightly faster |
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
572 |
* since it avoids the range check and also handles the most common case first |
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
573 |
*/ |
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
574 |
if ((n == __MASKSMALLINT(POINTERARRAY)) |
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
575 |
|| (n == __MASKSMALLINT(WKPOINTERARRAY))) { |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
576 |
if ((indx >= 0) && (indx < (__BYTES2OBJS__(nbytes)))) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
577 |
op = (OBJ *)pFirst + indx; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
578 |
*op = anObject; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
579 |
__STORE(self, anObject); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
580 |
RETURN ( anObject ); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
581 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
582 |
} else if (n == __MASKSMALLINT(BYTEARRAY)) { |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
583 |
if (__isSmallInteger(anObject)) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
584 |
val = __intVal(anObject); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
585 |
if ((val & ~0xFF) == 0 /* i.e. (val >= 0) && (val <= 255) */) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
586 |
if ((indx >= 0) && (indx < (nbytes / sizeof(char)))) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
587 |
cp = pFirst + indx; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
588 |
*cp = val; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
589 |
RETURN ( anObject ); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
590 |
} |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
591 |
} |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
592 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
593 |
} else if (n == __MASKSMALLINT(FLOATARRAY)) { |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
594 |
if ((indx >= 0) && (indx < (nbytes / sizeof(float)))) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
595 |
float *fp; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
596 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
597 |
fp = (float *)pFirst + indx; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
598 |
if (__isFloatLike(anObject)) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
599 |
*fp = _floatVal(anObject); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
600 |
RETURN ( anObject ); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
601 |
} |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
602 |
if (__isSmallInteger(anObject)) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
603 |
*fp = (float) __intVal(anObject); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
604 |
RETURN ( anObject ); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
605 |
} |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
606 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
607 |
} else if (n == __MASKSMALLINT(DOUBLEARRAY)) { |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
608 |
if ((indx >= 0) && (indx < (nbytes / sizeof(double)))) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
609 |
double *dp; |
13 | 610 |
|
56 | 611 |
#ifdef NEED_DOUBLE_ALIGN |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
612 |
/* |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
613 |
* care for filler |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
614 |
*/ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
615 |
pFirst += sizeof(FILLTYPE); |
56 | 616 |
#endif |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
617 |
dp = (double *)pFirst + indx; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
618 |
if (__isFloatLike(anObject)) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
619 |
*dp = _floatVal(anObject); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
620 |
RETURN ( anObject ); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
621 |
} |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
622 |
if (__isSmallInteger(anObject)) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
623 |
*dp = (double) __intVal(anObject); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
624 |
RETURN ( anObject ); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
625 |
} |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
626 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
627 |
} else if (n == __MASKSMALLINT(WORDARRAY)) { |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
628 |
if (__isSmallInteger(anObject)) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
629 |
val = __intVal(anObject); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
630 |
if ((val >= 0) && (val <= 0xFFFF)) { |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
631 |
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { |
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
632 |
sp = (unsigned short *)pFirst + indx; |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
633 |
*sp = val; |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
634 |
RETURN ( anObject ); |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
635 |
} |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
636 |
} |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
637 |
} |
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
638 |
} else if (n == __MASKSMALLINT(SWORDARRAY)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
639 |
if (__isSmallInteger(anObject)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
640 |
val = __intVal(anObject); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
641 |
if ((val >= -32768) && (val < 32768)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
642 |
if ((indx >= 0) && (indx < (nbytes / sizeof(short)))) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
643 |
ssp = (short *)pFirst + indx; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
644 |
*ssp = val; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
645 |
RETURN ( anObject ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
646 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
647 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
648 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
649 |
} else if (n == __MASKSMALLINT(SLONGARRAY)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
650 |
if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
651 |
slp = (long *)pFirst + indx; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
652 |
if (__isSmallInteger(anObject)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
653 |
*slp = __intVal(anObject); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
654 |
RETURN ( anObject ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
655 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
656 |
n = __signedLongIntVal(anObject); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
657 |
/* zero means failure for an int larger than 4 bytes ... (would be a smallInteger) */ |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
658 |
if (n) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
659 |
*slp = n; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
660 |
RETURN ( anObject ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
661 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
662 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
663 |
} else if (n == __MASKSMALLINT(LONGARRAY)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
664 |
if ((indx >= 0) && (indx < (nbytes / sizeof(long)))) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
665 |
lp = (unsigned long *)pFirst + indx; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
666 |
if (anObject == __MKSMALLINT(0)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
667 |
*lp = 0; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
668 |
RETURN ( anObject ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
669 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
670 |
u = __longIntVal(anObject); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
671 |
/* zero means failure for an int larger than 4 bytes ... (would be a smallInteger) */ |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
672 |
if (u) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
673 |
*lp = u; |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
674 |
RETURN ( anObject ); |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
675 |
} |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
676 |
} |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
677 |
} |
1 | 678 |
} |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
679 |
%}. |
10 | 680 |
index isInteger ifFalse:[ |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
681 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
682 |
the index should be an integer number |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
683 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
684 |
^ self indexNotInteger |
1 | 685 |
]. |
686 |
(index between:1 and:self size) ifFalse:[ |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
687 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
688 |
the index is less than 1 or greater than the size of the |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
689 |
receiver collection |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
690 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
691 |
^ self subscriptBoundsError:index |
1 | 692 |
]. |
643 | 693 |
(self class isFloatsOrDoubles) ifTrue:[ |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
694 |
anObject isNumber ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
695 |
^ self basicAt:index put:(anObject asFloat) |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
696 |
] |
13 | 697 |
]. |
10 | 698 |
anObject isInteger ifFalse:[ |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
699 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
700 |
the object to put into the receiver collection |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
701 |
should be an integer number |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
702 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
703 |
^ self elementNotInteger |
2 | 704 |
]. |
159 | 705 |
" |
213 | 706 |
the object to put into the receiver collection |
362 | 707 |
is not an instance of the expected element class, |
708 |
or the value is not within the elements valid range. |
|
159 | 709 |
" |
2 | 710 |
^ self elementBoundsError |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
711 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
712 |
"Modified: 19.4.1996 / 11:14:10 / cg" |
1 | 713 |
! |
714 |
||
715 |
instVarAt:index |
|
716 |
"return a non-indexed instance variable; |
|
13 | 717 |
peeking into an object this way is not very object oriented |
718 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 719 |
|
720 |
%{ /* NOCONTEXT */ |
|
721 |
||
722 |
OBJ myClass; |
|
723 |
int idx, ninstvars; |
|
724 |
||
253 | 725 |
if (__isSmallInteger(index)) { |
329 | 726 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
727 |
idx = __intVal(index) - 1; |
357 | 728 |
/* |
729 |
* do not allow return of non-object fields. |
|
730 |
* if subclass did not make privisions for that, |
|
731 |
* we wont do so here ... |
|
732 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
733 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 734 |
if (idx == 0) { |
735 |
RETURN ( nil ) |
|
736 |
} |
|
737 |
} |
|
1133 | 738 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
159 | 739 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 740 |
RETURN ( __InstPtr(self)->i_instvars[idx] ); |
159 | 741 |
} |
1 | 742 |
} |
743 |
%} |
|
744 |
. |
|
745 |
index isInteger ifFalse:[ |
|
159 | 746 |
^ self indexNotInteger |
1 | 747 |
]. |
159 | 748 |
^ self subscriptBoundsError:index |
1 | 749 |
! |
750 |
||
751 |
instVarAt:index put:value |
|
752 |
"change a non-indexed instance variable; |
|
13 | 753 |
peeking into an object this way is not very object oriented |
754 |
- use with care (needed for copy, inspector etc.)" |
|
1 | 755 |
|
756 |
%{ /* NOCONTEXT */ |
|
757 |
||
758 |
OBJ myClass; |
|
759 |
int idx, ninstvars; |
|
760 |
||
253 | 761 |
if (__isSmallInteger(index)) { |
329 | 762 |
myClass = __Class(self); |
755
eaab1d1dacbd
_-macros replcaed by __-macros (needed especially for MKLARGINT)
Claus Gittinger <cg@exept.de>
parents:
751
diff
changeset
|
763 |
idx = __intVal(index) - 1; |
1133 | 764 |
ninstvars = __intVal(__ClassInstPtr(myClass)->c_ninstvars); |
357 | 765 |
/* |
766 |
* do not allow setting of non-object fields. |
|
767 |
* if subclass did not make privisions for that, |
|
768 |
* we wont do so here ... |
|
769 |
*/ |
|
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
770 |
if (((INT)(__ClassInstPtr(myClass)->c_flags) & __MASKSMALLINT(NONOBJECT_INSTS))) { |
357 | 771 |
if (idx == 0) { |
772 |
RETURN ( nil ) |
|
773 |
} |
|
774 |
} |
|
159 | 775 |
if ((idx >= 0) && (idx < ninstvars)) { |
1133 | 776 |
__InstPtr(self)->i_instvars[idx] = value; |
159 | 777 |
__STORE(self, value); |
778 |
RETURN ( value ); |
|
779 |
} |
|
1 | 780 |
} |
781 |
%} |
|
782 |
. |
|
783 |
index isInteger ifFalse:[ |
|
159 | 784 |
^ self indexNotInteger |
1 | 785 |
]. |
159 | 786 |
^ self subscriptBoundsError:index |
359 | 787 |
! |
788 |
||
789 |
instVarNamed:name |
|
790 |
"return a non-indexed instance variables value by name; |
|
791 |
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
|
792 |
- 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
|
793 |
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
|
794 |
parsed ad runtime)" |
359 | 795 |
|
796 |
^ 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
|
797 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
798 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
799 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
800 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
801 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
802 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
803 |
p instVarNamed:'x' |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
804 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
805 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
806 |
"Modified: 19.4.1996 / 11:12:39 / cg" |
359 | 807 |
! |
808 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
809 |
instVarNamed:name ifAbsent:exceptionBlock |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
810 |
"return a non-indexed instance variables value by name, |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
811 |
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
|
812 |
peeking into an object this way is not very object oriented |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
813 |
- 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
|
814 |
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
|
815 |
parsed ad runtime)" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
816 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
817 |
|idx| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
818 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
819 |
idx := self class instVarOffsetOf:name. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
820 |
idx isNil ifTrue:[^ exceptionBlock value]. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
821 |
^ self instVarAt:idx |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
822 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
823 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
824 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
825 |
|p| |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
826 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
827 |
p := Point x:10 y:20. |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
828 |
p instVarNamed:'x' |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
829 |
" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
830 |
|
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
831 |
"Created: 6.7.1996 / 23:02:49 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
832 |
"Modified: 6.7.1996 / 23:03:41 / cg" |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
833 |
! |
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
834 |
|
359 | 835 |
instVarNamed:name put:value |
836 |
"set a non-indexed instance variable by name; |
|
837 |
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
|
838 |
- 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
|
839 |
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
|
840 |
parsed ad runtime)" |
359 | 841 |
|
842 |
^ 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
|
843 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
844 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
845 |
|p| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
846 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
847 |
p := Point x:10 y:20. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
848 |
p instVarNamed:'x' put:30. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
849 |
p |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
850 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
851 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
852 |
"Modified: 19.4.1996 / 11:12:49 / cg" |
1 | 853 |
! ! |
854 |
||
783 | 855 |
!Object methodsFor:'binary storage'! |
856 |
||
857 |
hasSpecialBinaryRepresentation |
|
858 |
"return true, if the receiver has a special binary representation; |
|
859 |
default here is false, but can be redefined in class which provide |
|
860 |
their own storeBinary/readBinary methods. |
|
861 |
||
862 |
Normal user classes should not use this, it is meant as a hook for |
|
863 |
special classes such as True, False, UndefinedObject or SmallInteger. |
|
864 |
||
865 |
If your instances should be stored in a special way, see |
|
866 |
#representBinaryOn: and #readBinaryContentsFromdata:manager:." |
|
867 |
||
868 |
^ false |
|
1 | 869 |
! |
870 |
||
783 | 871 |
readBinaryContentsFrom:stream manager:manager |
872 |
"reconstruct the receivers instance variables by reading a binary |
|
873 |
binary representation from stream. |
|
874 |
This is a general implementation, walking over instances |
|
875 |
and loading each recursively using manager. |
|
876 |
Redefined by some classes to read a more compact representations |
|
877 |
(see String, SmallInteger etc). |
|
878 |
||
879 |
Notice, that the object is already recreated as an empty corps |
|
880 |
with instance variables all nil and bit-instances (bytes, words etc.) |
|
881 |
already read and restored. |
|
882 |
||
883 |
Also notice: this method is not called for if a private representation |
|
884 |
has been stored (see representBinaryOn:). |
|
885 |
In that case, #readBinaryContentsFromData:manager: is called, which |
|
886 |
has to be reimplemented in the objects class." |
|
887 |
||
888 |
|size "{ Class: SmallInteger }" |
|
889 |
instvarArray| |
|
890 |
||
891 |
stream next == 1 ifTrue:[ |
|
892 |
"/ |
|
893 |
"/ special representation ... |
|
894 |
"/ |
|
895 |
instvarArray := Array new:(size := stream nextNumber:3). |
|
896 |
1 to:size do:[:i | |
|
897 |
instvarArray basicAt:i put:(manager nextObject) |
|
898 |
]. |
|
899 |
self readBinaryContentsFromData:instvarArray manager:manager. |
|
900 |
^ self |
|
901 |
]. |
|
902 |
||
903 |
"/ |
|
904 |
"/ standard representation |
|
905 |
"/ |
|
906 |
size := self basicSize. |
|
907 |
size ~~ 0 ifTrue:[ |
|
908 |
self class isPointers ifTrue:[ |
|
909 |
1 to:size do:[:i | |
|
910 |
self basicAt:i put:(manager nextObject) |
|
911 |
] |
|
912 |
] |
|
913 |
]. |
|
914 |
size := self class instSize. |
|
915 |
1 to:size do:[:i | |
|
916 |
self instVarAt:i put:(manager nextObject) |
|
917 |
]. |
|
918 |
! |
|
919 |
||
920 |
readBinaryContentsFromData:instvarArray manager:manager |
|
921 |
"reconstruct the receivers instance variables by filling instance |
|
922 |
variables with values from instvarArray. This array contains the instvars |
|
923 |
as specified in #representBinaryOn: when the object was stored. |
|
924 |
It is the receivers responsibility to set its instance variables in the |
|
925 |
same order from that array." |
|
926 |
||
927 |
^ self subclassResponsibility |
|
928 |
||
929 |
"typical implementation (see also comment in #representBinaryOn:) |
|
930 |
(for an object with foo, bar and baz as instance variables, |
|
931 |
which did not store baz and wants baz to be reinitialized to |
|
932 |
some constant string) |
|
933 |
||
934 |
foo := instvarArray at:1. |
|
935 |
bar := instvarArray at:2. |
|
936 |
baz := 'aConstant'. |
|
937 |
" |
|
938 |
! |
|
939 |
||
940 |
representBinaryOn:manager |
|
941 |
"this method is called by the storage manager to ask objects |
|
942 |
if they wish to provide their own binary representation. |
|
943 |
||
944 |
If they want to do so, they should return an array containing all |
|
945 |
instance variables (named & indexed pointer) to be stored. |
|
946 |
If not redefined, this method returns nil which means that all |
|
947 |
instance variables are to be stored. |
|
948 |
||
949 |
It should be redefined in objects which do not want all instance variables |
|
950 |
to be stored (for example: objects which keep references to a view etc.). |
|
951 |
||
952 |
If this is redefined returning non-nil, the corresponding class needs |
|
953 |
a redefined instance method named #readBinaryContentsFromData:manager: |
|
954 |
which has to fill the receivers named (and optionally indexed pointer) |
|
955 |
instance variables with corresponding values from a data array." |
|
956 |
||
957 |
^ nil |
|
958 |
||
959 |
"typical implementation: |
|
960 |
(see also comment in #readBinaryContentsFromData:manager:) |
|
961 |
for an object with foo, bar and baz as instance variables, |
|
962 |
which does not want to store baz: |
|
963 |
||
964 |
representBinaryOn:manager |
|
965 |
|data| |
|
966 |
||
967 |
data := Array new:2. |
|
968 |
data at:1 put:foo. |
|
969 |
data at:2 put:bar. |
|
970 |
^ data |
|
971 |
" |
|
159 | 972 |
! |
973 |
||
783 | 974 |
storeBinaryContentsFromData:instvarArray on:stream manager:manager |
975 |
"store the instvars (both named & indexed pointer) |
|
976 |
as returned by #representBinaryOn:." |
|
977 |
||
978 |
|size "{ Class: SmallInteger }"| |
|
979 |
||
980 |
size := instvarArray size. |
|
981 |
1 to:size do:[:i | |
|
982 |
manager putIdOf:(instvarArray at:i) on:stream |
|
983 |
]. |
|
984 |
! |
|
985 |
||
986 |
storeBinaryContentsOn:stream manager:manager |
|
987 |
"store the receivers instance variables in a binary representation |
|
988 |
on a stream using manager. |
|
989 |
This is a general implementation, walking over instances |
|
990 |
and storing each recursively using manager. |
|
991 |
||
992 |
Notice, that the objects definition and bit-instances (bytes, words etc.) |
|
993 |
are already stored. |
|
994 |
Here, we only have to deal with indexed-pointer and named instance variables. |
|
995 |
||
996 |
Also notice: this method is not called for if a private representation |
|
997 |
has been stored (see representBinaryOn:). |
|
998 |
In that case, #storeBinaryContentsFromData:manager: is called." |
|
999 |
||
1000 |
|size "{ Class: SmallInteger }"| |
|
1001 |
||
1002 |
size := self basicSize. |
|
1003 |
size ~~ 0 ifTrue:[ |
|
1004 |
self class isPointers ifTrue:[ |
|
1005 |
1 to:size do:[:i | |
|
1006 |
manager putIdOf:(self basicAt:i) on:stream |
|
1007 |
]. |
|
1008 |
]. |
|
1009 |
]. |
|
1010 |
size := self class instSize. |
|
1011 |
1 to:size do:[:i | |
|
1012 |
manager putIdOf:(self instVarAt:i) on:stream |
|
1013 |
]. |
|
1 | 1014 |
! |
1015 |
||
783 | 1016 |
storeBinaryDefinitionBodyOn:stream manager:manager |
1017 |
"append a binary representation of the receivers body onto stream. |
|
1018 |
This is a general implementation walking over instances storing |
|
1019 |
each recursively as an ID using manager. |
|
1020 |
Can be redefined in subclasses." |
|
1021 |
||
1022 |
|basicSize "{ Class: SmallInteger }" |
|
1023 |
instSize "{ Class: SmallInteger }" |
|
1024 |
myClass specialRep pointers| |
|
1025 |
||
1026 |
myClass := self class. |
|
1027 |
instSize := myClass instSize. |
|
1028 |
||
1029 |
(pointers := myClass isPointers) ifTrue:[ |
|
1030 |
"/ |
|
1031 |
"/ inst size not needed - if you uncomment the line below, |
|
1032 |
"/ also uncomment the corresponding line in |
|
1033 |
"/ Object>>binaryDefinitionFrom:manager: |
|
1034 |
"/ |
|
1035 |
"/ stream nextPut:instSize. "mhmh this limits us to 255 named instvars" |
|
1036 |
||
1037 |
myClass isVariable ifTrue:[ |
|
1038 |
stream nextNumber:3 put:(basicSize := self basicSize) |
|
1039 |
] ifFalse:[ |
|
1040 |
basicSize := 0 |
|
1041 |
]. |
|
1042 |
] ifFalse: [ |
|
1043 |
stream nextNumber:4 put:(basicSize := self basicSize). |
|
1044 |
myClass isBytes ifTrue:[ |
|
1045 |
1 to:basicSize do:[:i | |
|
1046 |
stream nextPut:(self basicAt:i) |
|
1047 |
] |
|
1048 |
] ifFalse:[ |
|
1049 |
myClass isWords ifTrue:[ |
|
1050 |
1 to:basicSize do:[:i | |
|
1051 |
stream nextNumber:2 put:(self basicAt: i) |
|
1052 |
] |
|
1053 |
] ifFalse:[ |
|
1054 |
myClass isLongs ifTrue:[ |
|
1055 |
1 to:basicSize do:[:i | |
|
1056 |
stream nextNumber:4 put:(self basicAt: i) |
|
1057 |
] |
|
1058 |
] ifFalse:[ |
|
1059 |
myClass isFloats ifTrue:[ |
|
1060 |
"could do it in one big write on machines which use IEEE floats ..." |
|
1061 |
1 to:basicSize do:[:i | |
|
1062 |
Float storeBinaryIEEESingle:(self basicAt:i) on:stream |
|
1063 |
] |
|
1064 |
] ifFalse:[ |
|
1065 |
myClass isDoubles ifTrue:[ |
|
1066 |
"could do it in one big write on machines which use IEEE doubles ..." |
|
1067 |
1 to:basicSize do:[:i | |
|
1068 |
Float storeBinaryIEEEDouble:(self basicAt:i) on:stream |
|
1069 |
] |
|
1070 |
] ifFalse:[ |
|
1071 |
"/ should never be reached ... |
|
1072 |
1 to:basicSize do:[:i | |
|
1073 |
manager putIdOf:(self basicAt:i) on:stream |
|
1074 |
] |
|
1075 |
] |
|
1076 |
] |
|
1077 |
] |
|
1078 |
] |
|
1079 |
]. |
|
1080 |
]. |
|
1081 |
||
1082 |
(pointers or:[instSize ~~ 0]) ifTrue:[ |
|
1083 |
specialRep := self representBinaryOn:manager. |
|
1084 |
specialRep notNil ifTrue:[ |
|
1085 |
stream nextPut:1. "/ means: private representation follows |
|
1086 |
stream nextNumber:3 put:(specialRep basicSize). |
|
1087 |
self storeBinaryContentsFromData:specialRep on:stream manager:manager |
|
1088 |
] ifFalse:[ |
|
1089 |
stream nextPut:0. "/ means: full representation follows |
|
1090 |
self storeBinaryContentsOn:stream manager:manager |
|
159 | 1091 |
] |
1 | 1092 |
] |
783 | 1093 |
|
1094 |
"Modified: 25.10.1995 / 14:00:51 / cg" |
|
1 | 1095 |
! |
1096 |
||
783 | 1097 |
storeBinaryDefinitionOn:stream manager:manager |
1098 |
"append a binary representation of the receiver onto stream. |
|
1260 | 1099 |
This is an internal interface for binary storage mechanism. |
783 | 1100 |
This method first stores the class, then the body, which is done |
1101 |
in a separate method to allow redefinition of the bodies format. |
|
1102 |
Can be redefined in subclasses to write more compact representations |
|
1103 |
(see String, SmallInteger etc)." |
|
1104 |
||
1105 |
manager putIdOfClass:(self class) on:stream. |
|
1106 |
self storeBinaryDefinitionBodyOn:stream manager:manager |
|
1260 | 1107 |
|
1108 |
"Modified: 23.4.1996 / 09:31:12 / cg" |
|
783 | 1109 |
! |
1110 |
||
1111 |
storeBinaryOn:aStream |
|
1112 |
"Writes a description of the receiver onto aStream, in a way that allows |
|
1113 |
the object's structure to be reconstructed from the stream's contents" |
|
1114 |
||
1115 |
BinaryOutputManager store:self on:aStream |
|
899 | 1116 |
|
1117 |
" |
|
1118 |
|a s1 s2| |
|
1119 |
||
1120 |
s1 := 'hello'. |
|
1121 |
s2 := 'world'. |
|
1122 |
a := Array new:5. |
|
1123 |
a at:1 put:s1. |
|
1124 |
a at:2 put:s2. |
|
1125 |
a at:3 put:s1. |
|
1126 |
a at:4 put:s2. |
|
1127 |
a storeBinaryOn:'test.boss' |
|
1128 |
" |
|
1129 |
||
1130 |
" |
|
1131 |
(BinaryObjectStorage onOld:'test.boss' asFilename readStream) |
|
1132 |
next |
|
1133 |
inspect |
|
1134 |
" |
|
783 | 1135 |
! |
1136 |
||
1137 |
storeBinaryOn:stream manager:manager |
|
1138 |
"append a binary representation of the receiver onto stream." |
|
1139 |
||
1140 |
manager putIdOf:self on:stream |
|
1 | 1141 |
! ! |
1142 |
||
1143 |
!Object methodsFor:'change and update'! |
|
1144 |
||
783 | 1145 |
broadcast:aSelectorSymbol |
1146 |
"send a message with selector aSelectorSymbol to all my dependents" |
|
1147 |
||
1148 |
self dependentsDo:[:dependent | |
|
1149 |
dependent perform:aSelectorSymbol |
|
1150 |
] |
|
1151 |
! |
|
1152 |
||
1153 |
broadcast:aSelectorSymbol with:anArgument |
|
1154 |
"send a message with selector aSelectorSymbol with an additional |
|
1155 |
argument anArgument to all my dependents." |
|
1156 |
||
1157 |
self dependentsDo:[:dependent | |
|
1158 |
dependent perform:aSelectorSymbol with:anArgument |
|
1159 |
] |
|
1160 |
! |
|
1161 |
||
159 | 1162 |
changeRequest |
1163 |
"the receiver wants to change - check if all dependents |
|
1164 |
grant the request, and return true if so" |
|
1165 |
||
1166 |
self dependentsDo:[:dependent | |
|
1167 |
dependent updateRequest ifFalse:[^ false]. |
|
1168 |
]. |
|
1169 |
^ true |
|
1170 |
! |
|
1171 |
||
1172 |
changeRequest:aParameter |
|
1173 |
"the receiver wants to change - check if all dependents |
|
1174 |
grant the request, and return true if so" |
|
1175 |
||
1176 |
self dependentsDo:[:dependent | |
|
1177 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1178 |
]. |
|
1179 |
^ true |
|
1180 |
! |
|
1181 |
||
783 | 1182 |
changeRequest:aParameter from:anObject |
1183 |
"the receiver wants to change - check if all dependents |
|
1184 |
except anObject grant the request, and return true if so. |
|
1185 |
The argument anObject is typically going to be the one who is |
|
1186 |
about to send the change request." |
|
1187 |
||
1188 |
self dependentsDo:[:dependent | |
|
1189 |
dependent == anObject ifFalse:[ |
|
1190 |
(dependent updateRequest:aParameter) ifFalse:[^ false]. |
|
1191 |
] |
|
1192 |
]. |
|
1193 |
^ true |
|
1194 |
! |
|
1195 |
||
159 | 1196 |
changeRequestFrom:anObject |
1197 |
"the receiver wants to change - check if all dependents |
|
202 | 1198 |
except anObject grant the request, and return true if so. |
1199 |
The argument anObject is typically going to be the one who is |
|
1200 |
about to send the change request." |
|
159 | 1201 |
|
1202 |
self dependentsDo:[:dependent | |
|
1203 |
dependent == anObject ifFalse:[ |
|
1204 |
(dependent updateRequest) ifFalse:[^ false]. |
|
1205 |
] |
|
1206 |
]. |
|
1207 |
^ true |
|
1208 |
! |
|
1209 |
||
1 | 1210 |
changed |
1211 |
"notify all dependents that the receiver has changed. |
|
71 | 1212 |
Each dependent gets a '#update:'-message with the original |
1213 |
receiver as argument." |
|
1 | 1214 |
|
159 | 1215 |
self changed:nil |
1 | 1216 |
! |
1217 |
||
1218 |
changed:aParameter |
|
1219 |
"notify all dependents that the receiver has changed somehow. |
|
71 | 1220 |
Each dependent gets a '#update:'-message with aParameter |
1221 |
as argument." |
|
1 | 1222 |
|
159 | 1223 |
self changed:aParameter with:nil |
1 | 1224 |
! |
1225 |
||
71 | 1226 |
changed:aParameter with:anArgument |
1 | 1227 |
"notify all dependents that the receiver has changed somehow. |
159 | 1228 |
Each dependent gets a '#update:with:from:'-message, with aParameter |
71 | 1229 |
and anArgument as arguments." |
1 | 1230 |
|
159 | 1231 |
self dependentsDo:[:dependent | |
1232 |
dependent update:aParameter with:anArgument from:self |
|
1 | 1233 |
] |
1234 |
! |
|
1235 |
||
1236 |
update:aParameter |
|
71 | 1237 |
"the message is sent to a dependent, when one of the objects |
1238 |
on whom the receiver depends, has changed. The argument aParameter |
|
1239 |
is either the changed object or the argument to the #changed: message. |
|
1240 |
||
1241 |
Default behavior here is to do nothing" |
|
1 | 1242 |
|
1243 |
^ self |
|
1244 |
! |
|
1245 |
||
1246 |
update:aParameter with:anArgument |
|
1247 |
"dependent is notified of some change - |
|
159 | 1248 |
Default is to try update:" |
1 | 1249 |
|
1250 |
^ self update:aParameter |
|
1251 |
! |
|
1252 |
||
1253 |
update:aParameter with:anArgument from:sender |
|
1254 |
"dependent is notified of some change - |
|
159 | 1255 |
Default is to try update:with:" |
1 | 1256 |
|
1257 |
^ self update:aParameter with:anArgument |
|
159 | 1258 |
! |
1259 |
||
1260 |
updateRequest |
|
1261 |
"return true, if an update request is granted. |
|
1262 |
Default here is to grant updates - may be used |
|
1263 |
to lock updates if someone is making other changes |
|
202 | 1264 |
from within an update. Or if someone has locked its |
1265 |
state and does not want others to change things. |
|
1266 |
However, these dependents must all honor the |
|
1267 |
changeRequest - ifTrue - change protocol. I.e. they |
|
1268 |
must first ask all others via changeRequest, and only do the change |
|
1269 |
it returns true. The others must decide in updateRequest and |
|
1270 |
return true if they think a change is ok." |
|
159 | 1271 |
|
1272 |
^ true |
|
1273 |
! |
|
1274 |
||
1275 |
updateRequest:aSymbol |
|
1276 |
"return true, if an update request is granted. |
|
1277 |
Default here a simple updateRequest" |
|
1278 |
||
1279 |
^ self updateRequest |
|
1 | 1280 |
! ! |
1281 |
||
783 | 1282 |
!Object methodsFor:'cleanup'! |
1283 |
||
1284 |
lowSpaceCleanup |
|
1285 |
"ignored here - redefined in some classes to |
|
1286 |
cleanup in low-memory situations" |
|
1287 |
||
1288 |
^ self |
|
1289 |
! ! |
|
1290 |
||
1291 |
!Object methodsFor:'comparing'! |
|
1292 |
||
1293 |
= anObject |
|
1294 |
"return true, if the receiver and the arg have the same structure" |
|
1295 |
||
1296 |
^ self == anObject |
|
1297 |
! |
|
1298 |
||
1299 |
== anObject |
|
1300 |
"return true, if the receiver and the arg are the same object" |
|
1301 |
||
1302 |
%{ /* NOCONTEXT */ |
|
1303 |
||
1304 |
RETURN ( (self == anObject) ? true : false ); |
|
1305 |
%} |
|
1306 |
! |
|
1307 |
||
1308 |
hash |
|
1309 |
"return an Integer useful as a hash key for the receiver. |
|
1310 |
This hash should return same values for objects with same |
|
1311 |
contents (i.e. use this to hash on structure)" |
|
1312 |
||
1313 |
^ self identityHash |
|
1314 |
! |
|
1315 |
||
1316 |
identityHash |
|
1317 |
"return an Integer useful as a hash key for the receiver. |
|
1318 |
This hash should return same values for the same object (i.e. use |
|
1319 |
this to hash on identity of objects). |
|
1320 |
||
1321 |
We cannot use the Objects address (as other smalltalks do) since |
|
1322 |
no object-table exists and the hashval must not change when objects |
|
1323 |
are moved by the collector. Therefore we assign each object a unique |
|
1324 |
Id in the object header itself as its hashed upon. |
|
1325 |
(luckily we have 11 bits spare to do this - unluckily its only 11 bits). |
|
1326 |
Time will show, if 11 bits are enough; if not, another entry in the |
|
1327 |
object header will be needed, adding 4 bytes to every object. Alternatively, |
|
1328 |
hashed-upon objects could add an instvar containing the hash value." |
|
1329 |
||
1330 |
%{ /* NOCONTEXT */ |
|
1331 |
||
1332 |
REGISTER unsigned hash; |
|
1333 |
static unsigned nextHash = 0; |
|
1334 |
OBJ cls; |
|
1335 |
||
1336 |
if (__isNonNilObject(self)) { |
|
1337 |
hash = __GET_HASH(self); |
|
1338 |
if (hash == 0) { |
|
1339 |
hash = nextHash++; |
|
1340 |
__SET_HASH(self, hash); |
|
1341 |
hash = __GET_HASH(self); |
|
1342 |
if (hash == 0) { |
|
1343 |
hash = nextHash++; |
|
1344 |
__SET_HASH(self, hash); |
|
1345 |
hash = __GET_HASH(self); |
|
1346 |
} |
|
1347 |
} |
|
1348 |
||
1349 |
/* |
|
1350 |
* now, we got 11 bits for hashing; |
|
1351 |
* make it as large as possible; since most hashers use the returned |
|
1352 |
* key and take it modulu some prime number, this will allow for |
|
1353 |
* better distribution (i.e. bigger empty spaces) in hashed collection. |
|
1354 |
* we could shift it up to the 30 bit limit - not making it negative. |
|
1355 |
*/ |
|
1356 |
RETURN ( __MKSMALLINT(hash << __HASH_SHIFT__) ); |
|
1357 |
} |
|
1358 |
%}. |
|
1359 |
^ 0 "never reached, since redefined in UndefinedObject and SmallInteger" |
|
1360 |
! |
|
1361 |
||
1362 |
isNil |
|
1363 |
"return true, if the receiver is nil" |
|
1364 |
||
1365 |
^ false |
|
1366 |
! |
|
1367 |
||
1368 |
notNil |
|
1369 |
"return true, if the receiver is not nil" |
|
1370 |
||
1371 |
^ true |
|
1372 |
! |
|
1373 |
||
1374 |
~= anObject |
|
1375 |
"return true, if the receiver and the arg do not have the same structure" |
|
1376 |
||
1377 |
^ (self = anObject) not |
|
1378 |
! |
|
1379 |
||
1380 |
~~ anObject |
|
1381 |
"return true, if the receiver and the arg are not the same object" |
|
1382 |
||
1383 |
%{ /* NOCONTEXT */ |
|
1384 |
||
1385 |
RETURN ( (self == anObject) ? false : true ); |
|
1386 |
%} |
|
1387 |
! ! |
|
1388 |
||
1389 |
!Object methodsFor:'converting'! |
|
1390 |
||
1391 |
asValue |
|
1392 |
"return a valueHolder for for the receiver" |
|
1393 |
||
1394 |
^ ValueHolder with:self |
|
1395 |
! ! |
|
1396 |
||
1397 |
!Object methodsFor:'copying'! |
|
1398 |
||
1399 |
copy |
|
1400 |
"return a copy of the receiver - defaults to shallowcopy here. |
|
1401 |
Notice, that copy does not copy dependents." |
|
1402 |
||
1403 |
^ self shallowCopy postCopy |
|
1404 |
! |
|
1405 |
||
1406 |
deepCopy |
|
1407 |
"return a copy of the object with all subobjects also copied. |
|
1408 |
This method DOES handle cycles/self-refs; however the receivers |
|
1409 |
class is not copied (to avoid the 'total' copy). |
|
1410 |
This deepCopy is a bit slower than the old (unsecure) one, since it |
|
1411 |
keeps track of already copied objects. If you are sure, that your |
|
1129 | 1412 |
copied object does not include duplicates (or you do not care) and |
783 | 1413 |
no cycles, you can use the old simpleDeepCopy, which avoids this overhead, |
1414 |
but may run into trouble. |
|
1415 |
Notice, that copy does not copy dependents." |
|
1416 |
||
1417 |
^ self deepCopyUsing:(IdentityDictionary new) |
|
1418 |
||
1419 |
"an example which is not handled by the old deepCopy: |
|
1420 |
||
1421 |
|a| |
|
1422 |
a := Array new:3. |
|
1423 |
a at:3 put:a. |
|
1424 |
a deepCopy inspect |
|
1425 |
" |
|
1129 | 1426 |
|
1427 |
"Modified: 27.3.1996 / 16:31:20 / stefan" |
|
783 | 1428 |
! |
1429 |
||
1430 |
deepCopyError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1431 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1432 |
|
783 | 1433 |
"raise a signal, that deepCopy is not allowed for this object" |
1434 |
||
1435 |
^ DeepCopyErrorSignal raise |
|
1436 |
! |
|
1437 |
||
1438 |
deepCopyUsing:aDictionary |
|
1439 |
"a helper for deepCopy; return a copy of the object with |
|
1440 |
all subobjects also copied. If the to-be-copied object is in the dictionary, |
|
1441 |
use the value found there. The class of the receiver is not copied. |
|
1442 |
This method DOES handle cycles/self references." |
|
1443 |
||
1444 |
|myClass aCopy |
|
1445 |
sz "{ Class: SmallInteger }" |
|
1446 |
iOrig iCopy| |
|
1447 |
||
1448 |
myClass := self class. |
|
1449 |
myClass isVariable ifTrue:[ |
|
1450 |
sz := self basicSize. |
|
1451 |
aCopy := myClass basicNew:sz. |
|
1452 |
] ifFalse:[ |
|
1453 |
sz := 0. |
|
1454 |
aCopy := myClass basicNew |
|
1455 |
]. |
|
1456 |
aCopy setHashFrom:self. |
|
1457 |
||
1458 |
aDictionary at:self put:aCopy. |
|
143 | 1459 |
|
1460 |
" |
|
783 | 1461 |
copy indexed instvars - if any |
1462 |
" |
|
1463 |
sz ~~ 0 ifTrue:[ |
|
1464 |
myClass isBits ifTrue:[ |
|
1465 |
"block-copy indexed instvars" |
|
1466 |
aCopy replaceFrom:1 to:sz with:self startingAt:1 |
|
1467 |
] ifFalse:[ |
|
1468 |
"individual deep copy the indexed variables" |
|
1469 |
1 to:sz do:[:i | |
|
1470 |
iOrig := self basicAt:i. |
|
1471 |
iOrig notNil ifTrue:[ |
|
1472 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
1473 |
iCopy := aDictionary at:iOrig |
|
1474 |
] ifFalse:[ |
|
1475 |
iCopy := iOrig deepCopyUsing:aDictionary. |
|
1476 |
]. |
|
1477 |
aCopy basicAt:i put:iCopy |
|
1478 |
] |
|
1479 |
] |
|
1480 |
] |
|
1481 |
]. |
|
1482 |
||
1483 |
" |
|
1484 |
copy the instance variables |
|
1485 |
" |
|
1486 |
sz := myClass instSize. |
|
1487 |
sz ~~ 0 ifTrue:[ |
|
1488 |
1 to:sz do:[:i | |
|
1489 |
iOrig := self instVarAt:i. |
|
1490 |
iOrig notNil ifTrue:[ |
|
1491 |
(aDictionary includesKey:iOrig) ifTrue:[ |
|
1492 |
iCopy := aDictionary at:iOrig |
|
1493 |
] ifFalse:[ |
|
1494 |
iCopy := iOrig deepCopyUsing:aDictionary. |
|
1495 |
]. |
|
1496 |
aCopy instVarAt:i put:iCopy |
|
1497 |
] |
|
1498 |
]. |
|
1499 |
]. |
|
1500 |
||
1501 |
^ aCopy |
|
1502 |
! |
|
1503 |
||
1504 |
postCopy |
|
1505 |
"this is for compatibility with ST-80 code, which uses postCopy for |
|
1506 |
cleanup after copying, while ST/X passes the original in postCopyFrom: |
|
1507 |
(see there)" |
|
1508 |
||
1509 |
^ self |
|
1510 |
! |
|
1511 |
||
1512 |
postCopyFrom:original |
|
1513 |
"sent to a freshly deep-copied object to give it a chance to adjust things. |
|
1514 |
(a font could flush its device-handle for example). |
|
1515 |
Notice, that for Sets/Dicts etc. a rehash is not needed, since the deepCopy |
|
1516 |
will have the same hash key as the receiver (as long as ST/X provides the |
|
1517 |
setHash: functionality)." |
|
1518 |
||
1519 |
"for ST-80 compatibility, we try postCopy here ..." |
|
1520 |
^ self postCopy |
|
1521 |
! |
|
1522 |
||
1523 |
setHashFrom:anObject |
|
1524 |
"set my identity-hash key to be the same as anObjects hash key. |
|
1525 |
This is an ST/X speciality, which is NOT available in other (especially OT based) |
|
1526 |
Smalltalks, and may not be available in future ST/X versions. |
|
1527 |
DO NEVER use this for normal application code." |
|
1528 |
||
1529 |
%{ /* NOCONTEXT */ |
|
1530 |
||
1531 |
REGISTER unsigned h; |
|
1532 |
||
1533 |
if (__isNonNilObject(self) && __isNonNilObject(anObject)) { |
|
1534 |
h = __GET_HASH(anObject); |
|
1535 |
__SET_HASH(self, h); |
|
1536 |
RETURN (self); |
|
1537 |
} |
|
1538 |
%} |
|
1539 |
. |
|
1540 |
self primitiveFailed "neither receiver not arg may be nil or SmallInteger" |
|
1541 |
! |
|
1542 |
||
1543 |
shallowCopy |
|
1544 |
"return a copy of the object with shared subobjects (a shallow copy) |
|
1545 |
i.e. the copy shares referenced instvars with its original." |
|
1546 |
||
1547 |
|myClass aCopy |
|
1548 |
sz "{ Class: SmallInteger }" | |
|
1549 |
||
1550 |
myClass := self class. |
|
1551 |
myClass isVariable ifTrue:[ |
|
1552 |
sz := self basicSize. |
|
1553 |
aCopy := myClass basicNew:sz. |
|
1554 |
||
1555 |
"copy the indexed variables" |
|
1556 |
1 to:sz do:[:i | |
|
1557 |
aCopy basicAt:i put:(self basicAt:i) |
|
1558 |
] |
|
1559 |
] ifFalse:[ |
|
1560 |
aCopy := myClass basicNew |
|
1561 |
]. |
|
1562 |
||
1563 |
"copy the instance variables" |
|
1564 |
sz := myClass instSize. |
|
1565 |
1 to:sz do:[:i | |
|
1566 |
aCopy instVarAt:i put:(self instVarAt:i) |
|
1567 |
]. |
|
1568 |
||
1569 |
^ aCopy |
|
1570 |
! |
|
1571 |
||
1572 |
shallowCopyForFinalization |
|
1573 |
"this is used to aquire a copy to be used for finalization - |
|
1574 |
(the copy will get a dispose-notification; see the documentation in the Registry class) |
|
1575 |
This method can be redefined for more efficient copying - especially for large objects." |
|
1576 |
||
1577 |
^ self shallowCopy |
|
1578 |
! |
|
1579 |
||
1580 |
simpleDeepCopy |
|
1581 |
"return a copy of the object with all subobjects also copied. |
|
1582 |
This method does NOT handle cycles - but is included to allow this |
|
1583 |
slightly faster copy in situations where it is known that |
|
1584 |
no recursive references occur (LargeIntegers for example). |
|
1585 |
NOTICE: you will run into trouble, when trying this with recursive |
|
1586 |
objects (usually recursionInterrupt or memory-alert). |
|
1587 |
This method corresponds to the 'traditional' deepCopy found in |
|
1588 |
the Blue book." |
|
1589 |
||
1590 |
|myClass aCopy |
|
1591 |
sz "{ Class: SmallInteger }" | |
|
1592 |
||
1593 |
myClass := self class. |
|
1594 |
myClass isVariable ifTrue:[ |
|
1595 |
sz := self basicSize. |
|
1596 |
aCopy := myClass basicNew:sz. |
|
1597 |
||
1598 |
"copy the indexed variables" |
|
1599 |
1 to:sz do:[:i | |
|
1600 |
aCopy basicAt:i put:((self basicAt:i) simpleDeepCopy) |
|
1601 |
] |
|
1602 |
] ifFalse:[ |
|
1603 |
aCopy := myClass basicNew |
|
1604 |
]. |
|
1605 |
||
1606 |
"copy the instance variables" |
|
1607 |
sz := myClass instSize. |
|
1608 |
1 to:sz do:[:i | |
|
1609 |
aCopy instVarAt:i put:((self instVarAt:i) simpleDeepCopy) |
|
1610 |
]. |
|
1611 |
||
1612 |
^ aCopy |
|
1613 |
||
1614 |
"a bad example (but ST/X should survive ...)" |
|
1615 |
" |
|
1616 |
|a| |
|
1617 |
a := Array new:3. |
|
1618 |
a at:3 put:a. |
|
1619 |
a simpleDeepCopy |
|
1620 |
" |
|
1621 |
! ! |
|
1622 |
||
1623 |
!Object methodsFor:'debugging'! |
|
1624 |
||
1625 |
basicInspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1626 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1627 |
|
783 | 1628 |
"launch an inspector on the receiver. |
1629 |
this method should NOT be redefined in subclasses." |
|
1630 |
||
1631 |
Inspector isNil ifTrue:[ |
|
1417 | 1632 |
" |
1633 |
for systems without GUI |
|
1634 |
" |
|
1635 |
Transcript showCR:'no Inspector' |
|
783 | 1636 |
] ifFalse:[ |
1417 | 1637 |
Inspector openOn:self |
783 | 1638 |
] |
1417 | 1639 |
|
1640 |
"Modified: 18.5.1996 / 15:43:25 / cg" |
|
783 | 1641 |
! |
1642 |
||
1643 |
inspect |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1644 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1645 |
|
783 | 1646 |
"launch an inspector on the receiver. |
1647 |
this method (or better: inspectorClass) can be redefined in subclasses |
|
1648 |
to start special inspectors." |
|
1649 |
||
1650 |
|cls| |
|
1651 |
||
1652 |
cls := self inspectorClass. |
|
1653 |
cls isNil ifTrue:[ |
|
1654 |
^ self basicInspect |
|
1655 |
]. |
|
1656 |
cls openOn:self |
|
1657 |
||
1658 |
" |
|
1659 |
Object new inspect |
|
1660 |
(1 @ 2) inspect |
|
1661 |
Smalltalk inspect |
|
1662 |
#(1 2 3) asOrderedCollection inspect |
|
1663 |
(Color red) inspect |
|
1664 |
(Image fromFile:'bitmaps/garfield.gif') inspect |
|
143 | 1665 |
" |
71 | 1666 |
! |
1667 |
||
783 | 1668 |
inspectorClass |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1669 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1670 |
|
783 | 1671 |
"return the class to use for inspect. |
1672 |
Can (should) be redefined in classes for which a better inspector is available" |
|
1673 |
||
1674 |
^ Inspector |
|
1675 |
! |
|
1676 |
||
1677 |
mustBeKindOf:aClass |
|
1678 |
"for compatibility & debugging support: |
|
1679 |
check if the receiver isKindOf:aClass and raise an error if not. |
|
1680 |
Notice: |
|
1681 |
it is VERY questionable, if it makes sense to add manual |
|
1682 |
type checks to a dynamically typed language like smalltalk. |
|
1683 |
It will, at least, slow down performance, |
|
1684 |
make your code less reusable and clutter your code with stupid sends |
|
1685 |
of this selector. Also, read the comment in isKindOf:, regarding the |
|
1686 |
use of isXXX check methods. |
|
1687 |
You see: The author does not like this at all ..." |
|
1688 |
||
1689 |
(self isKindOf:aClass) ifFalse:[ |
|
1690 |
self error:'argument is not of expected type' |
|
1691 |
] |
|
1692 |
! |
|
1693 |
||
1694 |
obsoleteMethodWarning |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1695 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1696 |
|
783 | 1697 |
"in methods which are going to be obsoleted, a self send to |
1698 |
this method is used to tell programmers that a method is |
|
1699 |
used which is going to be removed in later ST/X versions. |
|
1700 |
Find all methods which will be obsolete soon by looking at senders |
|
1701 |
of this message. |
|
1702 |
Hopefully, this warning message is annoying enough for you to |
|
1703 |
change the code ... ;-)" |
|
1704 |
||
1705 |
self obsoleteMethodWarning:nil from:thisContext sender |
|
1706 |
! |
|
1707 |
||
1708 |
obsoleteMethodWarning:message |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1709 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1710 |
|
783 | 1711 |
"in methods which are going to be obsoleted, a self send to |
1712 |
this method is used to tell programmers that a method is |
|
1713 |
used which is going to be removed in later ST/X versions. |
|
1714 |
Find all methods which will be obsolete soon by looking at senders |
|
1715 |
of this message. |
|
1716 |
Hopefully, this warning message is annoying enough for you to |
|
1717 |
change the code ... ;-)" |
|
1718 |
||
1719 |
self obsoleteMethodWarning:message from:thisContext sender |
|
1720 |
! |
|
1721 |
||
1722 |
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
|
1723 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
1724 |
|
783 | 1725 |
"in methods which are going to be obsoleted, a self-send to |
1726 |
this method is used to tell programmers that a method is |
|
1727 |
used which is going to be removed in later ST/X versions. |
|
1728 |
Find all methods which will be obsolete soon by looking at senders |
|
1729 |
of this message. |
|
1730 |
Hopefully, this warning message is annoying enough for you to |
|
1731 |
change the code ... ;-)" |
|
1732 |
||
1733 |
|spec| |
|
1734 |
||
1735 |
spec := aContext methodPrintString. |
|
1736 |
('WARNING: the ''' , spec , ''' method is obsolete.') errorPrintNL. |
|
1737 |
(' And may not be present in future ST/X versions.') errorPrintNL. |
|
1738 |
(' called from ' , aContext sender printString) errorPrintNL. |
|
1739 |
message notNil ifTrue:[ |
|
1740 |
'------> ' errorPrint. message errorPrintNL |
|
1741 |
] |
|
1742 |
||
1743 |
" |
|
1744 |
Object obsoleteMethodWarning:'foo' from:thisContext sender sender |
|
1745 |
" |
|
1746 |
! ! |
|
1747 |
||
1748 |
!Object methodsFor:'dependents access'! |
|
1749 |
||
1750 |
addDependent:anObject |
|
1751 |
"make the argument, anObject be a dependent of the receiver" |
|
1752 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1753 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1754 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1755 |
"/ 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
|
1756 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1757 |
"/ 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
|
1758 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1759 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1760 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
1761 |
[ |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1762 |
|deps| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1763 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1764 |
deps := self dependents. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1765 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1766 |
"/ to save a fair amount of memory in case of |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1767 |
"/ many dependencies, we store a single dependent in |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1768 |
"/ a WeakArray, and switch to a WeakSet if more dependents are |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1769 |
"/ added. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1770 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1771 |
deps isNil ifTrue:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1772 |
self dependents:(WeakArray with:anObject) |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1773 |
] ifFalse:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1774 |
deps class == WeakArray ifTrue:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1775 |
self dependents:(WeakIdentitySet with:(deps at:1) with:anObject) |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1776 |
] ifFalse:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1777 |
deps add:anObject |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1778 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1779 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1780 |
] valueNowOrOnUnwindDo:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1781 |
wasBlocked ifFalse:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1782 |
OperatingSystem unblockInterrupts |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1783 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1784 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1785 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1786 |
"Modified: 19.7.1996 / 12:38:50 / cg" |
783 | 1787 |
! |
1788 |
||
1789 |
dependents |
|
1790 |
"return a Collection of dependents - nil if there is none. |
|
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1791 |
The default implementation here uses a global WeakDictionary to store |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1792 |
dependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1793 |
This may be too slow for high frequency change&update, |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1794 |
therefore, some classes (Model) redefine this for better performance. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1795 |
Notice the mentioning of a WeakDictionary - read the classes documentation." |
783 | 1796 |
|
1797 |
^ Dependencies at:self ifAbsent:[nil] |
|
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1798 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1799 |
"Modified: 19.4.1996 / 12:36:46 / cg" |
783 | 1800 |
! |
1801 |
||
1802 |
dependents:aCollection |
|
1803 |
"set the collection of dependents. |
|
1804 |
The default implementation here uses a global Dictionary to store |
|
1805 |
dependents which may be too slow for high frequency change&update. |
|
1806 |
Therefore, some classes (Model) redefine this for better performance." |
|
1807 |
||
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
1808 |
[ |
891 | 1809 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
1810 |
Dependencies removeKey:self ifAbsent:[] |
891 | 1811 |
] ifFalse:[ |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
1812 |
Dependencies at:self put:aCollection |
891 | 1813 |
] |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
1814 |
] valueUninterruptably |
783 | 1815 |
! |
1816 |
||
1817 |
dependentsDo:aBlock |
|
1818 |
"evaluate aBlock for all of my dependents" |
|
1819 |
||
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1820 |
|deps nwDeps| |
783 | 1821 |
|
1822 |
deps := self dependents. |
|
1823 |
deps notNil ifTrue:[ |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1824 |
deps do:aBlock |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1825 |
]. |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1826 |
nwDeps := self nonWeakDependents. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1827 |
(nwDeps notNil and:[nwDeps ~~ deps]) ifTrue:[ |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1828 |
nwDeps do:aBlock |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1829 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1830 |
|
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1831 |
"Modified: 19.4.1996 / 12:35:54 / cg" |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1832 |
! |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1833 |
|
783 | 1834 |
release |
1835 |
"remove all dependencies from the receiver" |
|
1836 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1837 |
self dependents:nil. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1838 |
self nonWeakDependents:nil |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1839 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1840 |
"Modified: 19.4.1996 / 10:55:36 / cg" |
783 | 1841 |
! |
1842 |
||
1843 |
removeDependent:anObject |
|
1844 |
"make the argument, anObject be independent of the receiver" |
|
1845 |
||
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1846 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1847 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1848 |
"/ 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
|
1849 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1850 |
"/ 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
|
1851 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1852 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1853 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1854 |
[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1855 |
|deps n| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1856 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1857 |
deps := self dependents. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1858 |
deps notNil ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1859 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1860 |
"/ to save a fair amount of memory in case of |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1861 |
"/ many dependencies, we store a single dependent in |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1862 |
"/ a WeakArray, and switch to a WeakSet if more dependents are |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1863 |
"/ added. Here we have to do the inverse ... |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1864 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1865 |
deps class == WeakArray ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1866 |
(deps at:1) == anObject ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1867 |
self dependents:nil |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1868 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1869 |
] ifFalse:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1870 |
deps remove:anObject ifAbsent:[]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1871 |
(n := deps size) == 0 ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1872 |
self dependents:nil |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1873 |
] ifFalse:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1874 |
n == 1 ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1875 |
self dependents:(WeakArray with:(deps first)) |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1876 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1877 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1878 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1879 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1880 |
] valueNowOrOnUnwindDo:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1881 |
wasBlocked ifFalse:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1882 |
OperatingSystem unblockInterrupts |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1883 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1884 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1885 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1886 |
"Modified: 19.7.1996 / 12:40:23 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1887 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1888 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1889 |
!Object methodsFor:'dependents access (nonWeak)'! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1890 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1891 |
addNonWeakDependent:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1892 |
"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
|
1893 |
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
|
1894 |
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
|
1895 |
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
|
1896 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1897 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1898 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1899 |
"/ 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
|
1900 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1901 |
"/ 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
|
1902 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1903 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1904 |
wasBlocked := OperatingSystem blockInterrupts. |
863
2c83fe958ca7
change dependencies uninterruptably
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
1905 |
[ |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1906 |
|deps| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1907 |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1908 |
deps := self nonWeakDependents. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1909 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1910 |
"/ to save a fair amount of memory in case of |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1911 |
"/ many dependencies, we store a single dependent in |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1912 |
"/ an Array, and switch to a Set if more dependents are |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1913 |
"/ added. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1914 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1915 |
deps isNil ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1916 |
self nonWeakDependents:(Array with:anObject) |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1917 |
] ifFalse:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1918 |
deps class == Array ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1919 |
self nonWeakDependents:(IdentitySet with:(deps at:1) with:anObject) |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1920 |
] ifFalse:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1921 |
deps add:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1922 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1923 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1924 |
] valueNowOrOnUnwindDo:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1925 |
wasBlocked ifFalse:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1926 |
OperatingSystem unblockInterrupts |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1927 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1928 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1929 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1930 |
"Created: 19.4.1996 / 10:54:08 / cg" |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1931 |
"Modified: 19.7.1996 / 12:41:44 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1932 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1933 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1934 |
nonWeakDependents |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1935 |
"return a Collection of nonWeakDependents - nil if there is none. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1936 |
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
|
1937 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1938 |
NonWeakDependencies isNil ifTrue:[^nil]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1939 |
^ NonWeakDependencies at:self ifAbsent:[nil] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1940 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1941 |
"Created: 19.4.1996 / 10:55:06 / cg" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1942 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1943 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1944 |
nonWeakDependents:aCollection |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1945 |
"set the collection of nonWeak dependents. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1946 |
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
|
1947 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1948 |
[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1949 |
(aCollection isNil or:[aCollection isEmpty]) ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1950 |
NonWeakDependencies removeKey:self ifAbsent:[] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1951 |
] ifFalse:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1952 |
NonWeakDependencies at:self put:aCollection |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1953 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1954 |
] valueUninterruptably |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1955 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1956 |
"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
|
1957 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1958 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1959 |
removeNonWeakDependent:anObject |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1960 |
"remove a nonWeak dependency from the receiver to the argument, anObject. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
1961 |
(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
|
1962 |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1963 |
|wasBlocked| |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1964 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1965 |
"/ 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
|
1966 |
"/ is possibly accessed from multiple threads. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1967 |
"/ 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
|
1968 |
"/ faster execution. |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1969 |
|
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1970 |
wasBlocked := OperatingSystem blockInterrupts. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1971 |
[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1972 |
|deps n| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1973 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1974 |
deps := self nonWeakDependents. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1975 |
deps notNil ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1976 |
deps class == Array ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1977 |
(deps at:1) == anObject ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1978 |
self nonWeakDependents:nil |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1979 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1980 |
] ifFalse:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1981 |
deps remove:anObject ifAbsent:[]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1982 |
(n := deps size) == 0 ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1983 |
self nonWeakDependents:nil |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1984 |
] ifFalse:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1985 |
n == 1 ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1986 |
self nonWeakDependents:(Array with:(deps first)) |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1987 |
] |
1098
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1988 |
] |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1989 |
] |
e8543399e2a0
support aspect-specific interests
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1990 |
] |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1991 |
] valueNowOrOnUnwindDo:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1992 |
wasBlocked ifFalse:[ |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1993 |
OperatingSystem unblockInterrupts |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1994 |
] |
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1995 |
] |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1996 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
1997 |
"Created: 19.4.1996 / 11:44:44 / cg" |
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
1998 |
"Modified: 19.7.1996 / 12:42:08 / cg" |
783 | 1999 |
! ! |
2000 |
||
2001 |
!Object methodsFor:'error handling'! |
|
2002 |
||
2003 |
appropriateDebugger:aSelector |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2004 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2005 |
|
783 | 2006 |
"return an appropriate debugger to use. |
2007 |
If there is already a debugger active on the stack, and it is |
|
2008 |
the DebugView, return MiniDebugger (as a last chance) otherwise abort." |
|
2009 |
||
2010 |
|context| |
|
2011 |
||
2012 |
context := thisContext. |
|
2013 |
context := context sender. |
|
2014 |
[context notNil] whileTrue:[ |
|
2015 |
((context receiver class == Debugger) |
|
2016 |
and:[context selector == aSelector]) ifTrue:[ |
|
2017 |
"we are already in some Debugger" |
|
2018 |
(Debugger == MiniDebugger) ifTrue:[ |
|
2019 |
"we are already in the MiniDebugger" |
|
2020 |
ErrorRecursion ifFalse:[ |
|
2021 |
Smalltalk fatalAbort:'recursive error ...' |
|
2022 |
] |
|
2023 |
]. |
|
2024 |
MiniDebugger isNil ifTrue:[ |
|
2025 |
Smalltalk fatalAbort:'no debugger' |
|
2026 |
]. |
|
2027 |
||
2028 |
"ok, an error occured while in the graphical debugger; |
|
2029 |
lets try MiniDebugger" |
|
2030 |
^ MiniDebugger |
|
2031 |
]. |
|
2032 |
context := context sender |
|
71 | 2033 |
]. |
783 | 2034 |
"not within Debugger - no problem" |
2035 |
^ Debugger |
|
2036 |
! |
|
2037 |
||
2038 |
doesNotUnderstand:aMessage |
|
2039 |
"this message is sent by the runtime system (VM) when |
|
2040 |
a message is not understood by some object (i.e. there |
|
2041 |
is no method for that selector). The original message has |
|
2042 |
been packed into aMessage (i.e. the receiver, selector and |
|
2043 |
any arguments) and the original receiver is then sent the |
|
2044 |
#doesNotUnderstand: message. |
|
2045 |
Here, we raise another signal which usually enters the debugger. |
|
2046 |
You can of course redefine #doesNotUnderstand: in your classes |
|
1327 | 2047 |
to implement message delegation, |
2048 |
or handle the MessageNotUnderstoodSignal gracefully." |
|
783 | 2049 |
|
2050 |
|sel errorString cls sender| |
|
2051 |
||
2052 |
"/ handle the case of an error during early startup |
|
2053 |
"/ (output streams not yet initialized) |
|
2054 |
"/ |
|
2055 |
Stdout isNil ifTrue:[ |
|
1327 | 2056 |
Smalltalk fatalAbort:'error during init: ' , aMessage selector , ' not understood'. |
783 | 2057 |
]. |
2058 |
||
2059 |
(sel := aMessage selector) isNil ifTrue:[ |
|
1327 | 2060 |
"/ |
2061 |
"/ happens when things go mad, or a method has been |
|
2062 |
"/ called by valueWithReceiver: with a wrong receiver. |
|
2063 |
"/ To avoid later trouble (when concatenating strings), |
|
2064 |
"/ replace the selector by some (nonNil) string |
|
2065 |
"/ |
|
2066 |
sel := '(nil)' |
|
783 | 2067 |
]. |
2068 |
||
2069 |
"/ |
|
2070 |
"/ extract the class that should have implemented the message. |
|
2071 |
"/ (in case of a super-send, this is not the receivers class) |
|
2072 |
"/ |
|
2073 |
sender := thisContext sender. |
|
2074 |
cls := sender searchClass. |
|
2075 |
cls isNil ifTrue:[ |
|
1327 | 2076 |
"it was NOT a super or directed send ..." |
2077 |
cls := self class |
|
783 | 2078 |
]. |
2079 |
||
2080 |
cls notNil ifTrue:[ |
|
1327 | 2081 |
"/ |
2082 |
"/ displayString is better than 'cls name', |
|
2083 |
"/ since it appends (obsolete) for outdated classes. |
|
2084 |
"/ (this happens if you send messages to old instances |
|
2085 |
"/ after changing a classes definition) |
|
2086 |
"/ |
|
2087 |
errorString := cls displayString. |
|
783 | 2088 |
] ifFalse:[ |
1327 | 2089 |
errorString := '(** nil-class **)' |
783 | 2090 |
]. |
2091 |
errorString := errorString , ' does not understand: ' , sel. |
|
2092 |
||
2093 |
"/ |
|
2094 |
"/ this only happens, when YOU play around with my classvars ... |
|
1327 | 2095 |
"/ (or an error occurs during very early startup, when signals are not yet set) |
783 | 2096 |
"/ |
2097 |
MessageNotUnderstoodSignal isNil ifTrue:[ |
|
1327 | 2098 |
^ self enterDebuggerWith:nil |
2099 |
message:'oops - MessageNotUnderstoodSignal is gone'. |
|
783 | 2100 |
]. |
2101 |
||
2102 |
"/ |
|
2103 |
"/ thats where we end up normally - raise a signal which (if unhandled) opens a debugger |
|
2104 |
"/ |
|
2105 |
^ MessageNotUnderstoodSignal |
|
1327 | 2106 |
raiseRequestWith:aMessage |
2107 |
errorString:errorString |
|
2108 |
in:sender |
|
2109 |
||
2110 |
"Modified: 3.5.1996 / 11:51:45 / cg" |
|
783 | 2111 |
! |
2112 |
||
2113 |
elementBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2114 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2115 |
|
1345 | 2116 |
"report an error that badElement is out of bounds |
2117 |
(i.e. cannot be put into that collection). |
|
2118 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 2119 |
|
2120 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 2121 |
|
2122 |
"Modified: 8.5.1996 / 09:12:45 / cg" |
|
783 | 2123 |
! |
2124 |
||
2125 |
elementNotCharacter |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2126 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2127 |
|
1345 | 2128 |
"report an error that object to be stored is no Character. |
2129 |
(usually when storing into Strings). |
|
2130 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 2131 |
|
2132 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 2133 |
|
2134 |
"Modified: 8.5.1996 / 09:12:49 / cg" |
|
783 | 2135 |
! |
2136 |
||
2137 |
elementNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2138 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2139 |
|
1345 | 2140 |
"report an error that object to be stored is not Integer. |
2141 |
(in collections that store integers only). |
|
2142 |
The error is reported by raising the ElementOutOfBoundsSignal exception." |
|
783 | 2143 |
|
2144 |
^ ElementOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 2145 |
|
2146 |
"Modified: 8.5.1996 / 09:12:51 / cg" |
|
783 | 2147 |
! |
2148 |
||
2149 |
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
|
2150 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2151 |
|
783 | 2152 |
"enter the debugger with error-message aString" |
2153 |
||
2154 |
^ self enterDebuggerWith:anException |
|
2155 |
message:aString |
|
2156 |
on:anException suspendedContext |
|
2157 |
! |
|
2158 |
||
2159 |
enterDebuggerWith:anException message: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
|
2160 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2161 |
|
783 | 2162 |
"enter the debugger with error-message aString. |
2163 |
The first visible context shown there is aContext |
|
2164 |
(this allows intermediate helpers to hide themselfes from what is |
|
2165 |
presented to the user)" |
|
2166 |
||
1094
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2167 |
|debugger msg| |
71 | 2168 |
|
2169 |
" |
|
783 | 2170 |
if there is no debugger, exit smalltalk |
2171 |
" |
|
2172 |
Debugger isNil ifTrue:[ |
|
1094
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2173 |
msg := 'error: ' , aString. |
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2174 |
|
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2175 |
Smalltalk isStandAloneApp ifTrue:[ |
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2176 |
Dialog notNil ifTrue:[ |
1097 | 2177 |
(Dialog |
2178 |
confirm:msg title:(Smalltalk commandName) |
|
2179 |
yesLabel:'ignore' noLabel:'exit' |
|
2180 |
) ifTrue:[ |
|
1095 | 2181 |
^ AbortSignal raise |
1094
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2182 |
] |
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2183 |
]. |
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2184 |
msg errorPrintNL. |
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2185 |
OperatingSystem exit:1 |
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2186 |
]. |
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2187 |
msg errorPrintNL. |
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2188 |
Smalltalk fatalAbort:'no Debugger defined' |
783 | 2189 |
]. |
983 | 2190 |
|
783 | 2191 |
" |
2192 |
find an appropriate debugger to use |
|
71 | 2193 |
" |
783 | 2194 |
debugger := self appropriateDebugger:#'enter:withMessage:'. |
2195 |
^ 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
|
2196 |
|
af10927dc0f2
standAlone graphical app gives user a chance to ignore errors
Claus Gittinger <cg@exept.de>
parents:
1089
diff
changeset
|
2197 |
"Modified: 8.3.1996 / 20:40:48 / cg" |
783 | 2198 |
! |
2199 |
||
2200 |
error |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2201 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2202 |
|
1345 | 2203 |
"report error that an error occured. |
2204 |
The error is reported by raising the ErrorSignal exception." |
|
2205 |
||
2206 |
^ ErrorSignal raiseIn:thisContext sender |
|
2207 |
||
2208 |
"Modified: 8.5.1996 / 09:13:01 / cg" |
|
783 | 2209 |
! |
2210 |
||
2211 |
error:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2212 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2213 |
|
1345 | 2214 |
"enter debugger with error-message aString. |
2215 |
The error is reported by raising the ErrorSignal exception." |
|
783 | 2216 |
|
2217 |
^ ErrorSignal raiseRequestWith:#error: |
|
1345 | 2218 |
errorString:aString |
2219 |
in:thisContext sender |
|
2220 |
||
2221 |
"Modified: 8.5.1996 / 09:13:04 / cg" |
|
2222 |
! |
|
2223 |
||
2224 |
error:aString in:aContext |
|
2225 |
"{ Pragma: +optSpace }" |
|
2226 |
||
2227 |
"enter debugger with error-message aString. |
|
2228 |
The error is reported by raising the ErrorSignal exception." |
|
2229 |
||
2230 |
^ ErrorSignal raiseRequestWith:#error: |
|
2231 |
errorString:aString |
|
2232 |
in:aContext |
|
2233 |
||
2234 |
"Created: 8.5.1996 / 09:07:59 / cg" |
|
2235 |
"Modified: 8.5.1996 / 09:13:06 / cg" |
|
783 | 2236 |
! |
2237 |
||
2238 |
errorKeyNotFound:aKey |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2239 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2240 |
|
1345 | 2241 |
"report an error that a key was not found in a collection. |
2242 |
The error is reported by raising the KeyNotFoundSignal exception." |
|
783 | 2243 |
|
2244 |
^ KeyNotFoundSignal raiseRequestWith:aKey in:thisContext sender |
|
1345 | 2245 |
|
2246 |
"Modified: 8.5.1996 / 09:13:08 / cg" |
|
783 | 2247 |
! |
2248 |
||
2249 |
errorNotFound |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2250 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2251 |
|
1345 | 2252 |
"report an error that no element was found in a collection. |
2253 |
The error is reported by raising the NotFoundSignal exception." |
|
783 | 2254 |
|
2255 |
^ NotFoundSignal raiseIn:thisContext sender |
|
1345 | 2256 |
|
2257 |
"Modified: 8.5.1996 / 09:13:11 / cg" |
|
783 | 2258 |
! |
2259 |
||
2260 |
halt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2261 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2262 |
|
1345 | 2263 |
"enter debugger with halt-message. |
2264 |
The error is reported by raising the HaltSignal exception." |
|
783 | 2265 |
|
2266 |
^ HaltSignal raiseIn:thisContext sender. |
|
1345 | 2267 |
|
2268 |
"Modified: 8.5.1996 / 09:12:38 / cg" |
|
783 | 2269 |
! |
2270 |
||
2271 |
halt:aString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2272 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2273 |
|
1345 | 2274 |
"enter debugger with halt-message. |
2275 |
The error is reported by raising the HaltSignal exception." |
|
783 | 2276 |
|
2277 |
^ HaltSignal raiseRequestWith:#halt: |
|
1345 | 2278 |
errorString:aString |
2279 |
in:thisContext sender |
|
2280 |
||
2281 |
"Modified: 8.5.1996 / 09:13:23 / cg" |
|
783 | 2282 |
! |
2283 |
||
2284 |
implementedBySubclass |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2285 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2286 |
|
783 | 2287 |
"this is sent by ST/V code - its the same as #subclassResponsibility" |
2288 |
||
2289 |
^ self subclassResponsibility |
|
2290 |
! |
|
2291 |
||
2292 |
indexNotInteger |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2293 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2294 |
|
1345 | 2295 |
"report an error that index is not an Integer. |
2296 |
(when accessing collections indexed by an integer key). |
|
2297 |
The error is reported by raising the NonIntegerIndexSignal exception." |
|
783 | 2298 |
|
2299 |
^ NonIntegerIndexSignal raiseIn:thisContext sender |
|
1345 | 2300 |
|
2301 |
"Modified: 8.5.1996 / 09:13:37 / cg" |
|
783 | 2302 |
! |
2303 |
||
2304 |
integerCheckError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2305 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2306 |
|
783 | 2307 |
"generated when a variable declared with an integer type gets a bad |
2308 |
value assigned" |
|
2309 |
||
2310 |
^ self error:'bad assign of ' , self printString , |
|
2311 |
' (' , self class name , ') to integer-typed variable' |
|
71 | 2312 |
! |
2313 |
||
783 | 2314 |
invalidMessage |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2315 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2316 |
|
783 | 2317 |
"this is sent by ST/V code - its the same as #shouldNotImplement" |
2318 |
||
2319 |
^ self shouldNotImplement |
|
2320 |
! |
|
2321 |
||
2322 |
mustBeRectangle |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2323 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2324 |
|
783 | 2325 |
"report an argument-not-rectangle-error" |
2326 |
||
2327 |
^ self error:'argument must be a Rectangle' |
|
2328 |
! |
|
2329 |
||
2330 |
mustBeString |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2331 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2332 |
|
783 | 2333 |
"report an argument-not-string-error" |
2334 |
||
2335 |
^ self error:'argument must be a String' |
|
2336 |
! |
|
2337 |
||
2338 |
notIndexed |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2339 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2340 |
|
1345 | 2341 |
"report an error that receiver has no indexed instance variables" |
783 | 2342 |
|
2343 |
^ self error:'receiver has no indexed variables' |
|
1345 | 2344 |
|
2345 |
"Modified: 8.5.1996 / 09:09:56 / cg" |
|
783 | 2346 |
! |
2347 |
||
2348 |
primitiveFailed |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2349 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2350 |
|
1345 | 2351 |
"report an error that some primitive code failed. |
2352 |
The error is reported by raising the PrimitiveFailureSignal exception." |
|
783 | 2353 |
|
2354 |
^ PrimitiveFailureSignal raiseIn:(thisContext sender) |
|
1345 | 2355 |
|
2356 |
"Modified: 8.5.1996 / 09:14:07 / cg" |
|
783 | 2357 |
! |
2358 |
||
2359 |
shouldNotImplement |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2360 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2361 |
|
1345 | 2362 |
"report an error that this message should not be implemented" |
783 | 2363 |
|
2364 |
^ self error:'method not appropriate for this class' |
|
1345 | 2365 |
|
2366 |
"Modified: 8.5.1996 / 09:09:44 / cg" |
|
783 | 2367 |
! |
2368 |
||
2369 |
subclassResponsibility |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2370 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2371 |
|
1345 | 2372 |
"report an error that this message should have been reimplemented in a |
783 | 2373 |
subclass" |
2374 |
||
1345 | 2375 |
^ self error:'method must be reimplemented in subclass' in:thisContext sender |
2376 |
||
2377 |
"Modified: 8.5.1996 / 09:09:26 / cg" |
|
783 | 2378 |
! |
2379 |
||
2380 |
subscriptBoundsError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2381 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2382 |
|
1345 | 2383 |
"report an error that some index is out of bounds. |
2384 |
(when accessing indexable collections). |
|
2385 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 2386 |
|
2387 |
^ SubscriptOutOfBoundsSignal raiseIn:thisContext sender |
|
1345 | 2388 |
|
2389 |
"Modified: 8.5.1996 / 09:14:26 / cg" |
|
783 | 2390 |
! |
2391 |
||
2392 |
subscriptBoundsError:anIndex |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2393 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2394 |
|
1345 | 2395 |
"report an error that anIndex is out of bounds. |
2396 |
(when accessing indexable collections). |
|
2397 |
The error is reported by raising the SubscriptOutOfBoundsSignal exception." |
|
783 | 2398 |
|
1021
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
2399 |
^ SubscriptOutOfBoundsSignal |
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
2400 |
raiseRequestWith:anIndex |
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
2401 |
errorString:('subscript (' , anIndex printString , ') out of bounds') |
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
2402 |
in:thisContext sender |
b0c7f4a235fb
show bad index in subscriptBoundsError
Claus Gittinger <cg@exept.de>
parents:
985
diff
changeset
|
2403 |
|
1345 | 2404 |
"Modified: 8.5.1996 / 09:14:34 / cg" |
783 | 2405 |
! |
2406 |
||
2407 |
typeCheckError |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2408 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2409 |
|
783 | 2410 |
"generated when a variable declared with a type hint gets a bad |
2411 |
value assigned" |
|
2412 |
||
2413 |
^ self error:'bad assign of ' , self printString , |
|
2414 |
' (' , self class name , ') to typed variable' |
|
2415 |
! ! |
|
2416 |
||
2417 |
!Object methodsFor:'evaluation'! |
|
2418 |
||
2419 |
value |
|
1327 | 2420 |
"return the receiver itself. |
2421 |
This allows every object to be used where blocks or valueHolders |
|
2422 |
are typically used, and allows for valueHolders and blocks to be |
|
2423 |
used interchangably in some situations. |
|
2424 |
||
783 | 2425 |
Time will show, if this is a good idea or leads to sloppy programming |
2426 |
style ... (the idea was borrowed from the Self language). |
|
1327 | 2427 |
|
2428 |
WARNING: dont 'optimize' away ifXXX: blocks |
|
2429 |
(i.e. do NOT replace |
|
2430 |
foo ifTrue:[var1] ifFalse:[var2] |
|
2431 |
by: |
|
2432 |
foo ifTrue:var1 ifFalse:var2 |
|
2433 |
) |
|
2434 |
- the compilers will only generate inline code for the if, |
|
2435 |
iff the argument(s) are blocks - otherwise, a true send is |
|
2436 |
generated. |
|
2437 |
This 'oprimization' will work semantically correct, |
|
2438 |
but execute SLOWER instead." |
|
783 | 2439 |
|
2440 |
^ self |
|
71 | 2441 |
|
2442 |
" |
|
1327 | 2443 |
#(1 2 3 4) indexOf:5 ifAbsent:0 |
2444 |
#(1 2 3 4) indexOf:5 ifAbsent:[0] |
|
2445 |
1 > 2 ifTrue:['yes'] ifFalse:['no'] |
|
2446 |
1 > 2 ifTrue:'yes' ifFalse:'no' |
|
783 | 2447 |
" |
2448 |
||
2449 |
"DO NOT DO THIS (its slower) |
|
2450 |
(1 > 4) ifTrue:'oops' ifFalse:'ok' |
|
2451 |
||
2452 |
USE (the compiler optimizes blocks in if/while): |
|
2453 |
(1 > 4) ifTrue:['oops'] ifFalse:['ok'] |
|
2454 |
" |
|
1327 | 2455 |
|
2456 |
"Modified: 3.5.1996 / 11:57:08 / cg" |
|
783 | 2457 |
! ! |
2458 |
||
2459 |
!Object methodsFor:'initialization'! |
|
2460 |
||
2461 |
initialize |
|
2462 |
"just to ignore initialize to objects which do not need it" |
|
2463 |
||
2464 |
^ self |
|
2465 |
! ! |
|
2466 |
||
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2467 |
!Object methodsFor:'interrest'! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2468 |
|
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2469 |
addInterrest:anInterrest |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2470 |
"install an interrest forwarder. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2471 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2472 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2473 |
self addNonWeakDependent:anInterrest |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2474 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2475 |
"Created: 19.4.1996 / 12:33:47 / cg" |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2476 |
! |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2477 |
|
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2478 |
expressInterestIn:aspect for:anObject sendBack:aSelector |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2479 |
"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
|
2480 |
changes aspect." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2481 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2482 |
"/ 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
|
2483 |
"/ 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
|
2484 |
|
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2485 |
self addInterrest:(InterestConverter |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2486 |
destination:anObject |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2487 |
selector:aSelector |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2488 |
aspect:aspect) |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2489 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2490 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2491 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2492 |
|
1422 | 2493 |
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
|
2494 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2495 |
p := Point new. |
1422 | 2496 |
Transcript showCR:'interest in #foo:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2497 |
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
|
2498 |
p x:1. |
1422 | 2499 |
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
|
2500 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2501 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2502 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2503 |
Delay waitForSeconds:1. |
1422 | 2504 |
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
|
2505 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2506 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2507 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2508 |
Delay waitForSeconds:1. |
1422 | 2509 |
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
|
2510 |
p retractInterestIn:#foo for:b. |
1422 | 2511 |
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
|
2512 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2513 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2514 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2515 |
Delay waitForSeconds:1. |
1422 | 2516 |
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
|
2517 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 2518 |
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
|
2519 |
p changed:#foo. |
1422 | 2520 |
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
|
2521 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2522 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2523 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2524 |
Delay waitForSeconds:1. |
1422 | 2525 |
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
|
2526 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 2527 |
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
|
2528 |
p changed:#foo. |
1422 | 2529 |
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
|
2530 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2531 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2532 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2533 |
Delay waitForSeconds:1. |
1422 | 2534 |
Transcript showCR:'no more interests:'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2535 |
p retractInterestsFor:b. |
1422 | 2536 |
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
|
2537 |
p changed:#foo. |
1422 | 2538 |
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
|
2539 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2540 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2541 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2542 |
p release. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2543 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2544 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2545 |
"Created: 19.4.1996 / 10:26:22 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2546 |
"Modified: 19.4.1996 / 12:34:08 / cg" |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2547 |
! |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2548 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2549 |
interrests |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2550 |
"return a Collection of interrests - nil if there is none. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2551 |
Here, we use the nonWeakDependents for interrests." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2552 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2553 |
^ self nonWeakDependents |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2554 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2555 |
"Created: 19.4.1996 / 12:27:56 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2556 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2557 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2558 |
onChangeSend:aSelector to:anObject |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2559 |
"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
|
2560 |
changes." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2561 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2562 |
"/ 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
|
2563 |
"/ 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
|
2564 |
|
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2565 |
self addInterrest:(InterestConverter |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2566 |
destination:anObject |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2567 |
selector:aSelector) |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2568 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2569 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2570 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2571 |
|
1422 | 2572 |
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
|
2573 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2574 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2575 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2576 |
p x:1. |
1422 | 2577 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2578 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2579 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2580 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2581 |
Delay waitForSeconds:1. |
1422 | 2582 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2583 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2584 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2585 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2586 |
Delay waitForSeconds:1. |
1422 | 2587 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2588 |
p retractInterestsFor:b. |
1422 | 2589 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2590 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2591 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2592 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2593 |
Delay waitForSeconds:1. |
1422 | 2594 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2595 |
p onChangeSend:#value to:b. |
1422 | 2596 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2597 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2598 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2599 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2600 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2601 |
"Created: 19.4.1996 / 10:26:38 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2602 |
"Modified: 19.4.1996 / 12:34:26 / cg" |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2603 |
! |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2604 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2605 |
removeInterrest:anInterrest |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2606 |
"remove an interrest forwarder. |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2607 |
Here, we use the nonWeakDependencies." |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2608 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2609 |
self removeNonWeakDependent:anInterrest |
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2610 |
|
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2611 |
"Created: 19.4.1996 / 12:35:01 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2612 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2613 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2614 |
retractInterestIn:aspect for:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2615 |
"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
|
2616 |
(as installed with #expressInterestIn:for:sendBack:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2617 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2618 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2619 |
"/ 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
|
2620 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2621 |
|deps| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2622 |
|
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2623 |
deps := self interrests. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2624 |
deps notNil ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2625 |
deps do:[:dep | |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2626 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2627 |
dep destination == someOne ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2628 |
dep aspect == aspect ifTrue:[ |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2629 |
self removeInterrest:dep. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2630 |
^ self |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2631 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2632 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2633 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2634 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2635 |
]. |
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 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2638 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2639 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2640 |
|
1422 | 2641 |
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
|
2642 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2643 |
p := Point new. |
1422 | 2644 |
Transcript showCR:'interest in #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2645 |
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
|
2646 |
p x:1. |
1422 | 2647 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2648 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2649 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2650 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2651 |
Delay waitForSeconds:1. |
1422 | 2652 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2653 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2654 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2655 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2656 |
Delay waitForSeconds:1. |
1422 | 2657 |
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
|
2658 |
p retractInterestIn:#foo for:b. |
1422 | 2659 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2660 |
p changed:#foo. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2661 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2662 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2663 |
Delay waitForSeconds:1. |
1422 | 2664 |
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
|
2665 |
p expressInterestIn:#bar for:b sendBack:#value. |
1422 | 2666 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2667 |
p changed:#foo. |
1422 | 2668 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2669 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2670 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2671 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2672 |
Delay waitForSeconds:1. |
1422 | 2673 |
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
|
2674 |
p expressInterestIn:#foo for:b sendBack:#value. |
1422 | 2675 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2676 |
p changed:#foo. |
1422 | 2677 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2678 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2679 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2680 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2681 |
Delay waitForSeconds:1. |
1422 | 2682 |
Transcript showCR:'no more interests'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2683 |
p retractInterestsFor:b. |
1422 | 2684 |
Transcript showCR:'now changing #foo'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2685 |
p changed:#foo. |
1422 | 2686 |
Transcript showCR:'now changing #bar'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2687 |
p changed:#bar. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2688 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2689 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2690 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2691 |
"Created: 19.4.1996 / 10:27:11 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2692 |
"Modified: 19.4.1996 / 12:29:52 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2693 |
! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2694 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2695 |
retractInterestsFor:someOne |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2696 |
"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
|
2697 |
(as installed with #onChangeSend:to:)." |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2698 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2699 |
"/ for now, remove the interestConverter. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2700 |
"/ 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
|
2701 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2702 |
|coll deps| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2703 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2704 |
"/ 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
|
2705 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2706 |
coll := IdentitySet new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2707 |
|
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2708 |
deps := self interrests. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2709 |
deps notNil ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2710 |
deps do:[:dep | |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2711 |
(dep isMemberOf:InterestConverter) ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2712 |
dep destination == someOne ifTrue:[ |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2713 |
coll add:dep. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2714 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2715 |
] |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2716 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2717 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2718 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2719 |
coll do:[:dep | |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2720 |
self removeInterrest:dep. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2721 |
]. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2722 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2723 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2724 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2725 |
|p b| |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2726 |
|
1422 | 2727 |
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
|
2728 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2729 |
p := Point new. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2730 |
p onChangeSend:#value to:b. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2731 |
p x:1. |
1422 | 2732 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2733 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2734 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2735 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2736 |
Delay waitForSeconds:1. |
1422 | 2737 |
Transcript showCR:'now changing'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2738 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2739 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2740 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2741 |
Delay waitForSeconds:1. |
1422 | 2742 |
Transcript showCR:'no more interest'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2743 |
p retractInterestsFor:b. |
1422 | 2744 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2745 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2746 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2747 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2748 |
Delay waitForSeconds:1. |
1422 | 2749 |
Transcript showCR:'interest again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2750 |
p onChangeSend:#value to:b. |
1422 | 2751 |
Transcript showCR:'now changing again'. |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2752 |
p changed. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2753 |
Transcript cr. |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2754 |
" |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2755 |
|
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2756 |
"Created: 19.4.1996 / 10:23:46 / cg" |
1231
4f457f654e57
interrests slightly rewritten
Claus Gittinger <cg@exept.de>
parents:
1217
diff
changeset
|
2757 |
"Modified: 19.4.1996 / 12:30:03 / cg" |
1217
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2758 |
! ! |
4f7099eb007c
separated dependencies into weak-ones and nonWeak ones
Claus Gittinger <cg@exept.de>
parents:
1133
diff
changeset
|
2759 |
|
783 | 2760 |
!Object methodsFor:'interrupt handling'! |
2761 |
||
2762 |
childSignalInterrupt |
|
2763 |
"death of a child process (unix process) - do nothing" |
|
2764 |
||
2765 |
^ self |
|
2766 |
! |
|
2767 |
||
2768 |
customInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2769 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2770 |
|
783 | 2771 |
"a custom interrupt" |
2772 |
||
2773 |
^ self error:'custom interrupt' |
|
2774 |
! |
|
2775 |
||
2776 |
errorInterrupt:errorID with:aParameter |
|
2777 |
"subsystem error. The arguments errorID and aParameter are the values passed |
|
2778 |
to the 'errorInterruptWithIDAndParameter(id, param)' function, |
|
2779 |
which can be called from C subsystems to raise an (asynchronous) |
|
2780 |
error exception. |
|
2781 |
||
2782 |
Currently, this is used to map XErrors to smalltalk errors, but can be |
|
2783 |
used from other C subsystems too, to upcast errors. |
|
2784 |
Especially, for subsystems which call errorHandler functions asynchronously. |
|
2785 |
IDs (currently) used: |
|
2786 |
#DisplayError ..... x-error interrupt |
|
2787 |
#XtError ..... xt-error interrupt (Xt interface is not yet published) |
|
71 | 2788 |
" |
783 | 2789 |
|
2790 |
|handler| |
|
2791 |
||
2792 |
handler := ObjectMemory registeredErrorInterruptHandlers at:errorID ifAbsent:nil. |
|
2793 |
handler notNil ifTrue:[ |
|
2794 |
"/ |
|
2795 |
"/ handler found; let it do whatever it wants ... |
|
2796 |
"/ |
|
2797 |
handler errorInterrupt:errorID with:aParameter. |
|
2798 |
^ self |
|
2799 |
]. |
|
2800 |
||
2801 |
"/ |
|
2802 |
"/ no handler - raise errorSignal passing the errorId as parameter |
|
2803 |
"/ |
|
2804 |
^ ErrorSignal |
|
2805 |
raiseRequestWith:errorID |
|
2806 |
errorString:('Subsystem error. ErrorID = ' , errorID printString) |
|
2807 |
! |
|
2808 |
||
2809 |
exceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2810 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2811 |
|
783 | 2812 |
"exception interrupt - enter debugger" |
2813 |
||
2814 |
self error:'exception Interrupt' |
|
2815 |
! |
|
2816 |
||
2817 |
fpExceptionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2818 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2819 |
|
783 | 2820 |
"a floating point exception occured - this one |
2821 |
has to be handled differently since it comes asynchronous |
|
2822 |
on some machines (for example, on machines with a separate FPU |
|
2823 |
or superscalar architectures. Also, errors from within primitive code |
|
2824 |
(or library functions such as GL) are sent via the Unix-signal |
|
2825 |
mechanism this way." |
|
2826 |
||
2827 |
^ Float domainErrorSignal raise |
|
2828 |
! |
|
2829 |
||
2830 |
internalError:msg |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2831 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2832 |
|
783 | 2833 |
"this is triggered, when system hits some bad error, |
2834 |
such as corrupted class, corrupted method/selector array |
|
2835 |
etc. The argument string gives some more information on what happened. |
|
2836 |
(for example, if you set an objects class to a smallInteger, nil etc). |
|
2837 |
Its not guaranteed, that the system is in a working condition once |
|
2838 |
this error occurred ...." |
|
2839 |
||
2840 |
^ self error:msg |
|
2841 |
! |
|
2842 |
||
2843 |
ioInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2844 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2845 |
|
783 | 2846 |
"I/O (SIGIO/SIGPOLL) interrupt (supposed to be sent to Processor). |
2847 |
If we arrive here, there is either no handler (ObjMem>>ioInterruptHandler) |
|
2848 |
or it does not understand the ioInterrupt message. |
|
2849 |
In any case, this is a sign of some big trouble. Enter debugger." |
|
2850 |
||
2851 |
self error:'I/O Interrupt - but no handler' |
|
2852 |
! |
|
2853 |
||
2854 |
memoryInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2855 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2856 |
|
783 | 2857 |
"out-of-memory interrupt and no handler - enter debugger" |
2858 |
||
2859 |
^ self error:'almost out of memory' |
|
2860 |
! |
|
2861 |
||
2862 |
recursionInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2863 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2864 |
|
783 | 2865 |
"recursion limit (actually: stack overflow) interrupt. |
2866 |
This interrupt is triggered, when a process stack grows above |
|
2867 |
its stackLimit - usually, this leads into the debugger, but |
|
2868 |
could be cought and the stackLimit increased in the handler. |
|
2869 |
At the time we arrive here, the system has still some stack |
|
2870 |
as a reserve so we can continue to do some useful work or cleanup or |
|
2871 |
debugging for a while. |
|
2872 |
If the signal is ignored, and the stack continues to grow, there |
|
2873 |
will be a few more chances (and more interrupts) before the VM |
|
2874 |
hard-terminates the process." |
|
2875 |
||
2876 |
thisContext isRecursive ifFalse:[ |
|
2877 |
^ RecursionInterruptSignal raise |
|
2878 |
] |
|
2879 |
! |
|
2880 |
||
2881 |
schedulerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2882 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2883 |
|
783 | 2884 |
"scheduler interrupt (supposed to be sent to Processor). |
2885 |
If we arrive here, either the Processor does not understand it, |
|
2886 |
or it has been set to nil. In any case, this is a sign of some |
|
2887 |
big trouble. Enter debugger." |
|
2888 |
||
2889 |
self error:'schedulerInterrupt - but no Processor' |
|
2890 |
! |
|
2891 |
||
2892 |
signalInterrupt:signalNumber |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2893 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
2894 |
|
783 | 2895 |
"unix signal occured - some signals are handled as Smalltalk Exceptions |
2896 |
(SIGPIPE), others (SIGBUS) are rather fatal ... |
|
2897 |
In any case, if a smalltalk-signal has been connected to the OS signal, |
|
2898 |
that one is raised. |
|
2899 |
TODO: add another argument, giving more detailed signal info (PC, VADDR, |
|
2900 |
exact cause etc.). This helps if segvs occur in primitive code. |
|
2901 |
Currently (temporary kludge), these are passed as global variables." |
|
2902 |
||
2903 |
|box name here sig ignorable titles actions badContext msg pc addr| |
|
2904 |
||
2905 |
" |
|
2906 |
special case - since SIGPIPE has an ST-signal associated |
|
2907 |
" |
|
2908 |
(signalNumber == 13) ifTrue:[ |
|
2909 |
"SIGPIPE - write on a pipe with no one to read" |
|
2910 |
||
2911 |
^ PipeStream brokenPipeSignal raise. |
|
2912 |
]. |
|
2913 |
||
2914 |
"if there has been an ST-signal installed, use it ..." |
|
2915 |
||
2916 |
sig := OperatingSystem operatingSystemSignal:signalNumber. |
|
2917 |
sig notNil ifTrue:[ |
|
2918 |
^ sig raise |
|
2919 |
]. |
|
2920 |
||
2921 |
" |
|
2922 |
... otherwise , bring up a box asking for what to do ... |
|
2923 |
" |
|
2924 |
name := OperatingSystem nameForSignal:signalNumber. |
|
2925 |
here := thisContext. |
|
2926 |
||
2927 |
" |
|
2928 |
the context, in which the signal occurred: |
|
2929 |
" |
|
2930 |
badContext := here sender. |
|
2931 |
||
2932 |
" |
|
2933 |
ungrab - in case it happened in a box/popupview |
|
2934 |
otherwise display stays locked |
|
2935 |
" |
|
2936 |
Display notNil ifTrue:[ |
|
2937 |
Display ungrabPointer. |
|
2938 |
]. |
|
2939 |
||
2940 |
" |
|
2941 |
SIGBUS, SIGSEGV and SIGILL do not make sense to ignore (i.e. continue) |
|
2942 |
since the system will retry the faulty instruction, which leads to |
|
2943 |
another signal - to avoid frustration, better not offer this option. |
|
2944 |
" |
|
2945 |
ignorable := (signalNumber ~~ OperatingSystem sigBUS) |
|
2946 |
and:[signalNumber ~~ OperatingSystem sigILL |
|
2947 |
and:[signalNumber ~~ OperatingSystem sigSEGV]]. |
|
2948 |
||
2949 |
ignorable ifFalse:[ |
|
2950 |
here isRecursive ifTrue:[ |
|
2951 |
'fatal: signal ' errorPrint. signalNumber errorPrintNL. |
|
2952 |
MiniDebugger enterWithMessage:'recursive signal'. |
|
2953 |
^ self |
|
2954 |
]. |
|
2955 |
" |
|
2956 |
a hard signal - go into debugger immediately |
|
2957 |
" |
|
2958 |
msg := 'Signal ', name. |
|
2959 |
InterruptPcLow notNil ifTrue:[ |
|
2960 |
pc := InterruptPcLow + (InterruptPcHi bitShift:16). |
|
2961 |
pc ~~ 0 ifTrue:[ |
|
2962 |
msg := msg , ' PC=' , (pc printStringRadix:16) |
|
2963 |
]. |
|
2964 |
]. |
|
2965 |
InterruptAddrLow notNil ifTrue:[ |
|
2966 |
addr := InterruptAddrLow + (InterruptAddrHi bitShift:16). |
|
2967 |
addr ~~ 0 ifTrue:[ |
|
2968 |
msg := msg , ' ADDR=' , (addr printStringRadix:16) |
|
2969 |
]. |
|
2970 |
]. |
|
2971 |
Debugger enter:here withMessage:msg. |
|
2972 |
badContext return. |
|
2973 |
^ nil. |
|
2974 |
]. |
|
2975 |
||
2976 |
OptionBox isNil ifTrue:[ |
|
2977 |
" |
|
2978 |
a system without GUI ... |
|
2979 |
go into minidebugger (if there is one) |
|
2980 |
" |
|
2981 |
MiniDebugger isNil ifTrue:[ |
|
2982 |
" |
|
2983 |
a system without debugging facilities |
|
2984 |
(i.e. a standalone system) |
|
2985 |
output a message and exit. |
|
2986 |
" |
|
2987 |
('exit due to Signal ' , name) errorPrintNL. |
|
2988 |
Smalltalk exit. |
|
2989 |
]. |
|
2990 |
MiniDebugger enterWithMessage:'Signal cought (' , name, ')'. |
|
2991 |
^ self |
|
2992 |
]. |
|
2993 |
||
2994 |
box := OptionBox |
|
2995 |
title:'Signal cought (' , name, ')' |
|
2996 |
numberOfOptions:(ignorable ifTrue:[5] ifFalse:[4]). |
|
2997 |
||
2998 |
titles := #('return' 'debug' 'dump' 'exit'). |
|
2999 |
actions := Array |
|
3000 |
with:[badContext return] |
|
3001 |
with:[Debugger enter:here withMessage:('Signal ', name). ^nil] |
|
3002 |
with:[Smalltalk fatalAbort] |
|
3003 |
with:[Smalltalk exit]. |
|
3004 |
||
3005 |
ignorable ifTrue:[ |
|
3006 |
titles := #('ignore') , titles. |
|
3007 |
actions := (Array with:[^ nil]) , actions. |
|
3008 |
]. |
|
3009 |
box buttonTitles:titles. |
|
3010 |
box actions:actions. |
|
3011 |
box showAtPointer |
|
3012 |
! |
|
3013 |
||
3014 |
spyInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3015 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3016 |
|
783 | 3017 |
"spy interrupt and no handler - enter debugger" |
3018 |
||
3019 |
self error:'spy Interrupt - but no handler' |
|
3020 |
! |
|
3021 |
||
3022 |
timerInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3023 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3024 |
|
783 | 3025 |
"timer interrupt and no handler - enter debugger" |
3026 |
||
3027 |
self error:'timer Interrupt - but no handler' |
|
3028 |
! |
|
3029 |
||
3030 |
userInterrupt |
|
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3031 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3032 |
|
783 | 3033 |
"user (^c) interrupt - enter debugger" |
3034 |
||
3035 |
UserInterruptSignal raise |
|
71 | 3036 |
! ! |
3037 |
||
1 | 3038 |
!Object methodsFor:'message sending'! |
3039 |
||
3040 |
perform:aSelector |
|
3041 |
"send the message aSelector to the receiver" |
|
3042 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3043 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3044 |
struct inlineCache *pIlc; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3045 |
static struct inlineCache ilc_0 = _DUMMYILC0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3046 |
static struct inlineCache ilc_1 = _DUMMYILC0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3047 |
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
|
3048 |
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
|
3049 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3050 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3051 |
if (aSelector != last_0) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3052 |
if (aSelector != last_1) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3053 |
if (flip) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3054 |
pIlc = &ilc_0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3055 |
flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3056 |
last_0 = aSelector; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3057 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3058 |
pIlc = &ilc_1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3059 |
flip = 1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3060 |
last_1 = aSelector; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3061 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3062 |
pIlc->ilc_func = __SEND0ADDR__; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3063 |
if (pIlc->ilc_poly) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3064 |
__flushPolyCache(pIlc->ilc_poly); |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3065 |
pIlc->ilc_poly = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3066 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3067 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3068 |
pIlc = &ilc_1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3069 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3070 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3071 |
pIlc = &ilc_0; |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3072 |
} |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3073 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, CON_COMMA nil, pIlc) ); |
1 | 3074 |
%} |
3075 |
! |
|
3076 |
||
783 | 3077 |
perform:aSelector inClass:aClass withArguments:argArray |
3078 |
"send the message aSelector with all args taken from argArray |
|
3079 |
to the receiver as a super-send message. |
|
3080 |
This is actually more flexible than the normal super-send, since it allows |
|
3081 |
to execute a method in ANY superclass of the receiver (not just the |
|
3082 |
immediate superclass). |
|
3083 |
Thus, it is (theoretically) possible to do |
|
3084 |
'5 perform:#< inClass:Magnitude withArguments:#(6)' |
|
3085 |
and evaluate Magnitudes compare method even if there was one in Number. |
|
3086 |
This method is used by the interpreter to evaluate super sends |
|
3087 |
and could be used for very special behavior (language extension ?). |
|
3088 |
||
3089 |
WARNING: this is an ST/X feature - probably not found in other smalltalks." |
|
3090 |
||
3091 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
|
3092 |
||
3093 |
" |
|
3094 |
check, if aClass is really a superclass of the receiver |
|
3095 |
" |
|
3096 |
(self class isSubclassOf:aClass) ifFalse:[ |
|
3097 |
self error:'class argument is not a superclass of the receiver'. |
|
3098 |
^ nil |
|
3099 |
]. |
|
3100 |
numberOfArgs := argArray size. |
|
3101 |
%{ |
|
3102 |
REGISTER OBJ *argP; |
|
3103 |
int nargs, i; |
|
3104 |
static struct inlineCache ilc0 = _DUMMYILC0; |
|
3105 |
static struct inlineCache ilc1 = _DUMMYILC1; |
|
3106 |
static struct inlineCache ilc2 = _DUMMYILC2; |
|
3107 |
static struct inlineCache ilc3 = _DUMMYILC3; |
|
3108 |
static struct inlineCache ilc4 = _DUMMYILC4; |
|
3109 |
static struct inlineCache ilc5 = _DUMMYILC5; |
|
3110 |
static struct inlineCache ilc6 = _DUMMYILC6; |
|
3111 |
static struct inlineCache ilc7 = _DUMMYILC7; |
|
3112 |
static struct inlineCache ilc8 = _DUMMYILC8; |
|
3113 |
static struct inlineCache ilc9 = _DUMMYILC9; |
|
3114 |
static struct inlineCache ilc10 = _DUMMYILC10; |
|
3115 |
static struct inlineCache ilc11 = _DUMMYILC11; |
|
3116 |
static struct inlineCache ilc12 = _DUMMYILC12; |
|
3117 |
static struct inlineCache ilc13 = _DUMMYILC13; |
|
3118 |
static struct inlineCache ilc14 = _DUMMYILC14; |
|
3119 |
static struct inlineCache ilc15 = _DUMMYILC15; |
|
3120 |
||
3121 |
if (__isSmallInteger(numberOfArgs)) { |
|
3122 |
nargs = __intVal(numberOfArgs); |
|
3123 |
if (nargs == 0) { |
|
3124 |
RETURN (_SEND0(self, aSelector, CON_COMMA aClass, &ilc0)); |
|
3125 |
} |
|
3126 |
||
3127 |
argP = (OBJ *)(&a1); |
|
1133 | 3128 |
if (__Class(argArray) == @global(Array)) { |
783 | 3129 |
for (i=0; i < nargs; i++) { |
1133 | 3130 |
*argP++ = __ArrayInstPtr(argArray)->a_element[i]; |
783 | 3131 |
} |
3132 |
} else { |
|
3133 |
for (i=1; i <= nargs; i++) { |
|
3134 |
*argP++ = __AT_(argArray, CON_COMMA __MKSMALLINT(i)); |
|
3135 |
} |
|
3136 |
} |
|
3137 |
switch (nargs) { |
|
3138 |
case 1: |
|
3139 |
RETURN ( _SEND1(self, aSelector, CON_COMMA aClass, &ilc1, a1)); |
|
3140 |
||
3141 |
case 2: |
|
3142 |
RETURN ( _SEND2(self, aSelector, CON_COMMA aClass, &ilc2, a1, a2)); |
|
3143 |
||
3144 |
case 3: |
|
3145 |
RETURN ( _SEND3(self, aSelector, CON_COMMA aClass, &ilc3, a1, a2, a3)); |
|
3146 |
||
3147 |
case 4: |
|
3148 |
RETURN ( _SEND4(self, aSelector, CON_COMMA aClass, &ilc4, a1, a2, a3, a4)); |
|
3149 |
||
3150 |
case 5: |
|
3151 |
RETURN ( _SEND5(self, aSelector, CON_COMMA aClass, &ilc5, |
|
3152 |
a1, a2, a3, a4, a5)); |
|
3153 |
||
3154 |
case 6: |
|
3155 |
RETURN ( _SEND6(self, aSelector, CON_COMMA aClass, &ilc6, |
|
3156 |
a1, a2, a3, a4, a5, a6)); |
|
3157 |
||
3158 |
case 7: |
|
3159 |
RETURN ( _SEND7(self, aSelector, CON_COMMA aClass, &ilc7, |
|
3160 |
a1, a2, a3, a4, a5, a6, a7)); |
|
3161 |
||
3162 |
case 8: |
|
3163 |
RETURN ( _SEND8(self, aSelector, CON_COMMA aClass, &ilc8, |
|
3164 |
a1, a2, a3, a4, a5, a6, a7, a8)); |
|
3165 |
||
3166 |
case 9: |
|
3167 |
RETURN ( _SEND9(self, aSelector, CON_COMMA aClass, &ilc9, |
|
3168 |
a1, a2, a3, a4, a5, a6, a7, a8, a9)); |
|
3169 |
||
3170 |
case 10: |
|
3171 |
RETURN ( _SEND10(self, aSelector, CON_COMMA aClass, &ilc10, |
|
3172 |
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)); |
|
3173 |
||
3174 |
case 11: |
|
3175 |
RETURN ( _SEND11(self, aSelector, CON_COMMA aClass, &ilc11, |
|
3176 |
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11)); |
|
3177 |
||
3178 |
case 12: |
|
3179 |
RETURN ( _SEND12(self, aSelector, CON_COMMA aClass, &ilc12, |
|
3180 |
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12)); |
|
3181 |
||
3182 |
case 13: |
|
3183 |
RETURN ( _SEND13(self, aSelector, CON_COMMA aClass, &ilc13, |
|
3184 |
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, |
|
3185 |
a13)); |
|
3186 |
||
3187 |
case 14: |
|
3188 |
RETURN ( _SEND14(self, aSelector, CON_COMMA aClass, &ilc14, |
|
3189 |
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, |
|
3190 |
a13, a14)); |
|
3191 |
||
3192 |
case 15: |
|
3193 |
RETURN ( _SEND15(self, aSelector, CON_COMMA aClass, &ilc15, |
|
3194 |
a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, |
|
3195 |
a13, a14, a15)); |
|
3196 |
} |
|
3197 |
} |
|
3198 |
%} |
|
3199 |
. |
|
3200 |
^ self primitiveFailed |
|
3201 |
! |
|
3202 |
||
1 | 3203 |
perform:aSelector with:anObject |
3204 |
"send the one-arg-message aSelector to the receiver" |
|
3205 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3206 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3207 |
struct inlineCache *pIlc; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3208 |
static struct inlineCache ilc_0 = _DUMMYILC1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3209 |
static struct inlineCache ilc_1 = _DUMMYILC1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3210 |
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
|
3211 |
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
|
3212 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3213 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3214 |
if (aSelector != last_0) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3215 |
if (aSelector != last_1) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3216 |
if (flip) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3217 |
pIlc = &ilc_0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3218 |
flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3219 |
last_0 = aSelector; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3220 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3221 |
pIlc = &ilc_1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3222 |
flip = 1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3223 |
last_1 = aSelector; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3224 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3225 |
pIlc->ilc_func = __SEND1ADDR__; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3226 |
if (pIlc->ilc_poly) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3227 |
__flushPolyCache(pIlc->ilc_poly); |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3228 |
pIlc->ilc_poly = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3229 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3230 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3231 |
pIlc = &ilc_1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3232 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3233 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3234 |
pIlc = &ilc_0; |
1 | 3235 |
} |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3236 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, CON_COMMA nil, pIlc, anObject) ); |
1 | 3237 |
%} |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3238 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3239 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3240 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3241 |
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
|
3242 |
"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
|
3243 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3244 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3245 |
struct inlineCache *pIlc; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3246 |
static struct inlineCache ilc_0 = _DUMMYILC2; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3247 |
static struct inlineCache ilc_1 = _DUMMYILC2; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3248 |
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
|
3249 |
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
|
3250 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3251 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3252 |
if (aSelector != last_0) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3253 |
if (aSelector != last_1) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3254 |
if (flip) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3255 |
pIlc = &ilc_0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3256 |
flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3257 |
last_0 = aSelector; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3258 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3259 |
pIlc = &ilc_1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3260 |
flip = 1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3261 |
last_1 = aSelector; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3262 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3263 |
pIlc->ilc_func = __SEND2ADDR__; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3264 |
if (pIlc->ilc_poly) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3265 |
__flushPolyCache(pIlc->ilc_poly); |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3266 |
pIlc->ilc_poly = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3267 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3268 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3269 |
pIlc = &ilc_1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3270 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3271 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3272 |
pIlc = &ilc_0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3273 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3274 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, CON_COMMA nil, pIlc, arg1, arg2) ); |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3275 |
%} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3276 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3277 |
! |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3278 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3279 |
perform:aSelector with:arg1 with:arg2 with:arg3 |
1 | 3280 |
"send the three-arg-message aSelector to the receiver" |
3281 |
||
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3282 |
%{ |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3283 |
struct inlineCache *pIlc; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3284 |
static struct inlineCache ilc_0 = _DUMMYILC3; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3285 |
static struct inlineCache ilc_1 = _DUMMYILC3; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3286 |
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
|
3287 |
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
|
3288 |
static flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3289 |
|
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3290 |
if (aSelector != last_0) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3291 |
if (aSelector != last_1) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3292 |
if (flip) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3293 |
pIlc = &ilc_0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3294 |
flip = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3295 |
last_0 = aSelector; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3296 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3297 |
pIlc = &ilc_1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3298 |
flip = 1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3299 |
last_1 = aSelector; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3300 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3301 |
pIlc->ilc_func = __SEND3ADDR__; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3302 |
if (pIlc->ilc_poly) { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3303 |
__flushPolyCache(pIlc->ilc_poly); |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3304 |
pIlc->ilc_poly = 0; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3305 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3306 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3307 |
pIlc = &ilc_1; |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3308 |
} |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3309 |
} else { |
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3310 |
pIlc = &ilc_0; |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3311 |
} |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3312 |
RETURN ( (*(pIlc->ilc_func))(self, aSelector, CON_COMMA nil, pIlc, arg1, arg2, arg3) ); |
1 | 3313 |
%} |
1533
179ce527e383
added a 2-slot cache to #perform: / #perform:with:* methods.
Claus Gittinger <cg@exept.de>
parents:
1528
diff
changeset
|
3314 |
|
1 | 3315 |
! |
3316 |
||
3317 |
perform:aSelector withArguments:argArray |
|
3318 |
"send the message aSelector with all args taken from argArray |
|
44 | 3319 |
to the receiver." |
1 | 3320 |
|
77 | 3321 |
|numberOfArgs a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15| |
1 | 3322 |
|
3323 |
numberOfArgs := argArray size. |
|
3324 |
%{ |
|
3325 |
REGISTER OBJ *argP; |
|
3326 |
int nargs, i; |
|
3327 |
static OBJ last0 = nil; static struct inlineCache ilc0 = _ILC0; |
|
3328 |
static OBJ last1 = nil; static struct inlineCache ilc1 = _ILC1; |
|
3329 |
static OBJ last2 = nil; static struct inlineCache ilc2 = _ILC2; |
|
3330 |
static OBJ last3 = nil; static struct inlineCache ilc3 = _ILC3; |
|
3331 |
static OBJ last4 = nil; static struct inlineCache ilc4 = _ILC4; |
|
3332 |
static OBJ last5 = nil; static struct inlineCache ilc5 = _ILC5; |
|
3333 |
static OBJ last6 = nil; static struct inlineCache ilc6 = _ILC6; |
|
3334 |
static OBJ last7 = nil; static struct inlineCache ilc7 = _ILC7; |
|
3335 |
static OBJ last8 = nil; static struct inlineCache ilc8 = _ILC8; |
|
3336 |
static OBJ last9 = nil; static struct inlineCache ilc9 = _ILC9; |
|
3337 |
static OBJ last10 = nil; static struct inlineCache ilc10 = _ILC10; |
|
3338 |
static OBJ last11 = nil; static struct inlineCache ilc11 = _ILC11; |
|
3339 |
static OBJ last12 = nil; static struct inlineCache ilc12 = _ILC12; |
|
71 | 3340 |
static OBJ last13 = nil; static struct inlineCache ilc13 = _ILC13; |
3341 |
static OBJ last14 = nil; static struct inlineCache ilc14 = _ILC14; |
|
3342 |
static OBJ last15 = nil; static struct inlineCache ilc15 = _ILC15; |
|
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3343 |
OBJ l; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3344 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3345 |
#if defined(xxxTHIS_CONTEXT) /* not because this has a context */ |
71 | 3346 |
/* |
93 | 3347 |
* must set lineno in sender by hand here ... (because of NOCONTEXT) |
71 | 3348 |
*/ |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3349 |
if ((l = __ILC_LNO_AS_OBJ(__pilc)) != __MKSMALLINT(0)) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3350 |
_ContextInstPtr(__thisContext)->c_lineno = l; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3351 |
} |
71 | 3352 |
#endif |
1 | 3353 |
|
253 | 3354 |
if (__isSmallInteger(numberOfArgs)) { |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3355 |
nargs = __intVal(numberOfArgs); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3356 |
if (nargs == 0) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3357 |
if (aSelector != last0) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3358 |
ilc0.ilc_func = __SEND0ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3359 |
if (ilc0.ilc_poly) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3360 |
__flushPolyCache(ilc0.ilc_poly); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3361 |
ilc0.ilc_poly = 0; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3362 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3363 |
last0 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3364 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3365 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3366 |
ilc0.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 3367 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3368 |
RETURN ((*ilc0.ilc_func)(self, aSelector, CON_COMMA nil, &ilc0)); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3369 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3370 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3371 |
if (__isArray(argArray)) { |
1133 | 3372 |
argP = __ArrayInstPtr(argArray)->a_element; |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3373 |
} else { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3374 |
argP = (OBJ *)(&a1); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3375 |
for (i=1; i <= nargs; i++) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3376 |
*argP++ = __AT_(argArray, CON_COMMA __MKSMALLINT(i)); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3377 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3378 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3379 |
switch (nargs) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3380 |
case 1: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3381 |
if (aSelector != last1) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3382 |
ilc1.ilc_func = __SEND1ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3383 |
if (ilc1.ilc_poly) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3384 |
__flushPolyCache(ilc1.ilc_poly); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3385 |
ilc1.ilc_poly = 0; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3386 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3387 |
last1 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3388 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3389 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3390 |
ilc1.ilc_lineNo = __pilc->ilc_lineNo; |
44 | 3391 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3392 |
RETURN ( (*ilc1.ilc_func)(self, aSelector, CON_COMMA nil, &ilc1, argP[0])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3393 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3394 |
case 2: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3395 |
if (aSelector != last2) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3396 |
ilc2.ilc_func = __SEND2ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3397 |
if (ilc2.ilc_poly) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3398 |
__flushPolyCache(ilc2.ilc_poly); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3399 |
ilc2.ilc_poly = 0; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3400 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3401 |
last2 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3402 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3403 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3404 |
ilc2.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3405 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3406 |
RETURN ( (*ilc2.ilc_func)(self, aSelector, CON_COMMA nil, &ilc2, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3407 |
argP[0], argP[1])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3408 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3409 |
case 3: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3410 |
if (aSelector != last3) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3411 |
ilc3.ilc_func = __SEND3ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3412 |
if (ilc3.ilc_poly) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3413 |
__flushPolyCache(ilc3.ilc_poly); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3414 |
ilc3.ilc_poly = 0; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3415 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3416 |
last3 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3417 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3418 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3419 |
ilc3.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3420 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3421 |
RETURN ( (*ilc3.ilc_func)(self, aSelector, CON_COMMA nil, &ilc3, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3422 |
argP[0], argP[1], argP[2])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3423 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3424 |
case 4: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3425 |
if (aSelector != last4) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3426 |
ilc4.ilc_func = __SEND4ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3427 |
if (ilc4.ilc_poly) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3428 |
__flushPolyCache(ilc4.ilc_poly); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3429 |
ilc4.ilc_poly = 0; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3430 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3431 |
last4 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3432 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3433 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3434 |
ilc4.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3435 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3436 |
RETURN ( (*ilc4.ilc_func)(self, aSelector, CON_COMMA nil, &ilc4, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3437 |
argP[0], argP[1], argP[2], argP[3])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3438 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3439 |
case 5: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3440 |
if (aSelector != last5) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3441 |
ilc5.ilc_func = __SEND5ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3442 |
if (ilc5.ilc_poly) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3443 |
__flushPolyCache(ilc5.ilc_poly); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3444 |
ilc5.ilc_poly = 0; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3445 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3446 |
last5 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3447 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3448 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3449 |
ilc5.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3450 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3451 |
RETURN ( (*ilc5.ilc_func)(self, aSelector, CON_COMMA nil, &ilc5, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3452 |
argP[0], argP[1], argP[2], argP[3], argP[4])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3453 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3454 |
case 6: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3455 |
if (aSelector != last6) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3456 |
ilc6.ilc_func = __SEND6ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3457 |
if (ilc6.ilc_poly) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3458 |
__flushPolyCache(ilc6.ilc_poly); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3459 |
ilc6.ilc_poly = 0; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3460 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3461 |
last6 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3462 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3463 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3464 |
ilc6.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3465 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3466 |
RETURN ( (*ilc6.ilc_func)(self, aSelector, CON_COMMA nil, &ilc6, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3467 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3468 |
argP[5])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3469 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3470 |
case 7: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3471 |
if (aSelector != last7) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3472 |
ilc7.ilc_func = __SEND7ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3473 |
if (ilc7.ilc_poly) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3474 |
__flushPolyCache(ilc7.ilc_poly); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3475 |
ilc7.ilc_poly = 0; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3476 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3477 |
last7 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3478 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3479 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3480 |
ilc7.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3481 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3482 |
RETURN ( (*ilc7.ilc_func)(self, aSelector, CON_COMMA nil, &ilc7, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3483 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3484 |
argP[5], argP[6])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3485 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3486 |
case 8: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3487 |
if (aSelector != last8) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3488 |
ilc8.ilc_func = __SEND8ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3489 |
last8 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3490 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3491 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3492 |
ilc8.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3493 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3494 |
RETURN ( (*ilc8.ilc_func)(self, aSelector, CON_COMMA nil, &ilc8, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3495 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3496 |
argP[5], argP[6], argP[7])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3497 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3498 |
case 9: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3499 |
if (aSelector != last9) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3500 |
ilc9.ilc_func = __SEND9ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3501 |
last9 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3502 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3503 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3504 |
ilc9.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3505 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3506 |
RETURN ( (*ilc9.ilc_func)(self, aSelector, CON_COMMA nil, &ilc9, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3507 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3508 |
argP[5], argP[6], argP[7], argP[8])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3509 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3510 |
case 10: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3511 |
if (aSelector != last10) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3512 |
ilc10.ilc_func = __SEND10ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3513 |
last10 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3514 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3515 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3516 |
ilc10.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3517 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3518 |
RETURN ( (*ilc10.ilc_func)(self, aSelector, CON_COMMA nil, &ilc10, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3519 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3520 |
argP[5], argP[6], argP[7], argP[8], argP[9])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3521 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3522 |
case 11: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3523 |
if (aSelector != last11) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3524 |
ilc11.ilc_func = __SEND11ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3525 |
last11 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3526 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3527 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3528 |
ilc11.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3529 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3530 |
RETURN ( (*ilc11.ilc_func)(self, aSelector, CON_COMMA nil, &ilc11, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3531 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3532 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3533 |
argP[10])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3534 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3535 |
case 12: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3536 |
if (aSelector != last12) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3537 |
ilc12.ilc_func = __SEND12ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3538 |
last12 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3539 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3540 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3541 |
ilc12.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3542 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3543 |
RETURN ( (*ilc12.ilc_func)(self, aSelector, CON_COMMA nil, &ilc12, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3544 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3545 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3546 |
argP[10], argP[11])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3547 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3548 |
case 13: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3549 |
if (aSelector != last13) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3550 |
ilc13.ilc_func = __SEND13ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3551 |
last13 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3552 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3553 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3554 |
ilc13.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3555 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3556 |
RETURN ( (*ilc13.ilc_func)(self, aSelector, CON_COMMA nil, &ilc13, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3557 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3558 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3559 |
argP[10], argP[11], argP[12])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3560 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3561 |
case 14: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3562 |
if (aSelector != last14) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3563 |
ilc14.ilc_func = __SEND14ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3564 |
last14 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3565 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3566 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3567 |
ilc14.ilc_lineNo = __pilc->ilc_lineNo; |
71 | 3568 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3569 |
RETURN ( (*ilc14.ilc_func)(self, aSelector, CON_COMMA nil, &ilc14, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3570 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3571 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3572 |
argP[10], argP[11], argP[12], argP[13])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3573 |
|
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3574 |
case 15: |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3575 |
if (aSelector != last15) { |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3576 |
ilc15.ilc_func = __SEND15ADDR__; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3577 |
last15 = aSelector; |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3578 |
} |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3579 |
#ifdef xxTHIS_CONTEXT /* not because this has a context */ |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3580 |
ilc15.ilc_lineNo = __pilc->ilc_lineNo; |
77 | 3581 |
#endif |
1085
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3582 |
RETURN ( (*ilc15.ilc_func)(self, aSelector, CON_COMMA nil, &ilc15, |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3583 |
argP[0], argP[1], argP[2], argP[3], argP[4], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3584 |
argP[5], argP[6], argP[7], argP[8], argP[9], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3585 |
argP[10], argP[11], argP[12], argP[13], |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3586 |
argP[14])); |
3f5ae1995e83
fixed lineNumber info with #perform (that used to work !)
Claus Gittinger <cg@exept.de>
parents:
1078
diff
changeset
|
3587 |
} |
1 | 3588 |
} |
3589 |
%} |
|
3590 |
. |
|
3591 |
^ self primitiveFailed |
|
3592 |
! ! |
|
3593 |
||
783 | 3594 |
!Object methodsFor:'misc'! |
3595 |
||
3596 |
-> anObject |
|
3597 |
"return an association with the receiver as key and |
|
3598 |
the argument as value" |
|
3599 |
||
3600 |
^ Association key:self value:anObject |
|
2 | 3601 |
! ! |
3602 |
||
1 | 3603 |
!Object methodsFor:'printing & storing'! |
3604 |
||
3605 |
className |
|
3606 |
"return the classname of the receivers class" |
|
3607 |
||
3608 |
^ self class name |
|
56 | 3609 |
|
293 | 3610 |
" |
3611 |
1 className |
|
3612 |
1 class className 'this may change ...' |
|
3613 |
$a className |
|
3614 |
$a class className 'this may change ...' |
|
3615 |
" |
|
1 | 3616 |
! |
3617 |
||
3618 |
classNameWithArticle |
|
71 | 3619 |
"return a string consisting of classname preceeded by an article. |
3620 |
(dont expect me to write national variants for this ... :-) |
|
3621 |
If you have special preferences, redefine it ..." |
|
1 | 3622 |
|
1391 | 3623 |
|classname cls| |
3624 |
||
3625 |
(cls := self class) == self ifTrue:[ |
|
3626 |
^ 'a funny object' |
|
3627 |
]. |
|
3628 |
classname := cls displayString. |
|
85 | 3629 |
^ classname article , ' ' , classname |
56 | 3630 |
|
293 | 3631 |
" |
3632 |
1 classNameWithArticle |
|
3633 |
(1->2) classNameWithArticle |
|
3634 |
XWorkstation basicNew classNameWithArticle |
|
3635 |
" |
|
1391 | 3636 |
|
3637 |
"Modified: 13.5.1996 / 12:16:14 / cg" |
|
1 | 3638 |
! |
3639 |
||
1445
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3640 |
displayOn:aGc |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3641 |
"ST-80 Compatibility |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3642 |
display the receiver in a graphicsContext at 0@0 |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3643 |
- this method allows for any object to be displayed in some view |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3644 |
(although the fallBack is to display its printString ...)" |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3645 |
|
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3646 |
^ self displayOn:aGc x:0 y:0. |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3647 |
|
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3648 |
"Created: 29.5.1996 / 16:28:58 / cg" |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3649 |
! |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3650 |
|
783 | 3651 |
displayOn:aGc at:aPoint |
3652 |
"ST-80 Compatibility |
|
3653 |
display the receiver in a graphicsContext - this method allows |
|
3654 |
for any object to be displayed in a ListView - for example." |
|
3655 |
||
3656 |
^ self displayOn:aGc x:(aPoint x) y:(aPoint y). |
|
56 | 3657 |
! |
3658 |
||
783 | 3659 |
displayOn:aGc x:x y:y |
3660 |
"display the receiver in a graphicsContext - this method allows |
|
1445
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3661 |
for any object to be displayed in a ListView - for example. |
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3662 |
The fallBack here shows the receivers printString." |
783 | 3663 |
|
3664 |
^ aGc displayString:(self displayString) x:x y:y. |
|
1445
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3665 |
|
c2dc94f9921b
added #displayOn: as a common fallBack
Claus Gittinger <cg@exept.de>
parents:
1425
diff
changeset
|
3666 |
"Modified: 29.5.1996 / 16:29:38 / cg" |
56 | 3667 |
! |
3668 |
||
783 | 3669 |
displayString |
3670 |
"return a string used when displaying the receiver in a view; |
|
3671 |
for example an Inspector. This is usually the same as printString, |
|
3672 |
but sometimes redefined for a better look." |
|
3673 |
||
3674 |
^ self printString |
|
3675 |
||
3676 |
" |
|
3677 |
#(1 2 3) printString |
|
3678 |
#(1 2 3) displayString |
|
3679 |
#(1 2 3) storeString |
|
3680 |
" |
|
1 | 3681 |
! |
3682 |
||
783 | 3683 |
errorPrint |
3684 |
"print the receiver on the standard error stream." |
|
3685 |
||
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3686 |
Stream streamErrorSignal catch:[ |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3687 |
self printOn:Stderr |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3688 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3689 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3690 |
"Modified: 7.3.1996 / 19:11:29 / cg" |
783 | 3691 |
! |
3692 |
||
1425 | 3693 |
errorPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3694 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3695 |
|
1089
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3696 |
"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
|
3697 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3698 |
Stream streamErrorSignal catch:[ |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3699 |
self printOn:Stderr. |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3700 |
Stderr cr |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3701 |
] |
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3702 |
|
6df9414b354f
catch errors while errorPrinting (happened when controlling xterm was closed)
Claus Gittinger <cg@exept.de>
parents:
1085
diff
changeset
|
3703 |
"Modified: 7.3.1996 / 19:13:01 / cg" |
1425 | 3704 |
"Created: 20.5.1996 / 10:20:41 / cg" |
3705 |
! |
|
3706 |
||
3707 |
errorPrintNL |
|
3708 |
"{ Pragma: +optSpace }" |
|
3709 |
||
3710 |
"print the receiver followed by a cr on the standard error stream. |
|
3711 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
3712 |
||
3713 |
^ self errorPrintCR |
|
3714 |
||
3715 |
"Modified: 20.5.1996 / 10:24:45 / cg" |
|
3716 |
! |
|
3717 |
||
3718 |
errorPrintNewline |
|
3719 |
"{ Pragma: +optSpace }" |
|
3720 |
||
3721 |
"print the receiver followed by a cr on the standard error stream. |
|
3722 |
Please use #errorPrintCR - this method exists for backward compatibility." |
|
3723 |
||
3724 |
self errorPrintCR. |
|
3725 |
||
3726 |
"Modified: 20.5.1996 / 10:24:38 / cg" |
|
71 | 3727 |
! |
3728 |
||
356 | 3729 |
infoPrint |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3730 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3731 |
|
356 | 3732 |
"print the receiver on the standard error stream. |
3733 |
This is meant for information messages which are not warnings |
|
3734 |
or fatal messages. |
|
3735 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
3736 |
||
3737 |
InfoPrinting ifTrue:[ |
|
3738 |
self printOn:Stderr |
|
3739 |
] |
|
3740 |
! |
|
3741 |
||
1425 | 3742 |
infoPrintCR |
1119
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3743 |
"{ Pragma: +optSpace }" |
956d62a5656c
compile seldom used methods with optSpace (is this a good idea ?)
Claus Gittinger <cg@exept.de>
parents:
1109
diff
changeset
|
3744 |
|
356 | 3745 |
"print the receiver followed by a cr on the standard error stream. |
3746 |
This is meant for information messages which are not warnings |
|
3747 |
or fatal messages. |
|
3748 |
These messages can be turned on/off by 'Object infoPrinting:true/false'" |
|
3749 |
||
3750 |
InfoPrinting ifTrue:[ |
|
1425 | 3751 |
self errorPrintCR |
356 | 3752 |
] |
1425 | 3753 |
|
3754 |
"Created: 20.5.1996 / 10:21:28 / cg" |
|
3755 |
! |
|
3756 |
||
3757 |
infoPrintNL |
|
3758 |
"{ Pragma: +optSpace }" |
|
3759 |
||
3760 |
"print the receiver followed by a cr on the standard error stream. |
|
3761 |
This is meant for information messages which are not warnings |
|
3762 |
or fatal messages. |
|
3763 |
These messages can be turned on/off by 'Object infoPrinting:true/false'. |
|
3764 |
||
3765 |
Please use #infoPrintCR - this method exists for backward compatibility." |
|
3766 |
||
3767 |
InfoPrinting ifTrue:[ |
|
3768 |
self errorPrintCR |
|
3769 |
] |
|
3770 |
||
3771 |
"Modified: 20.5.1996 / 10:25:07 / cg" |
|
356 | 3772 |
! |
3773 |
||
783 | 3774 |
|
3775 |
"print the receiver on the standard output stream" |
|
3776 |
||
3777 |
self printOn:Stdout |
|
3778 |
! |
|
3779 |
||
1425 | 3780 |
printCR |
783 | 3781 |
"print the receiver followed by a cr on the standard output stream" |
3782 |
||
3783 |
self printOn:Stdout. |
|
3784 |
Stdout cr |
|
1425 | 3785 |
|
3786 |
"Created: 20.5.1996 / 10:21:37 / cg" |
|
3787 |
! |
|
3788 |
||
3789 |
printNL |
|
3790 |
"print the receiver followed by a cr on the standard output stream |
|
3791 |
This exists for GNU Smalltalk compatibility - please use #printCR." |
|
3792 |
||
3793 |
^ self printCR |
|
3794 |
||
3795 |
"Modified: 20.5.1996 / 10:25:31 / cg" |
|
3796 |
! |
|
3797 |
||
3798 |
printNewline |
|
3799 |
"print the receiver followed by a cr on the standard output stream. |
|
3800 |
This exists for backward compatibility - please use #printCR." |
|
3801 |
||
3802 |
self printCR |
|
3803 |
||
3804 |
"Modified: 20.5.1996 / 10:25:46 / cg" |
|
783 | 3805 |
! |
3806 |
||
3807 |
printOn:aStream |
|
3808 |
"print the receiver on the argument-stream. |
|
3809 |
The default here is to output the receivers class name. |
|
3810 |
BUT: this method is heavily redefined for objects which |
|
3811 |
can print prettier." |
|
3812 |
||
3813 |
aStream nextPutAll:self classNameWithArticle |
|
3814 |
! |
|
3815 |
||
3816 |
printOn:aStream leftPaddedTo:size |
|
3817 |
"print the receiver on aStream, padding with spaces up to size. |
|
3818 |
padding is done on the left." |
|
3819 |
||
3820 |
self printOn:aStream leftPaddedTo:size with:(Character space) |
|
3821 |
||
3822 |
" |
|
3823 |
123 printOn:Transcript leftPaddedTo:10. Transcript cr |
|
3824 |
123 printOn:Transcript leftPaddedTo:2. Transcript cr |
|
3825 |
" |
|
71 | 3826 |
! |
3827 |
||
783 | 3828 |
printOn:aStream leftPaddedTo:size with:padCharacter |
3829 |
"print the receiver on aStream, padding with padCharacters up to size. |
|
3830 |
padding is done on the left." |
|
3831 |
||
3832 |
aStream nextPutAll:(self printStringLeftPaddedTo:size with:padCharacter) |
|
3833 |
||
3834 |
" |
|
3835 |
123 printOn:Transcript leftPaddedTo:10 with:$_ . Transcript cr |
|
3836 |
123 printOn:Transcript leftPaddedTo:10 with:$. . Transcript cr |
|
3837 |
" |
|
3838 |
! |
|
3839 |
||
3840 |
printOn:aStream paddedTo:size |
|
3841 |
"print the receiver on aStream, padding with spaces up to size." |
|
3842 |
||
3843 |
self printOn:aStream paddedTo:size with:(Character space) |
|
3844 |
||
3845 |
" |
|
3846 |
123.0 printOn:Transcript paddedTo:10. Transcript nextPut:$|. Transcript cr |
|
3847 |
" |
|
71 | 3848 |
! |
3849 |
||
783 | 3850 |
printOn:aStream paddedTo:size with:padCharacter |
3851 |
"print the receiver on aStream, padding with padCharacter up to size" |
|
3852 |
||
3853 |
aStream nextPutAll:(self printStringPaddedTo:size with:padCharacter). |
|
3854 |
||
3855 |
" |
|
3856 |
123 printOn:Transcript paddedTo:10 with:$_ . Transcript cr |
|
3857 |
123 printOn:Transcript paddedTo:10 with:$. . Transcript cr |
|
3858 |
" |
|
3859 |
! |
|
3860 |
||
3861 |
printOn:aStream zeroPaddedTo:size |
|
3862 |
"print the receiver on aStream, padding with zeros up to size. |
|
3863 |
Usually used with float numbers." |
|
3864 |
||
3865 |
self printOn:aStream paddedTo:size with:$0. |
|
3866 |
||
3867 |
" |
|
3868 |
123.0 printOn:Transcript zeroPaddedTo:10 |
|
3869 |
" |
|
3870 |
! |
|
3871 |
||
3872 |
printRightAdjustLen:size |
|
3873 |
"obsolete - just a name confusion. |
|
3874 |
This method will go away ..." |
|
3875 |
||
3876 |
(self printStringLeftPaddedTo:size) printOn:Stdout |
|
71 | 3877 |
! |
3878 |
||
3879 |
printString |
|
3880 |
"return a string for printing the receiver. |
|
3881 |
Since we now use printOn: as the basic print mechanism, |
|
3882 |
we have to create a stream and print into it." |
|
3883 |
||
3884 |
|s| |
|
3885 |
||
3886 |
s := WriteStream on:(String new:30). |
|
3887 |
self printOn:s. |
|
3888 |
^ s contents |
|
3889 |
! |
|
3890 |
||
783 | 3891 |
printStringLeftPaddedTo:size |
3892 |
"return my printString as a right-adjusted string of length size; |
|
3893 |
characters on the left are filled with spaces. |
|
3894 |
If the printString is longer than size, |
|
3895 |
it is returned unchanged (i.e. not truncated)" |
|
3896 |
||
3897 |
^ self printStringLeftPaddedTo:size with:(Character space) |
|
3898 |
||
3899 |
" |
|
3900 |
10 printStringLeftPaddedTo:10 |
|
3901 |
1 printStringLeftPaddedTo:10 |
|
3902 |
" |
|
3903 |
! |
|
3904 |
||
3905 |
printStringLeftPaddedTo:size ifLarger:alternative |
|
3906 |
"return my printString as a right-adjusted string of length size; |
|
3907 |
characters on the left are filled with spaces. |
|
3908 |
If the printString is larger than size, |
|
3909 |
return the result from evaluating alternative." |
|
3910 |
||
3911 |
^ self printStringLeftPaddedTo:size with:(Character space) ifLarger:alternative |
|
3912 |
||
3913 |
" |
|
3914 |
12 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
3915 |
123 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
3916 |
1234 printStringLeftPaddedTo:3 ifLarger:['***'] |
|
3917 |
" |
|
3918 |
! |
|
3919 |
||
3920 |
printStringLeftPaddedTo:size with:padCharacter |
|
3921 |
"return my printString as a right-adjusted string of length size; |
|
3922 |
characters on the left are filled with padCharacter. |
|
3923 |
If the printString is longer than size, |
|
3924 |
it is returned unchanged (i.e. not truncated)" |
|
3925 |
||
3926 |
^ (self printString) leftPaddedTo:size with:padCharacter |
|
3927 |
||
3928 |
" |
|
3929 |
123 printStringLeftPaddedTo:10 with:$. |
|
3930 |
1 printStringLeftPaddedTo:10 with:$. |
|
3931 |
(Float pi) printStringLeftPaddedTo:20 with:$* |
|
3932 |
" |
|
3933 |
! |
|
3934 |
||
3935 |
printStringLeftPaddedTo:size with:padCharacter ifLarger:alternative |
|
3936 |
"return my printString as a right-adjusted string of length size; |
|
3937 |
characters on the left are filled with padCharacter. |
|
3938 |
If the printString is larger than size, |
|
369 | 3939 |
return the result from evaluating alternative." |
3940 |
||
3941 |
|s| |
|
3942 |
||
3943 |
s := self printString. |
|
3944 |
s size > size ifTrue:[^ alternative value]. |
|
783 | 3945 |
^ s leftPaddedTo:size with:padCharacter |
369 | 3946 |
|
3947 |
" |
|
783 | 3948 |
12 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
3949 |
123 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
3950 |
1234 printStringLeftPaddedTo:3 with:$. ifLarger:['***'] |
|
293 | 3951 |
" |
13 | 3952 |
! |
3953 |
||
3954 |
printStringPaddedTo:size |
|
56 | 3955 |
"return a printed representation of the receiver, |
369 | 3956 |
padded with spaces (at the right) up to size. |
293 | 3957 |
If the printString is longer than size, |
3958 |
it is returned unchanged (i.e. not truncated)" |
|
13 | 3959 |
|
3960 |
^ self printStringPaddedTo:size with:(Character space) |
|
3961 |
||
293 | 3962 |
" |
3963 |
123 printStringPaddedTo:10 |
|
3964 |
1234567890123456 printStringPaddedTo:10 |
|
3965 |
'hello' printStringPaddedTo:10 |
|
3966 |
" |
|
2 | 3967 |
! |
3968 |
||
369 | 3969 |
printStringPaddedTo:size ifLarger:alternative |
3970 |
"return a printed representation of the receiver, |
|
3971 |
padded with spaces (at the right) up to size. |
|
3972 |
If the resulting printString is too large, |
|
3973 |
return the result from evaluating alternative." |
|
3974 |
||
3975 |
^ self printStringPaddedTo:size with:(Character space) ifLarger:alternative |
|
3976 |
||
3977 |
" |
|
3978 |
12 printStringPaddedTo:3 ifLarger:['***'] |
|
3979 |
123 printStringPaddedTo:3 ifLarger:['***'] |
|
3980 |
1234 printStringPaddedTo:3 ifLarger:['***'] |
|
3981 |
" |
|
3982 |
! |
|
3983 |
||
783 | 3984 |
printStringPaddedTo:size with:padCharacter |
3985 |
"return a printed representation of the receiver, |
|
3986 |
padded with padCharacter (at the right) up to size. |
|
3987 |
If the printString is longer than size, |
|
3988 |
it is returned unchanged (i.e. not truncated)" |
|
3989 |
||
3990 |
^ (self printString) paddedTo:size with:padCharacter |
|
3991 |
||
3992 |
" |
|
3993 |
123 printStringPaddedTo:10 with:$. |
|
3994 |
123 printStringPaddedTo:10 with:$* |
|
3995 |
123 printStringPaddedTo:3 with:$* |
|
3996 |
1234 printStringPaddedTo:3 with:$* |
|
3997 |
" |
|
3998 |
! |
|
3999 |
||
4000 |
printStringPaddedTo:size with:padCharacter ifLarger:alternative |
|
4001 |
"return a printed representation of the receiver, |
|
4002 |
padded with padCharacter (at the right) up to size. |
|
4003 |
If the resulting printString is too large, |
|
4004 |
return the result from evaluating alternative." |
|
4005 |
||
4006 |
|s| |
|
4007 |
||
4008 |
s := self printString. |
|
4009 |
s size > size ifTrue:[^ alternative value]. |
|
4010 |
^ s paddedTo:size with:padCharacter |
|
4011 |
||
4012 |
" |
|
4013 |
123 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
4014 |
12345 printStringPaddedTo:3 with:$. ifLarger:['***'] |
|
4015 |
" |
|
4016 |
! |
|
4017 |
||
4018 |
printStringRightAdjustLen:size |
|
4019 |
"obsolete - just a name confusion. |
|
4020 |
This method will go away ..." |
|
4021 |
||
4022 |
^ self printStringLeftPaddedTo:size |
|
4023 |
! |
|
4024 |
||
2 | 4025 |
printStringZeroPaddedTo:size |
71 | 4026 |
"return a printed representation of the receiver, |
369 | 4027 |
padded with zero (at the right) characters up to size. |
13 | 4028 |
Usually used with float numbers." |
2 | 4029 |
|
4030 |
^ self printStringPaddedTo:size with:$0 |
|
13 | 4031 |
|
293 | 4032 |
" |
4033 |
123.0 printStringZeroPaddedTo:10 |
|
4034 |
" |
|
2 | 4035 |
! |
4036 |
||
783 | 4037 |
store |
4038 |
"store the receiver on standard output. |
|
4039 |
this method is useless, but included for compatibility." |
|
4040 |
||
4041 |
self storeOn:Stdout |
|
71 | 4042 |
! |
4043 |
||
1425 | 4044 |
storeCR |
4045 |
"store the receiver on standard output; append a carriage return." |
|
4046 |
||
4047 |
self store. |
|
4048 |
Character cr print |
|
4049 |
||
4050 |
"Created: 20.5.1996 / 10:26:01 / cg" |
|
4051 |
"Modified: 20.5.1996 / 10:26:57 / cg" |
|
4052 |
! |
|
4053 |
||
783 | 4054 |
storeNl |
4055 |
"store the receiver on standard output; append a newline. |
|
1425 | 4056 |
This method is included for backward compatibility- use #storeCR." |
4057 |
||
4058 |
self storeCR. |
|
4059 |
||
4060 |
"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
|
4061 |
! |
7e058858cc3b
New Method: displayOn:aGc at:aPoint (ST80-compatibility).
Stefan Vogel <sv@exept.de>
parents:
446
diff
changeset
|
4062 |
|
56 | 4063 |
storeOn:aStream |
4064 |
"store the receiver on aStream; i.e. print an expression which will |
|
293 | 4065 |
reconstruct the receiver. |
4066 |
Notice, that no self referencing or cyclic objects can be represented |
|
4067 |
in this format. |
|
4068 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 4069 |
|
4070 |
|myClass hasSemi sz "{ Class: SmallInteger }" | |
|
1 | 4071 |
|
25 | 4072 |
thisContext isRecursive ifTrue:[ |
1417 | 4073 |
Transcript showCR:'Error: storeString of self referencing object.'. |
4074 |
aStream nextPutAll:'#("recursive")'. |
|
4075 |
^ self |
|
25 | 4076 |
]. |
56 | 4077 |
|
1 | 4078 |
myClass := self class. |
56 | 4079 |
aStream nextPut:$(. |
4080 |
aStream nextPutAll:self class name. |
|
4081 |
||
1 | 4082 |
hasSemi := false. |
4083 |
myClass isVariable ifTrue:[ |
|
1417 | 4084 |
aStream nextPutAll:' basicNew:'. |
4085 |
self basicSize printOn:aStream |
|
1 | 4086 |
] ifFalse:[ |
1417 | 4087 |
aStream nextPutAll:' basicNew' |
1 | 4088 |
]. |
56 | 4089 |
|
1 | 4090 |
sz := myClass instSize. |
4091 |
1 to:sz do:[:i | |
|
1417 | 4092 |
aStream nextPutAll:' instVarAt:'. |
4093 |
i printOn:aStream. |
|
4094 |
aStream nextPutAll:' put:'. |
|
4095 |
(self instVarAt:i) storeOn:aStream. |
|
4096 |
aStream nextPut:$;. |
|
4097 |
hasSemi := true |
|
1 | 4098 |
]. |
4099 |
myClass isVariable ifTrue:[ |
|
1417 | 4100 |
sz := self basicSize. |
4101 |
1 to:sz do:[:i | |
|
4102 |
aStream nextPutAll:' basicAt:'. |
|
4103 |
i printOn:aStream. |
|
4104 |
aStream nextPutAll:' put:'. |
|
4105 |
(self basicAt:i) storeOn:aStream. |
|
4106 |
aStream nextPut:$;. |
|
4107 |
hasSemi := true |
|
4108 |
] |
|
1 | 4109 |
]. |
4110 |
hasSemi ifTrue:[ |
|
1417 | 4111 |
aStream nextPutAll:' yourself' |
1 | 4112 |
]. |
56 | 4113 |
aStream nextPut:$). |
293 | 4114 |
|
4115 |
" |
|
4116 |
|s| |
|
4117 |
||
4118 |
s := WriteStream on:(String new). |
|
4119 |
('hello' -> 'world') storeOn:s. |
|
4120 |
s := ReadStream on:(s contents). |
|
4121 |
(Object readFrom:s) inspect |
|
4122 |
" |
|
4123 |
" |
|
4124 |
|s| |
|
4125 |
||
4126 |
s := 'data' asFilename writeStream. |
|
4127 |
('hello' -> 'world') storeOn:s. |
|
4128 |
s close. |
|
4129 |
||
4130 |
s := 'data' asFilename readStream. |
|
4131 |
(Object readFrom:s) inspect |
|
4132 |
" |
|
4133 |
||
4134 |
"does not work example:" |
|
4135 |
" |
|
4136 |
|s a| |
|
4137 |
||
4138 |
a := Array new:2. |
|
4139 |
a at:1 put:a. |
|
4140 |
||
4141 |
s := 'data' asFilename writeStream. |
|
4142 |
a storeOn:s. |
|
4143 |
s close. |
|
4144 |
||
4145 |
s := 'data' asFilename readStream. |
|
4146 |
(Object readFrom:s) inspect |
|
4147 |
" |
|
1417 | 4148 |
|
4149 |
"Modified: 18.5.1996 / 15:43:35 / cg" |
|
1 | 4150 |
! |
4151 |
||
56 | 4152 |
storeString |
293 | 4153 |
"return a string representing an expression to reconstruct the receiver. |
4154 |
Notice, that no self referencing or cyclic objects can be represented |
|
4155 |
in this format. |
|
4156 |
Use storeBinaryOn:, which handles these cases correctly." |
|
56 | 4157 |
|
4158 |
|s| |
|
4159 |
||
4160 |
s := WriteStream on:(String new:50). |
|
4161 |
self storeOn:s. |
|
4162 |
^ s contents |
|
783 | 4163 |
! ! |
4164 |
||
4165 |
!Object methodsFor:'queries'! |
|
4166 |
||
4167 |
basicSize |
|
4168 |
"return the number of the receivers indexed instance variables, |
|
4169 |
0 if it has none. |
|
4170 |
||
4171 |
This method should NOT be redefined in any subclass" |
|
4172 |
||
4173 |
%{ /* NOCONTEXT */ |
|
4174 |
||
4175 |
REGISTER int nbytes; |
|
4176 |
REGISTER OBJ myClass; |
|
4177 |
REGISTER int flags; |
|
4178 |
||
4179 |
/* |
|
4180 |
* notice the missing test for self being a nonNilObject - |
|
4181 |
* this can be done since basicSize is defined both in UndefinedObject |
|
4182 |
* and SmallInteger |
|
4183 |
*/ |
|
4184 |
myClass = __qClass(self); |
|
4185 |
nbytes = __qSize(self) |
|
4186 |
- OHDR_SIZE |
|
1133 | 4187 |
- __OBJS2BYTES__(__intVal(__ClassInstPtr(myClass)->c_ninstvars)); |
4188 |
||
4189 |
flags = __intVal(__ClassInstPtr(myClass)->c_flags) & ARRAYMASK; |
|
783 | 4190 |
/* |
4191 |
* replaced switch by open-if; this is slightly faster since |
|
4192 |
* it avoids the range check and also checks the most common case first |
|
4193 |
*/ |
|
4194 |
if ((flags == POINTERARRAY) |
|
4195 |
|| (flags == WKPOINTERARRAY)) { |
|
4196 |
RETURN ( __MKSMALLINT(__BYTES2OBJS__(nbytes)) ); |
|
4197 |
} |
|
4198 |
if (flags == BYTEARRAY) { |
|
4199 |
RETURN ( __MKSMALLINT(nbytes / sizeof(char)) ); |
|
4200 |
} |
|
4201 |
if (flags == FLOATARRAY) { |
|
4202 |
RETURN ( __MKSMALLINT(nbytes / sizeof(float)) ); |
|
4203 |
} |
|
4204 |
if (flags == DOUBLEARRAY) { |
|
4205 |
#ifdef NEED_DOUBLE_ALIGN |
|
4206 |
/* |
|
4207 |
* care for filler |
|
4208 |
*/ |
|
4209 |
nbytes -= sizeof(FILLTYPE); |
|
4210 |
#endif |
|
4211 |
RETURN ( __MKSMALLINT(nbytes / sizeof(double)) ); |
|
4212 |
} |
|
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
4213 |
if ((flags == WORDARRAY) || (flags == SWORDARRAY)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
4214 |
RETURN ( __MKSMALLINT(nbytes / sizeof(short)) ); |
783 | 4215 |
} |
1515
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
4216 |
if ((flags == LONGARRAY) || (flags == SLONGARRAY)) { |
49a8587fcc8f
added support for signedWord and signedLong indexable classes.
Claus Gittinger <cg@exept.de>
parents:
1445
diff
changeset
|
4217 |
RETURN ( __MKSMALLINT(nbytes / sizeof(long)) ); |
783 | 4218 |
} |
4219 |
%}. |
|
4220 |
^ 0 |
|
1 | 4221 |
! |
4222 |
||
783 | 4223 |
class |
4224 |
"return the receivers class" |
|
4225 |
||
4226 |
%{ /* NOCONTEXT */ |
|
4227 |
||
4228 |
RETURN ( __Class(self) ); |
|
4229 |
%} |
|
4230 |
! |
|
4231 |
||
4232 |
isArray |
|
4233 |
"return true, if the receiver is some kind of array (or weakArray etc); |
|
4234 |
false is returned here - the method is only redefined in Array." |
|
4235 |
||
4236 |
^ false |
|
4237 |
! |
|
4238 |
||
1397 | 4239 |
isAssociation |
4240 |
"return true, if the receiver is some kind of association; |
|
4241 |
false is returned here - the method is only redefined in Association." |
|
4242 |
||
4243 |
^ false |
|
4244 |
||
4245 |
"Created: 14.5.1996 / 17:03:45 / cg" |
|
4246 |
! |
|
4247 |
||
783 | 4248 |
isBehavior |
4249 |
"return true, if the receiver is some kind of class (i.e. behavior); |
|
4250 |
false is returned here - the method is only redefined in Behavior." |
|
4251 |
||
4252 |
^ false |
|
4253 |
! |
|
4254 |
||
4255 |
isBlock |
|
4256 |
"return true, if the receiver is some kind of block; |
|
4257 |
false returned here - the method is only redefined in Block." |
|
4258 |
||
4259 |
^ false |
|
4260 |
! |
|
4261 |
||
4262 |
isCharacter |
|
4263 |
"return true, if the receiver is some kind of character; |
|
4264 |
false is returned here - the method is only redefined in Character." |
|
4265 |
||
4266 |
^ false |
|
4267 |
! |
|
4268 |
||
4269 |
isClass |
|
4270 |
"return true, if the receiver is some kind of class (real class, |
|
4271 |
not just behavior); |
|
4272 |
false is returned here - the method is only redefined in Class." |
|
4273 |
||
4274 |
^ false |
|
4275 |
! |
|
4276 |
||
4277 |
isCollection |
|
4278 |
"return true, if the receiver is some kind of collection; |
|
4279 |
false is returned here - the method is only redefined in Collection." |
|
4280 |
||
4281 |
^ false |
|
4282 |
! |
|
4283 |
||
4284 |
isColor |
|
4285 |
"return true, if the receiver is some kind of color; |
|
4286 |
false is returned here - the method is only redefined in Color." |
|
4287 |
||
4288 |
^ false |
|
4289 |
! |
|
4290 |
||
4291 |
isContext |
|
4292 |
"return true, if the receiver is some kind of context; |
|
4293 |
false returned here - the method is only redefined in Context." |
|
4294 |
||
4295 |
^ false |
|
4296 |
! |
|
4297 |
||
4298 |
isExternalStream |
|
4299 |
"return true, if the receiver is some kind of externalStream; |
|
4300 |
false is returned here - the method is only redefined in ExternalStream." |
|
4301 |
||
4302 |
^false |
|
4303 |
! |
|
4304 |
||
4305 |
isFileStream |
|
4306 |
"return true, if the receiver is some kind of fileStream; |
|
4307 |
false is returned here - the method is only redefined in FileStream." |
|
4308 |
||
4309 |
^false |
|
4310 |
! |
|
4311 |
||
4312 |
isFixedSize |
|
4313 |
"return true if the receiver cannot grow easily |
|
4314 |
(i.e. a grow may be expensive, since it involves a become:)" |
|
4315 |
||
4316 |
^ true |
|
4317 |
! |
|
4318 |
||
4319 |
isForm |
|
4320 |
"return true, if the receiver is some kind of form; |
|
4321 |
false is returned here - the method is only redefined in Form." |
|
4322 |
||
4323 |
^ false |
|
4324 |
! |
|
4325 |
||
4326 |
isFraction |
|
4327 |
"return true, if the receiver is some kind of fraction; |
|
4328 |
false is returned here - the method is only redefined in Fraction." |
|
4329 |
||
4330 |
^ false |
|
4331 |
! |
|
4332 |
||
4333 |
isImage |
|
4334 |
"return true, if the receiver is some kind of image; |
|
4335 |
false is returned here - the method is only redefined in Image." |
|
4336 |
||
4337 |
^ false |
|
4338 |
! |
|
4339 |
||
4340 |
isImageOrForm |
|
4341 |
"return true, if the receiver is some kind of image or form; |
|
4342 |
false is returned here - the method is only redefined in Image and Form." |
|
4343 |
||
4344 |
^ false |
|
4345 |
! |
|
4346 |
||
4347 |
isInteger |
|
4348 |
"return true, if the receiver is some kind of integer number; |
|
4349 |
false is returned here - the method is only redefined in Integer." |
|
4350 |
||
4351 |
^ false |
|
4352 |
! |
|
4353 |
||
4354 |
isKindOf:aClass |
|
4355 |
"return true, if the receiver is an instance of aClass or one of its |
|
4356 |
subclasses, false otherwise. |
|
4357 |
Advice: |
|
4358 |
use of this to check objects for certain attributes/protocoll should |
|
4359 |
be avoided; it limits the reusability of your classes by limiting use |
|
4360 |
to instances of certain classes and fences you into a specific inheritance |
|
4361 |
hierarchy. |
|
4362 |
Use check-methods to check an object for a certain attributes/protocol |
|
4363 |
(such as #isXXXX, #respondsTo: or #isNumber). |
|
4364 |
||
4365 |
Using #isKindOf: is considered BAD STYLE. |
|
4366 |
||
4367 |
Advice2: |
|
4368 |
Be aware, that using an #isXXX method is usually much faster than |
|
4369 |
using #isKindOf:; because isKindOf: has to walk up all the superclass |
|
4370 |
hierarchy, comparing every class on the way. |
|
4371 |
Due to caching in the VM, a call to #isXXX is normally reached via |
|
4372 |
a single function call. |
|
4373 |
" |
|
4374 |
||
4375 |
%{ /* NOCONTEXT */ |
|
4376 |
register OBJ thisClass; |
|
4377 |
||
4378 |
thisClass = __Class(self); |
|
4379 |
while (thisClass != nil) { |
|
4380 |
if (thisClass == aClass) { |
|
4381 |
RETURN ( true ); |
|
4382 |
} |
|
1133 | 4383 |
thisClass = __ClassInstPtr(thisClass)->c_superclass; |
783 | 4384 |
} |
4385 |
%} |
|
4386 |
. |
|
4387 |
"/ |
|
4388 |
"/ the above code is equivalent to: |
|
4389 |
"/ |
|
4390 |
"/ thisClass := self class. |
|
4391 |
"/ [thisClass notNil] whileTrue:[ |
|
4392 |
"/ thisClass == aClass ifTrue:[^ true]. |
|
4393 |
"/ thisClass := thisClass superclass |
|
4394 |
"/ ] |
|
4395 |
"/ |
|
4396 |
^ false |
|
4397 |
! |
|
4398 |
||
4399 |
isLayout |
|
4400 |
"return true, if the receiver is some kind of layout; |
|
4401 |
false is returned here - the method is only redefined in Layout." |
|
4402 |
||
4403 |
^ false |
|
4404 |
! |
|
4405 |
||
4406 |
isLiteral |
|
4407 |
"return true, if the receiver can be represented as a constant in ST syntax; |
|
4408 |
false is returned here - the method is redefined in some classes." |
|
4409 |
||
4410 |
^ false |
|
4411 |
! |
|
4412 |
||
4413 |
isMemberOf:aClass |
|
4414 |
"return true, if the receiver is an instance of aClass, false otherwise. |
|
4415 |
Advice: |
|
4416 |
use of this to check objects for certain attributes/protocoll should |
|
4417 |
be avoided; it limits the reusability of your classes by limiting use |
|
4418 |
to instances of a certain class. |
|
4419 |
Use check-methods to check an object for a certain attributes/protocol |
|
4420 |
(such as #isXXX, #respondsTo: or #isNumber); |
|
4421 |
||
4422 |
Using #isMemberOf: is considered BAD STYLE." |
|
4423 |
||
4424 |
^ (self class) == aClass |
|
4425 |
! |
|
4426 |
||
4427 |
isMeta |
|
4428 |
"return true, if the receiver is some kind of metaclass; |
|
4429 |
false is returned here - the method is only redefined in Metaclass." |
|
4430 |
||
4431 |
^ false |
|
4432 |
! |
|
4433 |
||
4434 |
isMethod |
|
4435 |
"return true, if the receiver is some kind of method; |
|
4436 |
false returned here - the method is only redefined in Method." |
|
4437 |
||
4438 |
^ false |
|
4439 |
! |
|
4440 |
||
4441 |
isNumber |
|
4442 |
"return true, if the receiver is some kind of number; |
|
4443 |
false is returned here - the method is only redefined in Number." |
|
4444 |
||
4445 |
^ false |
|
4446 |
! |
|
4447 |
||
4448 |
isPoint |
|
4449 |
"return true, if the receiver is some kind of point; |
|
4450 |
false is returned here - the method is only redefined in Point." |
|
4451 |
||
4452 |
^ false |
|
4453 |
! |
|
4454 |
||
4455 |
isReal |
|
4456 |
"return true, if the receiver is some kind of real number; |
|
4457 |
false is returned here - the method is only redefined in LimitedPrecisionReal." |
|
4458 |
||
4459 |
^ false |
|
4460 |
! |
|
4461 |
||
4462 |
isRectangle |
|
4463 |
"return true, if the receiver is some kind of rectangle; |
|
4464 |
false is returned here - the method is only redefined in Rectangle." |
|
4465 |
||
4466 |
^ false |
|
4467 |
! |
|
4468 |
||
4469 |
isSequenceable |
|
4470 |
"return true, if the receiver is some kind of sequenceable collection; |
|
4471 |
false is returned here - the method is only redefined in SequenceableCollection." |
|
4472 |
||
4473 |
^ false |
|
4474 |
! |
|
4475 |
||
4476 |
isSequenceableCollection |
|
4477 |
"OBSOLETE: use isSequenceable for ST-80 compatibility. |
|
4478 |
This method is a historic leftover and will be removed soon ..." |
|
4479 |
||
4480 |
self obsoleteMethodWarning:'use #isSequenceable'. |
|
4481 |
^ false |
|
4482 |
! |
|
4483 |
||
4484 |
isSignal |
|
4485 |
"return true, if the receiver is some kind of signal; |
|
4486 |
false returned here - the method is only redefined in Signal." |
|
4487 |
||
4488 |
^ false |
|
4489 |
! |
|
4490 |
||
4491 |
isStream |
|
4492 |
"return true, if the receiver is some kind of stream; |
|
4493 |
false is returned here - the method is only redefined in Stream." |
|
4494 |
||
4495 |
^ false |
|
4496 |
! |
|
4497 |
||
4498 |
isString |
|
4499 |
"return true, if the receiver is some kind of string; |
|
4500 |
false is returned here - the method is only redefined in String." |
|
4501 |
||
4502 |
^ false |
|
4503 |
! |
|
4504 |
||
4505 |
isSymbol |
|
4506 |
"return true, if the receiver is some kind of symbol; |
|
4507 |
false is returned here - the method is only redefined in Symbol." |
|
4508 |
||
4509 |
^ false |
|
4510 |
! |
|
4511 |
||
1377 | 4512 |
isText |
4513 |
"return true, if the receiver is some kind of text object; |
|
4514 |
false is returned here - the method is only redefined in Text." |
|
4515 |
||
4516 |
^ false |
|
4517 |
||
4518 |
"Created: 12.5.1996 / 10:56:50 / cg" |
|
4519 |
! |
|
4520 |
||
783 | 4521 |
isVariable |
4522 |
"return true if the receiver has indexed instance variables, |
|
4523 |
false otherwise." |
|
4524 |
||
4525 |
^ self class isVariable |
|
4526 |
! |
|
4527 |
||
4528 |
isView |
|
4529 |
"return true, if the receiver is some kind of view; |
|
4530 |
false is returned here - the method is only redefined in View." |
|
4531 |
||
4532 |
^ false |
|
4533 |
! |
|
4534 |
||
4535 |
respondsTo:aSelector |
|
4536 |
"return true, if the receiver implements a method with selector equal |
|
4537 |
to aSelector; i.e. if there is a method for aSelector in either the |
|
4538 |
receivers class or one of its superclasses. |
|
4539 |
||
4540 |
Notice, that this does not imply, that such a message can be sent without |
|
4541 |
an error being raised. For example, an implementation could send |
|
4542 |
#shouldNotImplement or #subclassResponsibility." |
|
4543 |
||
4544 |
" |
|
4545 |
should we go via the cache, or search (by class) ? |
|
4546 |
The first is faster, most of the time; while the 2nd fills |
|
4547 |
the cache with useless data if this is sent in a loop over all objects. |
|
4548 |
For now, use the cache ... |
|
4549 |
" |
|
4550 |
%{ /* NOCONTEXT */ |
|
4551 |
||
829
fc386319f41c
removed external function defs (soon no longer allowed)
Claus Gittinger <cg@exept.de>
parents:
816
diff
changeset
|
4552 |
if (__lookup(__Class(self), aSelector) == nil) { |
783 | 4553 |
RETURN ( false ); |
4554 |
} |
|
4555 |
RETURN ( true ); |
|
4556 |
%} |
|
4557 |
. |
|
4558 |
" |
|
4559 |
^ self class canUnderstand:aSelector |
|
4560 |
" |
|
4561 |
||
4562 |
"'aString' respondsTo:#+" |
|
4563 |
"'aString' respondsTo:#," |
|
4564 |
"'aString' respondsTo:#collect:" |
|
4565 |
! |
|
4566 |
||
4567 |
respondsToArithmetic |
|
4568 |
"return true, if the receiver responds to arithmetic messages. |
|
4569 |
false is returned here - the method is redefined in ArithmeticValue." |
|
4570 |
||
4571 |
^ false |
|
4572 |
! |
|
4573 |
||
4574 |
size |
|
4575 |
"return the number of the receivers indexed instance variables; |
|
4576 |
this method may be redefined in subclasses" |
|
4577 |
||
4578 |
^ self basicSize |
|
4579 |
! |
|
4580 |
||
4581 |
species |
|
4582 |
"return a class which is similar to (or the same as) the receivers class. |
|
4583 |
This is used to create an appropriate object when creating derived |
|
4584 |
copies in the collection classes (sometimes redefined)." |
|
4585 |
||
4586 |
^ self class |
|
4587 |
! |
|
4588 |
||
4589 |
yourself |
|
4590 |
"return the receiver - used for cascades to return self at the end" |
|
4591 |
||
4592 |
^ self |
|
4593 |
! ! |
|
4594 |
||
4595 |
!Object methodsFor:'secure message sending'! |
|
4596 |
||
4597 |
askFor:aSelector |
|
4598 |
"try to send the receiver the message, aSelector. |
|
4599 |
If it does not understand it, return false. Otherwise |
|
4600 |
the real value returned. |
|
4601 |
Useful to send messages such as: 'isColor' to unknown |
|
4602 |
receivers." |
|
4603 |
||
4604 |
^ self perform:aSelector ifNotUnderstood:[false] |
|
4605 |
||
4606 |
" |
|
4607 |
1 askFor:#isColor |
|
4608 |
" |
|
4609 |
! |
|
4610 |
||
4611 |
perform:aSelector ifNotUnderstood:exceptionBlock |
|
4612 |
"try to send message aSelector to the receiver. |
|
4613 |
If its understood, return the methods returned value, |
|
4614 |
otherwise return the value of the exceptionBlock" |
|
4615 |
||
4616 |
|val| |
|
4617 |
||
4618 |
MessageNotUnderstoodSignal handle:[:ex | |
|
4619 |
^ exceptionBlock value |
|
4620 |
] do:[ |
|
4621 |
val := self perform:aSelector |
|
4622 |
]. |
|
4623 |
^ val |
|
4624 |
||
4625 |
" |
|
4626 |
1.2345 perform:#foo ifNotUnderstood:['sorry'] |
|
4627 |
" |
|
1 | 4628 |
! |
4629 |
||
783 | 4630 |
perform:aSelector with:argument ifNotUnderstood:exceptionBlock |
4631 |
"try to send message aSelector to the receiver. |
|
4632 |
If its understood, return the methods returned value, |
|
4633 |
otherwise return the value of the exceptionBlock" |
|
4634 |
||
4635 |
|val| |
|
4636 |
||
4637 |
MessageNotUnderstoodSignal handle:[:ex | |
|
4638 |
^ exceptionBlock value |
|
4639 |
] do:[ |
|
4640 |
val := self perform:aSelector with:argument |
|
4641 |
]. |
|
4642 |
^ val |
|
4643 |
||
4644 |
" |
|
4645 |
|unknown| |
|
4646 |
||
4647 |
unknown := 1. |
|
4648 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
4649 |
unknown := 'high there'. |
|
4650 |
(unknown perform:#+ with:2 ifNotUnderstood:['sorry']) printNewline. |
|
4651 |
" |
|
4652 |
! ! |
|
4653 |
||
4654 |
!Object methodsFor:'special queries'! |
|
4655 |
||
4656 |
allOwners |
|
4657 |
"return a collection of all objects referencing the receiver" |
|
4658 |
||
4659 |
^ ObjectMemory whoReferences:self |
|
4660 |
! |
|
4661 |
||
4662 |
references:anObject |
|
4663 |
"return true, if the receiver refers to the argument, anObject. |
|
4664 |
- for debugging only" |
|
4665 |
||
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4666 |
"/ |myClass |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4667 |
"/ numInst "{ Class: SmallInteger }" | |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4668 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4669 |
%{ /* NOCONTEXT */ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4670 |
OBJ cls, flags; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4671 |
int nInsts, i; |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4672 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4673 |
if (! __isNonNilObject(self)) { |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4674 |
RETURN (false); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4675 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4676 |
|
783 | 4677 |
/* |
4678 |
* a little optimization: use the fact that all old objects |
|
4679 |
* refering to a new object are on the remSet; if I am not, |
|
4680 |
* a trivial reject is possible, if anObject is a newbee |
|
4681 |
*/ |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4682 |
if (__isNonNilObject(anObject)) { |
783 | 4683 |
if ((__qSpace(self) <= OLDSPACE) && !__isRemembered(self)) { |
4684 |
int spc; |
|
4685 |
||
4686 |
if (((spc = __qSpace(anObject)) == NEWSPACE) || (spc == SURVSPACE)) { |
|
4687 |
RETURN (false); |
|
4688 |
} |
|
4689 |
} |
|
4690 |
} |
|
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4691 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4692 |
cls = __qClass(self); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4693 |
if (cls == anObject) { |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4694 |
RETURN (true); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4695 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4696 |
|
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4697 |
flags = __ClassInstPtr(cls)->c_flags; |
1386
a31cecccdfd8
_MASKSMALLINT -> __MASKSMALLINT;
Claus Gittinger <cg@exept.de>
parents:
1377
diff
changeset
|
4698 |
if (((INT)flags & __MASKSMALLINT(ARRAYMASK)) == __MASKSMALLINT(POINTERARRAY)) { |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4699 |
nInsts = __BYTES2OBJS__(__qSize(self) - OHDR_SIZE); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4700 |
} else { |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4701 |
nInsts = __intVal(__ClassInstPtr(cls)->c_ninstvars); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4702 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4703 |
if (! nInsts) { |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4704 |
RETURN (false); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4705 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4706 |
for (i=0; i<nInsts; i++) { |
1133 | 4707 |
if (__InstPtr(self)->i_instvars[i] == anObject) { |
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4708 |
RETURN (true); |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4709 |
} |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4710 |
} |
783 | 4711 |
%}. |
4712 |
||
1109
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4713 |
"/ myClass := self class. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4714 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4715 |
"/ "check the class" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4716 |
"/ (myClass == anObject) ifTrue:[^ true]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4717 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4718 |
"/ "check the instance variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4719 |
"/ numInst := myClass instSize. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4720 |
"/ 1 to:numInst do:[:i | |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4721 |
"/ ((self instVarAt:i) == anObject) ifTrue:[^ true] |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4722 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4723 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4724 |
"/ "check the indexed variables" |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4725 |
"/ myClass isVariable ifTrue:[ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4726 |
"/ myClass isPointers ifFalse:[ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4727 |
"/ "/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4728 |
"/ "/ we could argue about the following unconditional return: |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4729 |
"/ "/ it says that a non pointer array never has a reference to the |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4730 |
"/ "/ corresponding object - not mimicing a reference to a copy of the |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4731 |
"/ "/ integer. However, it avoids useless searches in huge byteArray |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4732 |
"/ "/ like objects when searching for owners. If in doubt, remove it. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4733 |
"/ "/ A consequence of the return below is that #[1 2 3] will say that it |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4734 |
"/ "/ does not refer to the number 2 (think of keeping a copy instead) |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4735 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4736 |
"/ ^ false. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4737 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4738 |
"/ "/ alternative: |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4739 |
"/ "/ anObject isNumber ifFalse:[^ false]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4740 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4741 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4742 |
"/ "/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4743 |
"/ "/ because arrays are so common, and those have a highly tuned |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4744 |
"/ "/ idenitytIndex method, use it |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4745 |
"/ "/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4746 |
"/ myClass == Array ifTrue:[ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4747 |
"/ ^ (self identityIndexOf:anObject) ~~ 0 |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4748 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4749 |
"/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4750 |
"/ "/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4751 |
"/ "/ otherwise, do it the slow way |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4752 |
"/ "/ |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4753 |
"/ numInst := self basicSize. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4754 |
"/ 1 to:numInst do:[:i | |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4755 |
"/ ((self basicAt:i) == anObject) ifTrue:[^ true] |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4756 |
"/ ] |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4757 |
"/ ]. |
38956a3cd61e
speeded up #references: (needed for allOwners etc.)
Claus Gittinger <cg@exept.de>
parents:
1101
diff
changeset
|
4758 |
|
783 | 4759 |
^ false |
4760 |
||
4761 |
" |
|
4762 |
|v| |
|
4763 |
||
4764 |
v := View new initialize. |
|
4765 |
v references:Display. |
|
4766 |
" |
|
4767 |
! |
|
4768 |
||
4769 |
referencesDerivedInstanceOf:aClass |
|
4770 |
"return true, if the receiver refers to an instance of |
|
4771 |
the argument, aClass or its subclass. This method exists |
|
4772 |
to support searching for users of a class." |
|
4773 |
||
4774 |
|myClass |
|
4775 |
numInst "{ Class: SmallInteger }" | |
|
4776 |
||
4777 |
myClass := self class. |
|
4778 |
||
4779 |
"check the class" |
|
4780 |
(myClass isKindOf:aClass) ifTrue:[^ true]. |
|
4781 |
||
4782 |
"check the instance variables" |
|
4783 |
numInst := myClass instSize. |
|
4784 |
1 to:numInst do:[:i | |
|
4785 |
((self instVarAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
4786 |
]. |
|
4787 |
||
4788 |
"check the indexed variables" |
|
4789 |
myClass isVariable ifTrue:[ |
|
4790 |
myClass isPointers ifFalse:[ |
|
4791 |
"no need to search in non pointer fields" |
|
4792 |
((aClass == Number) or:[aClass isSubclassOf:Number]) ifFalse:[^ false]. |
|
4793 |
]. |
|
4794 |
numInst := self basicSize. |
|
4795 |
1 to:numInst do:[:i | |
|
4796 |
((self basicAt:i) isKindOf:aClass) ifTrue:[^ true] |
|
4797 |
] |
|
4798 |
]. |
|
4799 |
^ false |
|
4800 |
||
4801 |
" |
|
4802 |
(1 @ 3.4) referencesDerivedInstanceOf:Number |
|
4803 |
(1 @ 3.4) referencesDerivedInstanceOf:Array |
|
4804 |
View new initialize referencesDerivedInstanceOf:DeviceWorkstation |
|
4805 |
" |
|
4806 |
! |
|
4807 |
||
4808 |
referencesInstanceOf:aClass |
|
4809 |
"return true, if the receiver refers to an instance of |
|
4810 |
the argument, aClass.This method exists |
|
4811 |
to support searching for users of a class." |
|
4812 |
||
4813 |
|myClass |
|
4814 |
numInst "{ Class: SmallInteger }" | |
|
4815 |
||
4816 |
myClass := self class. |
|
4817 |
||
4818 |
"check the class" |
|
4819 |
(myClass isMemberOf:aClass) ifTrue:[^ true]. |
|
4820 |
||
4821 |
"check the instance variables" |
|
4822 |
numInst := myClass instSize. |
|
4823 |
1 to:numInst do:[:i | |
|
4824 |
((self instVarAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
4825 |
]. |
|
4826 |
||
4827 |
"check the indexed variables" |
|
4828 |
myClass isVariable ifTrue:[ |
|
4829 |
myClass isPointers ifFalse:[ |
|
4830 |
"no need to search in non-pointer indexed fields" |
|
4831 |
myClass isLongs ifTrue:[ |
|
4832 |
(aClass == SmallInteger or:[aClass == LargeInteger]) ifFalse:[^ false]. |
|
4833 |
] ifFalse:[ |
|
4834 |
myClass isFloatsOrDoubles ifTrue:[^ aClass == Float]. |
|
4835 |
^ aClass == SmallInteger |
|
4836 |
] |
|
4837 |
]. |
|
4838 |
numInst := self basicSize. |
|
4839 |
1 to:numInst do:[:i | |
|
4840 |
((self basicAt:i) isMemberOf:aClass) ifTrue:[^ true] |
|
4841 |
] |
|
4842 |
]. |
|
4843 |
^ false |
|
4844 |
||
4845 |
" |
|
4846 |
(1 @ 3.4) referencesInstanceOf:Float |
|
4847 |
(1 @ 3.4) referencesInstanceOf:Fraction |
|
4848 |
View new initialize referencesInstanceOf:(Display class) |
|
4849 |
" |
|
1 | 4850 |
! ! |
783 | 4851 |
|
4852 |
!Object methodsFor:'system primitives'! |
|
4853 |
||
4854 |
become:anotherObject |
|
4855 |
"make all references to the receiver become references to anotherObject |
|
859 | 4856 |
and vice-versa. Notice the vice-versa; see #becomeSameAs: for a one-way become. |
4857 |
This can be a very dangerous operation - be warned. |
|
861 | 4858 |
In general, using #become: should be avoided if possible, since it may |
4859 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
4860 |
||
4861 |
This may also be an expensive (i.e. slow) operation, |
|
783 | 4862 |
since in the worst case, the whole memory has to be searched for |
4863 |
references to the two objects (although the primitive tries hard to |
|
4864 |
limit the search, for acceptable performance in most cases). |
|
4865 |
This method fails, if the receiver or the argument is a SmallInteger |
|
4866 |
or nil, or is a context of a living method (i.e. one that has not already |
|
4867 |
returned). |
|
859 | 4868 |
(notice that #become: is not used heavily by the system |
783 | 4869 |
- the Collection-classes have been rewritten to not use it.)" |
4870 |
%{ |
|
859 | 4871 |
if (__primBecome(self, anotherObject COMMA_CON)) { |
783 | 4872 |
RETURN ( self ); |
859 | 4873 |
} |
4874 |
%}. |
|
783 | 4875 |
self primitiveFailed |
4876 |
! |
|
4877 |
||
4878 |
becomeNil |
|
4879 |
"make all references to the receiver become nil - effectively getting |
|
859 | 4880 |
rid of the receiver. |
4881 |
This can be a very dangerous operation - be warned. |
|
4882 |
||
4883 |
This may be an expensive (i.e. slow) operation. |
|
783 | 4884 |
The receiver may not be a SmallInteger or a context of a living method." |
4885 |
||
4886 |
%{ |
|
859 | 4887 |
if (__primBecomeNil(self COMMA_CON )) { |
783 | 4888 |
RETURN ( nil ); |
859 | 4889 |
} |
4890 |
%}. |
|
4891 |
self primitiveFailed |
|
4892 |
! |
|
4893 |
||
4894 |
becomeSameAs:anotherObject |
|
4895 |
"make all references to the receiver become references to anotherObject |
|
861 | 4896 |
but NOT vice versa (as done in #become:). |
859 | 4897 |
This can be a very dangerous operation - be warned. |
861 | 4898 |
In general, using #become: should be avoided if possible, since it may |
4899 |
produce many strange effects (think of hashing in Sets, Dictionaries etc.). |
|
4900 |
||
4901 |
This may also be an expensive (i.e. slow) operation, |
|
859 | 4902 |
since in the worst case, the whole memory has to be searched for |
4903 |
references to the two objects (although the primitive tries hard to |
|
4904 |
limit the search, for acceptable performance in most cases). |
|
4905 |
This method fails, if the receiver or the argument is a SmallInteger |
|
4906 |
or nil, or is a context of a living method (i.e. one that has not already returned)." |
|
4907 |
%{ |
|
4908 |
if (__primBecomeSameAs(self, anotherObject COMMA_CON)) { |
|
4909 |
RETURN ( self ); |
|
4910 |
} |
|
4911 |
%}. |
|
783 | 4912 |
self primitiveFailed |
4913 |
! |
|
4914 |
||
4915 |
changeClassTo:otherClass |
|
4916 |
"changes the class of the receiver to the argument, otherClass. |
|
4917 |
This is only allowed (possible), if the receivers class and the argument |
|
4918 |
have the same structure (i.e. number of named instance variables and |
|
4919 |
type of indexed instance variables). |
|
4920 |
If the structures do not match, or any of the original class or new class |
|
4921 |
is UndefinedObject or a Smallinteger, a primitive error is triggered." |
|
4922 |
||
4923 |
|myClass ok| |
|
4924 |
||
4925 |
"check for UndefinedObject/SmallInteger receiver or newClass" |
|
4926 |
%{ |
|
1133 | 4927 |
{ |
4928 |
OBJ other = otherClass; |
|
4929 |
||
4930 |
if (__isNonNilObject(self) |
|
4931 |
&& __isNonNilObject(other) |
|
4932 |
&& (other != UndefinedObject) |
|
4933 |
&& (other != SmallInteger)) { |
|
4934 |
ok = true; |
|
4935 |
} else { |
|
4936 |
ok = false; |
|
4937 |
} |
|
783 | 4938 |
} |
4939 |
%}. |
|
4940 |
ok ifTrue:[ |
|
1022
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4941 |
ok := false. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4942 |
myClass := self class. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4943 |
myClass flags == otherClass flags ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4944 |
myClass instSize == otherClass instSize ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4945 |
"same instance layout and types: its ok to do it" |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4946 |
ok := true. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4947 |
] ifFalse:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4948 |
myClass isPointers ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4949 |
myClass isVariable ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4950 |
ok := true |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4951 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4952 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4953 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4954 |
] ifFalse:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4955 |
myClass isPointers ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4956 |
"if newClass is a variable class, with instSize <= my instsize, |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4957 |
we can do it (effectively mapping additional instvars into the |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4958 |
variable part) - usefulness is questionable, though" |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4959 |
|
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4960 |
otherClass isPointers ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4961 |
otherClass isVariable ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4962 |
otherClass instSize <= (myClass instSize + self basicSize) |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4963 |
ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4964 |
ok := true |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4965 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4966 |
] ifFalse:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4967 |
otherClass instSize == (myClass instSize + self basicSize) |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4968 |
ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4969 |
ok := true |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4970 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4971 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4972 |
] ifFalse:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4973 |
"it does not make sense to convert pointers to bytes ..." |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4974 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4975 |
] ifFalse:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4976 |
"does it make sense, to convert bits ?" |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4977 |
"could allow byteArray->wordArray->longArray->floatArray->doubleArray here ..." |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4978 |
(myClass isBits and:[otherClass isBits]) ifTrue:[ |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4979 |
ok := true |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4980 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4981 |
] |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4982 |
] |
783 | 4983 |
]. |
4984 |
ok ifTrue:[ |
|
1022
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4985 |
"now, change the receivers class ..." |
783 | 4986 |
%{ |
1133 | 4987 |
{ |
4988 |
OBJ me = self; |
|
4989 |
||
4990 |
__qClass(me) = otherClass; |
|
4991 |
__STORE(me, otherClass); |
|
4992 |
RETURN (me); |
|
4993 |
} |
|
783 | 4994 |
%}. |
4995 |
]. |
|
1022
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4996 |
|
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4997 |
" |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4998 |
the receiver cannot be represented as a instance of |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
4999 |
the desired class. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
5000 |
For example, you cannot change a bitInstance (byteArray etc.) |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
5001 |
into a pointer object and vice versa. |
f526a827ea1a
allow changeClass of bitObjects
Claus Gittinger <cg@exept.de>
parents:
1021
diff
changeset
|
5002 |
" |
783 | 5003 |
self primitiveFailed |
5004 |
! |
|
5005 |
||
5006 |
changeClassToThatOf:anObject |
|
5007 |
"changes the class of the receiver to that of the argument, anObject. |
|
5008 |
This is only allowed (possible), if the receivers class and the arguments |
|
5009 |
class have the same structure (i.e. number of named instance variables and |
|
5010 |
type of indexed instance variables). If the structures do not match, or any |
|
5011 |
of the objects is nil or a Smallinteger, a primitive error is triggered." |
|
5012 |
||
5013 |
self changeClassTo:(anObject class) |
|
5014 |
! ! |
|
5015 |
||
5016 |
!Object methodsFor:'user interaction & notifications'! |
|
5017 |
||
5018 |
activityNotification:aString |
|
5019 |
"this can be sent from deeply nested methods, which are going to perform |
|
5020 |
some long-time activity. |
|
5021 |
If there is a handler for the ActivityNotificationSignal signal, that one is raised, |
|
5022 |
passing the argument. The handler should show this message whereever it likes, |
|
5023 |
and proceed. If there is no handler, this is simply ignored. |
|
5024 |
||
5025 |
This is very useful to pass busy messages up to some higher level (typically a view) |
|
5026 |
which likes to display that message in its label or a busy-box. |
|
5027 |
It could also be put into some logfile or printed on the standard output/error." |
|
5028 |
||
5029 |
ActivityNotificationSignal isHandled ifTrue:[ |
|
861 | 5030 |
^ ActivityNotificationSignal raiseRequestWith:self errorString:aString |
783 | 5031 |
]. |
5032 |
||
5033 |
" |
|
5034 |
nil activityNotification:'hello there' |
|
5035 |
self activityNotification:'hello there' |
|
5036 |
" |
|
5037 |
||
5038 |
" |
|
5039 |
ActivityNotificationSignal handle:[:ex | |
|
861 | 5040 |
ex errorString printNL. |
5041 |
ex proceed. |
|
783 | 5042 |
] do:[ |
861 | 5043 |
'hello' printNL. |
5044 |
self activityNotification:'doing some long time computation'. |
|
5045 |
'world' printNL. |
|
783 | 5046 |
] |
5047 |
" |
|
5048 |
||
5049 |
"Modified: 16.12.1995 / 18:23:42 / cg" |
|
5050 |
! |
|
5051 |
||
5052 |
confirm:aString |
|
5053 |
"launch a confirmer, which allows user to enter yes or no. |
|
5054 |
return true for yes, false for no" |
|
5055 |
||
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
5056 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
5057 |
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
|
5058 |
and return true (as if yes was answered) |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
5059 |
Q: should we ask user by reading Stdin ? |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
5060 |
" |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
5061 |
Smalltalk isInitialized ifFalse:[ |
1417 | 5062 |
'confirmation: ' print. aString print. |
1425 | 5063 |
'continue, assuming <yes>' printCR. |
1417 | 5064 |
^ true |
925
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
5065 |
]. |
020a15fa450f
use less memory for single-dependencies;
Claus Gittinger <cg@exept.de>
parents:
899
diff
changeset
|
5066 |
|
783 | 5067 |
Dialog isNil ifTrue:[ |
1417 | 5068 |
Transcript showCR:aString. |
5069 |
Transcript showCR:'continue, assuming <yes>'. |
|
5070 |
^ true |
|
783 | 5071 |
]. |
5072 |
Dialog autoload. "in case its autoloaded" |
|
5073 |
^ Dialog confirm:aString |
|
5074 |
||
5075 |
" |
|
5076 |
nil confirm:'hello' |
|
5077 |
self confirm:'hello' |
|
5078 |
" |
|
1417 | 5079 |
|
1425 | 5080 |
"Modified: 20.5.1996 / 10:28:40 / cg" |
783 | 5081 |
! |
5082 |
||
5083 |
errorNotify:aString |
|
5084 |
"launch a Notifier, showing top stack, telling user something |
|
5085 |
and give a chance to enter debugger." |
|
5086 |
||
5087 |
|info con sender| |
|
5088 |
||
891 | 5089 |
Smalltalk isInitialized ifFalse:[ |
1425 | 5090 |
'errorNotification: ' print. aString printCR. |
1417 | 5091 |
^ self |
891 | 5092 |
]. |
5093 |
||
783 | 5094 |
Dialog isNil ifTrue:[ |
1417 | 5095 |
" |
5096 |
on systems without GUI, simply show |
|
5097 |
the message on the Transcript. |
|
5098 |
" |
|
5099 |
Transcript showCR:aString. |
|
5100 |
^ self |
|
783 | 5101 |
]. |
5102 |
Dialog autoload. "in case its autoloaded" |
|
5103 |
||
5104 |
con := sender := thisContext sender. |
|
5105 |
info := aString , Character cr asString , Character cr asString. |
|
5106 |
1 to:5 do:[:n | |
|
1417 | 5107 |
con notNil ifTrue:[ |
5108 |
info := info , con printString , Character cr asString. |
|
5109 |
con := con sender |
|
5110 |
] |
|
783 | 5111 |
]. |
5112 |
||
5113 |
(Dialog choose:info |
|
1417 | 5114 |
labels:#('proceed' 'debug') |
5115 |
values:#(#proceed #debug) |
|
5116 |
default:#debug) == #debug |
|
783 | 5117 |
ifTrue:[ |
1417 | 5118 |
Debugger enter:sender withMessage:aString |
783 | 5119 |
] |
5120 |
||
5121 |
" |
|
5122 |
nil errorNotify:'hello there' |
|
5123 |
self errorNotify:'hello there' |
|
5124 |
" |
|
1417 | 5125 |
|
1425 | 5126 |
"Modified: 20.5.1996 / 10:28:45 / cg" |
783 | 5127 |
! |
5128 |
||
5129 |
information:aString |
|
5130 |
"launch an InfoBox, telling user something. |
|
5131 |
These info-boxes can be suppressed by handling the |
|
5132 |
UserNotification- or InformationSignal and proceeding in the handler." |
|
5133 |
||
5134 |
InformationSignal isHandled ifTrue:[ |
|
5135 |
^ InformationSignal raiseRequestWith:self errorString:aString |
|
5136 |
]. |
|
5137 |
self notify:aString |
|
5138 |
||
5139 |
" |
|
5140 |
nil information:'hello there' |
|
5141 |
self information:'hello there' |
|
5142 |
" |
|
5143 |
||
5144 |
" |
|
5145 |
InformationSignal handle:[:ex | |
|
5146 |
'no box popped' printNL. |
|
5147 |
ex proceed. |
|
5148 |
] do:[ |
|
5149 |
'hello' printNL. |
|
5150 |
self information:'some info'. |
|
5151 |
'world' printNL. |
|
5152 |
] |
|
5153 |
" |
|
5154 |
||
5155 |
"Modified: 24.11.1995 / 22:29:49 / cg" |
|
5156 |
! |
|
5157 |
||
5158 |
notify:aString |
|
5159 |
"launch a Notifier, telling user something. |
|
5160 |
Use #information: for ignorable messages." |
|
5161 |
||
891 | 5162 |
Smalltalk isInitialized ifFalse:[ |
1425 | 5163 |
'information: ' print. aString printCR. |
1417 | 5164 |
^ self |
891 | 5165 |
]. |
5166 |
||
783 | 5167 |
Dialog isNil ifTrue:[ |
1417 | 5168 |
" |
5169 |
on systems without GUI, simply show |
|
5170 |
the message on the Transcript. |
|
5171 |
" |
|
5172 |
Transcript showCR:aString. |
|
5173 |
^ self |
|
783 | 5174 |
]. |
5175 |
Dialog autoload. "in case its autoloaded" |
|
5176 |
Dialog information:aString |
|
5177 |
||
5178 |
" |
|
5179 |
nil notify:'hello there' |
|
5180 |
self notify:'hello there' |
|
5181 |
" |
|
1417 | 5182 |
|
1425 | 5183 |
"Modified: 20.5.1996 / 10:28:48 / cg" |
783 | 5184 |
! |
5185 |
||
5186 |
warn:aString |
|
5187 |
"launch a WarningBox, telling user something. |
|
5188 |
These warn-boxes can be suppressed by handling the |
|
5189 |
UserNotification- or WarningSignal and proceeding in the handler." |
|
5190 |
||
5191 |
WarningSignal isHandled ifTrue:[ |
|
1417 | 5192 |
^ WarningSignal raiseRequestWith:self errorString:aString |
783 | 5193 |
]. |
5194 |
||
891 | 5195 |
Smalltalk isInitialized ifFalse:[ |
1425 | 5196 |
'warning: ' print. aString printCR. |
1417 | 5197 |
^ self |
891 | 5198 |
]. |
5199 |
||
783 | 5200 |
Dialog isNil ifTrue:[ |
1417 | 5201 |
" |
5202 |
on systems without GUI, simply show |
|
5203 |
the message on the Transcript. |
|
5204 |
" |
|
5205 |
Transcript showCR:aString. |
|
5206 |
^ self |
|
783 | 5207 |
]. |
5208 |
Dialog autoload. "in case its autoloaded" |
|
5209 |
Dialog warn:aString |
|
5210 |
||
5211 |
" |
|
5212 |
nil warn:'hello there' |
|
5213 |
self warn:'hello there' |
|
5214 |
" |
|
5215 |
||
5216 |
" |
|
5217 |
WarningSignal handle:[:ex | |
|
1417 | 5218 |
ex proceed. |
783 | 5219 |
] do:[ |
1417 | 5220 |
'hello' printNL. |
5221 |
self warn:'some info'. |
|
5222 |
'world' printNL. |
|
783 | 5223 |
] |
5224 |
" |
|
1417 | 5225 |
|
1425 | 5226 |
"Modified: 20.5.1996 / 10:28:53 / cg" |
783 | 5227 |
! ! |
5228 |
||
1528
af168e6dadc9
added #instVarNamed:ifAbsent:
Claus Gittinger <cg@exept.de>
parents:
1515
diff
changeset
|
5229 |
!Object class methodsFor:'documentation'! |
783 | 5230 |
|
5231 |
version |
|
1585
5cfa7f2586ad
use inline interrupt blocking in dependents acces methods.
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
5232 |
^ '$Header: /cvs/stx/stx/libbasic/Object.st,v 1.128 1996-07-19 10:44:16 cg Exp $' |
783 | 5233 |
! ! |
5234 |
Object initialize! |