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