author | Claus Gittinger <cg@exept.de> |
Sat, 11 Nov 1995 16:28:41 +0100 | |
changeset 530 | 07d0bce293c9 |
parent 384 | cc3d110ea879 |
child 1183 | e3d58d115e53 |
permissions | -rw-r--r-- |
1 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1988 by Claus Gittinger |
362 | 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 |
||
13 |
Object subclass:#Message |
|
14 |
instanceVariableNames:'selector args' |
|
15 |
classVariableNames:'' |
|
16 |
poolDictionaries:'' |
|
17 |
category:'Kernel-Methods' |
|
18 |
! |
|
19 |
||
88 | 20 |
!Message class methodsFor:'documentation'! |
21 |
||
22 |
copyright |
|
23 |
" |
|
24 |
COPYRIGHT (c) 1988 by Claus Gittinger |
|
362 | 25 |
All Rights Reserved |
1 | 26 |
|
88 | 27 |
This software is furnished under a license and may be used |
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
34 |
! |
|
1 | 35 |
|
88 | 36 |
version |
530
07d0bce293c9
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
384
diff
changeset
|
37 |
^ '$Header: /cvs/stx/stx/libbasic/Message.st,v 1.15 1995-11-11 15:23:56 cg Exp $' |
88 | 38 |
! |
1 | 39 |
|
88 | 40 |
documentation |
41 |
" |
|
42 |
Instances of Message are only created, when a message send fails |
|
43 |
(i.e. some message is not understood). |
|
44 |
In this case, the selector and arguments are put into an instance of |
|
45 |
Message, which is then passed to #doesNotUnderstand: as argument. |
|
46 |
||
93 | 47 |
Typically, Object>>doesNotUnderstand: is evaluated, which starts up |
48 |
a debugger, but it is possible to redefine this method, which |
|
49 |
allows for re-evaluation of the failed send (after some cleanup). |
|
50 |
||
51 |
As an example of its use, see the implementation of the Autoload-class, |
|
52 |
or how ScrollableView forwards unknown messages to its slave-view. |
|
53 |
||
54 |
Notice: |
|
55 |
Since the layout of Message-objects is known by the runtime system, it is |
|
56 |
not allowed to change the definition of this class. |
|
88 | 57 |
" |
58 |
! ! |
|
1 | 59 |
|
60 |
!Message class methodsFor:'instance creation'! |
|
61 |
||
62 |
selector:aSymbol |
|
63 |
"return a new message object for a send without arguments" |
|
64 |
||
159 | 65 |
^ self basicNew setSelector:aSymbol arguments:nil |
1 | 66 |
! |
67 |
||
68 |
selector:aSymbol with:anArg |
|
159 | 69 |
"return a new message object for a send with one argument. |
70 |
OBSOLETE: use #selector:argument: for ST-80 compatibility." |
|
1 | 71 |
|
159 | 72 |
^ self basicNew setSelector:aSymbol arguments:(Array with:anArg) |
1 | 73 |
! |
74 |
||
75 |
selector:aSymbol with:arg1 with:arg2 |
|
159 | 76 |
"return a new message object for a send with two arguments. |
77 |
OBSOLETE: use #selector:arguments: for ST-80 compatibility." |
|
1 | 78 |
|
159 | 79 |
^ self basicNew setSelector:aSymbol arguments:(Array with:arg1 with:arg2) |
1 | 80 |
! |
81 |
||
82 |
selector:aSymbol withAll:argArray |
|
93 | 83 |
"return a new message object for a send with many arguments. |
159 | 84 |
OBSOLETE: use #selector:arguments: for ST-80 compatibilty." |
85 |
||
86 |
^ self basicNew setSelector:aSymbol arguments:argArray |
|
87 |
! |
|
93 | 88 |
|
159 | 89 |
selector:aSymbol argument:anArg |
90 |
"return a new message object for a send with one argument" |
|
91 |
||
92 |
^ self basicNew setSelector:aSymbol arguments:(Array with:anArg) |
|
93 | 93 |
! |
94 |
||
95 |
selector:aSymbol arguments:argArray |
|
1 | 96 |
"return a new message object for a send with many arguments" |
97 |
||
159 | 98 |
^ self basicNew setSelector:aSymbol arguments:argArray |
93 | 99 |
! ! |
100 |
||
101 |
!Message class methodsFor:'queries'! |
|
102 |
||
103 |
isBuiltInClass |
|
104 |
"this class is known by the run-time-system" |
|
105 |
||
106 |
^ self == Message |
|
1 | 107 |
! ! |
108 |
||
109 |
!Message methodsFor:'private accessing'! |
|
110 |
||
159 | 111 |
setSelector:aSymbol arguments:argArray |
1 | 112 |
"set selector and arguments of the receiver" |
113 |
||
114 |
selector := aSymbol. |
|
115 |
args := argArray |
|
116 |
! ! |
|
117 |
||
10 | 118 |
!Message methodsFor:'sending'! |
119 |
||
120 |
sendTo:aReceiver |
|
152 | 121 |
"send the selector with argument to some receiver" |
10 | 122 |
|
152 | 123 |
^ aReceiver perform:selector withArguments:args |
85 | 124 |
! |
125 |
||
362 | 126 |
reinvokeFor:aReceiver |
85 | 127 |
"send the selector with argument to a receiver. |
128 |
Same as sendTo: - for GNU-ST compatibility." |
|
93 | 129 |
|
85 | 130 |
^ self sendTo:aReceiver |
10 | 131 |
! ! |
132 |
||
1 | 133 |
!Message methodsFor:'accessing'! |
134 |
||
135 |
selector |
|
136 |
"return the selector of the message" |
|
137 |
||
138 |
^ selector |
|
139 |
! |
|
140 |
||
141 |
arguments |
|
142 |
"return the arguments of the message" |
|
143 |
||
144 |
^ args |
|
145 |
! ! |
|
146 |
||
93 | 147 |
!Message methodsFor:'printing & storing'! |
1 | 148 |
|
56 | 149 |
displayString |
150 |
"return a string for display in inspectors etc." |
|
151 |
||
152 |
^ 'Message(' , selector , ')' |
|
153 |
! |
|
154 |
||
155 |
printOn:aStream |
|
1 | 156 |
"return a string for printing the receiver" |
157 |
||
56 | 158 |
selector printOn:aStream |
1 | 159 |
! ! |